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/init.h>
20 #include <linux/platform_device.h>
21 #include <linux/pwm_backlight.h>
22 #include <linux/smc91x.h>
24 #include <asm/mach-types.h>
25 #include <asm/mach/arch.h>
26 #include <mach/hardware.h>
27 #include <mach/audio.h>
28 #include <mach/gpio.h>
29 #include <mach/pxafb.h>
30 #include <mach/zylonite.h>
32 #include <mach/ohci.h>
33 #include <mach/pxa27x_keypad.h>
34 #include <mach/pxa3xx_nand.h>
40 struct platform_mmc_slot zylonite_mmc_slot
[MAX_SLOTS
];
51 static struct resource smc91x_resources
[] = {
53 .start
= ZYLONITE_ETH_PHYS
+ 0x300,
54 .end
= ZYLONITE_ETH_PHYS
+ 0xfffff,
55 .flags
= IORESOURCE_MEM
,
58 .start
= -1, /* for run-time assignment */
60 .flags
= IORESOURCE_IRQ
| IORESOURCE_IRQ_HIGHEDGE
,
64 static struct smc91x_platdata zylonite_smc91x_info
= {
65 .flags
= SMC91X_USE_8BIT
| SMC91X_USE_16BIT
|
66 SMC91X_NOWAIT
| SMC91X_USE_DMA
,
69 static struct platform_device smc91x_device
= {
72 .num_resources
= ARRAY_SIZE(smc91x_resources
),
73 .resource
= smc91x_resources
,
75 .platform_data
= &zylonite_smc91x_info
,
79 #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
80 static struct gpio_led zylonite_debug_leds
[] = {
82 .name
= "zylonite:yellow:1",
83 .default_trigger
= "heartbeat",
86 .name
= "zylonite:yellow:2",
87 .default_trigger
= "default-on",
91 static struct gpio_led_platform_data zylonite_debug_leds_info
= {
92 .leds
= zylonite_debug_leds
,
93 .num_leds
= ARRAY_SIZE(zylonite_debug_leds
),
96 static struct platform_device zylonite_device_leds
= {
100 .platform_data
= &zylonite_debug_leds_info
,
104 static void __init
zylonite_init_leds(void)
106 zylonite_debug_leds
[0].gpio
= gpio_debug_led1
;
107 zylonite_debug_leds
[1].gpio
= gpio_debug_led2
;
109 platform_device_register(&zylonite_device_leds
);
112 static inline void zylonite_init_leds(void) {}
115 #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
116 static struct platform_pwm_backlight_data zylonite_backlight_data
= {
118 .max_brightness
= 100,
119 .dft_brightness
= 100,
120 .pwm_period_ns
= 10000,
123 static struct platform_device zylonite_backlight_device
= {
124 .name
= "pwm-backlight",
126 .parent
= &pxa27x_device_pwm1
.dev
,
127 .platform_data
= &zylonite_backlight_data
,
131 static struct pxafb_mode_info toshiba_ltm035a776c_mode
= {
142 .sync
= FB_SYNC_VERT_HIGH_ACT
,
145 static struct pxafb_mode_info toshiba_ltm04c380k_mode
= {
156 .sync
= FB_SYNC_HOR_HIGH_ACT
|FB_SYNC_VERT_HIGH_ACT
,
159 static struct pxafb_mach_info zylonite_toshiba_lcd_info
= {
161 .lcd_conn
= LCD_COLOR_TFT_16BPP
| LCD_PCLK_EDGE_FALL
,
164 static struct pxafb_mode_info sharp_ls037_modes
[] = {
193 static struct pxafb_mach_info zylonite_sharp_lcd_info
= {
194 .modes
= sharp_ls037_modes
,
196 .lcd_conn
= LCD_COLOR_TFT_16BPP
| LCD_PCLK_EDGE_FALL
,
199 static void __init
zylonite_init_lcd(void)
201 platform_device_register(&zylonite_backlight_device
);
204 set_pxa_fb_info(&zylonite_sharp_lcd_info
);
208 /* legacy LCD panels, it would be handy here if LCD panel type can
209 * be decided at run-time
212 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm035a776c_mode
;
214 zylonite_toshiba_lcd_info
.modes
= &toshiba_ltm04c380k_mode
;
216 set_pxa_fb_info(&zylonite_toshiba_lcd_info
);
219 static inline void zylonite_init_lcd(void) {}
222 #if defined(CONFIG_MMC)
223 static int zylonite_mci_ro(struct device
*dev
)
225 struct platform_device
*pdev
= to_platform_device(dev
);
227 return gpio_get_value(zylonite_mmc_slot
[pdev
->id
].gpio_wp
);
230 static int zylonite_mci_init(struct device
*dev
,
231 irq_handler_t zylonite_detect_int
,
234 struct platform_device
*pdev
= to_platform_device(dev
);
235 int err
, cd_irq
, gpio_cd
, gpio_wp
;
237 cd_irq
= gpio_to_irq(zylonite_mmc_slot
[pdev
->id
].gpio_cd
);
238 gpio_cd
= zylonite_mmc_slot
[pdev
->id
].gpio_cd
;
239 gpio_wp
= zylonite_mmc_slot
[pdev
->id
].gpio_wp
;
242 * setup GPIO for Zylonite MMC controller
244 err
= gpio_request(gpio_cd
, "mmc card detect");
247 gpio_direction_input(gpio_cd
);
249 err
= gpio_request(gpio_wp
, "mmc write protect");
252 gpio_direction_input(gpio_wp
);
254 err
= request_irq(cd_irq
, zylonite_detect_int
,
255 IRQF_TRIGGER_RISING
| IRQF_TRIGGER_FALLING
,
256 "MMC card detect", data
);
258 printk(KERN_ERR
"%s: MMC/SD/SDIO: "
259 "can't request card detect IRQ\n", __func__
);
260 goto err_request_irq
;
273 static void zylonite_mci_exit(struct device
*dev
, void *data
)
275 struct platform_device
*pdev
= to_platform_device(dev
);
276 int cd_irq
, gpio_cd
, gpio_wp
;
278 cd_irq
= gpio_to_irq(zylonite_mmc_slot
[pdev
->id
].gpio_cd
);
279 gpio_cd
= zylonite_mmc_slot
[pdev
->id
].gpio_cd
;
280 gpio_wp
= zylonite_mmc_slot
[pdev
->id
].gpio_wp
;
282 free_irq(cd_irq
, data
);
287 static struct pxamci_platform_data zylonite_mci_platform_data
= {
289 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
290 .init
= zylonite_mci_init
,
291 .exit
= zylonite_mci_exit
,
292 .get_ro
= zylonite_mci_ro
,
295 static struct pxamci_platform_data zylonite_mci2_platform_data
= {
297 .ocr_mask
= MMC_VDD_32_33
|MMC_VDD_33_34
,
300 static void __init
zylonite_init_mmc(void)
302 pxa_set_mci_info(&zylonite_mci_platform_data
);
303 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data
);
305 pxa3xx_set_mci3_info(&zylonite_mci_platform_data
);
308 static inline void zylonite_init_mmc(void) {}
311 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
312 static unsigned int zylonite_matrix_key_map
[] = {
313 /* KEY(row, col, key_code) */
314 KEY(0, 0, KEY_A
), KEY(0, 1, KEY_B
), KEY(0, 2, KEY_C
), KEY(0, 5, KEY_D
),
315 KEY(1, 0, KEY_E
), KEY(1, 1, KEY_F
), KEY(1, 2, KEY_G
), KEY(1, 5, KEY_H
),
316 KEY(2, 0, KEY_I
), KEY(2, 1, KEY_J
), KEY(2, 2, KEY_K
), KEY(2, 5, KEY_L
),
317 KEY(3, 0, KEY_M
), KEY(3, 1, KEY_N
), KEY(3, 2, KEY_O
), KEY(3, 5, KEY_P
),
318 KEY(5, 0, KEY_Q
), KEY(5, 1, KEY_R
), KEY(5, 2, KEY_S
), KEY(5, 5, KEY_T
),
319 KEY(6, 0, KEY_U
), KEY(6, 1, KEY_V
), KEY(6, 2, KEY_W
), KEY(6, 5, KEY_X
),
320 KEY(7, 1, KEY_Y
), KEY(7, 2, KEY_Z
),
322 KEY(4, 4, KEY_0
), KEY(1, 3, KEY_1
), KEY(4, 1, KEY_2
), KEY(1, 4, KEY_3
),
323 KEY(2, 3, KEY_4
), KEY(4, 2, KEY_5
), KEY(2, 4, KEY_6
), KEY(3, 3, KEY_7
),
324 KEY(4, 3, KEY_8
), KEY(3, 4, KEY_9
),
326 KEY(4, 5, KEY_SPACE
),
327 KEY(5, 3, KEY_KPASTERISK
), /* * */
328 KEY(5, 4, KEY_KPDOT
), /* #" */
333 KEY(3, 7, KEY_RIGHT
),
336 KEY(6, 4, KEY_DELETE
),
338 KEY(6, 3, KEY_CAPSLOCK
), /* KEY_LEFTSHIFT), */
340 KEY(4, 6, KEY_ENTER
), /* scroll push */
341 KEY(5, 7, KEY_ENTER
), /* keypad action */
343 KEY(0, 4, KEY_EMAIL
),
345 KEY(4, 0, KEY_CALENDAR
),
346 KEY(7, 6, KEY_RECORD
),
347 KEY(6, 7, KEY_VOLUMEUP
),
348 KEY(7, 7, KEY_VOLUMEDOWN
),
350 KEY(0, 6, KEY_F22
), /* soft1 */
351 KEY(1, 6, KEY_F23
), /* soft2 */
352 KEY(0, 3, KEY_AUX
), /* contact */
355 static struct pxa27x_keypad_platform_data zylonite_keypad_info
= {
356 .matrix_key_rows
= 8,
357 .matrix_key_cols
= 8,
358 .matrix_key_map
= zylonite_matrix_key_map
,
359 .matrix_key_map_size
= ARRAY_SIZE(zylonite_matrix_key_map
),
362 .rotary0_up_key
= KEY_UP
,
363 .rotary0_down_key
= KEY_DOWN
,
365 .debounce_interval
= 30,
368 static void __init
zylonite_init_keypad(void)
370 pxa_set_keypad_info(&zylonite_keypad_info
);
373 static inline void zylonite_init_keypad(void) {}
376 #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
377 static struct mtd_partition zylonite_nand_partitions
[] = {
379 .name
= "Bootloader",
382 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
388 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
391 .name
= "Filesystem",
393 .size
= 0x3000000, /* 48M - rootfs */
396 .name
= "MassStorage",
404 .mask_flags
= MTD_WRITEABLE
, /* force read-only */
406 /* NOTE: we reserve some blocks at the end of the NAND flash for
407 * bad block management, and the max number of relocation blocks
408 * differs on different platforms. Please take care with it when
409 * defining the partition table.
413 static struct pxa3xx_nand_platform_data zylonite_nand_info
= {
415 .parts
= zylonite_nand_partitions
,
416 .nr_parts
= ARRAY_SIZE(zylonite_nand_partitions
),
419 static void __init
zylonite_init_nand(void)
421 pxa3xx_set_nand_info(&zylonite_nand_info
);
424 static inline void zylonite_init_nand(void) {}
425 #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
427 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
428 static struct pxaohci_platform_data zylonite_ohci_info
= {
429 .port_mode
= PMM_PERPORT_MODE
,
430 .flags
= ENABLE_PORT1
| ENABLE_PORT2
|
431 POWER_CONTROL_LOW
| POWER_SENSE_LOW
,
434 static void __init
zylonite_init_ohci(void)
436 pxa_set_ohci_info(&zylonite_ohci_info
);
439 static inline void zylonite_init_ohci(void) {}
440 #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */
442 static void __init
zylonite_init(void)
444 /* board-processor specific initialization */
445 zylonite_pxa300_init();
446 zylonite_pxa320_init();
449 * Note: We depend that the bootloader set
450 * the correct value to MSC register for SMC91x.
452 smc91x_resources
[1].start
= gpio_to_irq(gpio_eth_irq
);
453 smc91x_resources
[1].end
= gpio_to_irq(gpio_eth_irq
);
454 platform_device_register(&smc91x_device
);
456 pxa_set_ac97_info(NULL
);
459 zylonite_init_keypad();
460 zylonite_init_nand();
461 zylonite_init_leds();
462 zylonite_init_ohci();
465 MACHINE_START(ZYLONITE
, "PXA3xx Platform Development Kit (aka Zylonite)")
466 .phys_io
= 0x40000000,
467 .boot_params
= 0xa0000100,
468 .io_pg_offst
= (io_p2v(0x40000000) >> 18) & 0xfffc,
469 .map_io
= pxa_map_io
,
470 .init_irq
= pxa3xx_init_irq
,
472 .init_machine
= zylonite_init
,