1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/littleton.c
5 * Support for the Marvell Littleton Development Platform.
7 * Author: Jason Chagas (largely modified code)
8 * Created: Nov 20, 2006
9 * Copyright: (C) Copyright 2006 Marvell International Ltd.
11 * 2007-11-22 modified to align with latest kernel
12 * eric miao <eric.miao@marvell.com>
15 #include <linux/init.h>
16 #include <linux/interrupt.h>
17 #include <linux/delay.h>
18 #include <linux/platform_device.h>
19 #include <linux/clk.h>
20 #include <linux/gpio/machine.h>
21 #include <linux/spi/spi.h>
22 #include <linux/spi/pxa2xx_spi.h>
23 #include <linux/smc91x.h>
24 #include <linux/i2c.h>
25 #include <linux/leds.h>
26 #include <linux/mfd/da903x.h>
27 #include <linux/platform_data/max732x.h>
28 #include <linux/platform_data/i2c-pxa.h>
30 #include <asm/types.h>
31 #include <asm/setup.h>
32 #include <asm/memory.h>
33 #include <asm/mach-types.h>
34 #include <mach/hardware.h>
37 #include <asm/mach/arch.h>
38 #include <asm/mach/map.h>
39 #include <asm/mach/irq.h>
43 #include <linux/platform_data/video-pxafb.h>
44 #include <linux/platform_data/mmc-pxamci.h>
45 #include <linux/platform_data/keypad-pxa27x.h>
46 #include "littleton.h"
47 #include <linux/platform_data/mtd-nand-pxa3xx.h>
51 /* Littleton MFP configurations */
52 static mfp_cfg_t littleton_mfp_cfg[] __initdata = {
80 GPIO17_GPIO, /* SFRM as chip-select */
107 GPIO15_GPIO, /* card detect */
116 static struct resource smc91x_resources[] = {
118 .start = (LITTLETON_ETH_PHYS + 0x300),
119 .end = (LITTLETON_ETH_PHYS + 0xfffff),
120 .flags = IORESOURCE_MEM,
123 .start = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
124 .end = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO90)),
125 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
129 static struct smc91x_platdata littleton_smc91x_info = {
130 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
131 SMC91X_NOWAIT | SMC91X_USE_DMA,
134 static struct platform_device smc91x_device = {
137 .num_resources = ARRAY_SIZE(smc91x_resources),
138 .resource = smc91x_resources,
140 .platform_data = &littleton_smc91x_info,
144 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
145 static struct pxafb_mode_info tpo_tdo24mtea1_modes[] = {
176 static struct pxafb_mach_info littleton_lcd_info = {
177 .modes = tpo_tdo24mtea1_modes,
179 .lcd_conn = LCD_COLOR_TFT_16BPP,
182 static void __init littleton_init_lcd(void)
184 pxa_set_fb_info(NULL, &littleton_lcd_info);
187 static inline void littleton_init_lcd(void) {};
188 #endif /* CONFIG_FB_PXA || CONFIG_FB_PXA_MODULE */
190 #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE)
191 static struct pxa2xx_spi_controller littleton_spi_info = {
195 static struct pxa2xx_spi_chip littleton_tdo24m_chip = {
198 .gpio_cs = LITTLETON_GPIO_LCD_CS,
201 static struct spi_board_info littleton_spi_devices[] __initdata = {
203 .modalias = "tdo24m",
204 .max_speed_hz = 1000000,
207 .controller_data= &littleton_tdo24m_chip,
211 static void __init littleton_init_spi(void)
213 pxa2xx_set_spi_info(2, &littleton_spi_info);
214 spi_register_board_info(ARRAY_AND_SIZE(littleton_spi_devices));
217 static inline void littleton_init_spi(void) {}
220 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
221 static const unsigned int littleton_matrix_key_map[] = {
222 /* KEY(row, col, key_code) */
223 KEY(1, 3, KEY_0), KEY(0, 0, KEY_1), KEY(1, 0, KEY_2), KEY(2, 0, KEY_3),
224 KEY(0, 1, KEY_4), KEY(1, 1, KEY_5), KEY(2, 1, KEY_6), KEY(0, 2, KEY_7),
225 KEY(1, 2, KEY_8), KEY(2, 2, KEY_9),
227 KEY(0, 3, KEY_KPASTERISK), /* * */
228 KEY(2, 3, KEY_KPDOT), /* # */
230 KEY(5, 4, KEY_ENTER),
235 KEY(5, 3, KEY_RIGHT),
241 KEY(4, 2, KEY_VOLUMEUP),
242 KEY(4, 3, KEY_VOLUMEDOWN),
244 KEY(3, 0, KEY_F22), /* soft1 */
245 KEY(3, 1, KEY_F23), /* soft2 */
248 static struct matrix_keymap_data littleton_matrix_keymap_data = {
249 .keymap = littleton_matrix_key_map,
250 .keymap_size = ARRAY_SIZE(littleton_matrix_key_map),
253 static struct pxa27x_keypad_platform_data littleton_keypad_info = {
254 .matrix_key_rows = 6,
255 .matrix_key_cols = 5,
256 .matrix_keymap_data = &littleton_matrix_keymap_data,
259 .rotary0_up_key = KEY_UP,
260 .rotary0_down_key = KEY_DOWN,
262 .debounce_interval = 30,
264 static void __init littleton_init_keypad(void)
266 pxa_set_keypad_info(&littleton_keypad_info);
269 static inline void littleton_init_keypad(void) {}
272 #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
273 static struct pxamci_platform_data littleton_mci_platform_data = {
274 .detect_delay_ms = 200,
275 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
278 static struct gpiod_lookup_table littleton_mci_gpio_table = {
279 .dev_id = "pxa2xx-mci.0",
281 /* Card detect on MFP (gpio-pxa) GPIO 15 */
282 GPIO_LOOKUP("gpio-pxa", MFP_PIN_GPIO15,
283 "cd", GPIO_ACTIVE_LOW),
288 static void __init littleton_init_mmc(void)
290 gpiod_add_lookup_table(&littleton_mci_gpio_table);
291 pxa_set_mci_info(&littleton_mci_platform_data);
294 static inline void littleton_init_mmc(void) {}
297 #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
298 static struct mtd_partition littleton_nand_partitions[] = {
300 .name = "Bootloader",
303 .mask_flags = MTD_WRITEABLE, /* force read-only */
309 .mask_flags = MTD_WRITEABLE, /* force read-only */
312 .name = "Filesystem",
314 .size = 0x3000000, /* 48M - rootfs */
317 .name = "MassStorage",
325 .mask_flags = MTD_WRITEABLE, /* force read-only */
327 /* NOTE: we reserve some blocks at the end of the NAND flash for
328 * bad block management, and the max number of relocation blocks
329 * differs on different platforms. Please take care with it when
330 * defining the partition table.
334 static struct pxa3xx_nand_platform_data littleton_nand_info = {
335 .parts = littleton_nand_partitions,
336 .nr_parts = ARRAY_SIZE(littleton_nand_partitions),
339 static void __init littleton_init_nand(void)
341 pxa3xx_set_nand_info(&littleton_nand_info);
344 static inline void littleton_init_nand(void) {}
345 #endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
347 #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
348 static struct led_info littleton_da9034_leds[] = {
350 .name = "littleton:keypad1",
351 .flags = DA9034_LED_RAMP,
354 .name = "littleton:keypad2",
355 .flags = DA9034_LED_RAMP,
358 .name = "littleton:vibra",
363 static struct da9034_touch_pdata littleton_da9034_touch = {
368 static struct da903x_subdev_info littleton_da9034_subdevs[] = {
370 .name = "da903x-led",
371 .id = DA9034_ID_LED_1,
372 .platform_data = &littleton_da9034_leds[0],
374 .name = "da903x-led",
375 .id = DA9034_ID_LED_2,
376 .platform_data = &littleton_da9034_leds[1],
378 .name = "da903x-led",
379 .id = DA9034_ID_VIBRA,
380 .platform_data = &littleton_da9034_leds[2],
382 .name = "da903x-backlight",
383 .id = DA9034_ID_WLED,
385 .name = "da9034-touch",
386 .id = DA9034_ID_TOUCH,
387 .platform_data = &littleton_da9034_touch,
391 static struct da903x_platform_data littleton_da9034_info = {
392 .num_subdevs = ARRAY_SIZE(littleton_da9034_subdevs),
393 .subdevs = littleton_da9034_subdevs,
396 static struct max732x_platform_data littleton_max7320_info = {
397 .gpio_base = EXT0_GPIO_BASE,
400 static struct i2c_board_info littleton_i2c_info[] = {
404 .platform_data = &littleton_da9034_info,
405 .irq = PXA_GPIO_TO_IRQ(mfp_to_gpio(MFP_PIN_GPIO18)),
410 .platform_data = &littleton_max7320_info,
414 static void __init littleton_init_i2c(void)
416 pxa_set_i2c_info(NULL);
417 i2c_register_board_info(0, ARRAY_AND_SIZE(littleton_i2c_info));
420 static inline void littleton_init_i2c(void) {}
421 #endif /* CONFIG_I2C_PXA || CONFIG_I2C_PXA_MODULE */
423 static void __init littleton_init(void)
425 /* initialize MFP configurations */
426 pxa3xx_mfp_config(ARRAY_AND_SIZE(littleton_mfp_cfg));
428 pxa_set_ffuart_info(NULL);
429 pxa_set_btuart_info(NULL);
430 pxa_set_stuart_info(NULL);
433 * Note: we depend bootloader set the correct
434 * value to MSC register for SMC91x.
436 platform_device_register(&smc91x_device);
438 littleton_init_spi();
439 littleton_init_i2c();
440 littleton_init_mmc();
441 littleton_init_lcd();
442 littleton_init_keypad();
443 littleton_init_nand();
446 MACHINE_START(LITTLETON, "Marvell Form Factor Development Platform (aka Littleton)")
447 .atag_offset = 0x100,
448 .map_io = pxa3xx_map_io,
449 .nr_irqs = LITTLETON_NR_IRQS,
450 .init_irq = pxa3xx_init_irq,
451 .handle_irq = pxa3xx_handle_irq,
452 .init_time = pxa_timer_init,
453 .init_machine = littleton_init,
454 .restart = pxa_restart,