diff options
Diffstat (limited to 'arch/arm/mach-pxa/z2.c')
-rw-r--r-- | arch/arm/mach-pxa/z2.c | 609 |
1 files changed, 609 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/z2.c b/arch/arm/mach-pxa/z2.c new file mode 100644 index 000000000000..f5d1ae3db3a4 --- /dev/null +++ b/arch/arm/mach-pxa/z2.c | |||
@@ -0,0 +1,609 @@ | |||
1 | /* | ||
2 | * linux/arch/arm/mach-pxa/z2.c | ||
3 | * | ||
4 | * Support for the Zipit Z2 Handheld device. | ||
5 | * | ||
6 | * Author: Ken McGuire | ||
7 | * Created: Jan 25, 2009 | ||
8 | * Based on mainstone.c as modified for the Zipit Z2. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/mtd/mtd.h> | ||
17 | #include <linux/mtd/partitions.h> | ||
18 | #include <linux/pwm_backlight.h> | ||
19 | #include <linux/dma-mapping.h> | ||
20 | #include <linux/spi/spi.h> | ||
21 | #include <linux/spi/libertas_spi.h> | ||
22 | #include <linux/spi/lms283gf05.h> | ||
23 | #include <linux/power_supply.h> | ||
24 | #include <linux/mtd/physmap.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/gpio_keys.h> | ||
27 | #include <linux/delay.h> | ||
28 | |||
29 | #include <asm/mach-types.h> | ||
30 | #include <asm/mach/arch.h> | ||
31 | |||
32 | #include <mach/pxa27x.h> | ||
33 | #include <mach/mfp-pxa27x.h> | ||
34 | #include <mach/z2.h> | ||
35 | #include <mach/pxafb.h> | ||
36 | #include <mach/mmc.h> | ||
37 | #include <mach/pxa27x_keypad.h> | ||
38 | #include <mach/pxa2xx_spi.h> | ||
39 | |||
40 | #include <plat/i2c.h> | ||
41 | |||
42 | #include "generic.h" | ||
43 | #include "devices.h" | ||
44 | |||
45 | /****************************************************************************** | ||
46 | * Pin configuration | ||
47 | ******************************************************************************/ | ||
48 | static unsigned long z2_pin_config[] = { | ||
49 | |||
50 | /* LCD - 16bpp Active TFT */ | ||
51 | GPIO58_LCD_LDD_0, | ||
52 | GPIO59_LCD_LDD_1, | ||
53 | GPIO60_LCD_LDD_2, | ||
54 | GPIO61_LCD_LDD_3, | ||
55 | GPIO62_LCD_LDD_4, | ||
56 | GPIO63_LCD_LDD_5, | ||
57 | GPIO64_LCD_LDD_6, | ||
58 | GPIO65_LCD_LDD_7, | ||
59 | GPIO66_LCD_LDD_8, | ||
60 | GPIO67_LCD_LDD_9, | ||
61 | GPIO68_LCD_LDD_10, | ||
62 | GPIO69_LCD_LDD_11, | ||
63 | GPIO70_LCD_LDD_12, | ||
64 | GPIO71_LCD_LDD_13, | ||
65 | GPIO72_LCD_LDD_14, | ||
66 | GPIO73_LCD_LDD_15, | ||
67 | GPIO74_LCD_FCLK, | ||
68 | GPIO75_LCD_LCLK, | ||
69 | GPIO76_LCD_PCLK, | ||
70 | GPIO77_LCD_BIAS, | ||
71 | GPIO19_GPIO, /* LCD reset */ | ||
72 | GPIO88_GPIO, /* LCD chipselect */ | ||
73 | |||
74 | /* PWM */ | ||
75 | GPIO115_PWM1_OUT, /* Keypad Backlight */ | ||
76 | GPIO11_PWM2_OUT, /* LCD Backlight */ | ||
77 | |||
78 | /* MMC */ | ||
79 | GPIO32_MMC_CLK, | ||
80 | GPIO112_MMC_CMD, | ||
81 | GPIO92_MMC_DAT_0, | ||
82 | GPIO109_MMC_DAT_1, | ||
83 | GPIO110_MMC_DAT_2, | ||
84 | GPIO111_MMC_DAT_3, | ||
85 | GPIO96_GPIO, /* SD detect */ | ||
86 | |||
87 | /* STUART */ | ||
88 | GPIO46_STUART_RXD, | ||
89 | GPIO47_STUART_TXD, | ||
90 | |||
91 | /* Keypad */ | ||
92 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
93 | GPIO101_KP_MKIN_1 | WAKEUP_ON_LEVEL_HIGH, | ||
94 | GPIO102_KP_MKIN_2 | WAKEUP_ON_LEVEL_HIGH, | ||
95 | GPIO34_KP_MKIN_3 | WAKEUP_ON_LEVEL_HIGH, | ||
96 | GPIO38_KP_MKIN_4 | WAKEUP_ON_LEVEL_HIGH, | ||
97 | GPIO16_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, | ||
98 | GPIO17_KP_MKIN_6 | WAKEUP_ON_LEVEL_HIGH, | ||
99 | GPIO103_KP_MKOUT_0, | ||
100 | GPIO104_KP_MKOUT_1, | ||
101 | GPIO105_KP_MKOUT_2, | ||
102 | GPIO106_KP_MKOUT_3, | ||
103 | GPIO107_KP_MKOUT_4, | ||
104 | GPIO108_KP_MKOUT_5, | ||
105 | GPIO35_KP_MKOUT_6, | ||
106 | GPIO41_KP_MKOUT_7, | ||
107 | |||
108 | /* I2C */ | ||
109 | GPIO117_I2C_SCL, | ||
110 | GPIO118_I2C_SDA, | ||
111 | |||
112 | /* SSP1 */ | ||
113 | GPIO23_SSP1_SCLK, /* SSP1_SCK */ | ||
114 | GPIO25_SSP1_TXD, /* SSP1_TXD */ | ||
115 | GPIO26_SSP1_RXD, /* SSP1_RXD */ | ||
116 | |||
117 | /* SSP2 */ | ||
118 | GPIO22_SSP2_SCLK, /* SSP2_SCK */ | ||
119 | GPIO13_SSP2_TXD, /* SSP2_TXD */ | ||
120 | GPIO40_SSP2_RXD, /* SSP2_RXD */ | ||
121 | |||
122 | /* LEDs */ | ||
123 | GPIO10_GPIO, /* WiFi LED */ | ||
124 | GPIO83_GPIO, /* Charging LED */ | ||
125 | GPIO85_GPIO, /* Charged LED */ | ||
126 | |||
127 | /* I2S */ | ||
128 | GPIO28_I2S_BITCLK_OUT, | ||
129 | GPIO29_I2S_SDATA_IN, | ||
130 | GPIO30_I2S_SDATA_OUT, | ||
131 | GPIO31_I2S_SYNC, | ||
132 | GPIO113_I2S_SYSCLK, | ||
133 | |||
134 | /* MISC */ | ||
135 | GPIO0_GPIO, /* AC power detect */ | ||
136 | GPIO1_GPIO, /* Power button */ | ||
137 | GPIO37_GPIO, /* Headphone detect */ | ||
138 | GPIO98_GPIO, /* Lid switch */ | ||
139 | GPIO14_GPIO, /* WiFi Reset */ | ||
140 | GPIO15_GPIO, /* WiFi Power */ | ||
141 | GPIO24_GPIO, /* WiFi CS */ | ||
142 | GPIO36_GPIO, /* WiFi IRQ */ | ||
143 | GPIO88_GPIO, /* LCD CS */ | ||
144 | }; | ||
145 | |||
146 | /****************************************************************************** | ||
147 | * NOR Flash | ||
148 | ******************************************************************************/ | ||
149 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
150 | static struct resource z2_flash_resource = { | ||
151 | .start = PXA_CS0_PHYS, | ||
152 | .end = PXA_CS0_PHYS + SZ_8M - 1, | ||
153 | .flags = IORESOURCE_MEM, | ||
154 | }; | ||
155 | |||
156 | static struct mtd_partition z2_flash_parts[] = { | ||
157 | { | ||
158 | .name = "U-Boot Bootloader", | ||
159 | .offset = 0x0, | ||
160 | .size = 0x20000, | ||
161 | }, | ||
162 | { | ||
163 | .name = "Linux Kernel", | ||
164 | .offset = 0x20000, | ||
165 | .size = 0x220000, | ||
166 | }, | ||
167 | { | ||
168 | .name = "Filesystem", | ||
169 | .offset = 0x240000, | ||
170 | .size = 0x5b0000, | ||
171 | }, | ||
172 | { | ||
173 | .name = "U-Boot Environment", | ||
174 | .offset = 0x7f0000, | ||
175 | .size = MTDPART_SIZ_FULL, | ||
176 | }, | ||
177 | }; | ||
178 | |||
179 | static struct physmap_flash_data z2_flash_data = { | ||
180 | .width = 2, | ||
181 | .parts = z2_flash_parts, | ||
182 | .nr_parts = ARRAY_SIZE(z2_flash_parts), | ||
183 | }; | ||
184 | |||
185 | static struct platform_device z2_flash = { | ||
186 | .name = "physmap-flash", | ||
187 | .id = -1, | ||
188 | .resource = &z2_flash_resource, | ||
189 | .num_resources = 1, | ||
190 | .dev = { | ||
191 | .platform_data = &z2_flash_data, | ||
192 | }, | ||
193 | }; | ||
194 | |||
195 | static void __init z2_nor_init(void) | ||
196 | { | ||
197 | platform_device_register(&z2_flash); | ||
198 | } | ||
199 | #else | ||
200 | static inline void z2_nor_init(void) {} | ||
201 | #endif | ||
202 | |||
203 | /****************************************************************************** | ||
204 | * Backlight | ||
205 | ******************************************************************************/ | ||
206 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | ||
207 | static struct platform_pwm_backlight_data z2_backlight_data[] = { | ||
208 | [0] = { | ||
209 | /* Keypad Backlight */ | ||
210 | .pwm_id = 1, | ||
211 | .max_brightness = 1023, | ||
212 | .dft_brightness = 512, | ||
213 | .pwm_period_ns = 1260320, | ||
214 | }, | ||
215 | [1] = { | ||
216 | /* LCD Backlight */ | ||
217 | .pwm_id = 2, | ||
218 | .max_brightness = 1023, | ||
219 | .dft_brightness = 512, | ||
220 | .pwm_period_ns = 1260320, | ||
221 | }, | ||
222 | }; | ||
223 | |||
224 | static struct platform_device z2_backlight_devices[2] = { | ||
225 | { | ||
226 | .name = "pwm-backlight", | ||
227 | .id = 0, | ||
228 | .dev = { | ||
229 | .platform_data = &z2_backlight_data[1], | ||
230 | }, | ||
231 | }, | ||
232 | { | ||
233 | .name = "pwm-backlight", | ||
234 | .id = 1, | ||
235 | .dev = { | ||
236 | .platform_data = &z2_backlight_data[0], | ||
237 | }, | ||
238 | }, | ||
239 | }; | ||
240 | static void __init z2_pwm_init(void) | ||
241 | { | ||
242 | platform_device_register(&z2_backlight_devices[0]); | ||
243 | platform_device_register(&z2_backlight_devices[1]); | ||
244 | } | ||
245 | #else | ||
246 | static inline void z2_pwm_init(void) {} | ||
247 | #endif | ||
248 | |||
249 | /****************************************************************************** | ||
250 | * Framebuffer | ||
251 | ******************************************************************************/ | ||
252 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | ||
253 | static struct pxafb_mode_info z2_lcd_modes[] = { | ||
254 | { | ||
255 | .pixclock = 192000, | ||
256 | .xres = 240, | ||
257 | .yres = 320, | ||
258 | .bpp = 16, | ||
259 | |||
260 | .left_margin = 4, | ||
261 | .right_margin = 8, | ||
262 | .upper_margin = 4, | ||
263 | .lower_margin = 8, | ||
264 | |||
265 | .hsync_len = 4, | ||
266 | .vsync_len = 4, | ||
267 | }, | ||
268 | }; | ||
269 | |||
270 | static struct pxafb_mach_info z2_lcd_screen = { | ||
271 | .modes = z2_lcd_modes, | ||
272 | .num_modes = ARRAY_SIZE(z2_lcd_modes), | ||
273 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW | | ||
274 | LCD_ALTERNATE_MAPPING, | ||
275 | }; | ||
276 | |||
277 | static void __init z2_lcd_init(void) | ||
278 | { | ||
279 | set_pxa_fb_info(&z2_lcd_screen); | ||
280 | } | ||
281 | #else | ||
282 | static inline void z2_lcd_init(void) {} | ||
283 | #endif | ||
284 | |||
285 | /****************************************************************************** | ||
286 | * SD/MMC card controller | ||
287 | ******************************************************************************/ | ||
288 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | ||
289 | static struct pxamci_platform_data z2_mci_platform_data = { | ||
290 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
291 | .gpio_card_detect = GPIO96_ZIPITZ2_SD_DETECT, | ||
292 | .gpio_power = -1, | ||
293 | .gpio_card_ro = -1, | ||
294 | .detect_delay_ms = 200, | ||
295 | }; | ||
296 | |||
297 | static void __init z2_mmc_init(void) | ||
298 | { | ||
299 | pxa_set_mci_info(&z2_mci_platform_data); | ||
300 | } | ||
301 | #else | ||
302 | static inline void z2_mmc_init(void) {} | ||
303 | #endif | ||
304 | |||
305 | /****************************************************************************** | ||
306 | * LEDs | ||
307 | ******************************************************************************/ | ||
308 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | ||
309 | struct gpio_led z2_gpio_leds[] = { | ||
310 | { | ||
311 | .name = "z2:green:wifi", | ||
312 | .default_trigger = "none", | ||
313 | .gpio = GPIO10_ZIPITZ2_LED_WIFI, | ||
314 | .active_low = 1, | ||
315 | }, { | ||
316 | .name = "z2:green:charged", | ||
317 | .default_trigger = "none", | ||
318 | .gpio = GPIO85_ZIPITZ2_LED_CHARGED, | ||
319 | .active_low = 1, | ||
320 | }, { | ||
321 | .name = "z2:amber:charging", | ||
322 | .default_trigger = "none", | ||
323 | .gpio = GPIO83_ZIPITZ2_LED_CHARGING, | ||
324 | .active_low = 1, | ||
325 | }, | ||
326 | }; | ||
327 | |||
328 | static struct gpio_led_platform_data z2_gpio_led_info = { | ||
329 | .leds = z2_gpio_leds, | ||
330 | .num_leds = ARRAY_SIZE(z2_gpio_leds), | ||
331 | }; | ||
332 | |||
333 | static struct platform_device z2_leds = { | ||
334 | .name = "leds-gpio", | ||
335 | .id = -1, | ||
336 | .dev = { | ||
337 | .platform_data = &z2_gpio_led_info, | ||
338 | } | ||
339 | }; | ||
340 | |||
341 | static void __init z2_leds_init(void) | ||
342 | { | ||
343 | platform_device_register(&z2_leds); | ||
344 | } | ||
345 | #else | ||
346 | static inline void z2_leds_init(void) {} | ||
347 | #endif | ||
348 | |||
349 | /****************************************************************************** | ||
350 | * GPIO keyboard | ||
351 | ******************************************************************************/ | ||
352 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | ||
353 | static unsigned int z2_matrix_keys[] = { | ||
354 | KEY(0, 0, KEY_OPTION), | ||
355 | KEY(1, 0, KEY_UP), | ||
356 | KEY(2, 0, KEY_DOWN), | ||
357 | KEY(3, 0, KEY_LEFT), | ||
358 | KEY(4, 0, KEY_RIGHT), | ||
359 | KEY(5, 0, KEY_END), | ||
360 | KEY(6, 0, KEY_KPPLUS), | ||
361 | |||
362 | KEY(0, 1, KEY_HOME), | ||
363 | KEY(1, 1, KEY_Q), | ||
364 | KEY(2, 1, KEY_I), | ||
365 | KEY(3, 1, KEY_G), | ||
366 | KEY(4, 1, KEY_X), | ||
367 | KEY(5, 1, KEY_ENTER), | ||
368 | KEY(6, 1, KEY_KPMINUS), | ||
369 | |||
370 | KEY(0, 2, KEY_PAGEUP), | ||
371 | KEY(1, 2, KEY_W), | ||
372 | KEY(2, 2, KEY_O), | ||
373 | KEY(3, 2, KEY_H), | ||
374 | KEY(4, 2, KEY_C), | ||
375 | KEY(5, 2, KEY_LEFTALT), | ||
376 | |||
377 | KEY(0, 3, KEY_PAGEDOWN), | ||
378 | KEY(1, 3, KEY_E), | ||
379 | KEY(2, 3, KEY_P), | ||
380 | KEY(3, 3, KEY_J), | ||
381 | KEY(4, 3, KEY_V), | ||
382 | KEY(5, 3, KEY_LEFTSHIFT), | ||
383 | |||
384 | KEY(0, 4, KEY_ESC), | ||
385 | KEY(1, 4, KEY_R), | ||
386 | KEY(2, 4, KEY_A), | ||
387 | KEY(3, 4, KEY_K), | ||
388 | KEY(4, 4, KEY_B), | ||
389 | KEY(5, 4, KEY_LEFTCTRL), | ||
390 | |||
391 | KEY(0, 5, KEY_TAB), | ||
392 | KEY(1, 5, KEY_T), | ||
393 | KEY(2, 5, KEY_S), | ||
394 | KEY(3, 5, KEY_L), | ||
395 | KEY(4, 5, KEY_N), | ||
396 | KEY(5, 5, KEY_SPACE), | ||
397 | |||
398 | KEY(0, 6, KEY_STOPCD), | ||
399 | KEY(1, 6, KEY_Y), | ||
400 | KEY(2, 6, KEY_D), | ||
401 | KEY(3, 6, KEY_BACKSPACE), | ||
402 | KEY(4, 6, KEY_M), | ||
403 | KEY(5, 6, KEY_COMMA), | ||
404 | |||
405 | KEY(0, 7, KEY_PLAYCD), | ||
406 | KEY(1, 7, KEY_U), | ||
407 | KEY(2, 7, KEY_F), | ||
408 | KEY(3, 7, KEY_Z), | ||
409 | KEY(4, 7, KEY_SEMICOLON), | ||
410 | KEY(5, 7, KEY_DOT), | ||
411 | }; | ||
412 | |||
413 | static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { | ||
414 | .matrix_key_rows = 7, | ||
415 | .matrix_key_cols = 8, | ||
416 | .matrix_key_map = z2_matrix_keys, | ||
417 | .matrix_key_map_size = ARRAY_SIZE(z2_matrix_keys), | ||
418 | |||
419 | .debounce_interval = 30, | ||
420 | }; | ||
421 | |||
422 | static void __init z2_mkp_init(void) | ||
423 | { | ||
424 | pxa_set_keypad_info(&z2_keypad_platform_data); | ||
425 | } | ||
426 | #else | ||
427 | static inline void z2_mkp_init(void) {} | ||
428 | #endif | ||
429 | |||
430 | /****************************************************************************** | ||
431 | * GPIO keys | ||
432 | ******************************************************************************/ | ||
433 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | ||
434 | static struct gpio_keys_button z2_pxa_buttons[] = { | ||
435 | {KEY_POWER, GPIO1_ZIPITZ2_POWER_BUTTON, 0, "Power Button" }, | ||
436 | {KEY_CLOSE, GPIO98_ZIPITZ2_LID_BUTTON, 0, "Lid Button" }, | ||
437 | }; | ||
438 | |||
439 | static struct gpio_keys_platform_data z2_pxa_keys_data = { | ||
440 | .buttons = z2_pxa_buttons, | ||
441 | .nbuttons = ARRAY_SIZE(z2_pxa_buttons), | ||
442 | }; | ||
443 | |||
444 | static struct platform_device z2_pxa_keys = { | ||
445 | .name = "gpio-keys", | ||
446 | .id = -1, | ||
447 | .dev = { | ||
448 | .platform_data = &z2_pxa_keys_data, | ||
449 | }, | ||
450 | }; | ||
451 | |||
452 | static void __init z2_keys_init(void) | ||
453 | { | ||
454 | platform_device_register(&z2_pxa_keys); | ||
455 | } | ||
456 | #else | ||
457 | static inline void z2_keys_init(void) {} | ||
458 | #endif | ||
459 | |||
460 | /****************************************************************************** | ||
461 | * SSP Devices - WiFi and LCD control | ||
462 | ******************************************************************************/ | ||
463 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) | ||
464 | /* WiFi */ | ||
465 | static int z2_lbs_spi_setup(struct spi_device *spi) | ||
466 | { | ||
467 | int ret = 0; | ||
468 | |||
469 | ret = gpio_request(GPIO15_ZIPITZ2_WIFI_POWER, "WiFi Power"); | ||
470 | if (ret) | ||
471 | goto err; | ||
472 | |||
473 | ret = gpio_direction_output(GPIO15_ZIPITZ2_WIFI_POWER, 1); | ||
474 | if (ret) | ||
475 | goto err2; | ||
476 | |||
477 | ret = gpio_request(GPIO14_ZIPITZ2_WIFI_RESET, "WiFi Reset"); | ||
478 | if (ret) | ||
479 | goto err2; | ||
480 | |||
481 | ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_RESET, 0); | ||
482 | if (ret) | ||
483 | goto err3; | ||
484 | |||
485 | /* Reset the card */ | ||
486 | mdelay(180); | ||
487 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 1); | ||
488 | mdelay(20); | ||
489 | |||
490 | spi->bits_per_word = 16; | ||
491 | spi->mode = SPI_MODE_2, | ||
492 | |||
493 | spi_setup(spi); | ||
494 | |||
495 | return 0; | ||
496 | |||
497 | err3: | ||
498 | gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); | ||
499 | err2: | ||
500 | gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); | ||
501 | err: | ||
502 | return ret; | ||
503 | }; | ||
504 | |||
505 | static int z2_lbs_spi_teardown(struct spi_device *spi) | ||
506 | { | ||
507 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_RESET, 0); | ||
508 | gpio_set_value(GPIO15_ZIPITZ2_WIFI_POWER, 0); | ||
509 | gpio_free(GPIO14_ZIPITZ2_WIFI_RESET); | ||
510 | gpio_free(GPIO15_ZIPITZ2_WIFI_POWER); | ||
511 | return 0; | ||
512 | |||
513 | }; | ||
514 | |||
515 | static struct pxa2xx_spi_chip z2_lbs_chip_info = { | ||
516 | .rx_threshold = 8, | ||
517 | .tx_threshold = 8, | ||
518 | .timeout = 1000, | ||
519 | .gpio_cs = GPIO24_ZIPITZ2_WIFI_CS, | ||
520 | }; | ||
521 | |||
522 | static struct libertas_spi_platform_data z2_lbs_pdata = { | ||
523 | .use_dummy_writes = 1, | ||
524 | .setup = z2_lbs_spi_setup, | ||
525 | .teardown = z2_lbs_spi_teardown, | ||
526 | }; | ||
527 | |||
528 | /* LCD */ | ||
529 | static struct pxa2xx_spi_chip lms283_chip_info = { | ||
530 | .rx_threshold = 1, | ||
531 | .tx_threshold = 1, | ||
532 | .timeout = 64, | ||
533 | .gpio_cs = GPIO88_ZIPITZ2_LCD_CS, | ||
534 | }; | ||
535 | |||
536 | static const struct lms283gf05_pdata lms283_pdata = { | ||
537 | .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, | ||
538 | }; | ||
539 | |||
540 | static struct spi_board_info spi_board_info[] __initdata = { | ||
541 | { | ||
542 | .modalias = "libertas_spi", | ||
543 | .platform_data = &z2_lbs_pdata, | ||
544 | .controller_data = &z2_lbs_chip_info, | ||
545 | .irq = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ), | ||
546 | .max_speed_hz = 13000000, | ||
547 | .bus_num = 1, | ||
548 | .chip_select = 0, | ||
549 | }, | ||
550 | { | ||
551 | .modalias = "lms283gf05", | ||
552 | .controller_data = &lms283_chip_info, | ||
553 | .platform_data = &lms283_pdata, | ||
554 | .max_speed_hz = 400000, | ||
555 | .bus_num = 2, | ||
556 | .chip_select = 0, | ||
557 | }, | ||
558 | }; | ||
559 | |||
560 | static struct pxa2xx_spi_master pxa_ssp1_master_info = { | ||
561 | .clock_enable = CKEN_SSP, | ||
562 | .num_chipselect = 1, | ||
563 | .enable_dma = 1, | ||
564 | }; | ||
565 | |||
566 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { | ||
567 | .clock_enable = CKEN_SSP2, | ||
568 | .num_chipselect = 1, | ||
569 | }; | ||
570 | |||
571 | static void __init z2_spi_init(void) | ||
572 | { | ||
573 | pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); | ||
574 | pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); | ||
575 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | ||
576 | } | ||
577 | #else | ||
578 | static inline void z2_spi_init(void) {} | ||
579 | #endif | ||
580 | |||
581 | /****************************************************************************** | ||
582 | * Machine init | ||
583 | ******************************************************************************/ | ||
584 | static void __init z2_init(void) | ||
585 | { | ||
586 | pxa2xx_mfp_config(ARRAY_AND_SIZE(z2_pin_config)); | ||
587 | |||
588 | z2_lcd_init(); | ||
589 | z2_mmc_init(); | ||
590 | z2_mkp_init(); | ||
591 | |||
592 | pxa_set_i2c_info(NULL); | ||
593 | |||
594 | z2_spi_init(); | ||
595 | z2_nor_init(); | ||
596 | z2_pwm_init(); | ||
597 | z2_leds_init(); | ||
598 | z2_keys_init(); | ||
599 | } | ||
600 | |||
601 | MACHINE_START(ZIPIT2, "Zipit Z2") | ||
602 | .phys_io = 0x40000000, | ||
603 | .boot_params = 0xa0000100, | ||
604 | .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, | ||
605 | .map_io = pxa_map_io, | ||
606 | .init_irq = pxa27x_init_irq, | ||
607 | .timer = &pxa_timer, | ||
608 | .init_machine = z2_init, | ||
609 | MACHINE_END | ||