Blame view
arch/arm/mach-pxa/zylonite.c
10.7 KB
2c8086a5d
|
1 2 3 4 5 6 7 |
/* * linux/arch/arm/mach-pxa/zylonite.c * * Support for the PXA3xx Development Platform (aka Zylonite) * * Copyright (C) 2006 Marvell International Ltd. * |
e9bba8ee6
|
8 |
* 2007-09-04: eric miao <eric.miao@marvell.com> |
2c8086a5d
|
9 10 11 12 13 14 15 16 17 18 19 20 |
* rewrite to align with latest kernel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/platform_device.h> |
80796f2a4
|
21 |
#include <linux/gpio.h> |
5cca91479
|
22 |
#include <linux/pwm_backlight.h> |
88c36eb73
|
23 |
#include <linux/smc91x.h> |
2c8086a5d
|
24 25 26 |
#include <asm/mach-types.h> #include <asm/mach/arch.h> |
ca0e687c8
|
27 |
#include <mach/pxa3xx.h> |
a09e64fbc
|
28 |
#include <mach/audio.h> |
a09e64fbc
|
29 30 31 |
#include <mach/pxafb.h> #include <mach/zylonite.h> #include <mach/mmc.h> |
7ff435356
|
32 |
#include <mach/ohci.h> |
4a2490eac
|
33 |
#include <plat/pxa27x_keypad.h> |
82b95ecb9
|
34 |
#include <plat/pxa3xx_nand.h> |
2c8086a5d
|
35 |
|
5cca91479
|
36 |
#include "devices.h" |
2c8086a5d
|
37 |
#include "generic.h" |
2c8086a5d
|
38 |
int gpio_eth_irq; |
5c9f50e90
|
39 40 |
int gpio_debug_led1; int gpio_debug_led2; |
2c8086a5d
|
41 |
|
768dec4cc
|
42 |
int wm9713_irq; |
2c8086a5d
|
43 44 |
int lcd_id; int lcd_orientation; |
f0fba2ad1
|
45 46 47 48 49 50 51 52 53 |
struct platform_device pxa_device_wm9713_audio = { .name = "wm9713-codec", .id = -1, }; static void __init zylonite_init_wm9713_audio(void) { platform_device_register(&pxa_device_wm9713_audio); } |
2c8086a5d
|
54 55 56 57 58 59 60 61 62 |
static struct resource smc91x_resources[] = { [0] = { .start = ZYLONITE_ETH_PHYS + 0x300, .end = ZYLONITE_ETH_PHYS + 0xfffff, .flags = IORESOURCE_MEM, }, [1] = { .start = -1, /* for run-time assignment */ .end = -1, |
e7b3dc7ef
|
63 |
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE, |
2c8086a5d
|
64 65 |
} }; |
88c36eb73
|
66 67 68 69 |
static struct smc91x_platdata zylonite_smc91x_info = { .flags = SMC91X_USE_8BIT | SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_USE_DMA, }; |
2c8086a5d
|
70 71 72 73 74 |
static struct platform_device smc91x_device = { .name = "smc91x", .id = 0, .num_resources = ARRAY_SIZE(smc91x_resources), .resource = smc91x_resources, |
88c36eb73
|
75 76 77 |
.dev = { .platform_data = &zylonite_smc91x_info, }, |
2c8086a5d
|
78 |
}; |
5c9f50e90
|
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) static struct gpio_led zylonite_debug_leds[] = { [0] = { .name = "zylonite:yellow:1", .default_trigger = "heartbeat", }, [1] = { .name = "zylonite:yellow:2", .default_trigger = "default-on", }, }; static struct gpio_led_platform_data zylonite_debug_leds_info = { .leds = zylonite_debug_leds, .num_leds = ARRAY_SIZE(zylonite_debug_leds), }; static struct platform_device zylonite_device_leds = { .name = "leds-gpio", .id = -1, .dev = { .platform_data = &zylonite_debug_leds_info, } }; static void __init zylonite_init_leds(void) { zylonite_debug_leds[0].gpio = gpio_debug_led1; zylonite_debug_leds[1].gpio = gpio_debug_led2; platform_device_register(&zylonite_device_leds); } #else static inline void zylonite_init_leds(void) {} #endif |
7a987e82c
|
114 |
#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
5cca91479
|
115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
static struct platform_pwm_backlight_data zylonite_backlight_data = { .pwm_id = 3, .max_brightness = 100, .dft_brightness = 100, .pwm_period_ns = 10000, }; static struct platform_device zylonite_backlight_device = { .name = "pwm-backlight", .dev = { .parent = &pxa27x_device_pwm1.dev, .platform_data = &zylonite_backlight_data, }, }; |
2c8086a5d
|
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
static struct pxafb_mode_info toshiba_ltm035a776c_mode = { .pixclock = 110000, .xres = 240, .yres = 320, .bpp = 16, .hsync_len = 4, .left_margin = 6, .right_margin = 4, .vsync_len = 2, .upper_margin = 2, .lower_margin = 3, .sync = FB_SYNC_VERT_HIGH_ACT, }; static struct pxafb_mode_info toshiba_ltm04c380k_mode = { .pixclock = 50000, .xres = 640, .yres = 480, .bpp = 16, .hsync_len = 1, .left_margin = 0x9f, .right_margin = 1, .vsync_len = 44, .upper_margin = 0, .lower_margin = 0, .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, }; static struct pxafb_mach_info zylonite_toshiba_lcd_info = { .num_modes = 1, |
0454bd09d
|
160 |
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
2c8086a5d
|
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
}; static struct pxafb_mode_info sharp_ls037_modes[] = { [0] = { .pixclock = 158000, .xres = 240, .yres = 320, .bpp = 16, .hsync_len = 4, .left_margin = 39, .right_margin = 39, .vsync_len = 1, .upper_margin = 2, .lower_margin = 3, .sync = 0, }, [1] = { .pixclock = 39700, .xres = 480, .yres = 640, .bpp = 16, .hsync_len = 8, .left_margin = 81, .right_margin = 81, .vsync_len = 1, .upper_margin = 2, .lower_margin = 7, .sync = 0, }, }; static struct pxafb_mach_info zylonite_sharp_lcd_info = { .modes = sharp_ls037_modes, .num_modes = 2, |
0454bd09d
|
195 |
.lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, |
2c8086a5d
|
196 197 198 199 |
}; static void __init zylonite_init_lcd(void) { |
5cca91479
|
200 |
platform_device_register(&zylonite_backlight_device); |
2c8086a5d
|
201 202 |
if (lcd_id & 0x20) { |
4321e1a12
|
203 |
pxa_set_fb_info(NULL, &zylonite_sharp_lcd_info); |
2c8086a5d
|
204 205 206 207 208 209 210 211 212 213 |
return; } /* legacy LCD panels, it would be handy here if LCD panel type can * be decided at run-time */ if (1) zylonite_toshiba_lcd_info.modes = &toshiba_ltm035a776c_mode; else zylonite_toshiba_lcd_info.modes = &toshiba_ltm04c380k_mode; |
4321e1a12
|
214 |
pxa_set_fb_info(NULL, &zylonite_toshiba_lcd_info); |
2c8086a5d
|
215 216 217 218 |
} #else static inline void zylonite_init_lcd(void) {} #endif |
fafc9d3fa
|
219 |
#if defined(CONFIG_MMC) |
fafc9d3fa
|
220 |
static struct pxamci_platform_data zylonite_mci_platform_data = { |
f97cab28b
|
221 |
.detect_delay_ms= 200, |
fafc9d3fa
|
222 |
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
f91e4906e
|
223 224 |
.gpio_card_detect = EXT_GPIO(0), .gpio_card_ro = EXT_GPIO(2), |
7a648256b
|
225 |
.gpio_power = -1, |
fafc9d3fa
|
226 |
}; |
8d33b0558
|
227 |
static struct pxamci_platform_data zylonite_mci2_platform_data = { |
f97cab28b
|
228 |
.detect_delay_ms= 200, |
8d33b0558
|
229 |
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
f91e4906e
|
230 231 232 233 234 235 |
.gpio_card_detect = EXT_GPIO(1), .gpio_card_ro = EXT_GPIO(3), .gpio_power = -1, }; static struct pxamci_platform_data zylonite_mci3_platform_data = { |
f97cab28b
|
236 |
.detect_delay_ms= 200, |
f91e4906e
|
237 238 239 240 |
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .gpio_card_detect = EXT_GPIO(30), .gpio_card_ro = EXT_GPIO(31), .gpio_power = -1, |
8d33b0558
|
241 |
}; |
fafc9d3fa
|
242 243 244 |
static void __init zylonite_init_mmc(void) { pxa_set_mci_info(&zylonite_mci_platform_data); |
8d33b0558
|
245 |
pxa3xx_set_mci2_info(&zylonite_mci2_platform_data); |
5a1f21b1e
|
246 |
if (cpu_is_pxa310()) |
f91e4906e
|
247 |
pxa3xx_set_mci3_info(&zylonite_mci3_platform_data); |
fafc9d3fa
|
248 249 250 251 |
} #else static inline void zylonite_init_mmc(void) {} #endif |
36caeb4ec
|
252 |
#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
468e086f7
|
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
static unsigned int zylonite_matrix_key_map[] = { /* KEY(row, col, key_code) */ KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D), KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H), KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L), KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P), KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T), KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X), KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z), KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3), KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7), KEY(4, 3, KEY_8), KEY(3, 4, KEY_9), KEY(4, 5, KEY_SPACE), KEY(5, 3, KEY_KPASTERISK), /* * */ KEY(5, 4, KEY_KPDOT), /* #" */ KEY(0, 7, KEY_UP), KEY(1, 7, KEY_DOWN), KEY(2, 7, KEY_LEFT), KEY(3, 7, KEY_RIGHT), KEY(2, 6, KEY_HOME), KEY(3, 6, KEY_END), KEY(6, 4, KEY_DELETE), KEY(6, 6, KEY_BACK), KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */ KEY(4, 6, KEY_ENTER), /* scroll push */ KEY(5, 7, KEY_ENTER), /* keypad action */ KEY(0, 4, KEY_EMAIL), KEY(5, 6, KEY_SEND), KEY(4, 0, KEY_CALENDAR), KEY(7, 6, KEY_RECORD), KEY(6, 7, KEY_VOLUMEUP), KEY(7, 7, KEY_VOLUMEDOWN), KEY(0, 6, KEY_F22), /* soft1 */ KEY(1, 6, KEY_F23), /* soft2 */ KEY(0, 3, KEY_AUX), /* contact */ }; static struct pxa27x_keypad_platform_data zylonite_keypad_info = { .matrix_key_rows = 8, .matrix_key_cols = 8, .matrix_key_map = zylonite_matrix_key_map, .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map), .enable_rotary0 = 1, .rotary0_up_key = KEY_UP, .rotary0_down_key = KEY_DOWN, .debounce_interval = 30, }; static void __init zylonite_init_keypad(void) { pxa_set_keypad_info(&zylonite_keypad_info); } #else static inline void zylonite_init_keypad(void) {} #endif |
481b55262
|
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
#if defined(CONFIG_MTD_NAND_PXA3xx) || defined(CONFIG_MTD_NAND_PXA3xx_MODULE) static struct mtd_partition zylonite_nand_partitions[] = { [0] = { .name = "Bootloader", .offset = 0, .size = 0x060000, .mask_flags = MTD_WRITEABLE, /* force read-only */ }, [1] = { .name = "Kernel", .offset = 0x060000, .size = 0x200000, .mask_flags = MTD_WRITEABLE, /* force read-only */ }, [2] = { .name = "Filesystem", .offset = 0x0260000, .size = 0x3000000, /* 48M - rootfs */ }, [3] = { .name = "MassStorage", .offset = 0x3260000, .size = 0x3d40000, }, [4] = { .name = "BBT", .offset = 0x6FA0000, .size = 0x80000, .mask_flags = MTD_WRITEABLE, /* force read-only */ }, /* NOTE: we reserve some blocks at the end of the NAND flash for * bad block management, and the max number of relocation blocks * differs on different platforms. Please take care with it when * defining the partition table. */ }; static struct pxa3xx_nand_platform_data zylonite_nand_info = { .enable_arbiter = 1, |
f3c8cfc23
|
355 356 357 |
.num_cs = 1, .parts[0] = zylonite_nand_partitions, .nr_parts[0] = ARRAY_SIZE(zylonite_nand_partitions), |
481b55262
|
358 359 360 361 362 363 364 365 366 |
}; static void __init zylonite_init_nand(void) { pxa3xx_set_nand_info(&zylonite_nand_info); } #else static inline void zylonite_init_nand(void) {} #endif /* CONFIG_MTD_NAND_PXA3xx || CONFIG_MTD_NAND_PXA3xx_MODULE */ |
7ff435356
|
367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) static struct pxaohci_platform_data zylonite_ohci_info = { .port_mode = PMM_PERPORT_MODE, .flags = ENABLE_PORT1 | ENABLE_PORT2 | POWER_CONTROL_LOW | POWER_SENSE_LOW, }; static void __init zylonite_init_ohci(void) { pxa_set_ohci_info(&zylonite_ohci_info); } #else static inline void zylonite_init_ohci(void) {} #endif /* CONFIG_USB_OHCI_HCD || CONFIG_USB_OHCI_HCD_MODULE */ |
2c8086a5d
|
381 382 |
static void __init zylonite_init(void) { |
cc155c6f2
|
383 384 385 |
pxa_set_ffuart_info(NULL); pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); |
2c8086a5d
|
386 387 388 389 390 391 392 393 |
/* board-processor specific initialization */ zylonite_pxa300_init(); zylonite_pxa320_init(); /* * Note: We depend that the bootloader set * the correct value to MSC register for SMC91x. */ |
4929f5a8a
|
394 395 |
smc91x_resources[1].start = PXA_GPIO_TO_IRQ(gpio_eth_irq); smc91x_resources[1].end = PXA_GPIO_TO_IRQ(gpio_eth_irq); |
2c8086a5d
|
396 |
platform_device_register(&smc91x_device); |
cabb352a6
|
397 |
pxa_set_ac97_info(NULL); |
2c8086a5d
|
398 |
zylonite_init_lcd(); |
fafc9d3fa
|
399 |
zylonite_init_mmc(); |
468e086f7
|
400 |
zylonite_init_keypad(); |
481b55262
|
401 |
zylonite_init_nand(); |
5c9f50e90
|
402 |
zylonite_init_leds(); |
7ff435356
|
403 |
zylonite_init_ohci(); |
f0fba2ad1
|
404 |
zylonite_init_wm9713_audio(); |
2c8086a5d
|
405 406 407 |
} MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") |
7375aba67
|
408 |
.atag_offset = 0x100, |
851982c1b
|
409 |
.map_io = pxa3xx_map_io, |
6ac6b817f
|
410 |
.nr_irqs = ZYLONITE_NR_IRQS, |
2c8086a5d
|
411 |
.init_irq = pxa3xx_init_irq, |
8a97ae2f5
|
412 |
.handle_irq = pxa3xx_handle_irq, |
2c8086a5d
|
413 414 |
.timer = &pxa_timer, .init_machine = zylonite_init, |
271a74fc8
|
415 |
.restart = pxa_restart, |
2c8086a5d
|
416 |
MACHINE_END |