[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1428657020-11191-1-git-send-email-Shengzhou.Liu@freescale.com>
Date: Fri, 10 Apr 2015 17:10:20 +0800
From: Shengzhou Liu <Shengzhou.Liu@...escale.com>
To: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<f.fainelli@...il.com>
CC: Shengzhou Liu <Shengzhou.Liu@...escale.com>
Subject: [PATCH] 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.
Signed-off-by: Shengzhou Liu <Shengzhou.Liu@...escale.com>
---
drivers/net/phy/phy_device.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index bdfe51f..07cf455 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -242,12 +242,29 @@ 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 mostly Fs, let's continue to probe more
+ * as some c45 PHYs have zero Devices In package,
+ * e.g. Cortina CS4315/CS4340 PHY.
*/
if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) {
- *phy_id = 0xffffffff;
- return 0;
+ reg_addr = MII_ADDR_C45 | 0 << 16 | 6;
+ phy_reg = mdiobus_read(bus, addr, reg_addr);
+ if (phy_reg < 0)
+ return -EIO;
+ c45_ids->devices_in_package = (phy_reg & 0xffff) << 16;
+ reg_addr = MII_ADDR_C45 | 0 << 16 | 5;
+ phy_reg = mdiobus_read(bus, addr, reg_addr);
+ if (phy_reg < 0)
+ 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;
+ }
}
}
--
2.1.0.27.g96db324
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists