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>
45 #include <mach/pxa2xx_spi.h>
47 #include <mach/pxa27x_keypad.h>
48 #include <mach/pxa3xx_nand.h>
49 #include <mach/littleton.h>
53 /* Littleton MFP configurations */
54 static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
82 GPIO17_GPIO, /* SFRM as chip-select */
103 static struct resource smc91x_resources[] = {
105 .start = (LITTLETON_ETH_PHYS + 0x300),
106 .end = (LITTLETON_ETH_PHYS + 0xfffff),
107 .flags = IORESOURCE_MEM,
110 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
111 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
112 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
116 static struct smc91x_platdata littleton_smc91x_info = {
117 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
118 SMC91X_NOWAIT | SMC91X_USE_DMA,
121 static struct platform_device smc91x_device = {
124 .num_resources = ARRAY_SIZE(smc91x_resources),
125 .resource = smc91x_resources,
127 .platform_data = &littleton_smc91x_info,
131 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
132 static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
163 static struct pxafb_mach_info littleton_lcd_info = {
164 .modes = tpo_tdo24mtea1_modes,
166 .lcd_conn = LCD_COLOR_TFT_16BPP,
169 static void littleton_init_lcd(void)
171 set_pxa_fb_info(&littleton_lcd_info);
174 static inline void littleton_init_lcd(void) {};
175 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
177 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
178 static struct pxa2xx_spi_master littleton_spi_info = {
182 static void littleton_tdo24m_cs(u32 cmd)
184 gpio_set_value(LITTLETON_GPIO_LCD_CS, !(cmd == PXA2XX_CS_ASSERT));
187 static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
190 .cs_control = littleton_tdo24m_cs,
193 static struct spi_board_info littleton_spi_devices[] __initdata = {
195 .modalias = "tdo24m",
196 .max_speed_hz = 1000000,
199 .controller_data= &littleton_tdo24m_chip,
203 static void __init littleton_init_spi(void)
207 err = gpio_request(LITTLETON_GPIO_LCD_CS, "LCD_CS");
209 pr_warning("failed to request GPIO for LCS CS\n");
213 gpio_direction_output(LITTLETON_GPIO_LCD_CS, 1);
215 pxa2xx_set_spi_info(2, &littleton_spi_info);
216 spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
219 static inline void littleton_init_spi(void) {}
222 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
223 static unsigned int littleton_matrix_key_map[] = {
224 /* KEY(row, col, key_code) */
225 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
226 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
227 KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
229 KEY(0, 3, KEY_KPASTERISK), /* * */
230 KEY(2, 3, KEY_KPDOT), /* # */
232 KEY(5, 4, KEY_ENTER),
237 KEY(5, 3, KEY_RIGHT),
243 KEY(4, 2, KEY_VOLUMEUP),
244 KEY(4, 3, KEY_VOLUMEDOWN),
246 KEY(3, 0, KEY_F22), /* soft1 */
247 KEY(3, 1, KEY_F23), /* soft2 */
250 static struct pxa27x_keypad_platform_data littleton_keypad_info = {
251 .matrix_key_rows = 6,
252 .matrix_key_cols = 5,
253 .matrix_key_map = littleton_matrix_key_map,
254 .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map),
257 .rotary0_up_key = KEY_UP,
258 .rotary0_down_key = KEY_DOWN,
260 .debounce_interval = 30,
262 static void __init littleton_init_keypad(void)
264 pxa_set_keypad_info(&littleton_keypad_info);
267 static inline void littleton_init_keypad(void) {}
270 #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
271 static struct mtd_partition littleton_nand_partitions[] = {
273 .name = "Bootloader",
276 .mask_flags = MTD_WRITEABLE, /* force read-only */
282 .mask_flags = MTD_WRITEABLE, /* force read-only */
285 .name = "Filesystem",
287 .size = 0x3000000, /* 48M - rootfs */
290 .name = "MassStorage",
298 .mask_flags = MTD_WRITEABLE, /* force read-only */
300 /* NOTE: we reserve some blocks at the end of the NAND flash for
301 * bad block management, and the max number of relocation blocks
302 * differs on different platforms. Please take care with it when
303 * defining the partition table.
307 static struct pxa3xx_nand_platform_data littleton_nand_info = {
309 .parts = littleton_nand_partitions,
310 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
313 static void __init littleton_init_nand(void)
315 pxa3xx_set_nand_info(&littleton_nand_info);
318 static inline void littleton_init_nand(void) {}
319 #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
321 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
322 static struct led_info littleton_da9034_leds[] = {
324 .name = "littleton:keypad1",
325 .flags = DA9034_LED_RAMP,
328 .name = "littleton:keypad2",
329 .flags = DA9034_LED_RAMP,
332 .name = "littleton:vibra",
337 static struct da903x_subdev_info littleton_da9034_subdevs[] = {
339 .name = "da903x-led",
340 .id = DA9034_ID_LED_1,
341 .platform_data = &littleton_da9034_leds[0],
343 .name = "da903x-led",
344 .id = DA9034_ID_LED_2,
345 .platform_data = &littleton_da9034_leds[1],
347 .name = "da903x-led",
348 .id = DA9034_ID_VIBRA,
349 .platform_data = &littleton_da9034_leds[2],
351 .name = "da903x-backlight",
352 .id = DA9034_ID_WLED,
356 static struct da903x_platform_data littleton_da9034_info = {
357 .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
358 .subdevs = littleton_da9034_subdevs,
361 static struct max732x_platform_data littleton_max7320_info = {
362 .gpio_base = EXT0_GPIO_BASE,
365 static struct i2c_board_info littleton_i2c_info[] = {
369 .platform_data = &littleton_da9034_info,
370 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
375 .platform_data = &littleton_max7320_info,
379 static void __init littleton_init_i2c(void)
381 pxa_set_i2c_info(NULL);
382 i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
385 static inline void littleton_init_i2c(void) {}
386 #endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
388 static void __init littleton_init(void)
390 /* initialize MFP configurations */
391 pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
394 * Note: we depend bootloader set the correct
395 * value to MSC register for SMC91x.
397 platform_device_register(&smc91x_device);
399 littleton_init_spi();
400 littleton_init_i2c();
401 littleton_init_lcd();
402 littleton_init_keypad();
403 littleton_init_nand();
406 MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
407 .phys_io = 0x40000000,
408 .boot_params = 0xa0000100,
409 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
410 .map_io = pxa_map_io,
411 .init_irq = pxa3xx_init_irq,
413 .init_machine = littleton_init,