* [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding
[not found] <1374595924-12338-1-git-send-email-g.liakhovetski@gmx.de>
@ 2013-07-23 16:12 ` Guennadi Liakhovetski
2013-07-23 22:10 ` Laurent Pinchart
2013-07-23 22:18 ` Sascha Hauer
0 siblings, 2 replies; 3+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-23 16:12 UTC (permalink / raw)
To: linux-sh
Cc: Magnus Damm, Simon Horman, Steve Glendinning, netdev,
Guennadi Liakhovetski, devicetree
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding
2013-07-23 16:12 ` [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding Guennadi Liakhovetski
@ 2013-07-23 22:10 ` Laurent Pinchart
2013-07-23 22:18 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2013-07-23 22:10 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-sh, Magnus Damm, Simon Horman, Steve Glendinning, netdev,
Guennadi Liakhovetski, devicetree
Hi Guennadi,
Thanks for the patch.
On Tuesday 23 July 2013 18:12:02 Guennadi Liakhovetski wrote:
> 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
Albeit defined in the smsc911x bindings, this property doesn't seem very
device-specific. I wonder whether it would make sense to drop the "smsc,"
prefix.
> - 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
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding
2013-07-23 16:12 ` [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding Guennadi Liakhovetski
2013-07-23 22:10 ` Laurent Pinchart
@ 2013-07-23 22:18 ` Sascha Hauer
1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2013-07-23 22:18 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: linux-sh, Magnus Damm, Simon Horman, Steve Glendinning, netdev,
Guennadi Liakhovetski, devicetree
On Tue, Jul 23, 2013 at 06:12:02PM +0200, Guennadi Liakhovetski wrote:
> 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
BTW there's also:
[PATCH v10] reset: Add driver for gpio-controlled reset pins
http://www.mail-archive.com/devicetree-discuss@lists.ozlabs.org/msg36900.html
which may be a generic way to handle device resets. Not mainline yet,
though.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-07-23 22:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1374595924-12338-1-git-send-email-g.liakhovetski@gmx.de>
2013-07-23 16:12 ` [PATCH 2/4] net: smsc911x: add a reset GPIO DT binding Guennadi Liakhovetski
2013-07-23 22:10 ` Laurent Pinchart
2013-07-23 22:18 ` Sascha Hauer
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).