[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1374595924-12338-3-git-send-email-g.liakhovetski@gmx.de>
Date: Tue, 23 Jul 2013 18:12:02 +0200
From: Guennadi Liakhovetski <g.liakhovetski@....de>
To: linux-sh@...r.kernel.org
Cc: Magnus Damm <magnus.damm@...il.com>,
Simon Horman <horms@...ge.net.au>,
Steve Glendinning <steve.glendinning@...well.net>,
netdev@...r.kernel.org,
Guennadi Liakhovetski <g.liakhovetski+renesas@...il.com>,
devicetree@...r.kernel.org
Subject: [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding
Add a new DT property to specify a reset GPIO.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@...il.com>
Cc: devicetree@...r.kernel.org
---
Documentation/devicetree/bindings/net/smsc911x.txt | 1 +
drivers/net/ethernet/smsc/smsc911x.c | 11 +++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/smsc911x.txt b/Documentation/devicetree/bindings/net/smsc911x.txt
index adb5b57..2bf32be 100644
--- a/Documentation/devicetree/bindings/net/smsc911x.txt
+++ b/Documentation/devicetree/bindings/net/smsc911x.txt
@@ -23,6 +23,7 @@ Optional properties:
external PHY
- smsc,save-mac-address : Indicates that mac address needs to be saved
before resetting the controller
+- smsc,reset-gpios : a GPIO binding to take the controller out of reset
- local-mac-address : 6 bytes, mac address
Examples:
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index ca01c03..db6255e 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -2328,6 +2328,8 @@ static int smsc911x_probe_config_dt(struct smsc911x_platform_config *config,
{
const char *mac;
u32 width = 0;
+ enum of_gpio_flags flags;
+ int gpio;
if (!np)
return -ENODEV;
@@ -2361,6 +2363,15 @@ static int smsc911x_probe_config_dt(struct smsc911x_platform_config *config,
if (of_get_property(np, "smsc,save-mac-address", NULL))
config->flags |= SMSC911X_SAVE_MAC_ADDRESS;
+ gpio = of_get_named_gpio_flags(np, "smsc,reset-gpios", 0, &flags);
+ if (gpio == -EPROBE_DEFER)
+ return gpio;
+ if (gpio_is_valid(gpio)) {
+ config->reset_gpio = gpio;
+ config->reset_gpio_config = SMSC911X_RESET_GPIO_VALID |
+ (flags & OF_GPIO_ACTIVE_LOW ? GPIOF_INIT_LOW : GPIOF_INIT_HIGH);
+ }
+
return 0;
}
#else
--
1.7.2.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists