2 * linux/arch/arm/mach-pxa/zylonite.c
4 * Support for the PXA3xx Development Platform (aka Zylonite)
6 * Copyright (C) 2006 Marvell International Ltd.
8 * 2007-09-04: eric miao <eric.miao@marvell.com>
9 * rewrite to align with latest kernel
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
16 #include <linux/module.h>
17 #include <linux/kernel.h>
18 #include <linux/interrupt.h>
19 #include <linux/leds.h>
20 #include <linux/init.h>
21 #include <linux/platform_device.h>
22 #include <linux/gpio/machine.h>
23 #include <linux/pwm.h>
24 #include <linux/pwm_backlight.h>
25 #include <linux/smc91x.h>
27 #include <asm/mach-types.h>
28 #include <asm/mach/arch.h>
30 #include <mach/audio.h>
31 #include <linux/platform_data/video-pxafb.h>
33 #include <linux/platform_data/mmc-pxamci.h>
34 #include <linux/platform_data/usb-ohci-pxa27x.h>
35 #include <linux/platform_data/keypad-pxa27x.h>
36 #include <linux/platform_data/mtd-nand-pxa3xx.h>
50 static struct resource smc91x_resources
[] = {
52 .start
= ZYLONITE_ETH_PHYS
+ 0x300,
53 .end
= ZYLONITE_ETH_PHYS
+ 0xfffff,
54 .flags
= IORESOURCE_MEM
,
57 .start
= -1, /* for run-time assignment */
59 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
63 static struct smc91x_platdata zylonite_smc91x_info
= {
64 .flags
= SMC91X_USE_8BIT
| SMC91X_USE_16BIT
|
65 SMC91X_NOWAIT
| SMC91X_USE_DMA
,
68 static struct platform_device smc91x_device
= {
71 .num_resources
= ARRAY_SIZE(smc91x_resources
),
72 .resource
= smc91x_resources
,
74 .platform_data
= &zylonite_smc91x_info
,
78 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
79 static struct gpio_led zylonite_debug_leds
[] = {
81 .name
= "zylonite:yellow:1",
82 .default_trigger
= "heartbeat",
85 .name
= "zylonite:yellow:2",
86 .default_trigger
= "default-on",
90 static struct gpio_led_platform_data zylonite_debug_leds_info
= {
91 .leds
= zylonite_debug_leds
,
92 .num_leds
= ARRAY_SIZE(zylonite_debug_leds
),
95 static struct platform_device zylonite_device_leds
= {
99 .platform_data
= &zylonite_debug_leds_info
,
103 static void __init
zylonite_init_leds(void)
105 zylonite_debug_leds
[0].gpio
= gpio_debug_led1
;
106 zylonite_debug_leds
[1].gpio
= gpio_debug_led2
;
108 platform_device_register(&zylonite_device_leds
);
111 static inline void zylonite_init_leds(void) {}
114 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
115 static struct pwm_lookup zylonite_pwm_lookup
[] = {
116 PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL
, 10000,
117 PWM_POLARITY_NORMAL
),
120 static struct platform_pwm_backlight_data zylonite_backlight_data
= {
121 .max_brightness
= 100,
122 .dft_brightness
= 100,
126 static struct platform_device zylonite_backlight_device
= {
127 .name
= "pwm-backlight",
129 .parent
= &pxa27x_device_pwm1
.dev
,
130 .platform_data
= &zylonite_backlight_data
,
134 static struct pxafb_mode_info toshiba_ltm035a776c_mode
= {
145 .sync
= FB_SYNC_VERT_HIGH_ACT
,
148 static struct pxafb_mode_info toshiba_ltm04c380k_mode
= {
159 .sync
= FB_SYNC_HOR_HIGH_ACT
|FB_SYNC_VERT_HIGH_ACT
,
162 static struct pxafb_mach_info zylonite_toshiba_lcd_info
= {
164 .lcd_conn
= LCD_COLOR_TFT_16BPP
| LCD_PCLK_EDGE_FALL
,
167 static struct pxafb_mode_info sharp_ls037_modes
[] = {
196 static struct pxafb_mach_info zylonite_sharp_lcd_info
= {
197 .modes
= sharp_ls037_modes
,
199 .lcd_conn
= LCD_COLOR_TFT_16BPP
| LCD_PCLK_EDGE_FALL
,
202 static void __init
zylonite_init_lcd(void)
204 pwm_add_table(zylonite_pwm_lookup
, ARRAY_SIZE(zylonite_pwm_lookup
));
205 platform_device_register(&zylonite_backlight_device
);
208 pxa_set_fb_info(NULL
, &zylonite_sharp_lcd_info
);
212 /* legacy LCD panels, it would be handy here if LCD panel type can
213 * be decided at run-time
216 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm035a776c_mode
;
218 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm04c380k_mode
;
220 pxa_set_fb_info(NULL
, &zylonite_toshiba_lcd_info
);
223 static inline void zylonite_init_lcd(void) {}
226 #if defined(CONFIG_MMC)
227 static struct pxamci_platform_data zylonite_mci_platform_data
= {
228 .detect_delay_ms
= 200,
229 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
232 #define PCA9539A_MCI_CD 0
233 #define PCA9539A_MCI1_CD 1
234 #define PCA9539A_MCI_WP 2
235 #define PCA9539A_MCI1_WP 3
236 #define PCA9539A_MCI3_CD 30
237 #define PCA9539A_MCI3_WP 31
239 static struct gpiod_lookup_table zylonite_mci_gpio_table
= {
240 .dev_id
= "pxa2xx-mci.0",
242 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_CD
,
243 "cd", GPIO_ACTIVE_LOW
),
244 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI_WP
,
245 "wp", GPIO_ACTIVE_LOW
),
250 static struct pxamci_platform_data zylonite_mci2_platform_data
= {
251 .detect_delay_ms
= 200,
252 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
255 static struct gpiod_lookup_table zylonite_mci2_gpio_table
= {
256 .dev_id
= "pxa2xx-mci.1",
258 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_CD
,
259 "cd", GPIO_ACTIVE_LOW
),
260 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI1_WP
,
261 "wp", GPIO_ACTIVE_LOW
),
266 static struct pxamci_platform_data zylonite_mci3_platform_data
= {
267 .detect_delay_ms
= 200,
268 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
271 static struct gpiod_lookup_table zylonite_mci3_gpio_table
= {
272 .dev_id
= "pxa2xx-mci.2",
274 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_CD
,
275 "cd", GPIO_ACTIVE_LOW
),
276 GPIO_LOOKUP("i2c-pca9539-a", PCA9539A_MCI3_WP
,
277 "wp", GPIO_ACTIVE_LOW
),
282 static void __init
zylonite_init_mmc(void)
284 gpiod_add_lookup_table(&zylonite_mci_gpio_table
);
285 pxa_set_mci_info(&zylonite_mci_platform_data
);
286 gpiod_add_lookup_table(&zylonite_mci2_gpio_table
);
287 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data
);
288 if (cpu_is_pxa310()) {
289 gpiod_add_lookup_table(&zylonite_mci3_gpio_table
);
290 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data
);
294 static inline void zylonite_init_mmc(void) {}
297 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
298 static const unsigned int zylonite_matrix_key_map
[] = {
299 /* KEY(row, col, key_code) */
300 KEY(0, 0, KEY_A
), KEY(0, 1, KEY_B
), KEY(0, 2, KEY_C
), KEY(0, 5, KEY_D
),
301 KEY(1, 0, KEY_E
), KEY(1, 1, KEY_F
), KEY(1, 2, KEY_G
), KEY(1, 5, KEY_H
),
302 KEY(2, 0, KEY_I
), KEY(2, 1, KEY_J
), KEY(2, 2, KEY_K
), KEY(2, 5, KEY_L
),
303 KEY(3, 0, KEY_M
), KEY(3, 1, KEY_N
), KEY(3, 2, KEY_O
), KEY(3, 5, KEY_P
),
304 KEY(5, 0, KEY_Q
), KEY(5, 1, KEY_R
), KEY(5, 2, KEY_S
), KEY(5, 5, KEY_T
),
305 KEY(6, 0, KEY_U
), KEY(6, 1, KEY_V
), KEY(6, 2, KEY_W
), KEY(6, 5, KEY_X
),
306 KEY(7, 1, KEY_Y
), KEY(7, 2, KEY_Z
),
308 KEY(4, 4, KEY_0
), KEY(1, 3, KEY_1
), KEY(4, 1, KEY_2
), KEY(1, 4, KEY_3
),
309 KEY(2, 3, KEY_4
), KEY(4, 2, KEY_5
), KEY(2, 4, KEY_6
), KEY(3, 3, KEY_7
),
310 KEY(4, 3, KEY_8
), KEY(3, 4, KEY_9
),
312 KEY(4, 5, KEY_SPACE
),
313 KEY(5, 3, KEY_KPASTERISK
), /* * */
314 KEY(5, 4, KEY_KPDOT
), /* #" */
319 KEY(3, 7, KEY_RIGHT
),
322 KEY(6, 4, KEY_DELETE
),
324 KEY(6, 3, KEY_CAPSLOCK
), /* KEY_LEFTSHIFT), */
326 KEY(4, 6, KEY_ENTER
), /* scroll push */
327 KEY(5, 7, KEY_ENTER
), /* keypad action */
329 KEY(0, 4, KEY_EMAIL
),
331 KEY(4, 0, KEY_CALENDAR
),
332 KEY(7, 6, KEY_RECORD
),
333 KEY(6, 7, KEY_VOLUMEUP
),
334 KEY(7, 7, KEY_VOLUMEDOWN
),
336 KEY(0, 6, KEY_F22
), /* soft1 */
337 KEY(1, 6, KEY_F23
), /* soft2 */
338 KEY(0, 3, KEY_AUX
), /* contact */
341 static struct matrix_keymap_data zylonite_matrix_keymap_data
= {
342 .keymap
= zylonite_matrix_key_map
,
343 .keymap_size
= ARRAY_SIZE(zylonite_matrix_key_map
),
346 static struct pxa27x_keypad_platform_data zylonite_keypad_info
= {
347 .matrix_key_rows
= 8,
348 .matrix_key_cols
= 8,
349 .matrix_keymap_data
= &zylonite_matrix_keymap_data
,
352 .rotary0_up_key
= KEY_UP
,
353 .rotary0_down_key
= KEY_DOWN
,
355 .debounce_interval
= 30,
358 static void __init
zylonite_init_keypad(void)
360 pxa_set_keypad_info(&zylonite_keypad_info
);
363 static inline void zylonite_init_keypad(void) {}
366 #if IS_ENABLED(CONFIG_MTD_NAND_MARVELL)
367 static struct mtd_partition zylonite_nand_partitions
[] = {
369 .name
= "Bootloader",
372 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
378 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
381 .name
= "Filesystem",
383 .size
= 0x3000000, /* 48M - rootfs */
386 .name
= "MassStorage",
394 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
396 /* NOTE: we reserve some blocks at the end of the NAND flash for
397 * bad block management, and the max number of relocation blocks
398 * differs on different platforms. Please take care with it when
399 * defining the partition table.
403 static struct pxa3xx_nand_platform_data zylonite_nand_info
= {
404 .parts
= zylonite_nand_partitions
,
405 .nr_parts
= ARRAY_SIZE(zylonite_nand_partitions
),
408 static void __init
zylonite_init_nand(void)
410 pxa3xx_set_nand_info(&zylonite_nand_info
);
413 static inline void zylonite_init_nand(void) {}
414 #endif /* IS_ENABLED(CONFIG_MTD_NAND_MARVELL) */
416 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
417 static struct pxaohci_platform_data zylonite_ohci_info
= {
418 .port_mode
= PMM_PERPORT_MODE
,
419 .flags
= ENABLE_PORT1
| ENABLE_PORT2
|
420 POWER_CONTROL_LOW
| POWER_SENSE_LOW
,
423 static void __init
zylonite_init_ohci(void)
425 pxa_set_ohci_info(&zylonite_ohci_info
);
428 static inline void zylonite_init_ohci(void) {}
429 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
431 static void __init
zylonite_init(void)
433 pxa_set_ffuart_info(NULL
);
434 pxa_set_btuart_info(NULL
);
435 pxa_set_stuart_info(NULL
);
437 /* board-processor specific initialization */
438 zylonite_pxa300_init();
439 zylonite_pxa320_init();
442 * Note: We depend that the bootloader set
443 * the correct value to MSC register for SMC91x.
445 smc91x_resources
[1].start
= PXA_GPIO_TO_IRQ(gpio_eth_irq
);
446 smc91x_resources
[1].end
= PXA_GPIO_TO_IRQ(gpio_eth_irq
);
447 platform_device_register(&smc91x_device
);
449 pxa_set_ac97_info(NULL
);
452 zylonite_init_keypad();
453 zylonite_init_nand();
454 zylonite_init_leds();
455 zylonite_init_ohci();
458 MACHINE_START(ZYLONITE
, "PXA3xx Platform Development Kit (aka Zylonite)")
459 .atag_offset
= 0x100,
460 .map_io
= pxa3xx_map_io
,
461 .nr_irqs
= ZYLONITE_NR_IRQS
,
462 .init_irq
= pxa3xx_init_irq
,
463 .handle_irq
= pxa3xx_handle_irq
,
464 .init_time
= pxa_timer_init
,
465 .init_machine
= zylonite_init
,
466 .restart
= pxa_restart
,