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