diff mbox series

[U-Boot,v2,3/5] net: phy: xilinx: switch to use phy_get_ofnode()

Message ID 20180705170252.5422-4-grygorii.strashko@ti.com
State Accepted
Commit aadbd97
Delegated to: Joe Hershberger
Headers show
Series net: phy: prevent uclass_eth device "node" field overwriting | expand

Commit Message

Grygorii Strashko July 5, 2018, 5:02 p.m. UTC
Use PHY API phy_get_ofnode() helper to get PHY DT node.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
---
 drivers/net/phy/xilinx_phy.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Joe Hershberger July 26, 2018, 7:18 p.m. UTC | #1
Hi Grygorii,

https://patchwork.ozlabs.org/patch/940100/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe
diff mbox series

Patch

diff --git a/drivers/net/phy/xilinx_phy.c b/drivers/net/phy/xilinx_phy.c
index 004cfcf..3aa8891 100644
--- a/drivers/net/phy/xilinx_phy.c
+++ b/drivers/net/phy/xilinx_phy.c
@@ -10,8 +10,6 @@ 
 #include <phy.h>
 #include <dm.h>
 
-DECLARE_GLOBAL_DATA_PTR;
-
 #define MII_PHY_STATUS_SPD_MASK		0x0C00
 #define MII_PHY_STATUS_FULLDUPLEX	0x1000
 #define MII_PHY_STATUS_1000		0x0800
@@ -101,10 +99,14 @@  static int xilinxphy_startup(struct phy_device *phydev)
 static int xilinxphy_of_init(struct phy_device *phydev)
 {
 	u32 phytype;
+	ofnode node;
 
 	debug("%s\n", __func__);
-	phytype = fdtdec_get_int(gd->fdt_blob, dev_of_offset(phydev->dev),
-				 "xlnx,phy-type", -1);
+	node = phy_get_ofnode(phydev);
+	if (!ofnode_valid(node))
+		return -EINVAL;
+
+	phytype = ofnode_read_u32_default(node, "xlnx,phy-type", -1);
 	if (phytype == XAE_PHY_TYPE_1000BASE_X)
 		phydev->flags |= XAE_PHY_TYPE_1000BASE_X;