diff mbox series

[U-Boot] net: xilinx_axiemac: Fill the phy node pointer in phydev

Message ID 1dbe50d83c89bfa1765e948798d2029b9d421bee.1568285103.git.michal.simek@xilinx.com
State Accepted
Commit fccfb71004cba0f89eed01bec73b1efc9a149e90
Delegated to: Michal Simek
Headers show
Series [U-Boot] net: xilinx_axiemac: Fill the phy node pointer in phydev | expand

Commit Message

Michal Simek Sept. 12, 2019, 10:45 a.m. UTC
From: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>

This patch assings the phynode pointer to the phydev node as it is needed
later in the corresponding phy driver to read phy properties from DT.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

This feature is present in these drivers:
drivers/net/ti/am65-cpsw-nuss.c:573:            phydev->node = priv->phy_node;
drivers/net/ti/cpsw.c:853:              phydev->node = offset_to_ofnode(slave->data->phy_of_handle);
drivers/net/ti/keystone_net.c:594:              priv->phydev->node = offset_to_ofnode(priv->phy_of_handle);
drivers/net/zynq_gem.c:322:     priv->phydev->node = priv->phy_of_node;
---
 drivers/net/xilinx_axi_emac.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Michal Simek Oct. 8, 2019, 7:54 a.m. UTC | #1
čt 12. 9. 2019 v 12:45 odesílatel Michal Simek <michal.simek@xilinx.com> napsal:
>
> From: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
>
> This patch assings the phynode pointer to the phydev node as it is needed
> later in the corresponding phy driver to read phy properties from DT.
>
> Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> This feature is present in these drivers:
> drivers/net/ti/am65-cpsw-nuss.c:573:            phydev->node = priv->phy_node;
> drivers/net/ti/cpsw.c:853:              phydev->node = offset_to_ofnode(slave->data->phy_of_handle);
> drivers/net/ti/keystone_net.c:594:              priv->phydev->node = offset_to_ofnode(priv->phy_of_handle);
> drivers/net/zynq_gem.c:322:     priv->phydev->node = priv->phy_of_node;
> ---
>  drivers/net/xilinx_axi_emac.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
> index 26c21c6d70fa..36d651109cbc 100644
> --- a/drivers/net/xilinx_axi_emac.c
> +++ b/drivers/net/xilinx_axi_emac.c
> @@ -93,6 +93,7 @@ struct axidma_priv {
>         struct phy_device *phydev;
>         struct mii_dev *bus;
>         u8 eth_hasnobuf;
> +       int phy_of_handle;
>  };
>
>  /* BD descriptors */
> @@ -276,6 +277,8 @@ static int axiemac_phy_init(struct udevice *dev)
>         phydev->supported &= supported;
>         phydev->advertising = phydev->supported;
>         priv->phydev = phydev;
> +       if (priv->phy_of_handle)
> +               priv->phydev->node = offset_to_ofnode(priv->phy_of_handle);
>         phy_config(phydev);
>
>         return 0;
> @@ -736,8 +739,10 @@ static int axi_emac_ofdata_to_platdata(struct udevice *dev)
>         priv->phyaddr = -1;
>
>         offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy-handle");
> -       if (offset > 0)
> +       if (offset > 0) {
>                 priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
> +               priv->phy_of_handle = offset;
> +       }
>
>         phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
>         if (phy_mode)
> --
> 2.17.1
>

Applied. Patchwork assigned this to me.
M
diff mbox series

Patch

diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index 26c21c6d70fa..36d651109cbc 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -93,6 +93,7 @@  struct axidma_priv {
 	struct phy_device *phydev;
 	struct mii_dev *bus;
 	u8 eth_hasnobuf;
+	int phy_of_handle;
 };
 
 /* BD descriptors */
@@ -276,6 +277,8 @@  static int axiemac_phy_init(struct udevice *dev)
 	phydev->supported &= supported;
 	phydev->advertising = phydev->supported;
 	priv->phydev = phydev;
+	if (priv->phy_of_handle)
+		priv->phydev->node = offset_to_ofnode(priv->phy_of_handle);
 	phy_config(phydev);
 
 	return 0;
@@ -736,8 +739,10 @@  static int axi_emac_ofdata_to_platdata(struct udevice *dev)
 	priv->phyaddr = -1;
 
 	offset = fdtdec_lookup_phandle(gd->fdt_blob, node, "phy-handle");
-	if (offset > 0)
+	if (offset > 0) {
 		priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", -1);
+		priv->phy_of_handle = offset;
+	}
 
 	phy_mode = fdt_getprop(gd->fdt_blob, node, "phy-mode", NULL);
 	if (phy_mode)