blob: 464b8bd2bcb98c983de618b8653bb93002de927e [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>
Linus Walleij32d15442018-12-02 09:43:22 +010023#include <linux/gpio/machine.h>
Eric Miao24ff4cd2008-09-01 06:56:07 +080024#include <linux/spi/spi.h>
Sebastian Andrzej Siewior8348c252010-11-22 17:12:15 -080025#include <linux/spi/pxa2xx_spi.h>
Eric Miaoe1719da2008-06-24 16:49:41 +080026#include <linux/smc91x.h>
Eric Miao3b24f302008-12-10 17:04:38 +080027#include <linux/i2c.h>
28#include <linux/leds.h>
29#include <linux/mfd/da903x.h>
Wolfram Sang0a848d62017-05-21 23:57:25 +020030#include <linux/platform_data/max732x.h>
Wolfram Sangf15fc9b2017-11-13 18:27:39 +010031#include <linux/platform_data/i2c-pxa.h>
eric miaoe1d9b952007-12-13 10:41:43 +080032
33#include <asm/types.h>
34#include <asm/setup.h>
35#include <asm/memory.h>
36#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010037#include <mach/hardware.h>
eric miaoe1d9b952007-12-13 10:41:43 +080038#include <asm/irq.h>
39
40#include <asm/mach/arch.h>
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010044#include "pxa300.h"
Wolfram Sangcb74dc32017-11-13 18:27:38 +010045#include "devices.h"
Arnd Bergmann293b2da2012-08-24 15:16:48 +020046#include <linux/platform_data/video-pxafb.h>
47#include <linux/platform_data/mmc-pxamci.h>
48#include <linux/platform_data/keypad-pxa27x.h>
Arnd Bergmann4c25c5d2015-01-30 10:45:33 +010049#include "littleton.h"
Arnd Bergmann293b2da2012-08-24 15:16:48 +020050#include <linux/platform_data/mtd-nand-pxa3xx.h>
eric miaoe1d9b952007-12-13 10:41:43 +080051
52#include "generic.h"
53
eric miaoe1d9b952007-12-13 10:41:43 +080054/* Littleton MFP configurations */
55static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
56 /* LCD */
57 GPIO54_LCD_LDD_0,
58 GPIO55_LCD_LDD_1,
59 GPIO56_LCD_LDD_2,
60 GPIO57_LCD_LDD_3,
61 GPIO58_LCD_LDD_4,
62 GPIO59_LCD_LDD_5,
63 GPIO60_LCD_LDD_6,
64 GPIO61_LCD_LDD_7,
65 GPIO62_LCD_LDD_8,
66 GPIO63_LCD_LDD_9,
67 GPIO64_LCD_LDD_10,
68 GPIO65_LCD_LDD_11,
69 GPIO66_LCD_LDD_12,
70 GPIO67_LCD_LDD_13,
71 GPIO68_LCD_LDD_14,
72 GPIO69_LCD_LDD_15,
73 GPIO70_LCD_LDD_16,
74 GPIO71_LCD_LDD_17,
75 GPIO72_LCD_FCLK,
76 GPIO73_LCD_LCLK,
77 GPIO74_LCD_PCLK,
78 GPIO75_LCD_BIAS,
79
80 /* SSP2 */
81 GPIO25_SSP2_SCLK,
eric miaoe1d9b952007-12-13 10:41:43 +080082 GPIO27_SSP2_TXD,
Eric Miao24ff4cd2008-09-01 06:56:07 +080083 GPIO17_GPIO, /* SFRM as chip-select */
eric miaoe1d9b952007-12-13 10:41:43 +080084
85 /* Debug Ethernet */
86 GPIO90_GPIO,
eric miao5fa41512008-01-23 15:07:22 +080087
88 /* Keypad */
89 GPIO107_KP_DKIN_0,
90 GPIO108_KP_DKIN_1,
91 GPIO115_KP_MKIN_0,
92 GPIO116_KP_MKIN_1,
93 GPIO117_KP_MKIN_2,
94 GPIO118_KP_MKIN_3,
95 GPIO119_KP_MKIN_4,
96 GPIO120_KP_MKIN_5,
97 GPIO121_KP_MKOUT_0,
98 GPIO122_KP_MKOUT_1,
99 GPIO123_KP_MKOUT_2,
100 GPIO124_KP_MKOUT_3,
101 GPIO125_KP_MKOUT_4,
Eric Miao361778d2009-06-05 16:42:29 +0800102
103 /* MMC1 */
104 GPIO3_MMC1_DAT0,
105 GPIO4_MMC1_DAT1,
106 GPIO5_MMC1_DAT2,
107 GPIO6_MMC1_DAT3,
108 GPIO7_MMC1_CLK,
109 GPIO8_MMC1_CMD,
110 GPIO15_GPIO, /* card detect */
Marek Vasut6d26ce62009-12-27 16:04:35 +0100111
112 /* UART3 */
113 GPIO107_UART3_CTS,
114 GPIO108_UART3_RTS,
115 GPIO109_UART3_TXD,
116 GPIO110_UART3_RXD,
eric miaoe1d9b952007-12-13 10:41:43 +0800117};
118
119static struct resource smc91x_resources[] = {
120 [0] = {
121 .start = (LITTLETON_ETH_PHYS + 0x300),
122 .end = (LITTLETON_ETH_PHYS + 0xfffff),
123 .flags = IORESOURCE_MEM,
124 },
125 [1] = {
Haojian Zhuang6384fda2011-10-10 14:21:08 +0800126 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
127 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
Eric Miao8a6e8872008-06-02 13:30:24 +0800128 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
eric miaoe1d9b952007-12-13 10:41:43 +0800129 }
130};
131
Eric Miaoe1719da2008-06-24 16:49:41 +0800132static struct smc91x_platdata littleton_smc91x_info = {
133 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
134 SMC91X_NOWAIT | SMC91X_USE_DMA,
135};
136
eric miaoe1d9b952007-12-13 10:41:43 +0800137static struct platform_device smc91x_device = {
138 .name = "smc91x",
139 .id = 0,
140 .num_resources = ARRAY_SIZE(smc91x_resources),
141 .resource = smc91x_resources,
Eric Miaoe1719da2008-06-24 16:49:41 +0800142 .dev = {
143 .platform_data = &littleton_smc91x_info,
144 },
eric miaoe1d9b952007-12-13 10:41:43 +0800145};
146
Eric Miao36caeb42008-06-02 13:32:42 +0800147#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
eric miaoe1d9b952007-12-13 10:41:43 +0800148static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
149 [0] = {
150 /* VGA */
151 .pixclock = 38250,
152 .xres = 480,
153 .yres = 640,
154 .bpp = 16,
155 .hsync_len = 8,
156 .left_margin = 8,
157 .right_margin = 24,
158 .vsync_len = 2,
159 .upper_margin = 2,
160 .lower_margin = 4,
161 .sync = 0,
162 },
163 [1] = {
164 /* QVGA */
165 .pixclock = 153000,
166 .xres = 240,
167 .yres = 320,
168 .bpp = 16,
169 .hsync_len = 8,
170 .left_margin = 8,
171 .right_margin = 88,
172 .vsync_len = 2,
173 .upper_margin = 2,
174 .lower_margin = 2,
175 .sync = 0,
176 },
177};
178
179static struct pxafb_mach_info littleton_lcd_info = {
180 .modes = tpo_tdo24mtea1_modes,
181 .num_modes = 2,
eric miao0454bd02008-04-30 00:52:23 -0700182 .lcd_conn = LCD_COLOR_TFT_16BPP,
eric miaoe1d9b952007-12-13 10:41:43 +0800183};
184
Arnd Bergmann88af3202018-12-10 22:58:39 +0100185static void __init littleton_init_lcd(void)
eric miaoe1d9b952007-12-13 10:41:43 +0800186{
Russell King - ARM Linux4321e1a2011-02-15 15:37:30 +0800187 pxa_set_fb_info(NULL, &littleton_lcd_info);
eric miaoe1d9b952007-12-13 10:41:43 +0800188}
189#else
190static inline void littleton_init_lcd(void) {};
Eric Miao36caeb42008-06-02 13:32:42 +0800191#endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
eric miaoe1d9b952007-12-13 10:41:43 +0800192
Eric Miao24ff4cd2008-09-01 06:56:07 +0800193#if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
Lubomir Rintel51eea522019-01-16 16:13:31 +0100194static struct pxa2xx_spi_controller littleton_spi_info = {
Eric Miao24ff4cd2008-09-01 06:56:07 +0800195 .num_chipselect = 1,
196};
197
Eric Miao24ff4cd2008-09-01 06:56:07 +0800198static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
199 .rx_threshold = 1,
200 .tx_threshold = 1,
Mike Rapoport46580c02009-04-14 08:33:49 +0300201 .gpio_cs = LITTLETON_GPIO_LCD_CS,
Eric Miao24ff4cd2008-09-01 06:56:07 +0800202};
203
204static struct spi_board_info littleton_spi_devices[] __initdata = {
205 {
206 .modalias = "tdo24m",
207 .max_speed_hz = 1000000,
208 .bus_num = 2,
209 .chip_select = 0,
210 .controller_data= &littleton_tdo24m_chip,
211 },
212};
213
214static void __init littleton_init_spi(void)
215{
Eric Miao24ff4cd2008-09-01 06:56:07 +0800216 pxa2xx_set_spi_info(2, &littleton_spi_info);
217 spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
218}
219#else
220static inline void littleton_init_spi(void) {}
221#endif
222
Eric Miao36caeb42008-06-02 13:32:42 +0800223#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
Chao Xie0a085a92013-05-05 20:24:58 -0700224static const unsigned int littleton_matrix_key_map[] = {
eric miao5fa41512008-01-23 15:07:22 +0800225 /* KEY(row, col, key_code) */
226 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
227 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
228 KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
229
230 KEY(0, 3, KEY_KPASTERISK), /* * */
231 KEY(2, 3, KEY_KPDOT), /* # */
232
233 KEY(5, 4, KEY_ENTER),
234
235 KEY(5, 0, KEY_UP),
236 KEY(5, 1, KEY_DOWN),
237 KEY(5, 2, KEY_LEFT),
238 KEY(5, 3, KEY_RIGHT),
239 KEY(3, 2, KEY_HOME),
240 KEY(4, 1, KEY_END),
241 KEY(3, 3, KEY_BACK),
242
243 KEY(4, 0, KEY_SEND),
244 KEY(4, 2, KEY_VOLUMEUP),
245 KEY(4, 3, KEY_VOLUMEDOWN),
246
247 KEY(3, 0, KEY_F22), /* soft1 */
248 KEY(3, 1, KEY_F23), /* soft2 */
249};
250
Chao Xie0a085a92013-05-05 20:24:58 -0700251static struct matrix_keymap_data littleton_matrix_keymap_data = {
252 .keymap = littleton_matrix_key_map,
253 .keymap_size = ARRAY_SIZE(littleton_matrix_key_map),
254};
255
eric miao5fa41512008-01-23 15:07:22 +0800256static struct pxa27x_keypad_platform_data littleton_keypad_info = {
257 .matrix_key_rows = 6,
258 .matrix_key_cols = 5,
Chao Xie0a085a92013-05-05 20:24:58 -0700259 .matrix_keymap_data = &littleton_matrix_keymap_data,
eric miao5fa41512008-01-23 15:07:22 +0800260
261 .enable_rotary0 = 1,
262 .rotary0_up_key = KEY_UP,
263 .rotary0_down_key = KEY_DOWN,
264
265 .debounce_interval = 30,
266};
267static void __init littleton_init_keypad(void)
268{
269 pxa_set_keypad_info(&littleton_keypad_info);
270}
271#else
272static inline void littleton_init_keypad(void) {}
273#endif
274
Eric Miao361778d2009-06-05 16:42:29 +0800275#if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
Eric Miao361778d2009-06-05 16:42:29 +0800276static struct pxamci_platform_data littleton_mci_platform_data = {
Eric Miaof97cab22010-04-14 07:00:42 +0800277 .detect_delay_ms = 200,
Eric Miao70f6d3e82009-07-13 22:57:56 +0800278 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
Eric Miao361778d2009-06-05 16:42:29 +0800279};
280
Linus Walleij32d15442018-12-02 09:43:22 +0100281static struct gpiod_lookup_table littleton_mci_gpio_table = {
282 .dev_id = "pxa2xx-mci.0",
283 .table = {
284 /* Card detect on MFP (gpio-pxa) GPIO 15 */
285 GPIO_LOOKUP("gpio-pxa", MFP_PIN_GPIO15,
286 "cd", GPIO_ACTIVE_LOW),
287 { },
288 },
289};
290
Eric Miao361778d2009-06-05 16:42:29 +0800291static void __init littleton_init_mmc(void)
292{
Linus Walleij32d15442018-12-02 09:43:22 +0100293 gpiod_add_lookup_table(&littleton_mci_gpio_table);
Eric Miao361778d2009-06-05 16:42:29 +0800294 pxa_set_mci_info(&littleton_mci_platform_data);
295}
296#else
297static inline void littleton_init_mmc(void) {}
298#endif
299
Miquel Raynal349dfe62018-02-19 23:35:52 +0100300#if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
Eric Miao9c1db1a2008-06-02 15:42:14 +0800301static struct mtd_partition littleton_nand_partitions[] = {
302 [0] = {
303 .name = "Bootloader",
304 .offset = 0,
305 .size = 0x060000,
306 .mask_flags = MTD_WRITEABLE, /* force read-only */
307 },
308 [1] = {
309 .name = "Kernel",
310 .offset = 0x060000,
311 .size = 0x200000,
312 .mask_flags = MTD_WRITEABLE, /* force read-only */
313 },
314 [2] = {
315 .name = "Filesystem",
316 .offset = 0x0260000,
317 .size = 0x3000000, /* 48M - rootfs */
318 },
319 [3] = {
320 .name = "MassStorage",
321 .offset = 0x3260000,
322 .size = 0x3d40000,
323 },
324 [4] = {
325 .name = "BBT",
326 .offset = 0x6FA0000,
327 .size = 0x80000,
328 .mask_flags = MTD_WRITEABLE, /* force read-only */
329 },
330 /* NOTE: we reserve some blocks at the end of the NAND flash for
331 * bad block management, and the max number of relocation blocks
332 * differs on different platforms. Please take care with it when
333 * defining the partition table.
334 */
335};
336
337static struct pxa3xx_nand_platform_data littleton_nand_info = {
Miquel Raynal75765942018-02-19 23:35:54 +0100338 .parts = littleton_nand_partitions,
339 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
Eric Miao9c1db1a2008-06-02 15:42:14 +0800340};
341
342static void __init littleton_init_nand(void)
343{
344 pxa3xx_set_nand_info(&littleton_nand_info);
345}
346#else
347static inline void littleton_init_nand(void) {}
Miquel Raynal349dfe62018-02-19 23:35:52 +0100348#endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
Eric Miao9c1db1a2008-06-02 15:42:14 +0800349
Eric Miao3b24f302008-12-10 17:04:38 +0800350#if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
351static struct led_info littleton_da9034_leds[] = {
352 [0] = {
353 .name = "littleton:keypad1",
354 .flags = DA9034_LED_RAMP,
355 },
356 [1] = {
357 .name = "littleton:keypad2",
358 .flags = DA9034_LED_RAMP,
359 },
360 [2] = {
361 .name = "littleton:vibra",
362 .flags = 0,
363 },
364};
365
Eric Miaofc761322009-04-13 11:06:49 +0800366static struct da9034_touch_pdata littleton_da9034_touch = {
367 .x_inverted = 1,
368 .interval_ms = 20,
369};
370
Eric Miao3b24f302008-12-10 17:04:38 +0800371static struct da903x_subdev_info littleton_da9034_subdevs[] = {
372 {
373 .name = "da903x-led",
374 .id = DA9034_ID_LED_1,
375 .platform_data = &littleton_da9034_leds[0],
376 }, {
377 .name = "da903x-led",
378 .id = DA9034_ID_LED_2,
379 .platform_data = &littleton_da9034_leds[1],
380 }, {
381 .name = "da903x-led",
382 .id = DA9034_ID_VIBRA,
383 .platform_data = &littleton_da9034_leds[2],
384 }, {
385 .name = "da903x-backlight",
386 .id = DA9034_ID_WLED,
Eric Miaofc761322009-04-13 11:06:49 +0800387 }, {
388 .name = "da9034-touch",
389 .id = DA9034_ID_TOUCH,
390 .platform_data = &littleton_da9034_touch,
Eric Miao3b24f302008-12-10 17:04:38 +0800391 },
392};
393
394static struct da903x_platform_data littleton_da9034_info = {
395 .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
396 .subdevs = littleton_da9034_subdevs,
397};
398
399static struct max732x_platform_data littleton_max7320_info = {
400 .gpio_base = EXT0_GPIO_BASE,
401};
402
403static struct i2c_board_info littleton_i2c_info[] = {
404 [0] = {
405 .type = "da9034",
406 .addr = 0x34,
407 .platform_data = &littleton_da9034_info,
Haojian Zhuang4929f5a2011-10-10 16:03:51 +0800408 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
Eric Miao3b24f302008-12-10 17:04:38 +0800409 },
410 [1] = {
411 .type = "max7320",
412 .addr = 0x50,
413 .platform_data = &littleton_max7320_info,
414 },
415};
416
417static void __init littleton_init_i2c(void)
418{
419 pxa_set_i2c_info(NULL);
420 i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
421}
422#else
423static inline void littleton_init_i2c(void) {}
424#endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
425
eric miaoe1d9b952007-12-13 10:41:43 +0800426static void __init littleton_init(void)
427{
428 /* initialize MFP configurations */
429 pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
430
Russell Kingcc155c62009-11-09 13:34:08 +0800431 pxa_set_ffuart_info(NULL);
432 pxa_set_btuart_info(NULL);
433 pxa_set_stuart_info(NULL);
434
eric miaoe1d9b952007-12-13 10:41:43 +0800435 /*
436 * Note: we depend bootloader set the correct
437 * value to MSC register for SMC91x.
438 */
439 platform_device_register(&smc91x_device);
440
Eric Miao24ff4cd2008-09-01 06:56:07 +0800441 littleton_init_spi();
Eric Miao3b24f302008-12-10 17:04:38 +0800442 littleton_init_i2c();
Eric Miao361778d2009-06-05 16:42:29 +0800443 littleton_init_mmc();
eric miaoe1d9b952007-12-13 10:41:43 +0800444 littleton_init_lcd();
eric miao5fa41512008-01-23 15:07:22 +0800445 littleton_init_keypad();
Eric Miao9c1db1a2008-06-02 15:42:14 +0800446 littleton_init_nand();
eric miaoe1d9b952007-12-13 10:41:43 +0800447}
448
449MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
Nicolas Pitre7375aba2011-07-05 22:38:15 -0400450 .atag_offset = 0x100,
Marek Vasut851982c2010-10-11 02:20:19 +0200451 .map_io = pxa3xx_map_io,
Haojian Zhuang6ac6b812010-08-20 15:23:59 +0800452 .nr_irqs = LITTLETON_NR_IRQS,
eric miaoe1d9b952007-12-13 10:41:43 +0800453 .init_irq = pxa3xx_init_irq,
Eric Miao8a97ae22011-05-18 21:30:04 +0800454 .handle_irq = pxa3xx_handle_irq,
Stephen Warren6bb27d72012-11-08 12:40:59 -0700455 .init_time = pxa_timer_init,
eric miaoe1d9b952007-12-13 10:41:43 +0800456 .init_machine = littleton_init,
Russell King271a74f2011-11-04 14:15:53 +0000457 .restart = pxa_restart,
eric miaoe1d9b952007-12-13 10:41:43 +0800458MACHINE_END