diff options
author | Hou Zhiqiang <Zhiqiang.Hou@nxp.com> | 2020-05-03 22:48:43 +0800 |
---|---|---|
committer | Priyanka Jain <priyanka.jain@nxp.com> | 2020-06-04 18:53:20 +0530 |
commit | a0f47e012fb679baa927feb3e673503c88083aa0 (patch) | |
tree | 159b3201f1da36723a788eaa0e07232333bac59a | |
parent | bf67eb325bea748577f98fd5bb5f10348b223c2a (diff) | |
download | u-boot-a0f47e012fb679baa927feb3e673503c88083aa0.tar.gz u-boot-a0f47e012fb679baa927feb3e673503c88083aa0.tar.bz2 u-boot-a0f47e012fb679baa927feb3e673503c88083aa0.zip |
net: tsec: Access TBI PHY through the corresponding MII
When an eTSEC is configured to use TBI, configuration of the
TBI is done through the MIIM registers for that eTSEC.
For example, if a TBI interface is required on eTSEC2, then
the MIIM registers starting at offset 0x2_5520 are used to
configure it.
Fixes: 9a1d6af55ecd ("net: tsec: Add driver model ethernet support")
Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
-rw-r--r-- | drivers/net/tsec.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c index 611cb040dc..3d75acb6b4 100644 --- a/drivers/net/tsec.c +++ b/drivers/net/tsec.c @@ -791,6 +791,7 @@ int tsec_probe(struct udevice *dev) { struct eth_pdata *pdata = dev_get_platdata(dev); struct tsec_private *priv = dev_get_priv(dev); + struct tsec_mii_mng __iomem *ext_phyregs_mii; struct ofnode_phandle_args phandle_args; u32 tbiaddr = CONFIG_SYS_TBIPA_VALUE; struct fsl_pq_mdio_info mdio_info; @@ -824,14 +825,30 @@ int tsec_probe(struct udevice *dev) return -ENOENT; } - priv->phyregs_sgmii = map_physmem(reg + TSEC_MDIO_REGS_OFFSET, 0, - MAP_NOCACHE); + ext_phyregs_mii = map_physmem(reg + TSEC_MDIO_REGS_OFFSET, 0, + MAP_NOCACHE); ret = dev_read_phandle_with_args(dev, "tbi-handle", NULL, 0, 0, &phandle_args); - if (ret == 0) + if (ret == 0) { ofnode_read_u32(phandle_args.node, "reg", &tbiaddr); + parent = ofnode_get_parent(phandle_args.node); + if (!ofnode_valid(parent)) { + printf("No parent node for TBI PHY?\n"); + return -ENOENT; + } + + reg = ofnode_get_addr_index(parent, 0); + if (reg == FDT_ADDR_T_NONE) { + printf("No 'reg' property of MII for TBI PHY\n"); + return -ENOENT; + } + + priv->phyregs_sgmii = map_physmem(reg + TSEC_MDIO_REGS_OFFSET, + 0, MAP_NOCACHE); + } + priv->tbiaddr = tbiaddr; phy_mode = dev_read_prop(dev, "phy-connection-type", NULL); @@ -848,7 +865,7 @@ int tsec_probe(struct udevice *dev) if (priv->interface == PHY_INTERFACE_MODE_SGMII) priv->flags |= TSEC_SGMII; - mdio_info.regs = priv->phyregs_sgmii; + mdio_info.regs = ext_phyregs_mii; mdio_info.name = (char *)dev->name; ret = fsl_pq_mdio_init(NULL, &mdio_info); if (ret) |