mvebu: switch to 3.10
[openwrt/staging/chunkeey.git] / target / linux / mvebu / patches-3.8 / 009-mmc_mvsdio_add_pinctrl.patch
1 From patchwork Wed Jan 16 13:14:00 2013
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [5/5] mmc: mvsdio: add pinctrl integration
6 Date: Wed, 16 Jan 2013 13:14:00 -0000
7 From: Andrew Lunn <andrew@lunn.ch>
8 X-Patchwork-Id: 1987901
9 Message-Id: <1358342040-7130-6-git-send-email-andrew@lunn.ch>
10 To: Jason Cooper <jason@lakedaemon.net>
11 Cc: linux ARM <linux-arm-kernel@lists.infradead.org>,
12 linux-mmc@vger.kernel.org, linux@arm.linux.org.uk,
13 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
14 Andrew Lunn <andrew@lunn.ch>
15
16 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
17
18 On many Marvell SoCs, the pins used for the SDIO interface are part of
19 the MPP pins, that are muxable pins. In order to get the muxing of
20 those pins correct, this commit integrates the mvsdio driver with the
21 pinctrl infrastructure by calling devm_pinctrl_get_select_default()
22 during ->probe().
23
24 Note that we permit this function to fail because not all Marvell
25 platforms have yet been fully converted to using the pinctrl
26 infrastructure.
27
28 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
29 Signed-off-by: Andrew Lunn <andrew@lunn.ch>
30 Tested-by: Stefan Peter <s.peter@mpl.ch>
31 Tested-by: Florian Fainelli <florian@openwrt.org>
32 Signed-off-by: Jason Cooper <jason@lakedaemon.net>
33
34 ---
35 drivers/mmc/host/mvsdio.c | 6 ++++++
36 1 file changed, 6 insertions(+)
37
38 --- a/drivers/mmc/host/mvsdio.c
39 +++ b/drivers/mmc/host/mvsdio.c
40 @@ -25,6 +25,7 @@
41 #include <linux/of_irq.h>
42 #include <linux/mmc/host.h>
43 #include <linux/mmc/slot-gpio.h>
44 +#include <linux/pinctrl/consumer.h>
45
46 #include <asm/sizes.h>
47 #include <asm/unaligned.h>
48 @@ -690,6 +691,7 @@ static int __init mvsd_probe(struct plat
49 struct resource *r;
50 int ret, irq;
51 int gpio_card_detect, gpio_write_protect;
52 + struct pinctrl *pinctrl;
53
54 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
55 irq = platform_get_irq(pdev, 0);
56 @@ -706,6 +708,10 @@ static int __init mvsd_probe(struct plat
57 host->mmc = mmc;
58 host->dev = &pdev->dev;
59
60 + pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
61 + if (IS_ERR(pinctrl))
62 + dev_warn(&pdev->dev, "no pins associated\n");
63 +
64 /* Some non-DT platforms do not pass a clock, and the clock
65 frequency is passed through platform_data. On DT platforms,
66 a clock must always be passed, even if there is no gatable