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 <asm/hardware.h>
27 #include <asm/arch/audio.h>
28 #include <asm/arch/gpio.h>
29 #include <asm/arch/pxafb.h>
30 #include <asm/arch/zylonite.h>
31 #include <asm/arch/mmc.h>
32 #include <asm/arch/pxa27x_keypad.h>
33 #include <asm/arch/pxa3xx_nand.h>
39 struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
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 platform_pwm_backlight_data zylonite_backlight_data = {
117 .max_brightness = 100,
118 .dft_brightness = 100,
119 .pwm_period_ns = 10000,
122 static struct platform_device zylonite_backlight_device = {
123 .name = "pwm-backlight",
125 .parent = &pxa27x_device_pwm1.dev,
126 .platform_data = &zylonite_backlight_data,
130 static struct pxafb_mode_info toshiba_ltm035a776c_mode = {
141 .sync = FB_SYNC_VERT_HIGH_ACT,
144 static struct pxafb_mode_info toshiba_ltm04c380k_mode = {
155 .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
158 static struct pxafb_mach_info zylonite_toshiba_lcd_info = {
160 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
163 static struct pxafb_mode_info sharp_ls037_modes[] = {
192 static struct pxafb_mach_info zylonite_sharp_lcd_info = {
193 .modes = sharp_ls037_modes,
195 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
198 static void __init zylonite_init_lcd(void)
200 platform_device_register(&zylonite_backlight_device);
203 set_pxa_fb_info(&zylonite_sharp_lcd_info);
207 /* legacy LCD panels, it would be handy here if LCD panel type can
208 * be decided at run-time
211 zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode;
213 zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode;
215 set_pxa_fb_info(&zylonite_toshiba_lcd_info);
218 static inline void zylonite_init_lcd(void) {}
221 #if defined(CONFIG_MMC)
222 static int zylonite_mci_ro(struct device *dev)
224 struct platform_device *pdev = to_platform_device(dev);
226 return gpio_get_value(zylonite_mmc_slot[pdev->id].gpio_wp);
229 static int zylonite_mci_init(struct device *dev,
230 irq_handler_t zylonite_detect_int,
233 struct platform_device *pdev = to_platform_device(dev);
234 int err, cd_irq, gpio_cd, gpio_wp;
236 cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd);
237 gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd;
238 gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp;
241 * setup GPIO for Zylonite MMC controller
243 err = gpio_request(gpio_cd, "mmc card detect");
246 gpio_direction_input(gpio_cd);
248 err = gpio_request(gpio_wp, "mmc write protect");
251 gpio_direction_input(gpio_wp);
253 err = request_irq(cd_irq, zylonite_detect_int,
254 IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
255 "MMC card detect", data);
257 printk(KERN_ERR "%s: MMC/SD/SDIO: "
258 "can't request card detect IRQ\n", __func__);
259 goto err_request_irq;
272 static void zylonite_mci_exit(struct device *dev, void *data)
274 struct platform_device *pdev = to_platform_device(dev);
275 int cd_irq, gpio_cd, gpio_wp;
277 cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd);
278 gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd;
279 gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp;
281 free_irq(cd_irq, data);
286 static struct pxamci_platform_data zylonite_mci_platform_data = {
288 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
289 .init = zylonite_mci_init,
290 .exit = zylonite_mci_exit,
291 .get_ro = zylonite_mci_ro,
294 static struct pxamci_platform_data zylonite_mci2_platform_data = {
296 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
299 static void __init zylonite_init_mmc(void)
301 pxa_set_mci_info(&zylonite_mci_platform_data);
302 pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
304 pxa3xx_set_mci3_info(&zylonite_mci_platform_data);
307 static inline void zylonite_init_mmc(void) {}
310 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
311 static unsigned int zylonite_matrix_key_map[] = {
312 /* KEY(row, col, key_code) */
313 KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
314 KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
315 KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
316 KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
317 KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
318 KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
319 KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
321 KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
322 KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
323 KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
325 KEY(4, 5, KEY_SPACE),
326 KEY(5, 3, KEY_KPASTERISK), /* * */
327 KEY(5, 4, KEY_KPDOT), /* #" */
332 KEY(3, 7, KEY_RIGHT),
335 KEY(6, 4, KEY_DELETE),
337 KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
339 KEY(4, 6, KEY_ENTER), /* scroll push */
340 KEY(5, 7, KEY_ENTER), /* keypad action */
342 KEY(0, 4, KEY_EMAIL),
344 KEY(4, 0, KEY_CALENDAR),
345 KEY(7, 6, KEY_RECORD),
346 KEY(6, 7, KEY_VOLUMEUP),
347 KEY(7, 7, KEY_VOLUMEDOWN),
349 KEY(0, 6, KEY_F22), /* soft1 */
350 KEY(1, 6, KEY_F23), /* soft2 */
351 KEY(0, 3, KEY_AUX), /* contact */
354 static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
355 .matrix_key_rows = 8,
356 .matrix_key_cols = 8,
357 .matrix_key_map = zylonite_matrix_key_map,
358 .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map),
361 .rotary0_up_key = KEY_UP,
362 .rotary0_down_key = KEY_DOWN,
364 .debounce_interval = 30,
367 static void __init zylonite_init_keypad(void)
369 pxa_set_keypad_info(&zylonite_keypad_info);
372 static inline void zylonite_init_keypad(void) {}
375 #if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE)
376 static struct mtd_partition zylonite_nand_partitions[] = {
378 .name = "Bootloader",
381 .mask_flags = MTD_WRITEABLE, /* force read-only */
387 .mask_flags = MTD_WRITEABLE, /* force read-only */
390 .name = "Filesystem",
392 .size = 0x3000000, /* 48M - rootfs */
395 .name = "MassStorage",
403 .mask_flags = MTD_WRITEABLE, /* force read-only */
405 /* NOTE: we reserve some blocks at the end of the NAND flash for
406 * bad block management, and the max number of relocation blocks
407 * differs on different platforms. Please take care with it when
408 * defining the partition table.
412 static struct pxa3xx_nand_platform_data zylonite_nand_info = {
414 .parts = zylonite_nand_partitions,
415 .nr_parts = ARRAY_SIZE(zylonite_nand_partitions),
418 static void __init zylonite_init_nand(void)
420 pxa3xx_set_nand_info(&zylonite_nand_info);
423 static inline void zylonite_init_nand(void) {}
424 #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */
426 static void __init zylonite_init(void)
428 /* board-processor specific initialization */
429 zylonite_pxa300_init();
430 zylonite_pxa320_init();
433 * Note: We depend that the bootloader set
434 * the correct value to MSC register for SMC91x.
436 smc91x_resources[1].start = gpio_to_irq(gpio_eth_irq);
437 smc91x_resources[1].end = gpio_to_irq(gpio_eth_irq);
438 platform_device_register(&smc91x_device);
440 pxa_set_ac97_info(NULL);
443 zylonite_init_keypad();
444 zylonite_init_nand();
445 zylonite_init_leds();
448 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
449 .phys_io = 0x40000000,
450 .boot_params = 0xa0000100,
451 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
452 .map_io = pxa_map_io,
453 .init_irq = pxa3xx_init_irq,
455 .init_machine = zylonite_init,