* [PATCH] net: smsc911x: adopt pinctrl support
@ 2013-04-13 17:22 Christoph Fritz
2013-04-13 18:32 ` Javier Martinez Canillas
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Fritz @ 2013-04-13 17:22 UTC (permalink / raw)
To: Steve Glendinning
Cc: netdev@vger.kernel.org, Javier Martinez Canillas,
Sebastien Guiriec, Daniel Mack, Hans J. Koch, linux-omap
This patch is derived from 2d4b4520a "i2c: omap: adopt pinctrl support":
Some GPIO expanders need some early pin control muxing. Due to
legacy boards sometimes the driver uses subsys_initcall instead of
module_init. This patch takes advantage of defer probe feature
and pin control in order to wait until pin control probing before
GPIO driver probing.
Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
drivers/net/ethernet/smsc/smsc911x.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
index da5cc9a..3e3547c 100644
--- a/drivers/net/ethernet/smsc/smsc911x.c
+++ b/drivers/net/ethernet/smsc/smsc911x.c
@@ -59,6 +59,7 @@
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/of_net.h>
+#include <linux/pinctrl/consumer.h>
#include "smsc911x.h"
#define SMSC_CHIPNAME "smsc911x"
@@ -144,6 +145,8 @@ struct smsc911x_data {
/* regulators */
struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES];
+
+ struct pinctrl *pins;
};
/* Easy access to information */
@@ -2433,6 +2436,18 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
if (retval < 0)
goto out_disable_resources;
+ pdata->pins = devm_pinctrl_get_select_default(&pdev->dev);
+ if (IS_ERR(pdata->pins)) {
+ if (PTR_ERR(pdata->pins) == -EPROBE_DEFER) {
+ retval = -EPROBE_DEFER;
+ goto out_disable_resources;
+ }
+
+ dev_warn(&pdev->dev, "No pins for smsc911x error: %li\n",
+ PTR_ERR(pdata->pins));
+ pdata->pins = NULL;
+ }
+
/* configure irq polarity and type before connecting isr */
if (pdata->config.irq_polarity == SMSC911X_IRQ_POLARITY_ACTIVE_HIGH)
intcfg |= INT_CFG_IRQ_POL_;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: smsc911x: adopt pinctrl support
2013-04-13 17:22 [PATCH] net: smsc911x: adopt pinctrl support Christoph Fritz
@ 2013-04-13 18:32 ` Javier Martinez Canillas
0 siblings, 0 replies; 2+ messages in thread
From: Javier Martinez Canillas @ 2013-04-13 18:32 UTC (permalink / raw)
To: Christoph Fritz
Cc: Steve Glendinning, netdev@vger.kernel.org, Sebastien Guiriec,
Daniel Mack, Hans J. Koch, linux-omap@vger.kernel.org
On Sat, Apr 13, 2013 at 7:22 PM, Christoph Fritz
<chf.fritz@googlemail.com> wrote:
> This patch is derived from 2d4b4520a "i2c: omap: adopt pinctrl support":
> Some GPIO expanders need some early pin control muxing. Due to
> legacy boards sometimes the driver uses subsys_initcall instead of
> module_init. This patch takes advantage of defer probe feature
> and pin control in order to wait until pin control probing before
> GPIO driver probing.
>
> Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
> ---
> drivers/net/ethernet/smsc/smsc911x.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/net/ethernet/smsc/smsc911x.c b/drivers/net/ethernet/smsc/smsc911x.c
> index da5cc9a..3e3547c 100644
> --- a/drivers/net/ethernet/smsc/smsc911x.c
> +++ b/drivers/net/ethernet/smsc/smsc911x.c
> @@ -59,6 +59,7 @@
> #include <linux/of_device.h>
> #include <linux/of_gpio.h>
> #include <linux/of_net.h>
> +#include <linux/pinctrl/consumer.h>
> #include "smsc911x.h"
>
> #define SMSC_CHIPNAME "smsc911x"
> @@ -144,6 +145,8 @@ struct smsc911x_data {
>
> /* regulators */
> struct regulator_bulk_data supplies[SMSC911X_NUM_SUPPLIES];
> +
> + struct pinctrl *pins;
> };
>
> /* Easy access to information */
> @@ -2433,6 +2436,18 @@ static int smsc911x_drv_probe(struct platform_device *pdev)
> if (retval < 0)
> goto out_disable_resources;
>
> + pdata->pins = devm_pinctrl_get_select_default(&pdev->dev);
> + if (IS_ERR(pdata->pins)) {
> + if (PTR_ERR(pdata->pins) == -EPROBE_DEFER) {
> + retval = -EPROBE_DEFER;
> + goto out_disable_resources;
> + }
> +
> + dev_warn(&pdev->dev, "No pins for smsc911x error: %li\n",
> + PTR_ERR(pdata->pins));
> + pdata->pins = NULL;
> + }
> +
> /* configure irq polarity and type before connecting isr */
> if (pdata->config.irq_polarity == SMSC911X_IRQ_POLARITY_ACTIVE_HIGH)
> intcfg |= INT_CFG_IRQ_POL_;
> --
> 1.7.10.4
>
>
>
Hi Christoph,
This is handled from the device core after from v3.9.
Please take a loot at this:
http://marc.info/?l=linux-kernel&m=135887740715083&w=2
Best regards,
Javier
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-04-13 18:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-13 17:22 [PATCH] net: smsc911x: adopt pinctrl support Christoph Fritz
2013-04-13 18:32 ` Javier Martinez Canillas
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).