mmc: mvsdio: add pinctrl integration
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Mon, 28 Jan 2013 11:26:53 +0000 (06:26 -0500)
committerChris Ball <cjb@laptop.org>
Sun, 24 Feb 2013 19:36:42 +0000 (14:36 -0500)
On many Marvell SoCs, the pins used for the SDIO interface are part of
the MPP pins, that are muxable pins. In order to get the muxing of
those pins correct, this commit integrates the mvsdio driver with the
pinctrl infrastructure by calling devm_pinctrl_get_select_default()
during ->probe().

Note that we permit this function to fail because not all Marvell
platforms have yet been fully converted to using the pinctrl
infrastructure.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Tested-by: Stefan Peter <s.peter@mpl.ch>
Tested-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/host/mvsdio.c

index 78d3abf837c24099ca72ecefb72135e189b32d7b..145cdaf000d1d31a0da6ed815c476655d902ec2d 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/of_irq.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
+#include <linux/pinctrl/consumer.h>
 
 #include <asm/sizes.h>
 #include <asm/unaligned.h>
@@ -690,6 +691,7 @@ static int __init mvsd_probe(struct platform_device *pdev)
        struct resource *r;
        int ret, irq;
        int gpio_card_detect, gpio_write_protect;
+       struct pinctrl *pinctrl;
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        irq = platform_get_irq(pdev, 0);
@@ -706,6 +708,10 @@ static int __init mvsd_probe(struct platform_device *pdev)
        host->mmc = mmc;
        host->dev = &pdev->dev;
 
+       pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
+       if (IS_ERR(pinctrl))
+               dev_warn(&pdev->dev, "no pins associated\n");
+
        /*
         * Some non-DT platforms do not pass a clock, and the clock
         * frequency is passed through platform_data. On DT platforms,