From: Fabio Estevam <festevam@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v3 2/4] net: fec: Allow the PHY node to be retrieved
Date: Thu, 18 Jun 2020 20:21:18 -0300 [thread overview]
Message-ID: <20200618232120.3289-2-festevam@gmail.com> (raw)
In-Reply-To: <20200618232120.3289-1-festevam@gmail.com>
As we move towards driver model, it is required to let the FEC driver
know how to properly deal with an Ethernet PHY subnode in the device tree.
For example:
&fec {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
phy-handle = <&phy>;
phy-mode = "rgmii-id";
phy-reset-duration = <2>;
phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
status = "okay";
mdio {
#address-cells = <1>;
#size-cells = <0>;
phy: ethernet-phy at 0 {
reg = <0>;
qca,clk-out-frequency = <125000000>;
};
};
};
Currently the PHY node pointer is incorrectly associated with the
Ethernel controller instead of the PHY node itself.
This causes the PHY properties, such as "qca,clk-out-frequency" in
the example above to not get parsed.
Fix this problem by populating the phy_of_node node.
Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
Tested-by: Tom Rini <trini@konsulko.com>
---
Changes since v2:
- None
drivers/net/fec_mxc.c | 7 +++++--
drivers/net/fec_mxc.h | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 9ae2db033e..992180df86 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -1294,7 +1294,7 @@ static const struct eth_ops fecmxc_ops = {
.read_rom_hwaddr = fecmxc_read_rom_hwaddr,
};
-static int device_get_phy_addr(struct udevice *dev)
+static int device_get_phy_addr(struct fec_priv *priv, struct udevice *dev)
{
struct ofnode_phandle_args phandle_args;
int reg;
@@ -1305,6 +1305,8 @@ static int device_get_phy_addr(struct udevice *dev)
return -ENODEV;
}
+ priv->phy_of_node = phandle_args.node;
+
reg = ofnode_read_u32_default(phandle_args.node, "reg", 0);
return reg;
@@ -1315,7 +1317,7 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)
struct phy_device *phydev;
int addr;
- addr = device_get_phy_addr(dev);
+ addr = device_get_phy_addr(priv, dev);
#ifdef CONFIG_FEC_MXC_PHYADDR
addr = CONFIG_FEC_MXC_PHYADDR;
#endif
@@ -1325,6 +1327,7 @@ static int fec_phy_init(struct fec_priv *priv, struct udevice *dev)
return -ENODEV;
priv->phydev = phydev;
+ priv->phydev->node = priv->phy_of_node;
phy_config(phydev);
return 0;
diff --git a/drivers/net/fec_mxc.h b/drivers/net/fec_mxc.h
index 0e8f08a51a..659d62646f 100644
--- a/drivers/net/fec_mxc.h
+++ b/drivers/net/fec_mxc.h
@@ -250,6 +250,7 @@ struct fec_priv {
struct mii_dev *bus;
#ifdef CONFIG_PHYLIB
struct phy_device *phydev;
+ ofnode phy_of_node;
#else
int phy_id;
int (*mii_postcall)(int);
--
2.17.1
next prev parent reply other threads:[~2020-06-18 23:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-18 23:21 [PATCH v3 1/4] phy: atheros: ar8035: Fix clock output calculation Fabio Estevam
2020-06-18 23:21 ` Fabio Estevam [this message]
2020-06-23 7:51 ` [PATCH v3 2/4] net: fec: Allow the PHY node to be retrieved sbabic at denx.de
2020-06-18 23:21 ` [PATCH v3 3/4] ARM: dts: imx6qdl-sr-som: Sync with kernel 5.8-rc1 Fabio Estevam
2020-06-23 7:50 ` sbabic at denx.de
2020-06-18 23:21 ` [PATCH v3 4/4] mx6cuboxi: Convert to DM_ETH Fabio Estevam
2020-06-23 7:50 ` sbabic at denx.de
2020-06-23 7:51 ` [PATCH v3 1/4] phy: atheros: ar8035: Fix clock output calculation sbabic at denx.de
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=20200618232120.3289-2-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=u-boot@lists.denx.de \
/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