Commit 4bff4a7e authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Paul Mundt

ARM: arch-shmobile: support SDHI card detection on mackerel, using a GPIO

On sh7372 the card-detection pin of SDHI0 can also produce interrupts,
when configured as GPIO. Use this feature to power down SDHI0, when no
card is plugged in.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent dce65a6a
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/mtd/mtd.h> #include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h> #include <linux/mtd/partitions.h>
#include <linux/mtd/physmap.h> #include <linux/mtd/physmap.h>
#include <linux/pm_runtime.h>
#include <linux/smsc911x.h> #include <linux/smsc911x.h>
#include <linux/sh_intc.h> #include <linux/sh_intc.h>
#include <linux/tca6416_keypad.h> #include <linux/tca6416_keypad.h>
...@@ -913,6 +914,17 @@ static int slot_cn7_get_cd(struct platform_device *pdev) ...@@ -913,6 +914,17 @@ static int slot_cn7_get_cd(struct platform_device *pdev)
} }
/* SDHI0 */ /* SDHI0 */
static irqreturn_t mackerel_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 = { static struct sh_mobile_sdhi_info sdhi0_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
...@@ -1296,6 +1308,7 @@ static void __init mackerel_init(void) ...@@ -1296,6 +1308,7 @@ static void __init mackerel_init(void)
{ {
u32 srcr4; u32 srcr4;
struct clk *clk; struct clk *clk;
int ret;
sh7372_pinmux_init(); sh7372_pinmux_init();
...@@ -1401,6 +1414,13 @@ static void __init mackerel_init(void) ...@@ -1401,6 +1414,13 @@ static void __init mackerel_init(void)
gpio_request(GPIO_FN_SDHID0_1, NULL); gpio_request(GPIO_FN_SDHID0_1, NULL);
gpio_request(GPIO_FN_SDHID0_0, NULL); gpio_request(GPIO_FN_SDHID0_0, NULL);
ret = request_irq(evt2irq(0x3340), mackerel_sdhi0_gpio_cd,
IRQF_TRIGGER_FALLING, "sdhi0 cd", &sdhi0_device.dev);
if (!ret)
sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD;
else
pr_err("Cannot get IRQ #%d: %d\n", evt2irq(0x3340), ret);
#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
/* enable SDHI1 */ /* enable SDHI1 */
gpio_request(GPIO_FN_SDHICMD1, NULL); gpio_request(GPIO_FN_SDHICMD1, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment