diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-10-31 02:04:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-11-01 11:45:58 -0400 |
commit | 8ef29f8aae524bd51298fb10ac6a5ce6c4c5a3d8 (patch) | |
tree | bc9ef33e95a49cbb650c68388b19f2715efed7f1 | |
parent | 29bc2e1e5504627c08ae2ce298e2209701289c40 (diff) |
net/macb: add pinctrl consumer support
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>
[nicolas.ferre@atmel.com: adapt the error path, remove unneeded headers]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Tested-by: Joachim Eastwood <manabian@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/cadence/macb.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cadence/macb.c b/drivers/net/ethernet/cadence/macb.c index c1f20b067abf..c37487535125 100644 --- a/drivers/net/ethernet/cadence/macb.c +++ b/drivers/net/ethernet/cadence/macb.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/of.h> | 26 | #include <linux/of.h> |
27 | #include <linux/of_device.h> | 27 | #include <linux/of_device.h> |
28 | #include <linux/of_net.h> | 28 | #include <linux/of_net.h> |
29 | #include <linux/pinctrl/consumer.h> | ||
29 | 30 | ||
30 | #include "macb.h" | 31 | #include "macb.h" |
31 | 32 | ||
@@ -1472,6 +1473,7 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1472 | struct phy_device *phydev; | 1473 | struct phy_device *phydev; |
1473 | u32 config; | 1474 | u32 config; |
1474 | int err = -ENXIO; | 1475 | int err = -ENXIO; |
1476 | struct pinctrl *pinctrl; | ||
1475 | 1477 | ||
1476 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1478 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1477 | if (!regs) { | 1479 | if (!regs) { |
@@ -1479,6 +1481,15 @@ static int __init macb_probe(struct platform_device *pdev) | |||
1479 | goto err_out; | 1481 | goto err_out; |
1480 | } | 1482 | } |
1481 | 1483 | ||
1484 | pinctrl = devm_pinctrl_get_select_default(&pdev->dev); | ||
1485 | if (IS_ERR(pinctrl)) { | ||
1486 | err = PTR_ERR(pinctrl); | ||
1487 | if (err == -EPROBE_DEFER) | ||
1488 | goto err_out; | ||
1489 | |||
1490 | dev_warn(&pdev->dev, "No pinctrl provided\n"); | ||
1491 | } | ||
1492 | |||
1482 | err = -ENOMEM; | 1493 | err = -ENOMEM; |
1483 | dev = alloc_etherdev(sizeof(*bp)); | 1494 | dev = alloc_etherdev(sizeof(*bp)); |
1484 | if (!dev) | 1495 | if (!dev) |