summaryrefslogtreecommitdiffstats
path: root/target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch')
-rw-r--r--target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch90
1 files changed, 53 insertions, 37 deletions
diff --git a/target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch b/target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch
index bede3bf7e..a1b3b8723 100644
--- a/target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch
+++ b/target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch
@@ -1,3 +1,20 @@
+From patchwork Wed Jan 16 13:13:58 2013
+Content-Type: text/plain; charset="utf-8"
+MIME-Version: 1.0
+Content-Transfer-Encoding: 7bit
+Subject: [3/5] mmc: mvsdio: use slot-gpio for card detect gpio
+Date: Wed, 16 Jan 2013 13:13:58 -0000
+From: Andrew Lunn <andrew@lunn.ch>
+X-Patchwork-Id: 1987941
+Message-Id: <1358342040-7130-4-git-send-email-andrew@lunn.ch>
+To: Jason Cooper <jason@lakedaemon.net>
+Cc: linux ARM <linux-arm-kernel@lists.infradead.org>,
+ linux-mmc@vger.kernel.org, linux@arm.linux.org.uk,
+ Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
+ Andrew Lunn <andrew@lunn.ch>
+
+From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
The MMC core subsystem provides in drivers/mmc/core/slot-gpio.c a nice
set of helper functions to simplify the management of the card detect
GPIO in MMC host drivers. This patch migrates the mvsdio driver to
@@ -6,21 +23,26 @@ therefore ease the process of adding a Device Tree binding for this
driver.
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>
+
---
- drivers/mmc/host/mvsdio.c | 44 +++++++++-----------------------------------
- 1 file changed, 9 insertions(+), 35 deletions(-)
+drivers/mmc/host/mvsdio.c | 39 +++++++++------------------------------
+ 1 file changed, 9 insertions(+), 30 deletions(-)
--- a/drivers/mmc/host/mvsdio.c
+++ b/drivers/mmc/host/mvsdio.c
-@@ -54,7 +54,6 @@ struct mvsd_host {
- struct resource *res;
- int irq;
+@@ -52,7 +52,6 @@ struct mvsd_host {
+ struct mmc_host *mmc;
+ struct device *dev;
struct clk *clk;
- int gpio_card_detect;
};
#define mvsd_write(offs, val) writel(val, iobase + (offs))
-@@ -540,13 +539,6 @@ static void mvsd_timeout_timer(unsigned
+@@ -538,13 +537,6 @@ static void mvsd_timeout_timer(unsigned
mmc_request_done(host->mmc, mrq);
}
@@ -34,24 +56,27 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
static void mvsd_enable_sdio_irq(struct mmc_host *mmc, int enable)
{
struct mvsd_host *host = mmc_priv(mmc);
-@@ -765,23 +757,11 @@ static int __init mvsd_probe(struct plat
+@@ -757,26 +749,11 @@ static int __init mvsd_probe(struct plat
+ if (!IS_ERR(host->clk))
clk_prepare_enable(host->clk);
- }
- if (mvsd_data->gpio_card_detect) {
-- ret = gpio_request(mvsd_data->gpio_card_detect,
-- DRIVER_NAME " cd");
+- ret = devm_gpio_request_one(&pdev->dev,
+- mvsd_data->gpio_card_detect,
+- GPIOF_IN, DRIVER_NAME " cd");
- if (ret == 0) {
-- gpio_direction_input(mvsd_data->gpio_card_detect);
- irq = gpio_to_irq(mvsd_data->gpio_card_detect);
-- ret = request_irq(irq, mvsd_card_detect_irq,
-- IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING,
-- DRIVER_NAME " cd", host);
+- ret = devm_request_irq(&pdev->dev, irq,
+- mvsd_card_detect_irq,
+- IRQ_TYPE_EDGE_RISING |
+- IRQ_TYPE_EDGE_FALLING,
+- DRIVER_NAME " cd", host);
- if (ret == 0)
- host->gpio_card_detect =
- mvsd_data->gpio_card_detect;
- else
-- gpio_free(mvsd_data->gpio_card_detect);
+- devm_gpio_free(&pdev->dev,
+- mvsd_data->gpio_card_detect);
- }
- }
- if (!host->gpio_card_detect)
@@ -63,7 +88,7 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
mmc->caps |= MMC_CAP_NEEDS_POLL;
mmc_gpio_request_ro(mmc, mvsd_data->gpio_write_protect);
-@@ -794,9 +774,9 @@ static int __init mvsd_probe(struct plat
+@@ -789,15 +766,16 @@ static int __init mvsd_probe(struct plat
pr_notice("%s: %s driver initialized, ",
mmc_hostname(mmc), DRIVER_NAME);
@@ -75,27 +100,18 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
else
printk("lacking card detect (fall back to polling)\n");
return 0;
-@@ -805,10 +785,7 @@ out:
- if (host) {
- if (host->irq)
- free_irq(host->irq, host);
-- if (host->gpio_card_detect) {
-- free_irq(gpio_to_irq(host->gpio_card_detect), host);
-- gpio_free(host->gpio_card_detect);
-- }
-+ mmc_gpio_free_cd(mmc);
- mmc_gpio_free_ro(mmc);
- if (host->base)
- iounmap(host->base);
-@@ -832,10 +809,7 @@ static int __exit mvsd_remove(struct pla
- if (mmc) {
- struct mvsd_host *host = mmc_priv(mmc);
-- if (host->gpio_card_detect) {
-- free_irq(gpio_to_irq(host->gpio_card_detect), host);
-- gpio_free(host->gpio_card_detect);
-- }
+ out:
+ if (mmc) {
+ mmc_gpio_free_cd(mmc);
- mmc_remove_host(mmc);
- free_irq(host->irq, host);
mmc_gpio_free_ro(mmc);
+ if (!IS_ERR(host->clk))
+ clk_disable_unprepare(host->clk);
+@@ -813,6 +791,7 @@ static int __exit mvsd_remove(struct pla
+
+ struct mvsd_host *host = mmc_priv(mmc);
+
++ mmc_gpio_free_cd(mmc);
+ mmc_gpio_free_ro(mmc);
+ mmc_remove_host(mmc);
+ del_timer_sync(&host->timer);