提交 da1da284 编写于 作者: S Shengzhou Liu 提交者: David S. Miller

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: NShengzhou Liu <Shengzhou.Liu@freescale.com>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d53c66a5
...@@ -230,7 +230,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, ...@@ -230,7 +230,7 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
for (i = 1; for (i = 1;
i < num_ids && c45_ids->devices_in_package == 0; i < num_ids && c45_ids->devices_in_package == 0;
i++) { i++) {
reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2; retry: reg_addr = MII_ADDR_C45 | i << 16 | MDIO_DEVS2;
phy_reg = mdiobus_read(bus, addr, reg_addr); phy_reg = mdiobus_read(bus, addr, reg_addr);
if (phy_reg < 0) if (phy_reg < 0)
return -EIO; return -EIO;
...@@ -242,12 +242,20 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id, ...@@ -242,12 +242,20 @@ static int get_phy_c45_ids(struct mii_bus *bus, int addr, u32 *phy_id,
return -EIO; return -EIO;
c45_ids->devices_in_package |= (phy_reg & 0xffff); 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) { if ((c45_ids->devices_in_package & 0x1fffffff) == 0x1fffffff) {
*phy_id = 0xffffffff; if (i) {
return 0; /* 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;
}
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册