blob: fa527b258d6116b77779e797a5df13967ad2d6b5 [file] [log] [blame]
eric miaoe1d9b952007-12-13 10:41:43 +08001/*
2 * linux/arch/arm/mach-pxa/littleton.c
3 *
4 * Support for the Marvell Littleton Development Platform.
5 *
6 * Author: Jason Chagas (largely modified code)
7 * Created: Nov 20, 2006
8 * Copyright: (C) Copyright 2006 Marvell International Ltd.
9 *
10 * 2007-11-22 modified to align with latest kernel
11 * eric miao <eric.miao@marvell.com>
12 *
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.
16 */
17
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>
Eric Miao80796f22008-11-25 11:03:03 +080023#include <linux/gpio.h>
Eric Miao24ff4cd2008-09-01 06:56:07 +080024#include <linux/spi/spi.h>
Eric Miaoe1719da2008-06-24 16:49:41 +080025#include <linux/smc91x.h>
Eric Miao3b24f302008-12-10 17:04:38 +080026#include <linux/i2c.h>
27#include <linux/leds.h>
28#include <linux/mfd/da903x.h>
29#include <linux/i2c/max732x.h>
eric miaoe1d9b952007-12-13 10:41:43 +080030
31#include <asm/types.h>
32#include <asm/setup.h>
33#include <asm/memory.h>
34#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010035#include <mach/hardware.h>
eric miaoe1d9b952007-12-13 10:41:43 +080036#include <asm/irq.h>
37
38#include <asm/mach/arch.h>
39#include <asm/mach/map.h>
40#include <asm/mach/irq.h>
41
Eric Miao51c62982009-01-02 23:17:22 +080042#include <mach/pxa300.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010043#include <mach/pxafb.h>
44#include <mach/ssp.h>
Eric Miao361778d2009-06-05 16:42:29 +080045#include <mach/mmc.h>
Eric Miao24ff4cd2008-09-01 06:56:07 +080046#include <mach/pxa2xx_spi.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010047#include <mach/pxa27x_keypad.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010048#include <mach/littleton.h>
Haojian Zhuang82b95ec2009-09-10 13:55:23 +080049#include <plat/i2c.h>
50#include <plat/pxa3xx_nand.h>
eric miaoe1d9b952007-12-13 10:41:43 +080051
52#include "generic.h"
53
Eric Miao361778d2009-06-05 16:42:29 +080054#define GPIO_MMC1_CARD_DETECT mfp_to_gpio(MFP_PIN_GPIO15)
55
eric miaoe1d9b952007-12-13 10:41:43 +080056/* Littleton MFP configurations */
57static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
58 /* LCD */
59 GPIO54_LCD_LDD_0,
60 GPIO55_LCD_LDD_1,
61 GPIO56_LCD_LDD_2,
62 GPIO57_LCD_LDD_3,
63 GPIO58_LCD_LDD_4,
64 GPIO59_LCD_LDD_5,
65 GPIO60_LCD_LDD_6,
66 GPIO61_LCD_LDD_7,
67 GPIO62_LCD_LDD_8,
68 GPIO63_LCD_LDD_9,
69 GPIO64_LCD_LDD_10,
70 GPIO65_LCD_LDD_11,
71 GPIO66_LCD_LDD_12,
72 GPIO67_LCD_LDD_13,
73 GPIO68_LCD_LDD_14,
74 GPIO69_LCD_LDD_15,
75 GPIO70_LCD_LDD_16,
76 GPIO71_LCD_LDD_17,
77 GPIO72_LCD_FCLK,
78 GPIO73_LCD_LCLK,
79 GPIO74_LCD_PCLK,
80 GPIO75_LCD_BIAS,
81
82 /* SSP2 */
83 GPIO25_SSP2_SCLK,
eric miaoe1d9b952007-12-13 10:41:43 +080084 GPIO27_SSP2_TXD,
Eric Miao24ff4cd2008-09-01 06:56:07 +080085 GPIO17_GPIO, /* SFRM as chip-select */
eric miaoe1d9b952007-12-13 10:41:43 +080086
87 /* Debug Ethernet */
88 GPIO90_GPIO,
eric miao5fa41512008-01-23 15:07:22 +080089
90 /* Keypad */
91 GPIO107_KP_DKIN_0,
92 GPIO108_KP_DKIN_1,
93 GPIO115_KP_MKIN_0,
94 GPIO116_KP_MKIN_1,
95 GPIO117_KP_MKIN_2,
96 GPIO118_KP_MKIN_3,
97 GPIO119_KP_MKIN_4,
98 GPIO120_KP_MKIN_5,
99 GPIO121_KP_MKOUT_0,
100 GPIO122_KP_MKOUT_1,
101 GPIO123_KP_MKOUT_2,
102 GPIO124_KP_MKOUT_3,
103 GPIO125_KP_MKOUT_4,
Eric Miao361778d2009-06-05 16:42:29 +0800104
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 */
Marek Vasut6d26ce62009-12-27 16:04:35 +0100113
114 /* UART3 */
115 GPIO107_UART3_CTS,
116 GPIO108_UART3_RTS,
117 GPIO109_UART3_TXD,
118 GPIO110_UART3_RXD,
eric miaoe1d9b952007-12-13 10:41:43 +0800119};
120
121static struct resource smc91x_resources[] = {
122 [0] = {
123 .start = (LITTLETON_ETH_PHYS + 0x300),
124 .end = (LITTLETON_ETH_PHYS + 0xfffff),
125 .flags = IORESOURCE_MEM,
126 },
127 [1] = {
128 .start = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
129 .end = IRQ_GPIO(mfp_to_gpio(MFP_PIN_GPIO90)),
Eric Miao8a6e8872008-06-02 13:30:24 +0800130 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
eric miaoe1d9b952007-12-13 10:41:43 +0800131 }
132};
133
Eric Miaoe1719da2008-06-24 16:49:41 +0800134static struct smc91x_platdata littleton_smc91x_info = {
135 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
136 SMC91X_NOWAIT | SMC91X_USE_DMA,
137};
138
eric miaoe1d9b952007-12-13 10:41:43 +0800139static struct platform_device smc91x_device = {
140 .name = "smc91x",
141 .id = 0,
142 .num_resources = ARRAY_SIZE(smc91x_resources),
143 .resource = smc91x_resources,
Eric Miaoe1719da2008-06-24 16:49:41 +0800144 .dev = {
145 .platform_data = &littleton_smc91x_info,
146 },
eric miaoe1d9b952007-12-13 10:41:43 +0800147};
148
Eric Miao36caeb42008-06-02 13:32:42 +0800149#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
eric miaoe1d9b952007-12-13 10:41:43 +0800150static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
151 [0] = {
152 /* VGA */
153 .pixclock = 38250,
154 .xres = 480,
155 .yres = 640,
156 .bpp = 16,
157 .hsync_len = 8,
158 .left_margin = 8,
159 .right_margin = 24,
160 .vsync_len = 2,
161 .upper_margin = 2,
162 .lower_margin = 4,
163 .sync = 0,
164 },
165 [1] = {
166 /* QVGA */
167 .pixclock = 153000,
168 .xres = 240,
169 .yres = 320,
170 .bpp = 16,
171 .hsync_len = 8,
172 .left_margin = 8,
173 .right_margin = 88,
174 .vsync_len = 2,
175 .upper_margin = 2,
176 .lower_margin = 2,
177 .sync = 0,
178 },
179};
180
181static struct pxafb_mach_info littleton_lcd_info = {
182 .modes = tpo_tdo24mtea1_modes,
183 .num_modes = 2,
eric miao0454bd02008-04-30 00:52:23 -0700184 .lcd_conn = LCD_COLOR_TFT_16BPP,
eric miaoe1d9b952007-12-13 10:41:43 +0800185};
186
187static void littleton_init_lcd(void)
188{
189 set_pxa_fb_info(&littleton_lcd_info);
190}
191#else
192static inline void littleton_init_lcd(void) {};
Eric Miao36caeb42008-06-02 13:32:42 +0800193#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
eric miaoe1d9b952007-12-13 10:41:43 +0800194
Eric Miao24ff4cd2008-09-01 06:56:07 +0800195#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
196static struct pxa2xx_spi_master littleton_spi_info = {
197 .num_chipselect = 1,
198};
199
Eric Miao24ff4cd2008-09-01 06:56:07 +0800200static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
201 .rx_threshold = 1,
202 .tx_threshold = 1,
Mike Rapoport46580c02009-04-14 08:33:49 +0300203 .gpio_cs = LITTLETON_GPIO_LCD_CS,
Eric Miao24ff4cd2008-09-01 06:56:07 +0800204};
205
206static struct spi_board_info littleton_spi_devices[] __initdata = {
207 {
208 .modalias = "tdo24m",
209 .max_speed_hz = 1000000,
210 .bus_num = 2,
211 .chip_select = 0,
212 .controller_data= &littleton_tdo24m_chip,
213 },
214};
215
216static void __init littleton_init_spi(void)
217{
Eric Miao24ff4cd2008-09-01 06:56:07 +0800218 pxa2xx_set_spi_info(2, &littleton_spi_info);
219 spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
220}
221#else
222static inline void littleton_init_spi(void) {}
223#endif
224
Eric Miao36caeb42008-06-02 13:32:42 +0800225#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
eric miao5fa41512008-01-23 15:07:22 +0800226static unsigned int littleton_matrix_key_map[] = {
227 /* KEY(row, col, key_code) */
228 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
229 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
230 KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
231
232 KEY(0, 3, KEY_KPASTERISK), /* * */
233 KEY(2, 3, KEY_KPDOT), /* # */
234
235 KEY(5, 4, KEY_ENTER),
236
237 KEY(5, 0, KEY_UP),
238 KEY(5, 1, KEY_DOWN),
239 KEY(5, 2, KEY_LEFT),
240 KEY(5, 3, KEY_RIGHT),
241 KEY(3, 2, KEY_HOME),
242 KEY(4, 1, KEY_END),
243 KEY(3, 3, KEY_BACK),
244
245 KEY(4, 0, KEY_SEND),
246 KEY(4, 2, KEY_VOLUMEUP),
247 KEY(4, 3, KEY_VOLUMEDOWN),
248
249 KEY(3, 0, KEY_F22), /* soft1 */
250 KEY(3, 1, KEY_F23), /* soft2 */
251};
252
253static struct pxa27x_keypad_platform_data littleton_keypad_info = {
254 .matrix_key_rows = 6,
255 .matrix_key_cols = 5,
256 .matrix_key_map = littleton_matrix_key_map,
257 .matrix_key_map_size = ARRAY_SIZE(littleton_matrix_key_map),
258
259 .enable_rotary0 = 1,
260 .rotary0_up_key = KEY_UP,
261 .rotary0_down_key = KEY_DOWN,
262
263 .debounce_interval = 30,
264};
265static void __init littleton_init_keypad(void)
266{
267 pxa_set_keypad_info(&littleton_keypad_info);
268}
269#else
270static inline void littleton_init_keypad(void) {}
271#endif
272
Eric Miao361778d2009-06-05 16:42:29 +0800273#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
Eric Miao361778d2009-06-05 16:42:29 +0800274static struct pxamci_platform_data littleton_mci_platform_data = {
Eric Miao70f6d3e82009-07-13 22:57:56 +0800275 .detect_delay = 20,
276 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
277 .gpio_card_detect = GPIO_MMC1_CARD_DETECT,
278 .gpio_card_ro = -1,
279 .gpio_power = -1,
Eric Miao361778d2009-06-05 16:42:29 +0800280};
281
282static void __init littleton_init_mmc(void)
283{
284 pxa_set_mci_info(&littleton_mci_platform_data);
285}
286#else
287static inline void littleton_init_mmc(void) {}
288#endif
289
Eric Miao9c1db1a2008-06-02 15:42:14 +0800290#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
291static struct mtd_partition littleton_nand_partitions[] = {
292 [0] = {
293 .name = "Bootloader",
294 .offset = 0,
295 .size = 0x060000,
296 .mask_flags = MTD_WRITEABLE, /* force read-only */
297 },
298 [1] = {
299 .name = "Kernel",
300 .offset = 0x060000,
301 .size = 0x200000,
302 .mask_flags = MTD_WRITEABLE, /* force read-only */
303 },
304 [2] = {
305 .name = "Filesystem",
306 .offset = 0x0260000,
307 .size = 0x3000000, /* 48M - rootfs */
308 },
309 [3] = {
310 .name = "MassStorage",
311 .offset = 0x3260000,
312 .size = 0x3d40000,
313 },
314 [4] = {
315 .name = "BBT",
316 .offset = 0x6FA0000,
317 .size = 0x80000,
318 .mask_flags = MTD_WRITEABLE, /* force read-only */
319 },
320 /* NOTE: we reserve some blocks at the end of the NAND flash for
321 * bad block management, and the max number of relocation blocks
322 * differs on different platforms. Please take care with it when
323 * defining the partition table.
324 */
325};
326
327static struct pxa3xx_nand_platform_data littleton_nand_info = {
328 .enable_arbiter = 1,
329 .parts = littleton_nand_partitions,
330 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
331};
332
333static void __init littleton_init_nand(void)
334{
335 pxa3xx_set_nand_info(&littleton_nand_info);
336}
337#else
338static inline void littleton_init_nand(void) {}
339#endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
340
Eric Miao3b24f302008-12-10 17:04:38 +0800341#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
342static struct led_info littleton_da9034_leds[] = {
343 [0] = {
344 .name = "littleton:keypad1",
345 .flags = DA9034_LED_RAMP,
346 },
347 [1] = {
348 .name = "littleton:keypad2",
349 .flags = DA9034_LED_RAMP,
350 },
351 [2] = {
352 .name = "littleton:vibra",
353 .flags = 0,
354 },
355};
356
Eric Miaofc761322009-04-13 11:06:49 +0800357static struct da9034_touch_pdata littleton_da9034_touch = {
358 .x_inverted = 1,
359 .interval_ms = 20,
360};
361
Eric Miao3b24f302008-12-10 17:04:38 +0800362static struct da903x_subdev_info littleton_da9034_subdevs[] = {
363 {
364 .name = "da903x-led",
365 .id = DA9034_ID_LED_1,
366 .platform_data = &littleton_da9034_leds[0],
367 }, {
368 .name = "da903x-led",
369 .id = DA9034_ID_LED_2,
370 .platform_data = &littleton_da9034_leds[1],
371 }, {
372 .name = "da903x-led",
373 .id = DA9034_ID_VIBRA,
374 .platform_data = &littleton_da9034_leds[2],
375 }, {
376 .name = "da903x-backlight",
377 .id = DA9034_ID_WLED,
Eric Miaofc761322009-04-13 11:06:49 +0800378 }, {
379 .name = "da9034-touch",
380 .id = DA9034_ID_TOUCH,
381 .platform_data = &littleton_da9034_touch,
Eric Miao3b24f302008-12-10 17:04:38 +0800382 },
383};
384
385static struct da903x_platform_data littleton_da9034_info = {
386 .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
387 .subdevs = littleton_da9034_subdevs,
388};
389
390static struct max732x_platform_data littleton_max7320_info = {
391 .gpio_base = EXT0_GPIO_BASE,
392};
393
394static struct i2c_board_info littleton_i2c_info[] = {
395 [0] = {
396 .type = "da9034",
397 .addr = 0x34,
398 .platform_data = &littleton_da9034_info,
399 .irq = gpio_to_irq(mfp_to_gpio(MFP_PIN_GPIO18)),
400 },
401 [1] = {
402 .type = "max7320",
403 .addr = 0x50,
404 .platform_data = &littleton_max7320_info,
405 },
406};
407
408static void __init littleton_init_i2c(void)
409{
410 pxa_set_i2c_info(NULL);
411 i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
412}
413#else
414static inline void littleton_init_i2c(void) {}
415#endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
416
eric miaoe1d9b952007-12-13 10:41:43 +0800417static void __init littleton_init(void)
418{
419 /* initialize MFP configurations */
420 pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
421
Russell Kingcc155c62009-11-09 13:34:08 +0800422 pxa_set_ffuart_info(NULL);
423 pxa_set_btuart_info(NULL);
424 pxa_set_stuart_info(NULL);
425
eric miaoe1d9b952007-12-13 10:41:43 +0800426 /*
427 * Note: we depend bootloader set the correct
428 * value to MSC register for SMC91x.
429 */
430 platform_device_register(&smc91x_device);
431
Eric Miao24ff4cd2008-09-01 06:56:07 +0800432 littleton_init_spi();
Eric Miao3b24f302008-12-10 17:04:38 +0800433 littleton_init_i2c();
Eric Miao361778d2009-06-05 16:42:29 +0800434 littleton_init_mmc();
eric miaoe1d9b952007-12-13 10:41:43 +0800435 littleton_init_lcd();
eric miao5fa41512008-01-23 15:07:22 +0800436 littleton_init_keypad();
Eric Miao9c1db1a2008-06-02 15:42:14 +0800437 littleton_init_nand();
eric miaoe1d9b952007-12-13 10:41:43 +0800438}
439
440MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
441 .phys_io = 0x40000000,
442 .boot_params = 0xa0000100,
443 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
444 .map_io = pxa_map_io,
445 .init_irq = pxa3xx_init_irq,
446 .timer = &pxa_timer,
447 .init_machine = littleton_init,
448MACHINE_END