Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /* |
---|---|
2 | * linux/arch/arm/mach-pxa/z2.c |
3 | * |
4 | * Support for the Zipit Z2 Handheld device. |
5 | * |
6 | * Copyright (C) 2009-2010 Marek Vasut <marek.vasut@gmail.com> |
7 | * |
8 | * Based on research and code by: Ken McGuire |
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.h> |
20 | #include <linux/pwm_backlight.h> |
21 | #include <linux/z2_battery.h> |
22 | #include <linux/dma-mapping.h> |
23 | #include <linux/spi/spi.h> |
24 | #include <linux/spi/pxa2xx_spi.h> |
25 | #include <linux/spi/libertas_spi.h> |
26 | #include <linux/spi/lms283gf05.h> |
27 | #include <linux/power_supply.h> |
28 | #include <linux/mtd/physmap.h> |
29 | #include <linux/gpio.h> |
30 | #include <linux/gpio/machine.h> |
31 | #include <linux/gpio_keys.h> |
32 | #include <linux/delay.h> |
33 | #include <linux/regulator/machine.h> |
34 | #include <linux/platform_data/i2c-pxa.h> |
35 | |
36 | #include <asm/mach-types.h> |
37 | #include <asm/mach/arch.h> |
38 | |
39 | #include "pxa27x.h" |
40 | #include "mfp-pxa27x.h" |
41 | #include <mach/z2.h> |
42 | #include <linux/platform_data/video-pxafb.h> |
43 | #include <linux/platform_data/mmc-pxamci.h> |
44 | #include <linux/platform_data/keypad-pxa27x.h> |
45 | #include "pm.h" |
46 | |
47 | #include "generic.h" |
48 | #include "devices.h" |
49 | |
50 | /****************************************************************************** |
51 | * Pin configuration |
52 | ******************************************************************************/ |
53 | static unsigned long z2_pin_config[] = { |
54 | |
55 | /* LCD - 16bpp Active TFT */ |
56 | GPIO58_LCD_LDD_0, |
57 | GPIO59_LCD_LDD_1, |
58 | GPIO60_LCD_LDD_2, |
59 | GPIO61_LCD_LDD_3, |
60 | GPIO62_LCD_LDD_4, |
61 | GPIO63_LCD_LDD_5, |
62 | GPIO64_LCD_LDD_6, |
63 | GPIO65_LCD_LDD_7, |
64 | GPIO66_LCD_LDD_8, |
65 | GPIO67_LCD_LDD_9, |
66 | GPIO68_LCD_LDD_10, |
67 | GPIO69_LCD_LDD_11, |
68 | GPIO70_LCD_LDD_12, |
69 | GPIO71_LCD_LDD_13, |
70 | GPIO72_LCD_LDD_14, |
71 | GPIO73_LCD_LDD_15, |
72 | GPIO74_LCD_FCLK, |
73 | GPIO75_LCD_LCLK, |
74 | GPIO76_LCD_PCLK, |
75 | GPIO77_LCD_BIAS, |
76 | GPIO19_GPIO, /* LCD reset */ |
77 | GPIO88_GPIO, /* LCD chipselect */ |
78 | |
79 | /* PWM */ |
80 | GPIO115_PWM1_OUT, /* Keypad Backlight */ |
81 | GPIO11_PWM2_OUT, /* LCD Backlight */ |
82 | |
83 | /* MMC */ |
84 | GPIO32_MMC_CLK, |
85 | GPIO112_MMC_CMD, |
86 | GPIO92_MMC_DAT_0, |
87 | GPIO109_MMC_DAT_1, |
88 | GPIO110_MMC_DAT_2, |
89 | GPIO111_MMC_DAT_3, |
90 | GPIO96_GPIO, /* SD detect */ |
91 | |
92 | /* STUART */ |
93 | GPIO46_STUART_RXD, |
94 | GPIO47_STUART_TXD, |
95 | |
96 | /* Keypad */ |
97 | GPIO100_KP_MKIN_0, |
98 | GPIO101_KP_MKIN_1, |
99 | GPIO102_KP_MKIN_2, |
100 | GPIO34_KP_MKIN_3, |
101 | GPIO38_KP_MKIN_4, |
102 | GPIO16_KP_MKIN_5, |
103 | GPIO17_KP_MKIN_6, |
104 | GPIO103_KP_MKOUT_0, |
105 | GPIO104_KP_MKOUT_1, |
106 | GPIO105_KP_MKOUT_2, |
107 | GPIO106_KP_MKOUT_3, |
108 | GPIO107_KP_MKOUT_4, |
109 | GPIO108_KP_MKOUT_5, |
110 | GPIO35_KP_MKOUT_6, |
111 | GPIO41_KP_MKOUT_7, |
112 | |
113 | /* I2C */ |
114 | GPIO117_I2C_SCL, |
115 | GPIO118_I2C_SDA, |
116 | |
117 | /* SSP1 */ |
118 | GPIO23_SSP1_SCLK, /* SSP1_SCK */ |
119 | GPIO25_SSP1_TXD, /* SSP1_TXD */ |
120 | GPIO26_SSP1_RXD, /* SSP1_RXD */ |
121 | |
122 | /* SSP2 */ |
123 | GPIO22_SSP2_SCLK, /* SSP2_SCK */ |
124 | GPIO13_SSP2_TXD, /* SSP2_TXD */ |
125 | GPIO40_SSP2_RXD, /* SSP2_RXD */ |
126 | |
127 | /* LEDs */ |
128 | GPIO10_GPIO, /* WiFi LED */ |
129 | GPIO83_GPIO, /* Charging LED */ |
130 | GPIO85_GPIO, /* Charged LED */ |
131 | |
132 | /* I2S */ |
133 | GPIO28_I2S_BITCLK_OUT, |
134 | GPIO29_I2S_SDATA_IN, |
135 | GPIO30_I2S_SDATA_OUT, |
136 | GPIO31_I2S_SYNC, |
137 | GPIO113_I2S_SYSCLK, |
138 | |
139 | /* MISC */ |
140 | GPIO0_GPIO, /* AC power detect */ |
141 | GPIO1_GPIO, /* Power button */ |
142 | GPIO37_GPIO, /* Headphone detect */ |
143 | GPIO98_GPIO, /* Lid switch */ |
144 | GPIO14_GPIO, /* WiFi Power */ |
145 | GPIO24_GPIO, /* WiFi CS */ |
146 | GPIO36_GPIO, /* WiFi IRQ */ |
147 | GPIO88_GPIO, /* LCD CS */ |
148 | }; |
149 | |
150 | /****************************************************************************** |
151 | * NOR Flash |
152 | ******************************************************************************/ |
153 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) |
154 | static struct resource z2_flash_resource = { |
155 | .start = PXA_CS0_PHYS, |
156 | .end = PXA_CS0_PHYS + SZ_8M - 1, |
157 | .flags = IORESOURCE_MEM, |
158 | }; |
159 | |
160 | static struct mtd_partition z2_flash_parts[] = { |
161 | { |
162 | .name = "U-Boot Bootloader", |
163 | .offset = 0x0, |
164 | .size = 0x40000, |
165 | }, { |
166 | .name = "U-Boot Environment", |
167 | .offset = 0x40000, |
168 | .size = 0x20000, |
169 | }, { |
170 | .name = "Flash", |
171 | .offset = 0x60000, |
172 | .size = MTDPART_SIZ_FULL, |
173 | }, |
174 | }; |
175 | |
176 | static struct physmap_flash_data z2_flash_data = { |
177 | .width = 2, |
178 | .parts = z2_flash_parts, |
179 | .nr_parts = ARRAY_SIZE(z2_flash_parts), |
180 | }; |
181 | |
182 | static struct platform_device z2_flash = { |
183 | .name = "physmap-flash", |
184 | .id = -1, |
185 | .resource = &z2_flash_resource, |
186 | .num_resources = 1, |
187 | .dev = { |
188 | .platform_data = &z2_flash_data, |
189 | }, |
190 | }; |
191 | |
192 | static void __init z2_nor_init(void) |
193 | { |
194 | platform_device_register(&z2_flash); |
195 | } |
196 | #else |
197 | static inline void z2_nor_init(void) {} |
198 | #endif |
199 | |
200 | /****************************************************************************** |
201 | * Backlight |
202 | ******************************************************************************/ |
203 | #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE) |
204 | static struct pwm_lookup z2_pwm_lookup[] = { |
205 | PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight.0", NULL, 1260320, |
206 | PWM_POLARITY_NORMAL), |
207 | PWM_LOOKUP("pxa27x-pwm.0", 1, "pwm-backlight.1", NULL, 1260320, |
208 | PWM_POLARITY_NORMAL), |
209 | }; |
210 | |
211 | static struct platform_pwm_backlight_data z2_backlight_data[] = { |
212 | [0] = { |
213 | /* Keypad Backlight */ |
214 | .max_brightness = 1023, |
215 | .dft_brightness = 0, |
216 | .enable_gpio = -1, |
217 | }, |
218 | [1] = { |
219 | /* LCD Backlight */ |
220 | .max_brightness = 1023, |
221 | .dft_brightness = 512, |
222 | .enable_gpio = -1, |
223 | }, |
224 | }; |
225 | |
226 | static struct platform_device z2_backlight_devices[2] = { |
227 | { |
228 | .name = "pwm-backlight", |
229 | .id = 0, |
230 | .dev = { |
231 | .platform_data = &z2_backlight_data[1], |
232 | }, |
233 | }, |
234 | { |
235 | .name = "pwm-backlight", |
236 | .id = 1, |
237 | .dev = { |
238 | .platform_data = &z2_backlight_data[0], |
239 | }, |
240 | }, |
241 | }; |
242 | static void __init z2_pwm_init(void) |
243 | { |
244 | pwm_add_table(z2_pwm_lookup, ARRAY_SIZE(z2_pwm_lookup)); |
245 | platform_device_register(&z2_backlight_devices[0]); |
246 | platform_device_register(&z2_backlight_devices[1]); |
247 | } |
248 | #else |
249 | static inline void z2_pwm_init(void) {} |
250 | #endif |
251 | |
252 | /****************************************************************************** |
253 | * Framebuffer |
254 | ******************************************************************************/ |
255 | #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE) |
256 | static struct pxafb_mode_info z2_lcd_modes[] = { |
257 | { |
258 | .pixclock = 192000, |
259 | .xres = 240, |
260 | .yres = 320, |
261 | .bpp = 16, |
262 | |
263 | .left_margin = 4, |
264 | .right_margin = 8, |
265 | .upper_margin = 4, |
266 | .lower_margin = 8, |
267 | |
268 | .hsync_len = 4, |
269 | .vsync_len = 4, |
270 | }, |
271 | }; |
272 | |
273 | static struct pxafb_mach_info z2_lcd_screen = { |
274 | .modes = z2_lcd_modes, |
275 | .num_modes = ARRAY_SIZE(z2_lcd_modes), |
276 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_BIAS_ACTIVE_LOW | |
277 | LCD_ALTERNATE_MAPPING, |
278 | }; |
279 | |
280 | static void __init z2_lcd_init(void) |
281 | { |
282 | pxa_set_fb_info(NULL, &z2_lcd_screen); |
283 | } |
284 | #else |
285 | static inline void z2_lcd_init(void) {} |
286 | #endif |
287 | |
288 | /****************************************************************************** |
289 | * SD/MMC card controller |
290 | ******************************************************************************/ |
291 | #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) |
292 | static struct pxamci_platform_data z2_mci_platform_data = { |
293 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, |
294 | .detect_delay_ms = 200, |
295 | }; |
296 | |
297 | static struct gpiod_lookup_table z2_mci_gpio_table = { |
298 | .dev_id = "pxa2xx-mci.0", |
299 | .table = { |
300 | GPIO_LOOKUP("gpio-pxa", GPIO96_ZIPITZ2_SD_DETECT, |
301 | "cd", GPIO_ACTIVE_LOW), |
302 | { }, |
303 | }, |
304 | }; |
305 | |
306 | static void __init z2_mmc_init(void) |
307 | { |
308 | gpiod_add_lookup_table(&z2_mci_gpio_table); |
309 | pxa_set_mci_info(&z2_mci_platform_data); |
310 | } |
311 | #else |
312 | static inline void z2_mmc_init(void) {} |
313 | #endif |
314 | |
315 | /****************************************************************************** |
316 | * LEDs |
317 | ******************************************************************************/ |
318 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
319 | struct gpio_led z2_gpio_leds[] = { |
320 | { |
321 | .name = "z2:green:wifi", |
322 | .default_trigger = "none", |
323 | .gpio = GPIO10_ZIPITZ2_LED_WIFI, |
324 | .active_low = 1, |
325 | }, { |
326 | .name = "z2:green:charged", |
327 | .default_trigger = "mmc0", |
328 | .gpio = GPIO85_ZIPITZ2_LED_CHARGED, |
329 | .active_low = 1, |
330 | }, { |
331 | .name = "z2:amber:charging", |
332 | .default_trigger = "Z2-charging-or-full", |
333 | .gpio = GPIO83_ZIPITZ2_LED_CHARGING, |
334 | .active_low = 1, |
335 | }, |
336 | }; |
337 | |
338 | static struct gpio_led_platform_data z2_gpio_led_info = { |
339 | .leds = z2_gpio_leds, |
340 | .num_leds = ARRAY_SIZE(z2_gpio_leds), |
341 | }; |
342 | |
343 | static struct platform_device z2_leds = { |
344 | .name = "leds-gpio", |
345 | .id = -1, |
346 | .dev = { |
347 | .platform_data = &z2_gpio_led_info, |
348 | } |
349 | }; |
350 | |
351 | static void __init z2_leds_init(void) |
352 | { |
353 | platform_device_register(&z2_leds); |
354 | } |
355 | #else |
356 | static inline void z2_leds_init(void) {} |
357 | #endif |
358 | |
359 | /****************************************************************************** |
360 | * GPIO keyboard |
361 | ******************************************************************************/ |
362 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
363 | static const unsigned int z2_matrix_keys[] = { |
364 | KEY(0, 0, KEY_OPTION), |
365 | KEY(1, 0, KEY_UP), |
366 | KEY(2, 0, KEY_DOWN), |
367 | KEY(3, 0, KEY_LEFT), |
368 | KEY(4, 0, KEY_RIGHT), |
369 | KEY(5, 0, KEY_END), |
370 | KEY(6, 0, KEY_KPPLUS), |
371 | |
372 | KEY(0, 1, KEY_HOME), |
373 | KEY(1, 1, KEY_Q), |
374 | KEY(2, 1, KEY_I), |
375 | KEY(3, 1, KEY_G), |
376 | KEY(4, 1, KEY_X), |
377 | KEY(5, 1, KEY_ENTER), |
378 | KEY(6, 1, KEY_KPMINUS), |
379 | |
380 | KEY(0, 2, KEY_PAGEUP), |
381 | KEY(1, 2, KEY_W), |
382 | KEY(2, 2, KEY_O), |
383 | KEY(3, 2, KEY_H), |
384 | KEY(4, 2, KEY_C), |
385 | KEY(5, 2, KEY_LEFTALT), |
386 | |
387 | KEY(0, 3, KEY_PAGEDOWN), |
388 | KEY(1, 3, KEY_E), |
389 | KEY(2, 3, KEY_P), |
390 | KEY(3, 3, KEY_J), |
391 | KEY(4, 3, KEY_V), |
392 | KEY(5, 3, KEY_LEFTSHIFT), |
393 | |
394 | KEY(0, 4, KEY_ESC), |
395 | KEY(1, 4, KEY_R), |
396 | KEY(2, 4, KEY_A), |
397 | KEY(3, 4, KEY_K), |
398 | KEY(4, 4, KEY_B), |
399 | KEY(5, 4, KEY_LEFTCTRL), |
400 | |
401 | KEY(0, 5, KEY_TAB), |
402 | KEY(1, 5, KEY_T), |
403 | KEY(2, 5, KEY_S), |
404 | KEY(3, 5, KEY_L), |
405 | KEY(4, 5, KEY_N), |
406 | KEY(5, 5, KEY_SPACE), |
407 | |
408 | KEY(0, 6, KEY_STOPCD), |
409 | KEY(1, 6, KEY_Y), |
410 | KEY(2, 6, KEY_D), |
411 | KEY(3, 6, KEY_BACKSPACE), |
412 | KEY(4, 6, KEY_M), |
413 | KEY(5, 6, KEY_COMMA), |
414 | |
415 | KEY(0, 7, KEY_PLAYCD), |
416 | KEY(1, 7, KEY_U), |
417 | KEY(2, 7, KEY_F), |
418 | KEY(3, 7, KEY_Z), |
419 | KEY(4, 7, KEY_SEMICOLON), |
420 | KEY(5, 7, KEY_DOT), |
421 | }; |
422 | |
423 | static struct matrix_keymap_data z2_matrix_keymap_data = { |
424 | .keymap = z2_matrix_keys, |
425 | .keymap_size = ARRAY_SIZE(z2_matrix_keys), |
426 | }; |
427 | |
428 | static struct pxa27x_keypad_platform_data z2_keypad_platform_data = { |
429 | .matrix_key_rows = 7, |
430 | .matrix_key_cols = 8, |
431 | .matrix_keymap_data = &z2_matrix_keymap_data, |
432 | |
433 | .debounce_interval = 30, |
434 | }; |
435 | |
436 | static void __init z2_mkp_init(void) |
437 | { |
438 | pxa_set_keypad_info(&z2_keypad_platform_data); |
439 | } |
440 | #else |
441 | static inline void z2_mkp_init(void) {} |
442 | #endif |
443 | |
444 | /****************************************************************************** |
445 | * GPIO keys |
446 | ******************************************************************************/ |
447 | #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE) |
448 | static struct gpio_keys_button z2_pxa_buttons[] = { |
449 | { |
450 | .code = KEY_POWER, |
451 | .gpio = GPIO1_ZIPITZ2_POWER_BUTTON, |
452 | .active_low = 0, |
453 | .desc = "Power Button", |
454 | .wakeup = 1, |
455 | .type = EV_KEY, |
456 | }, |
457 | { |
458 | .code = SW_LID, |
459 | .gpio = GPIO98_ZIPITZ2_LID_BUTTON, |
460 | .active_low = 1, |
461 | .desc = "Lid Switch", |
462 | .wakeup = 0, |
463 | .type = EV_SW, |
464 | }, |
465 | }; |
466 | |
467 | static struct gpio_keys_platform_data z2_pxa_keys_data = { |
468 | .buttons = z2_pxa_buttons, |
469 | .nbuttons = ARRAY_SIZE(z2_pxa_buttons), |
470 | }; |
471 | |
472 | static struct platform_device z2_pxa_keys = { |
473 | .name = "gpio-keys", |
474 | .id = -1, |
475 | .dev = { |
476 | .platform_data = &z2_pxa_keys_data, |
477 | }, |
478 | }; |
479 | |
480 | static void __init z2_keys_init(void) |
481 | { |
482 | platform_device_register(&z2_pxa_keys); |
483 | } |
484 | #else |
485 | static inline void z2_keys_init(void) {} |
486 | #endif |
487 | |
488 | /****************************************************************************** |
489 | * Battery |
490 | ******************************************************************************/ |
491 | #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE) |
492 | static struct z2_battery_info batt_chip_info = { |
493 | .batt_I2C_bus = 0, |
494 | .batt_I2C_addr = 0x55, |
495 | .batt_I2C_reg = 2, |
496 | .charge_gpio = GPIO0_ZIPITZ2_AC_DETECT, |
497 | .min_voltage = 3475000, |
498 | .max_voltage = 4190000, |
499 | .batt_div = 59, |
500 | .batt_mult = 1000000, |
501 | .batt_tech = POWER_SUPPLY_TECHNOLOGY_LION, |
502 | .batt_name = "Z2", |
503 | }; |
504 | |
505 | static struct i2c_board_info __initdata z2_i2c_board_info[] = { |
506 | { |
507 | I2C_BOARD_INFO("aer915", 0x55), |
508 | .platform_data = &batt_chip_info, |
509 | }, { |
510 | I2C_BOARD_INFO("wm8750", 0x1b), |
511 | }, |
512 | |
513 | }; |
514 | |
515 | static void __init z2_i2c_init(void) |
516 | { |
517 | pxa_set_i2c_info(NULL); |
518 | i2c_register_board_info(0, ARRAY_AND_SIZE(z2_i2c_board_info)); |
519 | } |
520 | #else |
521 | static inline void z2_i2c_init(void) {} |
522 | #endif |
523 | |
524 | /****************************************************************************** |
525 | * SSP Devices - WiFi and LCD control |
526 | ******************************************************************************/ |
527 | #if defined(CONFIG_SPI_PXA2XX) || defined(CONFIG_SPI_PXA2XX_MODULE) |
528 | /* WiFi */ |
529 | static int z2_lbs_spi_setup(struct spi_device *spi) |
530 | { |
531 | int ret = 0; |
532 | |
533 | ret = gpio_request(GPIO14_ZIPITZ2_WIFI_POWER, "WiFi Power"); |
534 | if (ret) |
535 | goto err; |
536 | |
537 | ret = gpio_direction_output(GPIO14_ZIPITZ2_WIFI_POWER, 1); |
538 | if (ret) |
539 | goto err2; |
540 | |
541 | /* Wait until card is powered on */ |
542 | mdelay(180); |
543 | |
544 | spi->bits_per_word = 16; |
545 | spi->mode = SPI_MODE_2, |
546 | |
547 | spi_setup(spi); |
548 | |
549 | return 0; |
550 | |
551 | err2: |
552 | gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); |
553 | err: |
554 | return ret; |
555 | }; |
556 | |
557 | static int z2_lbs_spi_teardown(struct spi_device *spi) |
558 | { |
559 | gpio_set_value(GPIO14_ZIPITZ2_WIFI_POWER, 0); |
560 | gpio_free(GPIO14_ZIPITZ2_WIFI_POWER); |
561 | |
562 | return 0; |
563 | }; |
564 | |
565 | static struct pxa2xx_spi_chip z2_lbs_chip_info = { |
566 | .rx_threshold = 8, |
567 | .tx_threshold = 8, |
568 | .timeout = 1000, |
569 | .gpio_cs = GPIO24_ZIPITZ2_WIFI_CS, |
570 | }; |
571 | |
572 | static struct libertas_spi_platform_data z2_lbs_pdata = { |
573 | .use_dummy_writes = 1, |
574 | .setup = z2_lbs_spi_setup, |
575 | .teardown = z2_lbs_spi_teardown, |
576 | }; |
577 | |
578 | /* LCD */ |
579 | static struct pxa2xx_spi_chip lms283_chip_info = { |
580 | .rx_threshold = 1, |
581 | .tx_threshold = 1, |
582 | .timeout = 64, |
583 | .gpio_cs = GPIO88_ZIPITZ2_LCD_CS, |
584 | }; |
585 | |
586 | static const struct lms283gf05_pdata lms283_pdata = { |
587 | .reset_gpio = GPIO19_ZIPITZ2_LCD_RESET, |
588 | }; |
589 | |
590 | static struct spi_board_info spi_board_info[] __initdata = { |
591 | { |
592 | .modalias = "libertas_spi", |
593 | .platform_data = &z2_lbs_pdata, |
594 | .controller_data = &z2_lbs_chip_info, |
595 | .irq = PXA_GPIO_TO_IRQ(GPIO36_ZIPITZ2_WIFI_IRQ), |
596 | .max_speed_hz = 13000000, |
597 | .bus_num = 1, |
598 | .chip_select = 0, |
599 | }, |
600 | { |
601 | .modalias = "lms283gf05", |
602 | .controller_data = &lms283_chip_info, |
603 | .platform_data = &lms283_pdata, |
604 | .max_speed_hz = 400000, |
605 | .bus_num = 2, |
606 | .chip_select = 0, |
607 | }, |
608 | }; |
609 | |
610 | static struct pxa2xx_spi_controller pxa_ssp1_master_info = { |
611 | .num_chipselect = 1, |
612 | .enable_dma = 1, |
613 | }; |
614 | |
615 | static struct pxa2xx_spi_controller pxa_ssp2_master_info = { |
616 | .num_chipselect = 1, |
617 | }; |
618 | |
619 | static void __init z2_spi_init(void) |
620 | { |
621 | pxa2xx_set_spi_info(1, &pxa_ssp1_master_info); |
622 | pxa2xx_set_spi_info(2, &pxa_ssp2_master_info); |
623 | spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info)); |
624 | } |
625 | #else |
626 | static inline void z2_spi_init(void) {} |
627 | #endif |
628 | |
629 | /****************************************************************************** |
630 | * Core power regulator |
631 | ******************************************************************************/ |
632 | #if defined(CONFIG_REGULATOR_TPS65023) || \ |
633 | defined(CONFIG_REGULATOR_TPS65023_MODULE) |
634 | static struct regulator_consumer_supply z2_tps65021_consumers[] = { |
635 | REGULATOR_SUPPLY("vcc_core", NULL), |
636 | }; |
637 | |
638 | static struct regulator_init_data z2_tps65021_info[] = { |
639 | { |
640 | .constraints = { |
641 | .name = "vcc_core range", |
642 | .min_uV = 800000, |
643 | .max_uV = 1600000, |
644 | .always_on = 1, |
645 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE, |
646 | }, |
647 | .consumer_supplies = z2_tps65021_consumers, |
648 | .num_consumer_supplies = ARRAY_SIZE(z2_tps65021_consumers), |
649 | }, { |
650 | .constraints = { |
651 | .name = "DCDC2", |
652 | .min_uV = 3300000, |
653 | .max_uV = 3300000, |
654 | .always_on = 1, |
655 | }, |
656 | }, { |
657 | .constraints = { |
658 | .name = "DCDC3", |
659 | .min_uV = 1800000, |
660 | .max_uV = 1800000, |
661 | .always_on = 1, |
662 | }, |
663 | }, { |
664 | .constraints = { |
665 | .name = "LDO1", |
666 | .min_uV = 1000000, |
667 | .max_uV = 3150000, |
668 | .always_on = 1, |
669 | }, |
670 | }, { |
671 | .constraints = { |
672 | .name = "LDO2", |
673 | .min_uV = 1050000, |
674 | .max_uV = 3300000, |
675 | .always_on = 1, |
676 | }, |
677 | } |
678 | }; |
679 | |
680 | static struct i2c_board_info __initdata z2_pi2c_board_info[] = { |
681 | { |
682 | I2C_BOARD_INFO("tps65021", 0x48), |
683 | .platform_data = &z2_tps65021_info, |
684 | }, |
685 | }; |
686 | |
687 | static void __init z2_pmic_init(void) |
688 | { |
689 | pxa27x_set_i2c_power_info(NULL); |
690 | i2c_register_board_info(1, ARRAY_AND_SIZE(z2_pi2c_board_info)); |
691 | } |
692 | #else |
693 | static inline void z2_pmic_init(void) {} |
694 | #endif |
695 | |
696 | #ifdef CONFIG_PM |
697 | static void z2_power_off(void) |
698 | { |
699 | /* We're using deep sleep as poweroff, so clear PSPR to ensure that |
700 | * bootloader will jump to its entry point in resume handler |
701 | */ |
702 | PSPR = 0x0; |
703 | local_irq_disable(); |
704 | pxa27x_set_pwrmode(PWRMODE_DEEPSLEEP); |
705 | pxa27x_cpu_pm_enter(PM_SUSPEND_MEM); |
706 | } |
707 | #else |
708 | #define z2_power_off NULL |
709 | #endif |
710 | |
711 | /****************************************************************************** |
712 | * Machine init |
713 | ******************************************************************************/ |
714 | static void __init z2_init(void) |
715 | { |
716 | pxa2xx_mfp_config(ARRAY_AND_SIZE(z2_pin_config)); |
717 | |
718 | pxa_set_ffuart_info(NULL); |
719 | pxa_set_btuart_info(NULL); |
720 | pxa_set_stuart_info(NULL); |
721 | |
722 | z2_lcd_init(); |
723 | z2_mmc_init(); |
724 | z2_mkp_init(); |
725 | z2_i2c_init(); |
726 | z2_spi_init(); |
727 | z2_nor_init(); |
728 | z2_pwm_init(); |
729 | z2_leds_init(); |
730 | z2_keys_init(); |
731 | z2_pmic_init(); |
732 | |
733 | pm_power_off = z2_power_off; |
734 | } |
735 | |
736 | MACHINE_START(ZIPIT2, "Zipit Z2") |
737 | .atag_offset = 0x100, |
738 | .map_io = pxa27x_map_io, |
739 | .nr_irqs = PXA_NR_IRQS, |
740 | .init_irq = pxa27x_init_irq, |
741 | .handle_irq = pxa27x_handle_irq, |
742 | .init_time = pxa_timer_init, |
743 | .init_machine = z2_init, |
744 | .restart = pxa_restart, |
745 | MACHINE_END |
746 |
Warning: That file was not part of the compilation database. It may have many parsing errors.