summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2016-01-11 22:41:25 -0800
committerJoe Hershberger <joe.hershberger@ni.com>2016-01-28 12:23:19 -0600
commita1c76c150831168c09810006ede95b164fa292df (patch)
treea9cabc1f97c6d54026b61e76679d32f429153b82 /drivers/net
parent9a1d6af55ecd73938d49076422e87da9f87fc68f (diff)
downloadu-boot-imx-a1c76c150831168c09810006ede95b164fa292df.zip
u-boot-imx-a1c76c150831168c09810006ede95b164fa292df.tar.gz
u-boot-imx-a1c76c150831168c09810006ede95b164fa292df.tar.bz2
net: tsec: Use priv->tbiaddr to initialize TBI PHY address
Add a new member 'tbiaddr' to tsec_private struct. For non-DM driver, it is initialized as CONFIG_SYS_TBIPA_VALUE, but for DM driver, we can get this from device tree. Update the bindings doc as well. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/tsec.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 18b44f6..025e7a7 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -658,7 +658,7 @@ static int init_phy(struct tsec_private *priv)
supported |= SUPPORTED_1000baseT_Full;
/* Assign a Physical address to the TBI */
- out_be32(&regs->tbipa, CONFIG_SYS_TBIPA_VALUE);
+ out_be32(&regs->tbipa, priv->tbiaddr);
priv->interface = tsec_get_interface(priv);
@@ -707,6 +707,7 @@ static int tsec_initialize(bd_t *bis, struct tsec_info_struct *tsec_info)
priv->phyregs_sgmii = tsec_info->miiregs_sgmii;
priv->phyaddr = tsec_info->phyaddr;
+ priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE;
priv->flags = tsec_info->flags;
sprintf(dev->name, tsec_info->devname);
@@ -801,6 +802,16 @@ int tsec_probe(struct udevice *dev)
return -ENOENT;
}
+ offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
+ "tbi-handle");
+ if (offset > 0) {
+ reg = fdtdec_get_int(gd->fdt_blob, offset, "reg",
+ CONFIG_SYS_TBIPA_VALUE);
+ priv->tbiaddr = reg;
+ } else {
+ priv->tbiaddr = CONFIG_SYS_TBIPA_VALUE;
+ }
+
phy_mode = fdt_getprop(gd->fdt_blob, dev->of_offset,
"phy-connection-type", NULL);
if (phy_mode)