diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2009-06-05 12:42:29 +0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-06-05 12:49:26 +0400 |
commit | 361778d6e7cb315b50f3f2469d782e90df7ac2cb (patch) | |
tree | 8e11305153f3e92586eebbd37b5f2f0573f18065 | |
parent | f6394e268fc541c274be8fa30ccb04b3e2f0450f (diff) | |
download | linux-361778d6e7cb315b50f3f2469d782e90df7ac2cb.tar.xz |
[ARM] pxa/littleton: add support for the Micro-SD slot (MMC1)
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
-rw-r--r-- | arch/arm/mach-pxa/littleton.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index 94a32321ad43..55b3788fd1ae 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c @@ -42,6 +42,7 @@ #include <mach/pxa300.h> #include <mach/pxafb.h> #include <mach/ssp.h> +#include <mach/mmc.h> #include <mach/pxa2xx_spi.h> #include <plat/i2c.h> #include <mach/pxa27x_keypad.h> @@ -50,6 +51,8 @@ #include "generic.h" +#define GPIO_MMC1_CARD_DETECT mfp_to_gpio(MFP_PIN_GPIO15) + /* Littleton MFP configurations */ static mfp_cfg_t littleton_mfp_cfg[] __initdata = { /* LCD */ @@ -98,6 +101,15 @@ static mfp_cfg_t littleton_mfp_cfg[] __initdata = { GPIO123_KP_MKOUT_2, GPIO124_KP_MKOUT_3, GPIO125_KP_MKOUT_4, + + /* MMC1 */ + GPIO3_MMC1_DAT0, + GPIO4_MMC1_DAT1, + GPIO5_MMC1_DAT2, + GPIO6_MMC1_DAT3, + GPIO7_MMC1_CLK, + GPIO8_MMC1_CMD, + GPIO15_GPIO, /* card detect */ }; static struct resource smc91x_resources[] = { @@ -252,6 +264,56 @@ static void __init littleton_init_keypad(void) static inline void littleton_init_keypad(void) {} #endif +#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) +static int littleton_mci_init(struct device *dev, + irq_handler_t littleton_detect_int, void *data) +{ + int err, gpio_cd = GPIO_MMC1_CARD_DETECT; + + err = gpio_request(gpio_cd, "mmc card detect"); + if (err) + goto err_request_cd; + + gpio_direction_input(gpio_cd); + + err = request_irq(gpio_to_irq(gpio_cd), littleton_detect_int, + IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, + "mmc card detect", data); + if (err) { + dev_err(dev, "failed to request card detect IRQ\n"); + goto err_request_irq; + } + return 0; + +err_request_irq: + gpio_free(gpio_cd); +err_request_cd: + return err; +} + +static void littleton_mci_exit(struct device *dev, void *data) +{ + int gpio_cd = GPIO_MMC1_CARD_DETECT; + + free_irq(gpio_to_irq(gpio_cd), data); + gpio_free(gpio_cd); +} + +static struct pxamci_platform_data littleton_mci_platform_data = { + .detect_delay = 20, + .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, + .init = littleton_mci_init, + .exit = littleton_mci_exit, +}; + +static void __init littleton_init_mmc(void) +{ + pxa_set_mci_info(&littleton_mci_platform_data); +} +#else +static inline void littleton_init_mmc(void) {} +#endif + #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) static struct mtd_partition littleton_nand_partitions[] = { [0] = { @@ -392,6 +454,7 @@ static void __init littleton_init(void) littleton_init_spi(); littleton_init_i2c(); + littleton_init_mmc(); littleton_init_lcd(); littleton_init_keypad(); littleton_init_nand(); |