Ubiquiti loco xw eth0 bug
Aus Opennet
Version vom 10. Mai 2015, 09:24 Uhr von Leo (Diskussion | Beiträge)
Inhaltsverzeichnis |
Bug description
Some Ubiquiti loco xw have a hardware bug which results in an interface shutdown with now possibility to bring the interface without reboot. More details, see https://dev.openwrt.org/ticket/19085
Steps for building workaround
Find a way to detect hang of eth0
Try 1
In general there are two places where uid of PHY is printed.
1. ag71xx_phy.c
function: static int ag71xx_phy_connect_multi(struct ag71xx *ag) .... DBG("%s: PHY found at %s, uid=%08x\n", dev_name(dev), dev_name(&ag->mii_bus->phy_map[phy_addr]->dev), ag->mii_bus->phy_map[phy_addr]->phy_id); dev_info(dev, "connected to PHY at %s [uid=%08x, driver=%s]\n", dev_name(&phydev->dev), phydev->phy_id, phydev->drv->name);
2. ag71xx_main.c
void ag71xx_link_adjust(struct ag71xx *ag) .... struct device *dev = &ag->pdev->dev; struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); struct phy_device *phydev = NULL; int phy_addr; int ret = 0; for (phy_addr = 0; phy_addr < PHY_MAX_ADDR; phy_addr++) { if (!(pdata->phy_mask & (1 << phy_addr))) continue; if (ag->mii_bus->phy_map[phy_addr] == NULL) continue; DBG("%s: PHY found at %s, uid=%08x\n", dev_name(dev), dev_name(&ag->mii_bus->phy_map[phy_addr]->dev), ag->mii_bus->phy_map[phy_addr]->phy_id); if (phydev == NULL) phydev = ag->mii_bus->phy_map[phy_addr]; } dev_info(dev, "connected to PHY at %s [uid=%08x, driver=%s]\n", dev_name(&phydev->dev), phydev->phy_id, phydev->drv->name);
ID can be read in ag71xx_link_adjust() in file ag71xx_main.c. See http://pastebin.com/0ze9iFcb for an example. But the ID is not changing when eth0 hangs. The output when it hangs is:
[155921.360000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:01 [uid=004dd023, driver=Generic PHY] (Opennet-Info1) [155921.360000] eth0: link up (10Mbps/Half duplex) [155923.370000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:01 [uid=004dd023, driver=Generic PHY] (Opennet-Info1) [155923.370000] eth0: link down [155923.380000] br-lan: port 1(eth0) entered disabled state
Try 2
...to write ... read ID was ffffff.....
Try 3 - use get_phy_id()
patch from Till
--- trunk/eth-bug-oni-trunk/on_firmware/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3. 10.49/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c.orig 2015-04-21 18:23:56.000000000 +0200 +++ trunk/eth-bug-oni-trunk/on_firmware/openwrt/build_dir/target-mips_34kc_uClibc-0.9.33.2/linux-ar71xx_generic/linux-3. 10.49/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c 2015-04-28 13:21:56.884431730 +0200 @@ -533,10 +533,16 @@ void ag71xx_link_adjust(struct ag71xx *ag) { struct ag71xx_platform_data *pdata = ag71xx_get_pdata(ag); + struct mii_bus *mii = ag->mii_bus; u32 cfg2; u32 ifctl; u32 fifo5; u32 fifo3; + u32 phy_id; + int phy_ret; + + phy_ret = get_phy_id(mii, 0, &phy_id); + pr_info("%s: PHY ID is %08x (ret=%d) (unschoener Opennet-Hack v3)\n", ag->dev->name, phy_id, phy_ret); if (!ag->link) { ag71xx_hw_stop(ag);
The function get_phy_id() needs to be exported...
Find a way to reset eth0
...TODO...