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.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 struct platform_device pxa_device_wm9713_audio
= {
51 .name
= "wm9713-codec",
55 static void __init
zylonite_init_wm9713_audio(void)
57 platform_device_register(&pxa_device_wm9713_audio
);
60 static struct resource smc91x_resources
[] = {
62 .start
= ZYLONITE_ETH_PHYS
+ 0x300,
63 .end
= ZYLONITE_ETH_PHYS
+ 0xfffff,
64 .flags
= IORESOURCE_MEM
,
67 .start
= -1, /* for run-time assignment */
69 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
73 static struct smc91x_platdata zylonite_smc91x_info
= {
74 .flags
= SMC91X_USE_8BIT
| SMC91X_USE_16BIT
|
75 SMC91X_NOWAIT
| SMC91X_USE_DMA
,
78 static struct platform_device smc91x_device
= {
81 .num_resources
= ARRAY_SIZE(smc91x_resources
),
82 .resource
= smc91x_resources
,
84 .platform_data
= &zylonite_smc91x_info
,
88 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
89 static struct gpio_led zylonite_debug_leds
[] = {
91 .name
= "zylonite:yellow:1",
92 .default_trigger
= "heartbeat",
95 .name
= "zylonite:yellow:2",
96 .default_trigger
= "default-on",
100 static struct gpio_led_platform_data zylonite_debug_leds_info
= {
101 .leds
= zylonite_debug_leds
,
102 .num_leds
= ARRAY_SIZE(zylonite_debug_leds
),
105 static struct platform_device zylonite_device_leds
= {
109 .platform_data
= &zylonite_debug_leds_info
,
113 static void __init
zylonite_init_leds(void)
115 zylonite_debug_leds
[0].gpio
= gpio_debug_led1
;
116 zylonite_debug_leds
[1].gpio
= gpio_debug_led2
;
118 platform_device_register(&zylonite_device_leds
);
121 static inline void zylonite_init_leds(void) {}
124 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
125 static struct pwm_lookup zylonite_pwm_lookup
[] = {
126 PWM_LOOKUP("pxa27x-pwm.1", 1, "pwm-backlight.0", NULL
, 10000,
127 PWM_POLARITY_NORMAL
),
130 static struct platform_pwm_backlight_data zylonite_backlight_data
= {
131 .max_brightness
= 100,
132 .dft_brightness
= 100,
136 static struct platform_device zylonite_backlight_device
= {
137 .name
= "pwm-backlight",
139 .parent
= &pxa27x_device_pwm1
.dev
,
140 .platform_data
= &zylonite_backlight_data
,
144 static struct pxafb_mode_info toshiba_ltm035a776c_mode
= {
155 .sync
= FB_SYNC_VERT_HIGH_ACT
,
158 static struct pxafb_mode_info toshiba_ltm04c380k_mode
= {
169 .sync
= FB_SYNC_HOR_HIGH_ACT
|FB_SYNC_VERT_HIGH_ACT
,
172 static struct pxafb_mach_info zylonite_toshiba_lcd_info
= {
174 .lcd_conn
= LCD_COLOR_TFT_16BPP
| LCD_PCLK_EDGE_FALL
,
177 static struct pxafb_mode_info sharp_ls037_modes
[] = {
206 static struct pxafb_mach_info zylonite_sharp_lcd_info
= {
207 .modes
= sharp_ls037_modes
,
209 .lcd_conn
= LCD_COLOR_TFT_16BPP
| LCD_PCLK_EDGE_FALL
,
212 static void __init
zylonite_init_lcd(void)
214 pwm_add_table(zylonite_pwm_lookup
, ARRAY_SIZE(zylonite_pwm_lookup
));
215 platform_device_register(&zylonite_backlight_device
);
218 pxa_set_fb_info(NULL
, &zylonite_sharp_lcd_info
);
222 /* legacy LCD panels, it would be handy here if LCD panel type can
223 * be decided at run-time
226 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm035a776c_mode
;
228 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm04c380k_mode
;
230 pxa_set_fb_info(NULL
, &zylonite_toshiba_lcd_info
);
233 static inline void zylonite_init_lcd(void) {}
236 #if defined(CONFIG_MMC)
237 static struct pxamci_platform_data zylonite_mci_platform_data
= {
238 .detect_delay_ms
= 200,
239 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
240 .gpio_card_detect
= EXT_GPIO(0),
241 .gpio_card_ro
= EXT_GPIO(2),
245 static struct pxamci_platform_data zylonite_mci2_platform_data
= {
246 .detect_delay_ms
= 200,
247 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
248 .gpio_card_detect
= EXT_GPIO(1),
249 .gpio_card_ro
= EXT_GPIO(3),
253 static struct pxamci_platform_data zylonite_mci3_platform_data
= {
254 .detect_delay_ms
= 200,
255 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
256 .gpio_card_detect
= EXT_GPIO(30),
257 .gpio_card_ro
= EXT_GPIO(31),
261 static void __init
zylonite_init_mmc(void)
263 pxa_set_mci_info(&zylonite_mci_platform_data
);
264 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data
);
266 pxa3xx_set_mci3_info(&zylonite_mci3_platform_data
);
269 static inline void zylonite_init_mmc(void) {}
272 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
273 static const unsigned int zylonite_matrix_key_map
[] = {
274 /* KEY(row, col, key_code) */
275 KEY(0, 0, KEY_A
), KEY(0, 1, KEY_B
), KEY(0, 2, KEY_C
), KEY(0, 5, KEY_D
),
276 KEY(1, 0, KEY_E
), KEY(1, 1, KEY_F
), KEY(1, 2, KEY_G
), KEY(1, 5, KEY_H
),
277 KEY(2, 0, KEY_I
), KEY(2, 1, KEY_J
), KEY(2, 2, KEY_K
), KEY(2, 5, KEY_L
),
278 KEY(3, 0, KEY_M
), KEY(3, 1, KEY_N
), KEY(3, 2, KEY_O
), KEY(3, 5, KEY_P
),
279 KEY(5, 0, KEY_Q
), KEY(5, 1, KEY_R
), KEY(5, 2, KEY_S
), KEY(5, 5, KEY_T
),
280 KEY(6, 0, KEY_U
), KEY(6, 1, KEY_V
), KEY(6, 2, KEY_W
), KEY(6, 5, KEY_X
),
281 KEY(7, 1, KEY_Y
), KEY(7, 2, KEY_Z
),
283 KEY(4, 4, KEY_0
), KEY(1, 3, KEY_1
), KEY(4, 1, KEY_2
), KEY(1, 4, KEY_3
),
284 KEY(2, 3, KEY_4
), KEY(4, 2, KEY_5
), KEY(2, 4, KEY_6
), KEY(3, 3, KEY_7
),
285 KEY(4, 3, KEY_8
), KEY(3, 4, KEY_9
),
287 KEY(4, 5, KEY_SPACE
),
288 KEY(5, 3, KEY_KPASTERISK
), /* * */
289 KEY(5, 4, KEY_KPDOT
), /* #" */
294 KEY(3, 7, KEY_RIGHT
),
297 KEY(6, 4, KEY_DELETE
),
299 KEY(6, 3, KEY_CAPSLOCK
), /* KEY_LEFTSHIFT), */
301 KEY(4, 6, KEY_ENTER
), /* scroll push */
302 KEY(5, 7, KEY_ENTER
), /* keypad action */
304 KEY(0, 4, KEY_EMAIL
),
306 KEY(4, 0, KEY_CALENDAR
),
307 KEY(7, 6, KEY_RECORD
),
308 KEY(6, 7, KEY_VOLUMEUP
),
309 KEY(7, 7, KEY_VOLUMEDOWN
),
311 KEY(0, 6, KEY_F22
), /* soft1 */
312 KEY(1, 6, KEY_F23
), /* soft2 */
313 KEY(0, 3, KEY_AUX
), /* contact */
316 static struct matrix_keymap_data zylonite_matrix_keymap_data
= {
317 .keymap
= zylonite_matrix_key_map
,
318 .keymap_size
= ARRAY_SIZE(zylonite_matrix_key_map
),
321 static struct pxa27x_keypad_platform_data zylonite_keypad_info
= {
322 .matrix_key_rows
= 8,
323 .matrix_key_cols
= 8,
324 .matrix_keymap_data
= &zylonite_matrix_keymap_data
,
327 .rotary0_up_key
= KEY_UP
,
328 .rotary0_down_key
= KEY_DOWN
,
330 .debounce_interval
= 30,
333 static void __init
zylonite_init_keypad(void)
335 pxa_set_keypad_info(&zylonite_keypad_info
);
338 static inline void zylonite_init_keypad(void) {}
341 #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
342 static struct mtd_partition zylonite_nand_partitions
[] = {
344 .name
= "Bootloader",
347 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
353 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
356 .name
= "Filesystem",
358 .size
= 0x3000000, /* 48M - rootfs */
361 .name
= "MassStorage",
369 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
371 /* NOTE: we reserve some blocks at the end of the NAND flash for
372 * bad block management, and the max number of relocation blocks
373 * differs on different platforms. Please take care with it when
374 * defining the partition table.
378 static struct pxa3xx_nand_platform_data zylonite_nand_info
= {
381 .parts
[0] = zylonite_nand_partitions
,
382 .nr_parts
[0] = ARRAY_SIZE(zylonite_nand_partitions
),
385 static void __init
zylonite_init_nand(void)
387 pxa3xx_set_nand_info(&zylonite_nand_info
);
390 static inline void zylonite_init_nand(void) {}
391 #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
393 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
394 static struct pxaohci_platform_data zylonite_ohci_info
= {
395 .port_mode
= PMM_PERPORT_MODE
,
396 .flags
= ENABLE_PORT1
| ENABLE_PORT2
|
397 POWER_CONTROL_LOW
| POWER_SENSE_LOW
,
400 static void __init
zylonite_init_ohci(void)
402 pxa_set_ohci_info(&zylonite_ohci_info
);
405 static inline void zylonite_init_ohci(void) {}
406 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
408 static void __init
zylonite_init(void)
410 pxa_set_ffuart_info(NULL
);
411 pxa_set_btuart_info(NULL
);
412 pxa_set_stuart_info(NULL
);
414 /* board-processor specific initialization */
415 zylonite_pxa300_init();
416 zylonite_pxa320_init();
419 * Note: We depend that the bootloader set
420 * the correct value to MSC register for SMC91x.
422 smc91x_resources
[1].start
= PXA_GPIO_TO_IRQ(gpio_eth_irq
);
423 smc91x_resources
[1].end
= PXA_GPIO_TO_IRQ(gpio_eth_irq
);
424 platform_device_register(&smc91x_device
);
426 pxa_set_ac97_info(NULL
);
429 zylonite_init_keypad();
430 zylonite_init_nand();
431 zylonite_init_leds();
432 zylonite_init_ohci();
433 zylonite_init_wm9713_audio();
436 MACHINE_START(ZYLONITE
, "PXA3xx Platform Development Kit (aka Zylonite)")
437 .atag_offset
= 0x100,
438 .map_io
= pxa3xx_map_io
,
439 .nr_irqs
= ZYLONITE_NR_IRQS
,
440 .init_irq
= pxa3xx_init_irq
,
441 .handle_irq
= pxa3xx_handle_irq
,
442 .init_time
= pxa_timer_init
,
443 .init_machine
= zylonite_init
,
444 .restart
= pxa_restart
,