brcm63xx: remove legacy led/button related patches
[openwrt.git] / target / linux / brcm63xx / patches-4.1 / 376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch
1 From ec905f2ea78ec40602a685ede31c5e4f9893d196 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sat, 21 Feb 2015 16:35:07 +0100
4 Subject: [PATCH 3/6] net: bcm63xx_enet: use named gpio for ephy reset gpio
5
6 Allow using a named optional gpio for ephy reset gpio registration.
7 ---
8  drivers/net/ethernet/broadcom/bcm63xx_enet.c |    9 +++++++++
9  1 file changed, 9 insertions(+)
10
11 --- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
12 +++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
13 @@ -30,6 +30,7 @@
14  #include <linux/dma-mapping.h>
15  #include <linux/platform_device.h>
16  #include <linux/if_vlan.h>
17 +#include <linux/gpio/consumer.h>
18  
19  #include <bcm63xx_dev_enet.h>
20  #include "bcm63xx_enet.h"
21 @@ -2848,10 +2849,15 @@ static int bcm_enet_shared_probe(struct
22  {
23         struct resource *res;
24         void __iomem *p[3];
25 +       struct gpio_desc *ephy_reset;
26         unsigned int i;
27  
28         memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
29  
30 +       ephy_reset = devm_gpiod_get_optional(&pdev->dev, "ephy-reset");
31 +       if (IS_ERR(ephy_reset))
32 +               return PTR_ERR(ephy_reset);
33 +
34         for (i = 0; i < 3; i++) {
35                 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
36                 p[i] = devm_ioremap_resource(&pdev->dev, res);
37 @@ -2861,6 +2867,9 @@ static int bcm_enet_shared_probe(struct
38  
39         memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
40  
41 +       if (ephy_reset)
42 +               gpiod_direction_output(ephy_reset, 0);
43 +
44         return 0;
45  }
46