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> | |
8348c259 | 23 | #include <linux/spi/pxa2xx_spi.h> |
b6377992 MV |
24 | #include <linux/spi/libertas_spi.h> |
25 | #include <linux/spi/lms283gf05.h> | |
26 | #include <linux/power_supply.h> | |
27 | #include <linux/mtd/physmap.h> | |
28 | #include <linux/gpio.h> | |
29 | #include <linux/gpio_keys.h> | |
30 | #include <linux/delay.h> | |
320bbb86 | 31 | #include <linux/regulator/machine.h> |
b459396e | 32 | #include <linux/i2c/pxa-i2c.h> |
b6377992 MV |
33 | |
34 | #include <asm/mach-types.h> | |
35 | #include <asm/mach/arch.h> | |
36 | ||
37 | #include <mach/pxa27x.h> | |
38 | #include <mach/mfp-pxa27x.h> | |
39 | #include <mach/z2.h> | |
40 | #include <mach/pxafb.h> | |
41 | #include <mach/mmc.h> | |
4a2490ea | 42 | #include <plat/pxa27x_keypad.h> |
b6377992 | 43 | |
b6377992 MV |
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 */ | |
2e62344d VK |
94 | GPIO100_KP_MKIN_0, |
95 | GPIO101_KP_MKIN_1, | |
96 | GPIO102_KP_MKIN_2, | |
97 | GPIO34_KP_MKIN_3, | |
98 | GPIO38_KP_MKIN_4, | |
99 | GPIO16_KP_MKIN_5, | |
100 | GPIO17_KP_MKIN_6, | |
b6377992 MV |
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 */ | |
b8f56a78 | 141 | GPIO14_GPIO, /* WiFi Power */ |
b6377992 MV |
142 | GPIO24_GPIO, /* WiFi CS */ |
143 | GPIO36_GPIO, /* WiFi IRQ */ | |
144 | GPIO88_GPIO, /* LCD CS */ | |
145 | }; | |
146 | ||
147 | /****************************************************************************** | |
148 | * NOR Flash | |
149 | ******************************************************************************/ | |
150 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | |
151 | static struct resource z2_flash_resource = { | |
152 | .start = PXA_CS0_PHYS, | |
153 | .end = PXA_CS0_PHYS + SZ_8M - 1, | |
154 | .flags = IORESOURCE_MEM, | |
155 | }; | |
156 | ||
157 | static struct mtd_partition z2_flash_parts[] = { | |
158 | { | |
159 | .name = "U-Boot Bootloader", | |
160 | .offset = 0x0, | |
60adc112 MV |
161 | .size = 0x40000, |
162 | }, { | |
b6377992 | 163 | .name = "U-Boot Environment", |
60adc112 | 164 | .offset = 0x40000, |
77310840 | 165 | .size = 0x20000, |
60adc112 MV |
166 | }, { |
167 | .name = "Flash", | |
168 | .offset = 0x60000, | |
b6377992 MV |
169 | .size = MTDPART_SIZ_FULL, |
170 | }, | |
171 | }; | |
172 | ||
173 | static struct physmap_flash_data z2_flash_data = { | |
174 | .width = 2, | |
175 | .parts = z2_flash_parts, | |
176 | .nr_parts = ARRAY_SIZE(z2_flash_parts), | |
177 | }; | |
178 | ||
179 | static struct platform_device z2_flash = { | |
180 | .name = "physmap-flash", | |
181 | .id = -1, | |
182 | .resource = &z2_flash_resource, | |
183 | .num_resources = 1, | |
184 | .dev = { | |
185 | .platform_data = &z2_flash_data, | |
186 | }, | |
187 | }; | |
188 | ||
189 | static void __init z2_nor_init(void) | |
190 | { | |
191 | platform_device_register(&z2_flash); | |
192 | } | |
193 | #else | |
194 | static inline void z2_nor_init(void) {} | |
195 | #endif | |
196 | ||
197 | /****************************************************************************** | |
198 | * Backlight | |
199 | ******************************************************************************/ | |
200 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) | |
201 | static struct platform_pwm_backlight_data z2_backlight_data[] = { | |
202 | [0] = { | |
203 | /* Keypad Backlight */ | |
204 | .pwm_id = 1, | |
205 | .max_brightness = 1023, | |
034e1756 | 206 | .dft_brightness = 0, |
b6377992 MV |
207 | .pwm_period_ns = 1260320, |
208 | }, | |
209 | [1] = { | |
210 | /* LCD Backlight */ | |
211 | .pwm_id = 2, | |
212 | .max_brightness = 1023, | |
213 | .dft_brightness = 512, | |
214 | .pwm_period_ns = 1260320, | |
215 | }, | |
216 | }; | |
217 | ||
218 | static struct platform_device z2_backlight_devices[2] = { | |
219 | { | |
220 | .name = "pwm-backlight", | |
221 | .id = 0, | |
222 | .dev = { | |
223 | .platform_data = &z2_backlight_data[1], | |
224 | }, | |
225 | }, | |
226 | { | |
227 | .name = "pwm-backlight", | |
228 | .id = 1, | |
229 | .dev = { | |
230 | .platform_data = &z2_backlight_data[0], | |
231 | }, | |
232 | }, | |
233 | }; | |
234 | static void __init z2_pwm_init(void) | |
235 | { | |
236 | platform_device_register(&z2_backlight_devices[0]); | |
237 | platform_device_register(&z2_backlight_devices[1]); | |
238 | } | |
239 | #else | |
240 | static inline void z2_pwm_init(void) {} | |
241 | #endif | |
242 | ||
243 | /****************************************************************************** | |
244 | * Framebuffer | |
245 | ******************************************************************************/ | |
246 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) | |
247 | static struct pxafb_mode_info z2_lcd_modes[] = { | |
248 | { | |
249 | .pixclock = 192000, | |
250 | .xres = 240, | |
251 | .yres = 320, | |
252 | .bpp = 16, | |
253 | ||
254 | .left_margin = 4, | |
255 | .right_margin = 8, | |
256 | .upper_margin = 4, | |
257 | .lower_margin = 8, | |
258 | ||
259 | .hsync_len = 4, | |
260 | .vsync_len = 4, | |
261 | }, | |
262 | }; | |
263 | ||
264 | static struct pxafb_mach_info z2_lcd_screen = { | |
265 | .modes = z2_lcd_modes, | |
266 | .num_modes = ARRAY_SIZE(z2_lcd_modes), | |
267 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW | | |
268 | LCD_ALTERNATE_MAPPING, | |
269 | }; | |
270 | ||
271 | static void __init z2_lcd_init(void) | |
272 | { | |
4321e1a1 | 273 | pxa_set_fb_info(NULL, &z2_lcd_screen); |
b6377992 MV |
274 | } |
275 | #else | |
276 | static inline void z2_lcd_init(void) {} | |
277 | #endif | |
278 | ||
279 | /****************************************************************************** | |
280 | * SD/MMC card controller | |
281 | ******************************************************************************/ | |
282 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) | |
283 | static struct pxamci_platform_data z2_mci_platform_data = { | |
284 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | |
285 | .gpio_card_detect = GPIO96_ZIPITZ2_SD_DETECT, | |
286 | .gpio_power = -1, | |
287 | .gpio_card_ro = -1, | |
f97cab28 | 288 | .detect_delay_ms = 200, |
b6377992 MV |
289 | }; |
290 | ||
291 | static void __init z2_mmc_init(void) | |
292 | { | |
293 | pxa_set_mci_info(&z2_mci_platform_data); | |
294 | } | |
295 | #else | |
296 | static inline void z2_mmc_init(void) {} | |
297 | #endif | |
298 | ||
299 | /****************************************************************************** | |
300 | * LEDs | |
301 | ******************************************************************************/ | |
302 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) | |
303 | struct gpio_led z2_gpio_leds[] = { | |
304 | { | |
305 | .name = "z2:green:wifi", | |
306 | .default_trigger = "none", | |
307 | .gpio = GPIO10_ZIPITZ2_LED_WIFI, | |
308 | .active_low = 1, | |
309 | }, { | |
310 | .name = "z2:green:charged", | |
54d57100 | 311 | .default_trigger = "mmc0", |
b6377992 MV |
312 | .gpio = GPIO85_ZIPITZ2_LED_CHARGED, |
313 | .active_low = 1, | |
314 | }, { | |
315 | .name = "z2:amber:charging", | |
54d57100 | 316 | .default_trigger = "Z2-charging-or-full", |
b6377992 MV |
317 | .gpio = GPIO83_ZIPITZ2_LED_CHARGING, |
318 | .active_low = 1, | |
319 | }, | |
320 | }; | |
321 | ||
322 | static struct gpio_led_platform_data z2_gpio_led_info = { | |
323 | .leds = z2_gpio_leds, | |
324 | .num_leds = ARRAY_SIZE(z2_gpio_leds), | |
325 | }; | |
326 | ||
327 | static struct platform_device z2_leds = { | |
328 | .name = "leds-gpio", | |
329 | .id = -1, | |
330 | .dev = { | |
331 | .platform_data = &z2_gpio_led_info, | |
332 | } | |
333 | }; | |
334 | ||
335 | static void __init z2_leds_init(void) | |
336 | { | |
337 | platform_device_register(&z2_leds); | |
338 | } | |
339 | #else | |
340 | static inline void z2_leds_init(void) {} | |
341 | #endif | |
342 | ||
343 | /****************************************************************************** | |
344 | * GPIO keyboard | |
345 | ******************************************************************************/ | |
346 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) | |
347 | static unsigned int z2_matrix_keys[] = { | |
348 | KEY(0, 0, KEY_OPTION), | |
349 | KEY(1, 0, KEY_UP), | |
350 | KEY(2, 0, KEY_DOWN), | |
351 | KEY(3, 0, KEY_LEFT), | |
352 | KEY(4, 0, KEY_RIGHT), | |
353 | KEY(5, 0, KEY_END), | |
354 | KEY(6, 0, KEY_KPPLUS), | |
355 | ||
356 | KEY(0, 1, KEY_HOME), | |
357 | KEY(1, 1, KEY_Q), | |
358 | KEY(2, 1, KEY_I), | |
359 | KEY(3, 1, KEY_G), | |
360 | KEY(4, 1, KEY_X), | |
361 | KEY(5, 1, KEY_ENTER), | |
362 | KEY(6, 1, KEY_KPMINUS), | |
363 | ||
364 | KEY(0, 2, KEY_PAGEUP), | |
365 | KEY(1, 2, KEY_W), | |
366 | KEY(2, 2, KEY_O), | |
367 | KEY(3, 2, KEY_H), | |
368 | KEY(4, 2, KEY_C), | |
369 | KEY(5, 2, KEY_LEFTALT), | |
370 | ||
371 | KEY(0, 3, KEY_PAGEDOWN), | |
372 | KEY(1, 3, KEY_E), | |
373 | KEY(2, 3, KEY_P), | |
374 | KEY(3, 3, KEY_J), | |
375 | KEY(4, 3, KEY_V), | |
376 | KEY(5, 3, KEY_LEFTSHIFT), | |
377 | ||
378 | KEY(0, 4, KEY_ESC), | |
379 | KEY(1, 4, KEY_R), | |
380 | KEY(2, 4, KEY_A), | |
381 | KEY(3, 4, KEY_K), | |
382 | KEY(4, 4, KEY_B), | |
383 | KEY(5, 4, KEY_LEFTCTRL), | |
384 | ||
385 | KEY(0, 5, KEY_TAB), | |
386 | KEY(1, 5, KEY_T), | |
387 | KEY(2, 5, KEY_S), | |
388 | KEY(3, 5, KEY_L), | |
389 | KEY(4, 5, KEY_N), | |
390 | KEY(5, 5, KEY_SPACE), | |
391 | ||
392 | KEY(0, 6, KEY_STOPCD), | |
393 | KEY(1, 6, KEY_Y), | |
394 | KEY(2, 6, KEY_D), | |
395 | KEY(3, 6, KEY_BACKSPACE), | |
396 | KEY(4, 6, KEY_M), | |
397 | KEY(5, 6, KEY_COMMA), | |
398 | ||
399 | KEY(0, 7, KEY_PLAYCD), | |
400 | KEY(1, 7, KEY_U), | |
401 | KEY(2, 7, KEY_F), | |
402 | KEY(3, 7, KEY_Z), | |
403 | KEY(4, 7, KEY_SEMICOLON), | |
404 | KEY(5, 7, KEY_DOT), | |
405 | }; | |
406 | ||
407 | static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { | |
408 | .matrix_key_rows = 7, | |
409 | .matrix_key_cols = 8, | |
410 | .matrix_key_map = z2_matrix_keys, | |
411 | .matrix_key_map_size = ARRAY_SIZE(z2_matrix_keys), | |
412 | ||
413 | .debounce_interval = 30, | |
414 | }; | |
415 | ||
416 | static void __init z2_mkp_init(void) | |
417 | { | |
418 | pxa_set_keypad_info(&z2_keypad_platform_data); | |
419 | } | |
420 | #else | |
421 | static inline void z2_mkp_init(void) {} | |
422 | #endif | |
423 | ||
424 | /****************************************************************************** | |
425 | * GPIO keys | |
426 | ******************************************************************************/ | |
427 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) | |
428 | static struct gpio_keys_button z2_pxa_buttons[] = { | |
2e62344d VK |
429 | { |
430 | .code = KEY_POWER, | |
431 | .gpio = GPIO1_ZIPITZ2_POWER_BUTTON, | |
432 | .active_low = 0, | |
433 | .desc = "Power Button", | |
434 | .wakeup = 1, | |
435 | .type = EV_KEY, | |
436 | }, | |
437 | { | |
e3b1ceed | 438 | .code = SW_LID, |
2e62344d | 439 | .gpio = GPIO98_ZIPITZ2_LID_BUTTON, |
e3b1ceed VK |
440 | .active_low = 1, |
441 | .desc = "Lid Switch", | |
442 | .wakeup = 0, | |
443 | .type = EV_SW, | |
2e62344d | 444 | }, |
b6377992 MV |
445 | }; |
446 | ||
447 | static struct gpio_keys_platform_data z2_pxa_keys_data = { | |
448 | .buttons = z2_pxa_buttons, | |
449 | .nbuttons = ARRAY_SIZE(z2_pxa_buttons), | |
450 | }; | |
451 | ||
452 | static struct platform_device z2_pxa_keys = { | |
453 | .name = "gpio-keys", | |
454 | .id = -1, | |
455 | .dev = { | |
456 | .platform_data = &z2_pxa_keys_data, | |
457 | }, | |
458 | }; | |
459 | ||
460 | static void __init z2_keys_init(void) | |
461 | { | |
462 | platform_device_register(&z2_pxa_keys); | |
463 | } | |
464 | #else | |
465 | static inline void z2_keys_init(void) {} | |
466 | #endif | |
467 | ||
d198290d MV |
468 | /****************************************************************************** |
469 | * Battery | |
470 | ******************************************************************************/ | |
471 | #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE) | |
472 | static struct z2_battery_info batt_chip_info = { | |
473 | .batt_I2C_bus = 0, | |
474 | .batt_I2C_addr = 0x55, | |
475 | .batt_I2C_reg = 2, | |
476 | .charge_gpio = GPIO0_ZIPITZ2_AC_DETECT, | |
233cdbce VK |
477 | .min_voltage = 3475000, |
478 | .max_voltage = 4190000, | |
479 | .batt_div = 59, | |
d198290d MV |
480 | .batt_mult = 1000000, |
481 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION, | |
482 | .batt_name = "Z2", | |
483 | }; | |
484 | ||
485 | static struct i2c_board_info __initdata z2_i2c_board_info[] = { | |
486 | { | |
487 | I2C_BOARD_INFO("aer915", 0x55), | |
488 | .platform_data = &batt_chip_info, | |
8499ded8 MV |
489 | }, { |
490 | I2C_BOARD_INFO("wm8750", 0x1b), | |
491 | }, | |
492 | ||
d198290d MV |
493 | }; |
494 | ||
495 | static void __init z2_i2c_init(void) | |
496 | { | |
497 | pxa_set_i2c_info(NULL); | |
498 | i2c_register_board_info(0, ARRAY_AND_SIZE(z2_i2c_board_info)); | |
499 | } | |
500 | #else | |
501 | static inline void z2_i2c_init(void) {} | |
502 | #endif | |
503 | ||
b6377992 MV |
504 | /****************************************************************************** |
505 | * SSP Devices - WiFi and LCD control | |
506 | ******************************************************************************/ | |
507 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) | |
508 | /* WiFi */ | |
509 | static int z2_lbs_spi_setup(struct spi_device *spi) | |
510 | { | |
511 | int ret = 0; | |
512 | ||
b8f56a78 | 513 | ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power"); |
b6377992 MV |
514 | if (ret) |
515 | goto err; | |
516 | ||
b8f56a78 | 517 | ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1); |
b6377992 MV |
518 | if (ret) |
519 | goto err2; | |
520 | ||
b8f56a78 | 521 | /* Wait until card is powered on */ |
b6377992 | 522 | mdelay(180); |
b6377992 MV |
523 | |
524 | spi->bits_per_word = 16; | |
525 | spi->mode = SPI_MODE_2, | |
526 | ||
527 | spi_setup(spi); | |
528 | ||
529 | return 0; | |
530 | ||
b6377992 | 531 | err2: |
b8f56a78 | 532 | gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); |
b6377992 MV |
533 | err: |
534 | return ret; | |
535 | }; | |
536 | ||
537 | static int z2_lbs_spi_teardown(struct spi_device *spi) | |
538 | { | |
b8f56a78 VK |
539 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0); |
540 | gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); | |
b6377992 | 541 | |
b8f56a78 | 542 | return 0; |
b6377992 MV |
543 | }; |
544 | ||
545 | static struct pxa2xx_spi_chip z2_lbs_chip_info = { | |
546 | .rx_threshold = 8, | |
547 | .tx_threshold = 8, | |
548 | .timeout = 1000, | |
549 | .gpio_cs = GPIO24_ZIPITZ2_WIFI_CS, | |
550 | }; | |
551 | ||
552 | static struct libertas_spi_platform_data z2_lbs_pdata = { | |
553 | .use_dummy_writes = 1, | |
554 | .setup = z2_lbs_spi_setup, | |
555 | .teardown = z2_lbs_spi_teardown, | |
556 | }; | |
557 | ||
558 | /* LCD */ | |
559 | static struct pxa2xx_spi_chip lms283_chip_info = { | |
560 | .rx_threshold = 1, | |
561 | .tx_threshold = 1, | |
562 | .timeout = 64, | |
563 | .gpio_cs = GPIO88_ZIPITZ2_LCD_CS, | |
564 | }; | |
565 | ||
566 | static const struct lms283gf05_pdata lms283_pdata = { | |
567 | .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, | |
568 | }; | |
569 | ||
570 | static struct spi_board_info spi_board_info[] __initdata = { | |
571 | { | |
572 | .modalias = "libertas_spi", | |
573 | .platform_data = &z2_lbs_pdata, | |
574 | .controller_data = &z2_lbs_chip_info, | |
575 | .irq = gpio_to_irq(GPIO36_ZIPITZ2_WIFI_IRQ), | |
576 | .max_speed_hz = 13000000, | |
577 | .bus_num = 1, | |
578 | .chip_select = 0, | |
579 | }, | |
580 | { | |
581 | .modalias = "lms283gf05", | |
582 | .controller_data = &lms283_chip_info, | |
583 | .platform_data = &lms283_pdata, | |
584 | .max_speed_hz = 400000, | |
585 | .bus_num = 2, | |
586 | .chip_select = 0, | |
587 | }, | |
588 | }; | |
589 | ||
590 | static struct pxa2xx_spi_master pxa_ssp1_master_info = { | |
591 | .clock_enable = CKEN_SSP, | |
592 | .num_chipselect = 1, | |
593 | .enable_dma = 1, | |
594 | }; | |
595 | ||
596 | static struct pxa2xx_spi_master pxa_ssp2_master_info = { | |
597 | .clock_enable = CKEN_SSP2, | |
598 | .num_chipselect = 1, | |
599 | }; | |
600 | ||
601 | static void __init z2_spi_init(void) | |
602 | { | |
603 | pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); | |
604 | pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); | |
605 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); | |
606 | } | |
607 | #else | |
608 | static inline void z2_spi_init(void) {} | |
609 | #endif | |
610 | ||
320bbb86 MV |
611 | /****************************************************************************** |
612 | * Core power regulator | |
613 | ******************************************************************************/ | |
614 | #if defined(CONFIG_REGULATOR_TPS65023) || \ | |
615 | defined(CONFIG_REGULATOR_TPS65023_MODULE) | |
616 | static struct regulator_consumer_supply z2_tps65021_consumers[] = { | |
617 | { | |
618 | .supply = "vcc_core", | |
619 | } | |
620 | }; | |
621 | ||
622 | static struct regulator_init_data z2_tps65021_info[] = { | |
623 | { | |
624 | .constraints = { | |
625 | .name = "vcc_core range", | |
626 | .min_uV = 800000, | |
627 | .max_uV = 1600000, | |
628 | .always_on = 1, | |
629 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, | |
630 | }, | |
631 | .consumer_supplies = z2_tps65021_consumers, | |
632 | .num_consumer_supplies = ARRAY_SIZE(z2_tps65021_consumers), | |
633 | }, { | |
634 | .constraints = { | |
635 | .name = "DCDC2", | |
636 | .min_uV = 3300000, | |
637 | .max_uV = 3300000, | |
638 | .always_on = 1, | |
639 | }, | |
640 | }, { | |
641 | .constraints = { | |
642 | .name = "DCDC3", | |
643 | .min_uV = 1800000, | |
644 | .max_uV = 1800000, | |
645 | .always_on = 1, | |
646 | }, | |
647 | }, { | |
648 | .constraints = { | |
649 | .name = "LDO1", | |
650 | .min_uV = 1000000, | |
651 | .max_uV = 3150000, | |
652 | .always_on = 1, | |
653 | }, | |
654 | }, { | |
655 | .constraints = { | |
656 | .name = "LDO2", | |
657 | .min_uV = 1050000, | |
658 | .max_uV = 3300000, | |
659 | .always_on = 1, | |
660 | }, | |
661 | } | |
662 | }; | |
663 | ||
664 | static struct i2c_board_info __initdata z2_pi2c_board_info[] = { | |
665 | { | |
666 | I2C_BOARD_INFO("tps65021", 0x48), | |
667 | .platform_data = &z2_tps65021_info, | |
668 | }, | |
669 | }; | |
670 | ||
671 | static void __init z2_pmic_init(void) | |
672 | { | |
673 | pxa27x_set_i2c_power_info(NULL); | |
674 | i2c_register_board_info(1, ARRAY_AND_SIZE(z2_pi2c_board_info)); | |
675 | } | |
676 | #else | |
677 | static inline void z2_pmic_init(void) {} | |
678 | #endif | |
679 | ||
b6377992 MV |
680 | /****************************************************************************** |
681 | * Machine init | |
682 | ******************************************************************************/ | |
683 | static void __init z2_init(void) | |
684 | { | |
685 | pxa2xx_mfp_config(ARRAY_AND_SIZE(z2_pin_config)); | |
686 | ||
d198290d MV |
687 | pxa_set_ffuart_info(NULL); |
688 | pxa_set_btuart_info(NULL); | |
689 | pxa_set_stuart_info(NULL); | |
690 | ||
b6377992 MV |
691 | z2_lcd_init(); |
692 | z2_mmc_init(); | |
693 | z2_mkp_init(); | |
d198290d | 694 | z2_i2c_init(); |
b6377992 MV |
695 | z2_spi_init(); |
696 | z2_nor_init(); | |
697 | z2_pwm_init(); | |
698 | z2_leds_init(); | |
699 | z2_keys_init(); | |
320bbb86 | 700 | z2_pmic_init(); |
b6377992 MV |
701 | } |
702 | ||
703 | MACHINE_START(ZIPIT2, "Zipit Z2") | |
b6377992 | 704 | .boot_params = 0xa0000100, |
851982c1 | 705 | .map_io = pxa27x_map_io, |
b6377992 MV |
706 | .init_irq = pxa27x_init_irq, |
707 | .timer = &pxa_timer, | |
708 | .init_machine = z2_init, | |
709 | MACHINE_END |