Patchwork [2/2] net: at91_ether: add pinctrl support

login
register
mail settings
Submitter Jean-Christophe PLAGNIOL-VILLARD
Date Nov. 4, 2012, 6:10 p.m.
Message ID <1352052637-5154-2-git-send-email-plagnioj@jcrosoft.com>
Download mbox | patch
Permalink /patch/197096/
State Superseded
Delegated to: David Miller
Headers show

Comments

Jean-Christophe PLAGNIOL-VILLARD - Nov. 4, 2012, 6:10 p.m.
If no pinctrl available just report a warning as some architecture may not
need to do anything.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Joachim Eastwood <manabian@gmail.com>
Cc: netdev@vger.kernel.org
---
 drivers/net/ethernet/cadence/at91_ether.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Patch

diff --git a/drivers/net/ethernet/cadence/at91_ether.c b/drivers/net/ethernet/cadence/at91_ether.c
index 3e843b4..ffcdbc3 100644
--- a/drivers/net/ethernet/cadence/at91_ether.c
+++ b/drivers/net/ethernet/cadence/at91_ether.c
@@ -34,6 +34,7 @@ 
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/of_net.h>
+#include <linux/pinctrl/consumer.h>
 
 #include "macb.h"
 
@@ -500,11 +501,21 @@  static int __init at91ether_probe(struct platform_device *pdev)
 	struct phy_device *phydev;
 	struct macb *lp;
 	int res;
+	struct pinctrl *pinctrl;
 
 	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!regs)
 		return -ENOENT;
 
+	pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+	if (IS_ERR(pinctrl)) {
+		res = PTR_ERR(pinctrl);
+		if (res == -EPROBE_DEFER)
+			return res;
+
+		dev_warn(&pdev->dev, "No pinctrl provided\n");
+	}
+
 	dev = alloc_etherdev(sizeof(struct macb));
 	if (!dev)
 		return -ENOMEM;