]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: mach-shmobile: SDHI0 GPIO hotplug for AG5EVM
authorMagnus Damm <damm@opensource.se>
Wed, 12 Oct 2011 07:21:50 +0000 (16:21 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Fri, 4 Nov 2011 16:03:23 +0000 (01:03 +0900)
Implement GPIO hotplugging via TMIO_MMC_HAS_COLD_CD for
AG5EVM SDHI0. This is possible now when INTCA is used for
IRQ triggering on sh73a0. Without INTCA IRQ support we are
left with the GIC hardware block that does not support
dealing with active low interrupt sources.

Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/arm/mach-shmobile/board-ag5evm.c

index 475342bcc95c36356291d866776d6a498678e952..d6e461710524e8950cb54ce3216b2217d76b82e2 100644 (file)
@@ -339,6 +339,18 @@ static struct platform_device mipidsi0_device = {
        },
 };
 
+/* SDHI0 */
+static irqreturn_t ag5evm_sdhi0_gpio_cd(int irq, void *arg)
+{
+       struct device *dev = arg;
+       struct sh_mobile_sdhi_info *info = dev->platform_data;
+       struct tmio_mmc_data *pdata = info->pdata;
+
+       tmio_mmc_cd_wakeup(pdata);
+
+       return IRQ_HANDLED;
+}
+
 static struct sh_mobile_sdhi_info sdhi0_info = {
        .dma_slave_tx   = SHDMA_SLAVE_SDHI0_TX,
        .dma_slave_rx   = SHDMA_SLAVE_SDHI0_RX,
@@ -570,6 +582,13 @@ static void __init ag5evm_init(void)
        gpio_request(GPIO_FN_SDHID0_1, NULL);
        gpio_request(GPIO_FN_SDHID0_0, NULL);
 
+       if (!request_irq(intcs_evt2irq(0x3c0), ag5evm_sdhi0_gpio_cd,
+                        IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
+                        "sdhi0 cd", &sdhi0_device.dev))
+               sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
+       else
+               pr_warn("Unable to setup SDHI0 GPIO IRQ\n");
+
        /* enable SDHI1 on CN4 [WLAN I/F] */
        gpio_request(GPIO_FN_SDHICLK1, NULL);
        gpio_request(GPIO_FN_SDHICMD1_PU, NULL);