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