summaryrefslogtreecommitdiff
path: root/drivers/net/phy
diff options
context:
space:
mode:
authorShengzhou Liu <Shengzhou.Liu@freescale.com>2014-04-23 09:31:00 (GMT)
committerJose Rivera <German.Rivera@freescale.com>2014-04-28 13:33:08 (GMT)
commite1e6719a2f483404f8c65e86c21b1c7723d076ec (patch)
tree22f5630d6a377eda1e674781bb661a39d665274b /drivers/net/phy
parent139ba80dd8dfe49189c638e787867dc69e6b7874 (diff)
downloadlinux-fsl-qoriq-e1e6719a2f483404f8c65e86c21b1c7723d076ec.tar.xz
net/phy: tune get_phy_c45_ids to support more c45 phy
As some C45 10G PHYs(e.g. Cortina CS4315/CS4340 PHY) have zero Devices In package, current driver can't get correct devices_in_package value by non-zero Devices In package. so let's probe more with zero Devices In package to support more C45 PHYs which have zero Devices In package. Signed-off-by: Shengzhou Liu <Shengzhou.Liu@freescale.com> Change-Id: I468aa36c18a6cae538a09a7da3347e7584e1a07e Reviewed-on: http://git.am.freescale.net:8181/11387 Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com> Reviewed-by: Shaohui Xie <Shaohui.Xie@freescale.com> Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r--drivers/net/phy/phy_device.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index cfb5110..4f5d518 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -232,7 +232,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
for (i = 1;
i < num_ids && c45_ids->devices_in_package == 0;
i++) {
- reg_addr = MII_ADDR_C45 | i << 16 | 6;
+retry: reg_addr = MII_ADDR_C45 | i << 16 | 6;
phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0)
return -EIO;
@@ -244,12 +244,20 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
return -EIO;
c45_ids->devices_in_package |= (phy_reg & 0xffff);
- /* If mostly Fs, there is no device there,
- * let's get out of here.
- */
if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) {
- *phy_id = 0xffffffff;
- return 0;
+ if (i) {
+ /* If mostly Fs, there is no device there,
+ * then let's continue to probe more, as some
+ * 10G PHYs have zero Devices In package,
+ * e.g. Cortina CS4315/CS4340 PHY.
+ */
+ i = 0;
+ goto retry;
+ } else {
+ /* no device there, let's get out of here */
+ *phy_id = 0xffffffff;
+ return 0;
+ }
}
}