Merge tag 'u-boot-at91-2022.07-a' of https://source.denx.de/u-boot/custodians/u-boot...
[platform/kernel/u-boot.git] / drivers / net / phy / xilinx_phy.c
index 920bfcb..39dbfdb 100644 (file)
@@ -1,18 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Xilinx PCS/PMA Core phy driver
  *
  * Copyright (C) 2015 - 2016 Xilinx, Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #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
@@ -102,10 +100,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, phydev->dev->of_offset,
-                                "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;