Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp109350ybg; Mon, 8 Jun 2020 17:51:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH0+xwSxg0zbuSFcjSXsjeRBc8yirDksQ5WyYjnvAE+YCbVBRu4H+3B8RFd8bEgplE7EDc X-Received: by 2002:a17:906:6b92:: with SMTP id l18mr23758216ejr.145.1591663906959; Mon, 08 Jun 2020 17:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663906; cv=none; d=google.com; s=arc-20160816; b=wu7HFv5lVaLwc24PVfefWmSB7Grv9+A8UI9YWCa0jyGZoOk3gtJD617iu0iPdGbXcJ FIUh7l4YF6Tyqw50QCZYbyNKiNnKym+qIgKA7pUtMOdPGvGg/iOGgvCa33tOMyykm8zH OPzt8pTliEQ7qbW8rd+WrVj3USVpowtLxJUrAGzBcw3HRUAbst6YkpPGY+9T2qltnwFs okWnr1qHgpYt7zehD2jFJ9xfIcqy8tGZmEcpkQDL+dGwWkgZd7zmzAzAVzEGj0fkYMK0 xD1bvoM8/GhD7ohRqtPt/JP1T3Zg0baHINvmhRobzrdre9YO8sEMPBLaekrC7gzhGi5p /YJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YBchxUOIxvGHhR5EPnHjt0yrzxBo3GAv1Z4yw3Yi1ww=; b=ueyCSf0y1kSAyrYQWu9KQY5GIOCHb7+TaZQGzJo21ylCco6oLhCR9/mC9/LBZgMat6 gj6z/lMHpH4bW8GlpHwPvIhhj/P4Qt3UYWP6dJ/1zntvkeMMRe81mwzC79mKLYVm5fNI Rn/s7ES+FWqEvUAq34qw8cVYqV3+xwAalexhr4Gk1UXJ2zgR7waE6hGVgJirtI7uj6L7 vif9DL++yVBq+nURT1x/ENvWUYd2JCau7p9w/YRgqFi5trjzVh7Wqaho4gufc1fgFEEX PZSOkJnaoZLRY7QZEAG20M/+9kiNRTDbCLQz7V9KwuzKJSPXo5koCHmx16hdi3Il4YKn yIYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WztCF1Mu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cf23si9528562ejb.540.2020.06.08.17.51.24; Mon, 08 Jun 2020 17:51:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WztCF1Mu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729600AbgFIArj (ORCPT + 99 others); Mon, 8 Jun 2020 20:47:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:58050 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728877AbgFHXLS (ORCPT ); Mon, 8 Jun 2020 19:11:18 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A051B20C56; Mon, 8 Jun 2020 23:11:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657878; bh=dpsUGNLG6DoVdDNoW0gHaByBiuslEuKEyAKeOGPrz5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WztCF1MuP8IlQExHXvt+IXG9ECqOf3jT2CYo4NbGZehV09+c2kh4WqH1wORheCPD8 uHhNmQSj/c7fY4cGx/W94flbHN7aUIwOHBlnm4x+lepVoj0v7Vt+s32vy3s+5dqy7/ xdAuNJTA3XIIn3EmB6JWr5V9btiSHJLeYYhTyX7E= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fugang Duan , "David S . Miller" , Sasha Levin , netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.7 235/274] net: ethernet: fec: move GPR register offset and bit into DT Date: Mon, 8 Jun 2020 19:05:28 -0400 Message-Id: <20200608230607.3361041-235-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Fugang Duan [ Upstream commit 8a448bf832af537d26aa557d183a16943dce4510 ] The commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) set the GPR reigster offset and bit in driver for wake on lan feature. But it introduces two issues here: - one SOC has two instances, they have different bit - different SOCs may have different offset and bit So to support wake-on-lan feature on other i.MX platforms, it should configure the GPR reigster offset and bit from DT. So the patch is to improve the commit da722186f654 (net: fec: set GPR bit on suspend by DT configuration) to support multiple ethernet instances on i.MX series. v2: * switch back to store the quirks bitmask in driver_data v3: * suggested by Sascha Hauer, use a struct fec_devinfo for abstracting differences between different hardware variants, it can give more freedom to describe the differences. Signed-off-by: Fugang Duan Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fec_main.c | 24 +++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index dc6f8763a5d4..2840dbad25cb 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -88,8 +88,6 @@ static void fec_enet_itr_coal_init(struct net_device *ndev); struct fec_devinfo { u32 quirks; - u8 stop_gpr_reg; - u8 stop_gpr_bit; }; static const struct fec_devinfo fec_imx25_info = { @@ -112,8 +110,6 @@ static const struct fec_devinfo fec_imx6q_info = { FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM | FEC_QUIRK_HAS_VLAN | FEC_QUIRK_ERR006358 | FEC_QUIRK_HAS_RACC, - .stop_gpr_reg = 0x34, - .stop_gpr_bit = 27, }; static const struct fec_devinfo fec_mvf600_info = { @@ -3452,19 +3448,23 @@ static int fec_enet_get_irq_cnt(struct platform_device *pdev) } static int fec_enet_init_stop_mode(struct fec_enet_private *fep, - struct fec_devinfo *dev_info, struct device_node *np) { struct device_node *gpr_np; + u32 out_val[3]; int ret = 0; - if (!dev_info) - return 0; - - gpr_np = of_parse_phandle(np, "gpr", 0); + gpr_np = of_parse_phandle(np, "fsl,stop-mode", 0); if (!gpr_np) return 0; + ret = of_property_read_u32_array(np, "fsl,stop-mode", out_val, + ARRAY_SIZE(out_val)); + if (ret) { + dev_dbg(&fep->pdev->dev, "no stop mode property\n"); + return ret; + } + fep->stop_gpr.gpr = syscon_node_to_regmap(gpr_np); if (IS_ERR(fep->stop_gpr.gpr)) { dev_err(&fep->pdev->dev, "could not find gpr regmap\n"); @@ -3473,8 +3473,8 @@ static int fec_enet_init_stop_mode(struct fec_enet_private *fep, goto out; } - fep->stop_gpr.reg = dev_info->stop_gpr_reg; - fep->stop_gpr.bit = dev_info->stop_gpr_bit; + fep->stop_gpr.reg = out_val[1]; + fep->stop_gpr.bit = out_val[2]; out: of_node_put(gpr_np); @@ -3551,7 +3551,7 @@ fec_probe(struct platform_device *pdev) if (of_get_property(np, "fsl,magic-packet", NULL)) fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET; - ret = fec_enet_init_stop_mode(fep, dev_info, np); + ret = fec_enet_init_stop_mode(fep, np); if (ret) goto failed_stop_mode; -- 2.25.1