From: fugang.duan@nxp.com
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, martin.fuzzey@flowbird.group,
robh+dt@kernel.org, shawnguo@kernel.org,
devicetree@vger.kernel.org, fugang.duan@nxp.com
Subject: [PATCH net 1/4] net: ethernet: fec: move GPR register offset and bit into DT
Date: Wed, 20 May 2020 16:31:53 +0800 [thread overview]
Message-ID: <1589963516-26703-2-git-send-email-fugang.duan@nxp.com> (raw)
In-Reply-To: <1589963516-26703-1-git-send-email-fugang.duan@nxp.com>
From: Fugang Duan <fugang.duan@nxp.com>
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.
Fixes: da722186f654(net: fec: set GPR bit on suspend by DT configuration)
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
---
drivers/net/ethernet/freescale/fec_main.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2e20914..9606411 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 = {
@@ -3476,19 +3472,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);
if (!gpr_np)
return 0;
+ ret = of_property_read_u32_array(np, "gpr", 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");
@@ -3497,8 +3497,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);
@@ -3575,7 +3575,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.7.4
next prev parent reply other threads:[~2020-05-20 8:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-20 8:31 [PATCH net 0/4] net: ethernet: fec: move GPR reigster offset and bit into DT fugang.duan
2020-05-20 8:31 ` fugang.duan [this message]
2020-05-20 16:54 ` [PATCH net 1/4] net: ethernet: fec: move GPR register " Jakub Kicinski
2020-05-21 2:40 ` [EXT] " Andy Duan
2020-05-23 9:55 ` Fuzzey, Martin
2020-05-25 2:36 ` [EXT] " Andy Duan
2020-05-20 8:31 ` [PATCH net 2/4] dt-bindings: fec: update the gpr property fugang.duan
2020-05-23 10:15 ` Fuzzey, Martin
2020-05-25 3:16 ` [EXT] " Andy Duan
2020-05-20 8:31 ` [PATCH net 3/4] ARM: dts: imx6: update fec gpr property to match new format fugang.duan
2020-05-20 17:03 ` Andrew Lunn
2020-05-21 3:15 ` [EXT] " Andy Duan
2020-05-21 13:07 ` Andrew Lunn
2020-05-22 1:01 ` Andy Duan
2020-05-22 18:02 ` Fuzzey, Martin
2020-05-22 23:50 ` Andrew Lunn
2020-05-25 2:32 ` Andy Duan
2020-05-25 2:29 ` Andy Duan
2020-05-20 8:31 ` [PATCH net 4/4] ARM: dts: imx6qdl-sabresd: enable fec wake-on-lan fugang.duan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1589963516-26703-2-git-send-email-fugang.duan@nxp.com \
--to=fugang.duan@nxp.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=martin.fuzzey@flowbird.group \
--cc=netdev@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=shawnguo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).