Skip to content

Commit 0f40d50

Browse files
glneovinodkoul
authored andcommitted
phy: ti: gmii-sel: Fix register offset when parent is not a syscon node
When the node for this phy selector is a child node of a syscon node then the property 'reg' is used as an offset into the parent regmap. When the node is standalone and gets its own regmap this offset is pre-applied. So we need to track which method was used to get the regmap and not apply the offset in the standalone case. Fixes: 1fdfa7c ("phy: ti: gmii-sel: Allow parent to not be syscon node") Signed-off-by: Andrew Davis <afd@ti.com> Reviewed-by: Roger Quadros <rogerq@kernel.org> Link: https://lore.kernel.org/r/20231025143302.1265633-1-afd@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent b85ea95 commit 0f40d50

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/phy/ti/phy-gmii-sel.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ struct phy_gmii_sel_priv {
6464
u32 num_ports;
6565
u32 reg_offset;
6666
u32 qsgmii_main_ports;
67+
bool no_offset;
6768
};
6869

6970
static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode)
@@ -402,7 +403,8 @@ static int phy_gmii_sel_init_ports(struct phy_gmii_sel_priv *priv)
402403
priv->num_ports = size / sizeof(u32);
403404
if (!priv->num_ports)
404405
return -EINVAL;
405-
priv->reg_offset = __be32_to_cpu(*offset);
406+
if (!priv->no_offset)
407+
priv->reg_offset = __be32_to_cpu(*offset);
406408
}
407409

408410
if_phys = devm_kcalloc(dev, priv->num_ports,
@@ -471,6 +473,7 @@ static int phy_gmii_sel_probe(struct platform_device *pdev)
471473
dev_err(dev, "Failed to get syscon %d\n", ret);
472474
return ret;
473475
}
476+
priv->no_offset = true;
474477
}
475478

476479
ret = phy_gmii_sel_init_ports(priv);

0 commit comments

Comments
 (0)