1 // SPDX-License-Identifier: GPL-2.0-only
3 * linux/arch/arm/mach-pxa/zylonite.c
5 * Support for the PXA3xx Development Platform (aka Zylonite)
7 * Copyright (C) 2006 Marvell International Ltd.
9 * 2007-09-04: eric miao <eric.miao@marvell.com>
10 * rewrite to align with latest kernel
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/interrupt.h>
16 #include <linux/leds.h>
17 #include <linux/init.h>
18 #include <linux/platform_device.h>
19 #include <linux/gpio/machine.h>
20 #include <linux/pwm.h>
21 #include <linux/pwm_backlight.h>
22 #include <linux/smc91x.h>
23 #include <linux/soc/pxa/cpu.h>
25 #include <asm/mach-types.h>
26 #include <asm/mach/arch.h>
28 #include <linux/platform_data/asoc-pxa.h>
29 #include <linux/platform_data/video-pxafb.h>
31 #include <linux/platform_data/mmc-pxamci.h>
32 #include <linux/platform_data/usb-ohci-pxa27x.h>
33 #include <linux/platform_data/keypad-pxa27x.h>
34 #include <linux/platform_data/mtd-nand-pxa3xx.h>
49 static struct resource smc91x_resources[] = {
51 .start = ZYLONITE_ETH_PHYS + 0x300,
52 .end = ZYLONITE_ETH_PHYS + 0xfffff,
53 .flags = IORESOURCE_MEM,
56 .start = -1, /* for run-time assignment */
58 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
62 static struct smc91x_platdata zylonite_smc91x_info = {
63 .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT |
64 SMC91X_NOWAIT | SMC91X_USE_DMA,
67 static struct platform_device smc91x_device = {
70 .num_resources = ARRAY_SIZE(smc91x_resources),
71 .resource = smc91x_resources,
73 .platform_data = &zylonite_smc91x_info,
77 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
78 static struct gpio_led zylonite_debug_leds[] = {
80 .name = "zylonite:yellow:1",
81 .default_trigger = "heartbeat",
84 .name = "zylonite:yellow:2",
85 .default_trigger = "default-on",
89 static struct gpio_led_platform_data zylonite_debug_leds_info = {
90 .leds = zylonite_debug_leds,
91 .num_leds = ARRAY_SIZE(zylonite_debug_leds),
94 static struct platform_device zylonite_device_leds = {
98 .platform_data = &zylonite_debug_leds_info,
102 static void __init zylonite_init_leds(void)
104 zylonite_debug_leds[0].gpio = gpio_debug_led1;
105 zylonite_debug_leds[1].gpio = gpio_debug_led2;
107 platform_device_register(&zylonite_device_leds);
110 static inline void zylonite_init_leds(void) {}
113 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
114 static struct pwm_lookup zylonite_pwm_lookup[] = {
115 PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL, 10000,
116 PWM_POLARITY_NORMAL),
119 static struct platform_pwm_backlight_data zylonite_backlight_data = {
120 .max_brightness = 100,
121 .dft_brightness = 100,
124 static struct platform_device zylonite_backlight_device = {
125 .name = "pwm-backlight",
127 .parent = &pxa27x_device_pwm1.dev,
128 .platform_data = &zylonite_backlight_data,
132 static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
143 .sync = FB_SYNC_VERT_HIGH_ACT,
146 static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
157 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
160 static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
162 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
165 static struct pxafb_mode_info sharp_ls037_modes[] = {
194 static struct pxafb_mach_info zylonite_sharp_lcd_info = {
195 .modes = sharp_ls037_modes,
197 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
200 static void __init zylonite_init_lcd(void)
202 pwm_add_table(zylonite_pwm_lookup, ARRAY_SIZE(zylonite_pwm_lookup));
203 platform_device_register(&zylonite_backlight_device);
206 pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info);
210 /* legacy LCD panels, it would be handy here if LCD panel type can
211 * be decided at run-time
214 zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
216 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
218 pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info);
221 static inline void zylonite_init_lcd(void) {}
224 #if defined(CONFIG_MMC)
225 static struct pxamci_platform_data zylonite_mci_platform_data = {
226 .detect_delay_ms= 200,
227 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
230 #define PCA9539A_MCI_CD 0
231 #define PCA9539A_MCI1_CD 1
232 #define PCA9539A_MCI_WP 2
233 #define PCA9539A_MCI1_WP 3
234 #define PCA9539A_MCI3_CD 30
235 #define PCA9539A_MCI3_WP 31
237 static struct gpiod_lookup_table zylonite_mci_gpio_table = {
238 .dev_id = "pxa2xx-mci.0",
240 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_CD,
241 "cd", GPIO_ACTIVE_LOW),
242 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_WP,
243 "wp", GPIO_ACTIVE_LOW),
248 static struct pxamci_platform_data zylonite_mci2_platform_data = {
249 .detect_delay_ms= 200,
250 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
253 static struct gpiod_lookup_table zylonite_mci2_gpio_table = {
254 .dev_id = "pxa2xx-mci.1",
256 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_CD,
257 "cd", GPIO_ACTIVE_LOW),
258 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_WP,
259 "wp", GPIO_ACTIVE_LOW),
264 static struct pxamci_platform_data zylonite_mci3_platform_data = {
265 .detect_delay_ms= 200,
266 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
269 static struct gpiod_lookup_table zylonite_mci3_gpio_table = {
270 .dev_id = "pxa2xx-mci.2",
272 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_CD,
273 "cd", GPIO_ACTIVE_LOW),
274 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_WP,
275 "wp", GPIO_ACTIVE_LOW),
280 static void __init zylonite_init_mmc(void)
282 gpiod_add_lookup_table(&zylonite_mci_gpio_table);
283 pxa_set_mci_info(&zylonite_mci_platform_data);
284 gpiod_add_lookup_table(&zylonite_mci2_gpio_table);
285 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
286 if (cpu_is_pxa310()) {
287 gpiod_add_lookup_table(&zylonite_mci3_gpio_table);
288 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
292 static inline void zylonite_init_mmc(void) {}
295 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
296 static const unsigned int zylonite_matrix_key_map[] = {
297 /* KEY(row, col, key_code) */
298 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
299 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
300 KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
301 KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
302 KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
303 KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
304 KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
306 KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
307 KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
308 KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
310 KEY(4, 5, KEY_SPACE),
311 KEY(5, 3, KEY_KPASTERISK), /* * */
312 KEY(5, 4, KEY_KPDOT), /* #" */
317 KEY(3, 7, KEY_RIGHT),
320 KEY(6, 4, KEY_DELETE),
322 KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
324 KEY(4, 6, KEY_ENTER), /* scroll push */
325 KEY(5, 7, KEY_ENTER), /* keypad action */
327 KEY(0, 4, KEY_EMAIL),
329 KEY(4, 0, KEY_CALENDAR),
330 KEY(7, 6, KEY_RECORD),
331 KEY(6, 7, KEY_VOLUMEUP),
332 KEY(7, 7, KEY_VOLUMEDOWN),
334 KEY(0, 6, KEY_F22), /* soft1 */
335 KEY(1, 6, KEY_F23), /* soft2 */
336 KEY(0, 3, KEY_AUX), /* contact */
339 static struct matrix_keymap_data zylonite_matrix_keymap_data = {
340 .keymap = zylonite_matrix_key_map,
341 .keymap_size = ARRAY_SIZE(zylonite_matrix_key_map),
344 static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
345 .matrix_key_rows = 8,
346 .matrix_key_cols = 8,
347 .matrix_keymap_data = &zylonite_matrix_keymap_data,
350 .rotary0_up_key = KEY_UP,
351 .rotary0_down_key = KEY_DOWN,
353 .debounce_interval = 30,
356 static void __init zylonite_init_keypad(void)
358 pxa_set_keypad_info(&zylonite_keypad_info);
361 static inline void zylonite_init_keypad(void) {}
364 #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
365 static struct mtd_partition zylonite_nand_partitions[] = {
367 .name = "Bootloader",
370 .mask_flags = MTD_WRITEABLE, /* force read-only */
376 .mask_flags = MTD_WRITEABLE, /* force read-only */
379 .name = "Filesystem",
381 .size = 0x3000000, /* 48M - rootfs */
384 .name = "MassStorage",
392 .mask_flags = MTD_WRITEABLE, /* force read-only */
394 /* NOTE: we reserve some blocks at the end of the NAND flash for
395 * bad block management, and the max number of relocation blocks
396 * differs on different platforms. Please take care with it when
397 * defining the partition table.
401 static struct pxa3xx_nand_platform_data zylonite_nand_info = {
402 .parts = zylonite_nand_partitions,
403 .nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
406 static void __init zylonite_init_nand(void)
408 pxa3xx_set_nand_info(&zylonite_nand_info);
411 static inline void zylonite_init_nand(void) {}
412 #endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
414 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
415 static struct pxaohci_platform_data zylonite_ohci_info = {
416 .port_mode = PMM_PERPORT_MODE,
417 .flags = ENABLE_PORT1 | ENABLE_PORT2 |
418 POWER_CONTROL_LOW | POWER_SENSE_LOW,
421 static void __init zylonite_init_ohci(void)
423 pxa_set_ohci_info(&zylonite_ohci_info);
426 static inline void zylonite_init_ohci(void) {}
427 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
429 static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio15_table = {
430 .dev_id = "wm97xx-touch.0",
432 GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO15),
433 "touch", GPIO_ACTIVE_LOW),
438 static struct gpiod_lookup_table zylonite_wm97xx_touch_gpio26_table = {
439 .dev_id = "wm97xx-touch.0",
441 GPIO_LOOKUP("gpio-pxa", mfp_to_gpio(MFP_PIN_GPIO26),
442 "touch", GPIO_ACTIVE_LOW),
447 static void __init zylonite_init_wm97xx_touch(void)
449 if (!IS_ENABLED(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE))
453 gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio15_table);
455 gpiod_add_lookup_table(&zylonite_wm97xx_touch_gpio26_table);
458 static void __init zylonite_init(void)
460 pxa_set_ffuart_info(NULL);
461 pxa_set_btuart_info(NULL);
462 pxa_set_stuart_info(NULL);
464 /* board-processor specific initialization */
465 zylonite_pxa300_init();
466 zylonite_pxa320_init();
469 * Note: We depend that the bootloader set
470 * the correct value to MSC register for SMC91x.
472 smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq);
473 smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq);
474 platform_device_register(&smc91x_device);
476 pxa_set_ac97_info(NULL);
479 zylonite_init_keypad();
480 zylonite_init_nand();
481 zylonite_init_leds();
482 zylonite_init_ohci();
483 zylonite_init_wm97xx_touch();
486 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
487 .atag_offset = 0x100,
488 .map_io = pxa3xx_map_io,
489 .nr_irqs = ZYLONITE_NR_IRQS,
490 .init_irq = pxa3xx_init_irq,
491 .handle_irq = pxa3xx_handle_irq,
492 .init_time = pxa_timer_init,
493 .init_machine = zylonite_init,
494 .restart = pxa_restart,