]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: phy: micrel_ksz90x1: switch to use ofnode apis
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Sat, 16 Mar 2019 12:21:23 +0000 (17:51 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Sat, 16 Mar 2019 13:02:37 +0000 (14:02 +0100)
phydev->node is phy node, phydev->dev->node is controller
and that current code is likely reading the properties from
controller node and not from phy. So, Use PHY API phy_get_ofnode()
helper to get PHY DT node and use ofnode_read_u32_default() to
read properties in phy node.

Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Changes for v2:
- Updated description
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/phy/micrel_ksz90x1.c

index 3951535bf1ff1b23c93bc55521019e5935adfce6..355a7d8e97e0adee64d49c4d42fccff4c679272c 100644 (file)
@@ -104,18 +104,22 @@ static const struct ksz90x1_reg_field ksz9031_clk_grp[] = {
 static int ksz90x1_of_config_group(struct phy_device *phydev,
                                   struct ksz90x1_ofcfg *ofcfg)
 {
-       struct udevice *dev = phydev->dev;
        struct phy_driver *drv = phydev->drv;
        const int ps_to_regval = 60;
        int val[4];
        int i, changed = 0, offset, max;
        u16 regval = 0;
+       ofnode node;
 
        if (!drv || !drv->writeext)
                return -EOPNOTSUPP;
 
+       node = phy_get_ofnode(phydev);
+       if (!ofnode_valid(node))
+               return -EINVAL;
+
        for (i = 0; i < ofcfg->grpsz; i++) {
-               val[i] = dev_read_u32_default(dev, ofcfg->grp[i].name, ~0);
+               val[i] = ofnode_read_u32_default(node, ofcfg->grp[i].name, ~0);
                offset = ofcfg->grp[i].off;
                if (val[i] == -1) {
                        /* Default register value for KSZ9021 */