From: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
To: linux-sh@vger.kernel.org
Cc: Magnus Damm <magnus.damm@gmail.com>,
Simon Horman <horms@verge.net.au>,
Steve Glendinning <steve.glendinning@shawell.net>,
netdev@vger.kernel.org,
Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>,
devicetree@vger.kernel.org
Subject: [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding
Date: Tue, 23 Jul 2013 18:12:02 +0200 [thread overview]
Message-ID: <1374595924-12338-3-git-send-email-g.liakhovetski@gmx.de> (raw)
In-Reply-To: <1374595924-12338-1-git-send-email-g.liakhovetski@gmx.de>
Add a new DT property to specify a reset GPIO.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com>
Cc: devicetree@vger.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
next prev parent reply other threads:[~2013-07-23 16:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 16:12 [PATCH 0/4] net: smsc911x: support reset GPIO and use it on ape6evm Guennadi Liakhovetski
2013-07-23 16:12 ` [PATCH 1/4] net: smsc911x: add support for a reset GPIO Guennadi Liakhovetski
2013-07-23 16:38 ` Fabio Estevam
2013-07-23 16:44 ` Guennadi Liakhovetski
2013-07-23 17:36 ` Sergei Shtylyov
2013-07-23 16:12 ` Guennadi Liakhovetski [this message]
2013-07-23 22:10 ` [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding Laurent Pinchart
2013-07-23 22:18 ` Sascha Hauer
2013-07-23 16:12 ` [PATCH 3/4] ARM: shmobile: ape6evm: use smsc911x platform parameters to handle eth reset Guennadi Liakhovetski
2013-07-23 16:12 ` [PATCH 4/4] ARM: shmobile: ape6evm-reference: add smsc911x ethernet support Guennadi Liakhovetski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374595924-12338-3-git-send-email-g.liakhovetski@gmx.de \
--to=g.liakhovetski@gmx.de \
--cc=devicetree@vger.kernel.org \
--cc=g.liakhovetski+renesas@gmail.com \
--cc=horms@verge.net.au \
--cc=linux-sh@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=steve.glendinning@shawell.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).