net: phy: micrel_ksz90x1: switch to use ofnode apis
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>
This commit is contained in:
committed by
Michal Simek
parent
602f217c49
commit
b351de58a9
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user