aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-3.18/376-net-bcm63xx_enet-use-named-gpio-for-ephy-reset-gpio.patch
blob: 6d19cc06164ebc1afac589be4f928bb8b64ab794 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From ec905f2ea78ec40602a685ede31c5e4f9893d196 Mon Sep 17 00:00:00 2001
From: Jonas Gorski <jogo@openwrt.org>
Date: Sat, 21 Feb 2015 16:35:07 +0100
Subject: [PATCH 3/6] net: bcm63xx_enet: use named gpio for ephy reset gpio

Allow using a named optional gpio for ephy reset gpio registration.
---
 drivers/net/ethernet/broadcom/bcm63xx_enet.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- a/drivers/net/ethernet/broadcom/bcm63xx_enet.c
+++ b/drivers/net/ethernet/broadcom/bcm63xx_enet.c
@@ -30,6 +30,7 @@
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/if_vlan.h>
+#include <linux/gpio/consumer.h>
 
 #include <bcm63xx_dev_enet.h>
 #include "bcm63xx_enet.h"
@@ -2848,10 +2849,15 @@ static int bcm_enet_shared_probe(struct
 {
 	struct resource *res;
 	void __iomem *p[3];
+	struct gpio_desc *ephy_reset;
 	unsigned int i;
 
 	memset(bcm_enet_shared_base, 0, sizeof(bcm_enet_shared_base));
 
+	ephy_reset = devm_gpiod_get_optional(&pdev->dev, "ephy-reset");
+	if (IS_ERR(ephy_reset))
+		return PTR_ERR(ephy_reset);
+
 	for (i = 0; i < 3; i++) {
 		res = platform_get_resource(pdev, IORESOURCE_MEM, i);
 		p[i] = devm_ioremap_resource(&pdev->dev, res);
@@ -2861,6 +2867,9 @@ static int bcm_enet_shared_probe(struct
 
 	memcpy(bcm_enet_shared_base, p, sizeof(bcm_enet_shared_base));
 
+	if (ephy_reset)
+		gpiod_direction_output(ephy_reset, 0);
+
 	return 0;
 }