diff options
author | Bin Meng <bmeng.cn@gmail.com> | 2016-01-11 22:41:26 -0800 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2016-01-28 12:23:22 -0600 |
commit | afe6462da9f68e872a9aeae1dc5389184819c1cf (patch) | |
tree | e0584e1b940ffa5fc6069671802db1840b9b51c0 | |
parent | a1c76c150831168c09810006ede95b164fa292df (diff) | |
download | u-boot-imx-afe6462da9f68e872a9aeae1dc5389184819c1cf.zip u-boot-imx-afe6462da9f68e872a9aeae1dc5389184819c1cf.tar.gz u-boot-imx-afe6462da9f68e872a9aeae1dc5389184819c1cf.tar.bz2 |
arm: ls102xa: Rewrite the logic of ft_fixup_enet_phy_connect_type()
eth_get_dev_by_index() is an API which is not available in driver
model. Use eth_get_dev_by_name() instead, which can also simplifly
the code logic a little bit.
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r-- | arch/arm/cpu/armv7/ls102xa/fdt.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c index 856abed..ae5e794 100644 --- a/arch/arm/cpu/armv7/ls102xa/fdt.c +++ b/arch/arm/cpu/armv7/ls102xa/fdt.c @@ -30,17 +30,13 @@ void ft_fixup_enet_phy_connect_type(void *fdt) int phy_node; int i = 0; uint32_t ph; + char *name[3] = { "eTSEC1", "eTSEC2", "eTSEC3" }; - while ((dev = eth_get_dev_by_index(i++)) != NULL) { - if (strstr(dev->name, "eTSEC1")) { - strcpy(enet, "ethernet0"); - strcpy(phy, "enet0_rgmii_phy"); - } else if (strstr(dev->name, "eTSEC2")) { - strcpy(enet, "ethernet1"); - strcpy(phy, "enet1_rgmii_phy"); - } else if (strstr(dev->name, "eTSEC3")) { - strcpy(enet, "ethernet2"); - strcpy(phy, "enet2_rgmii_phy"); + for (; i < ARRAY_SIZE(name); i++) { + dev = eth_get_dev_by_name(name[i]); + if (dev) { + sprintf(enet, "ethernet%d", i); + sprintf(phy, "enet%d_rgmii_phy", i); } else { continue; } |