2 * linux/arch/arm/mach-pxa/littleton.c
4 * Support for the Marvell Littleton Development Platform.
6 * Author: Jason Chagas (largely modified code)
7 * Created: Nov 20, 2006
8 * Copyright: (C) Copyright 2006 Marvell International Ltd.
10 * 2007-11-22 modified to align with latest kernel
11 * eric miao <eric.miao@marvell.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * publishhed by the Free Software Foundation.
18 #include <linux/init.h>
19 #include <linux/interrupt.h>
20 #include <linux/delay.h>
21 #include <linux/platform_device.h>
22 #include <linux/clk.h>
23 #include <linux/gpio.h>
24 #include <linux/spi/spi.h>
25 #include <linux/smc91x.h>
26 #include <linux/i2c.h>
27 #include <linux/leds.h>
28 #include <linux/mfd/da903x.h>
29 #include <linux/i2c/max732x.h>
31 #include <asm/types.h>
32 #include <asm/setup.h>
33 #include <asm/memory.h>
34 #include <asm/mach-types.h>
35 #include <mach/hardware.h>
38 #include <asm/mach/arch.h>
39 #include <asm/mach/map.h>
40 #include <asm/mach/irq.h>
42 #include <mach/pxa300.h>
43 #include <mach/pxafb.h>
46 #include <mach/pxa2xx_spi.h>
48 #include <mach/pxa27x_keypad.h>
49 #include <mach/pxa3xx_nand.h>
50 #include <mach/littleton.h>
54 #define GPIO_MMC1_CARD_DETECT mfp_to_gpio(MFP_PIN_GPIO15)
56 /* Littleton MFP configurations */
57 static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
85 GPIO17_GPIO, /* SFRM as chip-select */
112 GPIO15_GPIO, /* card detect */
115 static struct resource smc91x_resources[] = {
117 .start = (LITTLETON_ETH_PHYS + 0x300),
118 .end = (LITTLETON_ETH_PHYS + 0xfffff),
119 .flags = IORESOURCE_MEM,
122 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
123 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
124 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
128 static struct smc91x_platdata littleton_smc91x_info = {
129 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
130 SMC91X_NOWAIT | SMC91X_USE_DMA,
133 static struct platform_device smc91x_device = {
136 .num_resources = ARRAY_SIZE(smc91x_resources),
137 .resource = smc91x_resources,
139 .platform_data = &littleton_smc91x_info,
143 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
144 static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
175 static struct pxafb_mach_info littleton_lcd_info = {
176 .modes = tpo_tdo24mtea1_modes,
178 .lcd_conn = LCD_COLOR_TFT_16BPP,
181 static void littleton_init_lcd(void)
183 set_pxa_fb_info(&littleton_lcd_info);
186 static inline void littleton_init_lcd(void) {};
187 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
189 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
190 static struct pxa2xx_spi_master littleton_spi_info = {
194 static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
197 .gpio_cs = LITTLETON_GPIO_LCD_CS,
200 static struct spi_board_info littleton_spi_devices[] __initdata = {
202 .modalias = "tdo24m",
203 .max_speed_hz = 1000000,
206 .controller_data= &littleton_tdo24m_chip,
210 static void __init littleton_init_spi(void)
212 pxa2xx_set_spi_info(2, &littleton_spi_info);
213 spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
216 static inline void littleton_init_spi(void) {}
219 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
220 static unsigned int littleton_matrix_key_map[] = {
221 /* KEY(row, col, key_code) */
222 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
223 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
224 KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
226 KEY(0, 3, KEY_KPASTERISK), /* * */
227 KEY(2, 3, KEY_KPDOT), /* # */
229 KEY(5, 4, KEY_ENTER),
234 KEY(5, 3, KEY_RIGHT),
240 KEY(4, 2, KEY_VOLUMEUP),
241 KEY(4, 3, KEY_VOLUMEDOWN),
243 KEY(3, 0, KEY_F22), /* soft1 */
244 KEY(3, 1, KEY_F23), /* soft2 */
247 static struct pxa27x_keypad_platform_data littleton_keypad_info = {
248 .matrix_key_rows = 6,
249 .matrix_key_cols = 5,
250 .matrix_key_map = littleton_matrix_key_map,
251 .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map),
254 .rotary0_up_key = KEY_UP,
255 .rotary0_down_key = KEY_DOWN,
257 .debounce_interval = 30,
259 static void __init littleton_init_keypad(void)
261 pxa_set_keypad_info(&littleton_keypad_info);
264 static inline void littleton_init_keypad(void) {}
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)
271 int err, gpio_cd = GPIO_MMC1_CARD_DETECT;
273 err = gpio_request(gpio_cd, "mmc card detect");
277 gpio_direction_input(gpio_cd);
279 err = request_irq(gpio_to_irq(gpio_cd), littleton_detect_int,
280 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
281 "mmc card detect", data);
283 dev_err(dev, "failed to request card detect IRQ\n");
284 goto err_request_irq;
294 static void littleton_mci_exit(struct device *dev, void *data)
296 int gpio_cd = GPIO_MMC1_CARD_DETECT;
298 free_irq(gpio_to_irq(gpio_cd), data);
302 static struct pxamci_platform_data littleton_mci_platform_data = {
304 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
305 .init = littleton_mci_init,
306 .exit = littleton_mci_exit,
309 static void __init littleton_init_mmc(void)
311 pxa_set_mci_info(&littleton_mci_platform_data);
314 static inline void littleton_init_mmc(void) {}
317 #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
318 static struct mtd_partition littleton_nand_partitions[] = {
320 .name = "Bootloader",
323 .mask_flags = MTD_WRITEABLE, /* force read-only */
329 .mask_flags = MTD_WRITEABLE, /* force read-only */
332 .name = "Filesystem",
334 .size = 0x3000000, /* 48M - rootfs */
337 .name = "MassStorage",
345 .mask_flags = MTD_WRITEABLE, /* force read-only */
347 /* NOTE: we reserve some blocks at the end of the NAND flash for
348 * bad block management, and the max number of relocation blocks
349 * differs on different platforms. Please take care with it when
350 * defining the partition table.
354 static struct pxa3xx_nand_platform_data littleton_nand_info = {
356 .parts = littleton_nand_partitions,
357 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
360 static void __init littleton_init_nand(void)
362 pxa3xx_set_nand_info(&littleton_nand_info);
365 static inline void littleton_init_nand(void) {}
366 #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
368 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
369 static struct led_info littleton_da9034_leds[] = {
371 .name = "littleton:keypad1",
372 .flags = DA9034_LED_RAMP,
375 .name = "littleton:keypad2",
376 .flags = DA9034_LED_RAMP,
379 .name = "littleton:vibra",
384 static struct da9034_touch_pdata littleton_da9034_touch = {
389 static struct da903x_subdev_info littleton_da9034_subdevs[] = {
391 .name = "da903x-led",
392 .id = DA9034_ID_LED_1,
393 .platform_data = &littleton_da9034_leds[0],
395 .name = "da903x-led",
396 .id = DA9034_ID_LED_2,
397 .platform_data = &littleton_da9034_leds[1],
399 .name = "da903x-led",
400 .id = DA9034_ID_VIBRA,
401 .platform_data = &littleton_da9034_leds[2],
403 .name = "da903x-backlight",
404 .id = DA9034_ID_WLED,
406 .name = "da9034-touch",
407 .id = DA9034_ID_TOUCH,
408 .platform_data = &littleton_da9034_touch,
412 static struct da903x_platform_data littleton_da9034_info = {
413 .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
414 .subdevs = littleton_da9034_subdevs,
417 static struct max732x_platform_data littleton_max7320_info = {
418 .gpio_base = EXT0_GPIO_BASE,
421 static struct i2c_board_info littleton_i2c_info[] = {
425 .platform_data = &littleton_da9034_info,
426 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
431 .platform_data = &littleton_max7320_info,
435 static void __init littleton_init_i2c(void)
437 pxa_set_i2c_info(NULL);
438 i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
441 static inline void littleton_init_i2c(void) {}
442 #endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
444 static void __init littleton_init(void)
446 /* initialize MFP configurations */
447 pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
450 * Note: we depend bootloader set the correct
451 * value to MSC register for SMC91x.
453 platform_device_register(&smc91x_device);
455 littleton_init_spi();
456 littleton_init_i2c();
457 littleton_init_mmc();
458 littleton_init_lcd();
459 littleton_init_keypad();
460 littleton_init_nand();
463 MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
464 .phys_io = 0x40000000,
465 .boot_params = 0xa0000100,
466 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
467 .map_io = pxa_map_io,
468 .init_irq = pxa3xx_init_irq,
470 .init_machine = littleton_init,