diff options
Diffstat (limited to 'arch/arm/mach-pxa/littleton.c')
-rw-r--r-- | arch/arm/mach-pxa/littleton.c | 82 |
1 files changed, 65 insertions, 17 deletions
diff --git a/arch/arm/mach-pxa/littleton.c b/arch/arm/mach-pxa/littleton.c index c872b9feb4d4..55b3788fd1ae 100644 --- a/arch/arm/mach-pxa/littleton.c +++ b/arch/arm/mach-pxa/littleton.c | |||
@@ -42,14 +42,17 @@ | |||
42 | #include <mach/pxa300.h> | 42 | #include <mach/pxa300.h> |
43 | #include <mach/pxafb.h> | 43 | #include <mach/pxafb.h> |
44 | #include <mach/ssp.h> | 44 | #include <mach/ssp.h> |
45 | #include <mach/mmc.h> | ||
45 | #include <mach/pxa2xx_spi.h> | 46 | #include <mach/pxa2xx_spi.h> |
46 | #include <mach/i2c.h> | 47 | #include <plat/i2c.h> |
47 | #include <mach/pxa27x_keypad.h> | 48 | #include <mach/pxa27x_keypad.h> |
48 | #include <mach/pxa3xx_nand.h> | 49 | #include <mach/pxa3xx_nand.h> |
49 | #include <mach/littleton.h> | 50 | #include <mach/littleton.h> |
50 | 51 | ||
51 | #include "generic.h" | 52 | #include "generic.h" |
52 | 53 | ||
54 | #define GPIO_MMC1_CARD_DETECT mfp_to_gpio(MFP_PIN_GPIO15) | ||
55 | |||
53 | /* Littleton MFP configurations */ | 56 | /* Littleton MFP configurations */ |
54 | static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | 57 | static mfp_cfg_t littleton_mfp_cfg[] __initdata = { |
55 | /* LCD */ | 58 | /* LCD */ |
@@ -98,6 +101,15 @@ static mfp_cfg_t littleton_mfp_cfg[] __initdata = { | |||
98 | GPIO123_KP_MKOUT_2, | 101 | GPIO123_KP_MKOUT_2, |
99 | GPIO124_KP_MKOUT_3, | 102 | GPIO124_KP_MKOUT_3, |
100 | GPIO125_KP_MKOUT_4, | 103 | GPIO125_KP_MKOUT_4, |
104 | |||
105 | /* MMC1 */ | ||
106 | GPIO3_MMC1_DAT0, | ||
107 | GPIO4_MMC1_DAT1, | ||
108 | GPIO5_MMC1_DAT2, | ||
109 | GPIO6_MMC1_DAT3, | ||
110 | GPIO7_MMC1_CLK, | ||
111 | GPIO8_MMC1_CMD, | ||
112 | GPIO15_GPIO, /* card detect */ | ||
101 | }; | 113 | }; |
102 | 114 | ||
103 | static struct resource smc91x_resources[] = { | 115 | static struct resource smc91x_resources[] = { |
@@ -179,15 +191,10 @@ static struct pxa2xx_spi_master littleton_spi_info = { | |||
179 | .num_chipselect = 1, | 191 | .num_chipselect = 1, |
180 | }; | 192 | }; |
181 | 193 | ||
182 | static void littleton_tdo24m_cs(u32 cmd) | ||
183 | { | ||
184 | gpio_set_value(LITTLETON_GPIO_LCD_CS, !(cmd == PXA2XX_CS_ASSERT)); | ||
185 | } | ||
186 | |||
187 | static struct pxa2xx_spi_chip littleton_tdo24m_chip = { | 194 | static struct pxa2xx_spi_chip littleton_tdo24m_chip = { |
188 | .rx_threshold = 1, | 195 | .rx_threshold = 1, |
189 | .tx_threshold = 1, | 196 | .tx_threshold = 1, |
190 | .cs_control = littleton_tdo24m_cs, | 197 | .gpio_cs = LITTLETON_GPIO_LCD_CS, |
191 | }; | 198 | }; |
192 | 199 | ||
193 | static struct spi_board_info littleton_spi_devices[] __initdata = { | 200 | static struct spi_board_info littleton_spi_devices[] __initdata = { |
@@ -202,16 +209,6 @@ static struct spi_board_info littleton_spi_devices[] __initdata = { | |||
202 | 209 | ||
203 | static void __init littleton_init_spi(void) | 210 | static void __init littleton_init_spi(void) |
204 | { | 211 | { |
205 | int err; | ||
206 | |||
207 | err = gpio_request(LITTLETON_GPIO_LCD_CS, "LCD_CS"); | ||
208 | if (err) { | ||
209 | pr_warning("failed to request GPIO for LCS CS\n"); | ||
210 | return; | ||
211 | } | ||
212 | |||
213 | gpio_direction_output(LITTLETON_GPIO_LCD_CS, 1); | ||
214 | |||
215 | pxa2xx_set_spi_info(2, &littleton_spi_info); | 212 | pxa2xx_set_spi_info(2, &littleton_spi_info); |
216 | spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices)); | 213 | spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices)); |
217 | } | 214 | } |
@@ -267,6 +264,56 @@ static void __init littleton_init_keypad(void) | |||
267 | static inline void littleton_init_keypad(void) {} | 264 | static inline void littleton_init_keypad(void) {} |
268 | #endif | 265 | #endif |
269 | 266 | ||
267 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
268 | static int littleton_mci_init(struct device *dev, | ||
269 | irq_handler_t littleton_detect_int, void *data) | ||
270 | { | ||
271 | int err, gpio_cd = GPIO_MMC1_CARD_DETECT; | ||
272 | |||
273 | err = gpio_request(gpio_cd, "mmc card detect"); | ||
274 | if (err) | ||
275 | goto err_request_cd; | ||
276 | |||
277 | gpio_direction_input(gpio_cd); | ||
278 | |||
279 | err = request_irq(gpio_to_irq(gpio_cd), littleton_detect_int, | ||
280 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
281 | "mmc card detect", data); | ||
282 | if (err) { | ||
283 | dev_err(dev, "failed to request card detect IRQ\n"); | ||
284 | goto err_request_irq; | ||
285 | } | ||
286 | return 0; | ||
287 | |||
288 | err_request_irq: | ||
289 | gpio_free(gpio_cd); | ||
290 | err_request_cd: | ||
291 | return err; | ||
292 | } | ||
293 | |||
294 | static void littleton_mci_exit(struct device *dev, void *data) | ||
295 | { | ||
296 | int gpio_cd = GPIO_MMC1_CARD_DETECT; | ||
297 | |||
298 | free_irq(gpio_to_irq(gpio_cd), data); | ||
299 | gpio_free(gpio_cd); | ||
300 | } | ||
301 | |||
302 | static struct pxamci_platform_data littleton_mci_platform_data = { | ||
303 | .detect_delay = 20, | ||
304 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
305 | .init = littleton_mci_init, | ||
306 | .exit = littleton_mci_exit, | ||
307 | }; | ||
308 | |||
309 | static void __init littleton_init_mmc(void) | ||
310 | { | ||
311 | pxa_set_mci_info(&littleton_mci_platform_data); | ||
312 | } | ||
313 | #else | ||
314 | static inline void littleton_init_mmc(void) {} | ||
315 | #endif | ||
316 | |||
270 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) | 317 | #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) |
271 | static struct mtd_partition littleton_nand_partitions[] = { | 318 | static struct mtd_partition littleton_nand_partitions[] = { |
272 | [0] = { | 319 | [0] = { |
@@ -407,6 +454,7 @@ static void __init littleton_init(void) | |||
407 | 454 | ||
408 | littleton_init_spi(); | 455 | littleton_init_spi(); |
409 | littleton_init_i2c(); | 456 | littleton_init_i2c(); |
457 | littleton_init_mmc(); | ||
410 | littleton_init_lcd(); | 458 | littleton_init_lcd(); |
411 | littleton_init_keypad(); | 459 | littleton_init_keypad(); |
412 | littleton_init_nand(); | 460 | littleton_init_nand(); |