diff options
author | Guennadi Liakhovetski <g.liakhovetski@gmx.de> | 2011-05-11 12:51:20 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-05-26 02:07:10 -0400 |
commit | 4bff4a7ee4b9e487a1bc1d31082e77b6a381418a (patch) | |
tree | e5f55b2c6924e252e5e4be040bbda2dc670e7704 /arch/arm/mach-shmobile | |
parent | dce65a6a92f34fbc425ffb4302f8e747d89c9792 (diff) |
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: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/board-mackerel.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index d4fe74067d6c..776f20560e72 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/mtd/mtd.h> | 39 | #include <linux/mtd/mtd.h> |
40 | #include <linux/mtd/partitions.h> | 40 | #include <linux/mtd/partitions.h> |
41 | #include <linux/mtd/physmap.h> | 41 | #include <linux/mtd/physmap.h> |
42 | #include <linux/pm_runtime.h> | ||
42 | #include <linux/smsc911x.h> | 43 | #include <linux/smsc911x.h> |
43 | #include <linux/sh_intc.h> | 44 | #include <linux/sh_intc.h> |
44 | #include <linux/tca6416_keypad.h> | 45 | #include <linux/tca6416_keypad.h> |
@@ -913,6 +914,17 @@ static int slot_cn7_get_cd(struct platform_device *pdev) | |||
913 | } | 914 | } |
914 | 915 | ||
915 | /* SDHI0 */ | 916 | /* SDHI0 */ |
917 | static irqreturn_t mackerel_sdhi0_gpio_cd(int irq, void *arg) | ||
918 | { | ||
919 | struct device *dev = arg; | ||
920 | struct sh_mobile_sdhi_info *info = dev->platform_data; | ||
921 | struct tmio_mmc_data *pdata = info->pdata; | ||
922 | |||
923 | tmio_mmc_cd_wakeup(pdata); | ||
924 | |||
925 | return IRQ_HANDLED; | ||
926 | } | ||
927 | |||
916 | static struct sh_mobile_sdhi_info sdhi0_info = { | 928 | static struct sh_mobile_sdhi_info sdhi0_info = { |
917 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, | 929 | .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, |
918 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, | 930 | .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, |
@@ -1296,6 +1308,7 @@ static void __init mackerel_init(void) | |||
1296 | { | 1308 | { |
1297 | u32 srcr4; | 1309 | u32 srcr4; |
1298 | struct clk *clk; | 1310 | struct clk *clk; |
1311 | int ret; | ||
1299 | 1312 | ||
1300 | sh7372_pinmux_init(); | 1313 | sh7372_pinmux_init(); |
1301 | 1314 | ||
@@ -1401,6 +1414,13 @@ static void __init mackerel_init(void) | |||
1401 | gpio_request(GPIO_FN_SDHID0_1, NULL); | 1414 | gpio_request(GPIO_FN_SDHID0_1, NULL); |
1402 | gpio_request(GPIO_FN_SDHID0_0, NULL); | 1415 | gpio_request(GPIO_FN_SDHID0_0, NULL); |
1403 | 1416 | ||
1417 | ret = request_irq(evt2irq(0x3340), mackerel_sdhi0_gpio_cd, | ||
1418 | IRQF_TRIGGER_FALLING, "sdhi0 cd", &sdhi0_device.dev); | ||
1419 | if (!ret) | ||
1420 | sdhi0_info.tmio_flags |= TMIO_MMC_HAS_COLD_CD; | ||
1421 | else | ||
1422 | pr_err("Cannot get IRQ #%d: %d\n", evt2irq(0x3340), ret); | ||
1423 | |||
1404 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) | 1424 | #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) |
1405 | /* enable SDHI1 */ | 1425 | /* enable SDHI1 */ |
1406 | gpio_request(GPIO_FN_SDHICMD1, NULL); | 1426 | gpio_request(GPIO_FN_SDHICMD1, NULL); |