From 25475a095ec71f55826a5864e78e09c27031f179 Mon Sep 17 00:00:00 2001 From: Florian Fainelli Date: Tue, 8 Jan 2013 22:20:16 +0000 Subject: mvebu: add inital support for Marvell Armada XP/370 SoCs This brings in the initial support for the Marvell Armada XP/370 SoCs. Successfully tested on RD-A370-A1 and DB-MV784MP-GP boards the following interfaces: - Ethernet - SDIO - GPIOs - SATA Signed-off-by: Florian Fainelli SVN-Revision: 35058 --- .../007-mmc_mvsdio_use_slot_gpio_for_cd.patch | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch (limited to 'target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch') 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 new file mode 100644 index 0000000000..287dedf1d9 --- /dev/null +++ b/target/linux/mvebu/patches-3.8/007-mmc_mvsdio_use_slot_gpio_for_cd.patch @@ -0,0 +1,105 @@ +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 +using those helpers, which will make the ->probe() code simpler, and +therefore ease the process of adding a Device Tree binding for this +driver. + +Signed-off-by: Thomas Petazzoni +--- + drivers/mmc/host/mvsdio.c | 44 +++++++++----------------------------------- + 1 file changed, 9 insertions(+), 35 deletions(-) + +diff --git a/drivers/mmc/host/mvsdio.c b/drivers/mmc/host/mvsdio.c +index a24a22f..baf19fc 100644 +--- a/drivers/mmc/host/mvsdio.c ++++ b/drivers/mmc/host/mvsdio.c +@@ -54,7 +54,6 @@ struct mvsd_host { + struct resource *res; + int irq; + 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 long data) + mmc_request_done(host->mmc, mrq); + } + +-static irqreturn_t mvsd_card_detect_irq(int irq, void *dev) +-{ +- struct mvsd_host *host = dev; +- mmc_detect_change(host->mmc, msecs_to_jiffies(100)); +- return IRQ_HANDLED; +-} +- + 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 platform_device *pdev) + clk_prepare_enable(host->clk); + } + +- if (mvsd_data->gpio_card_detect) { +- ret = gpio_request(mvsd_data->gpio_card_detect, +- 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); +- if (ret == 0) +- host->gpio_card_detect = +- mvsd_data->gpio_card_detect; +- else +- gpio_free(mvsd_data->gpio_card_detect); +- } +- } +- if (!host->gpio_card_detect) ++ if (gpio_is_valid(mvsd_data->gpio_card_detect)) { ++ ret = mmc_gpio_request_cd(mmc, mvsd_data->gpio_card_detect); ++ if (ret) ++ goto out; ++ } else + 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 platform_device *pdev) + + pr_notice("%s: %s driver initialized, ", + mmc_hostname(mmc), DRIVER_NAME); +- if (host->gpio_card_detect) ++ if (!(mmc->caps & MMC_CAP_NEEDS_POLL)) + printk("using GPIO %d for card detection\n", +- host->gpio_card_detect); ++ mvsd_data->gpio_card_detect); + 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 platform_device *pdev) + 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); +- } ++ mmc_gpio_free_cd(mmc); + mmc_remove_host(mmc); + free_irq(host->irq, host); + mmc_gpio_free_ro(mmc); +-- +1.7.9.5 -- cgit v1.2.3