kernel: update 4.4 to 4.4.83
[oweals/openwrt.git] / target / linux / generic / pending-4.4 / 736-at803x-fix-reset-handling.patch
1 From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
2 Date: Wed, 23 Mar 2016 00:44:40 +0300
3 Subject: [PATCH] at803x: fix reset handling
4 MIME-Version: 1.0
5 Content-Type: text/plain; charset=UTF-8
6 Content-Transfer-Encoding: 8bit
7
8 The driver of course "knows" that the chip's reset signal is active low,
9 so  it drives the GPIO to 0  to reset the PHY and to 1 otherwise; however
10 all this will only work iff the GPIO  is  specified as active-high in the
11 device tree!  I think both the driver and the device trees (if there are
12 any -- I was unable to find them) need to be fixed in this case...
13
14 Fixes: 13a56b449325 ("net: phy: at803x: Add support for hardware reset")
15 Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
16 Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
17 Signed-off-by: David S. Miller <davem@davemloft.net>
18 ---
19
20 --- a/drivers/net/phy/at803x.c
21 +++ b/drivers/net/phy/at803x.c
22 @@ -250,7 +250,7 @@ static int at803x_probe(struct phy_devic
23         if (!priv)
24                 return -ENOMEM;
25  
26 -       gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
27 +       gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW);
28         if (IS_ERR(gpiod_reset))
29                 return PTR_ERR(gpiod_reset);
30  
31 @@ -377,10 +377,10 @@ static void at803x_link_change_notify(st
32  
33                                 at803x_context_save(phydev, &context);
34  
35 -                               gpiod_set_value(priv->gpiod_reset, 0);
36 -                               msleep(1);
37                                 gpiod_set_value(priv->gpiod_reset, 1);
38                                 msleep(1);
39 +                               gpiod_set_value(priv->gpiod_reset, 0);
40 +                               msleep(1);
41  
42                                 at803x_context_restore(phydev, &context);
43