720-mdio_bitbang_ignore_ta_value.patch 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. From: Jonas Gorski <[email protected]>
  2. Subject: ar71xx: add a workaround for ar8316 not always driving the TA bit to low
  3. AR8316 behind a GPIO bitbanged MDIO bus fails to drive the turnaround bit
  4. to low despite returning a valid value. Ignore it and just use the
  5. returned value anyway.
  6. SVN-Revision: 28422
  7. ---
  8. drivers/net/mdio/mdio-bitbang.c | 16 ++-----------------
  9. 1 file changed, 2 insertions(+), 14 deletions(-)
  10. --- a/drivers/net/mdio/mdio-bitbang.c
  11. +++ b/drivers/net/mdio/mdio-bitbang.c
  12. @@ -152,7 +152,7 @@ static int mdiobb_cmd_addr(struct mdiobb
  13. int mdiobb_read(struct mii_bus *bus, int phy, int reg)
  14. {
  15. struct mdiobb_ctrl *ctrl = bus->priv;
  16. - int ret, i;
  17. + int ret;
  18. if (reg & MII_ADDR_C45) {
  19. reg = mdiobb_cmd_addr(ctrl, phy, reg);
  20. @@ -162,19 +162,7 @@ int mdiobb_read(struct mii_bus *bus, int
  21. ctrl->ops->set_mdio_dir(ctrl, 0);
  22. - /* check the turnaround bit: the PHY should be driving it to zero, if this
  23. - * PHY is listed in phy_ignore_ta_mask as having broken TA, skip that
  24. - */
  25. - if (mdiobb_get_bit(ctrl) != 0 &&
  26. - !(bus->phy_ignore_ta_mask & (1 << phy))) {
  27. - /* PHY didn't drive TA low -- flush any bits it
  28. - * may be trying to send.
  29. - */
  30. - for (i = 0; i < 32; i++)
  31. - mdiobb_get_bit(ctrl);
  32. -
  33. - return 0xffff;
  34. - }
  35. + mdiobb_get_bit(ctrl);
  36. ret = mdiobb_get_num(ctrl, 16);
  37. mdiobb_get_bit(ctrl);