diff options
Diffstat (limited to 'arch/arm/mach-pxa/palmtreo.c')
-rw-r--r-- | arch/arm/mach-pxa/palmtreo.c | 716 |
1 files changed, 716 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c new file mode 100644 index 000000000000..606eb7e8a17e --- /dev/null +++ b/arch/arm/mach-pxa/palmtreo.c | |||
@@ -0,0 +1,716 @@ | |||
1 | /* | ||
2 | * Hardware definitions for Palm Treo smartphones | ||
3 | * | ||
4 | * currently supported: | ||
5 | * Palm Treo 680 (GSM) | ||
6 | * Palm Centro 685 (GSM) | ||
7 | * | ||
8 | * Author: Tomas Cech <sleep_walker@suse.cz> | ||
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 | * (find more info at www.hackndev.com) | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/delay.h> | ||
20 | #include <linux/irq.h> | ||
21 | #include <linux/gpio_keys.h> | ||
22 | #include <linux/input.h> | ||
23 | #include <linux/pda_power.h> | ||
24 | #include <linux/pwm_backlight.h> | ||
25 | #include <linux/gpio.h> | ||
26 | #include <linux/wm97xx_batt.h> | ||
27 | #include <linux/power_supply.h> | ||
28 | #include <linux/sysdev.h> | ||
29 | #include <linux/w1-gpio.h> | ||
30 | |||
31 | #include <asm/mach-types.h> | ||
32 | #include <asm/mach/arch.h> | ||
33 | #include <asm/mach/map.h> | ||
34 | |||
35 | #include <mach/pxa27x.h> | ||
36 | #include <mach/pxa27x-udc.h> | ||
37 | #include <mach/audio.h> | ||
38 | #include <mach/palmtreo.h> | ||
39 | #include <mach/mmc.h> | ||
40 | #include <mach/pxafb.h> | ||
41 | #include <mach/irda.h> | ||
42 | #include <mach/pxa27x_keypad.h> | ||
43 | #include <mach/udc.h> | ||
44 | #include <mach/ohci.h> | ||
45 | #include <mach/pxa2xx-regs.h> | ||
46 | #include <mach/palmasoc.h> | ||
47 | #include <mach/camera.h> | ||
48 | |||
49 | #include <sound/pxa2xx-lib.h> | ||
50 | |||
51 | #include "generic.h" | ||
52 | #include "devices.h" | ||
53 | |||
54 | /****************************************************************************** | ||
55 | * Pin configuration | ||
56 | ******************************************************************************/ | ||
57 | static unsigned long treo_pin_config[] __initdata = { | ||
58 | /* MMC */ | ||
59 | GPIO32_MMC_CLK, | ||
60 | GPIO92_MMC_DAT_0, | ||
61 | GPIO109_MMC_DAT_1, | ||
62 | GPIO110_MMC_DAT_2, | ||
63 | GPIO111_MMC_DAT_3, | ||
64 | GPIO112_MMC_CMD, | ||
65 | GPIO113_GPIO, /* SD detect */ | ||
66 | |||
67 | /* AC97 */ | ||
68 | GPIO28_AC97_BITCLK, | ||
69 | GPIO29_AC97_SDATA_IN_0, | ||
70 | GPIO30_AC97_SDATA_OUT, | ||
71 | GPIO31_AC97_SYNC, | ||
72 | GPIO89_AC97_SYSCLK, | ||
73 | GPIO95_AC97_nRESET, | ||
74 | |||
75 | /* IrDA */ | ||
76 | GPIO46_FICP_RXD, | ||
77 | GPIO47_FICP_TXD, | ||
78 | |||
79 | /* PWM */ | ||
80 | GPIO16_PWM0_OUT, | ||
81 | |||
82 | /* USB */ | ||
83 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */ | ||
84 | |||
85 | /* MATRIX KEYPAD */ | ||
86 | GPIO101_KP_MKIN_1, | ||
87 | GPIO102_KP_MKIN_2, | ||
88 | GPIO97_KP_MKIN_3, | ||
89 | GPIO98_KP_MKIN_4, | ||
90 | GPIO91_KP_MKIN_6, | ||
91 | GPIO13_KP_MKIN_7, | ||
92 | GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH, | ||
93 | GPIO104_KP_MKOUT_1, | ||
94 | GPIO105_KP_MKOUT_2, | ||
95 | GPIO106_KP_MKOUT_3, | ||
96 | GPIO107_KP_MKOUT_4, | ||
97 | GPIO108_KP_MKOUT_5, | ||
98 | GPIO96_KP_MKOUT_6, | ||
99 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */ | ||
100 | |||
101 | /* LCD */ | ||
102 | GPIO58_LCD_LDD_0, | ||
103 | GPIO59_LCD_LDD_1, | ||
104 | GPIO60_LCD_LDD_2, | ||
105 | GPIO61_LCD_LDD_3, | ||
106 | GPIO62_LCD_LDD_4, | ||
107 | GPIO63_LCD_LDD_5, | ||
108 | GPIO64_LCD_LDD_6, | ||
109 | GPIO65_LCD_LDD_7, | ||
110 | GPIO66_LCD_LDD_8, | ||
111 | GPIO67_LCD_LDD_9, | ||
112 | GPIO68_LCD_LDD_10, | ||
113 | GPIO69_LCD_LDD_11, | ||
114 | GPIO70_LCD_LDD_12, | ||
115 | GPIO71_LCD_LDD_13, | ||
116 | GPIO72_LCD_LDD_14, | ||
117 | GPIO73_LCD_LDD_15, | ||
118 | GPIO74_LCD_FCLK, | ||
119 | GPIO75_LCD_LCLK, | ||
120 | GPIO76_LCD_PCLK, | ||
121 | |||
122 | /* Quick Capture Interface */ | ||
123 | GPIO84_CIF_FV, | ||
124 | GPIO85_CIF_LV, | ||
125 | GPIO53_CIF_MCLK, | ||
126 | GPIO54_CIF_PCLK, | ||
127 | GPIO81_CIF_DD_0, | ||
128 | GPIO55_CIF_DD_1, | ||
129 | GPIO51_CIF_DD_2, | ||
130 | GPIO50_CIF_DD_3, | ||
131 | GPIO52_CIF_DD_4, | ||
132 | GPIO48_CIF_DD_5, | ||
133 | GPIO17_CIF_DD_6, | ||
134 | GPIO12_CIF_DD_7, | ||
135 | |||
136 | /* I2C */ | ||
137 | GPIO117_I2C_SCL, | ||
138 | GPIO118_I2C_SDA, | ||
139 | |||
140 | /* GSM */ | ||
141 | GPIO14_GPIO | WAKEUP_ON_EDGE_BOTH, /* GSM host wake up */ | ||
142 | GPIO34_FFUART_RXD, | ||
143 | GPIO35_FFUART_CTS, | ||
144 | GPIO39_FFUART_TXD, | ||
145 | GPIO41_FFUART_RTS, | ||
146 | |||
147 | /* MISC. */ | ||
148 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* external power detect */ | ||
149 | GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, /* silent switch */ | ||
150 | GPIO116_GPIO, /* headphone detect */ | ||
151 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */ | ||
152 | }; | ||
153 | |||
154 | #ifdef CONFIG_MACH_TREO680 | ||
155 | static unsigned long treo680_pin_config[] __initdata = { | ||
156 | GPIO33_GPIO, /* SD read only */ | ||
157 | |||
158 | /* MATRIX KEYPAD - different wake up source */ | ||
159 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | ||
160 | GPIO99_KP_MKIN_5, | ||
161 | }; | ||
162 | #endif /* CONFIG_MACH_TREO680 */ | ||
163 | |||
164 | #ifdef CONFIG_MACH_CENTRO | ||
165 | static unsigned long centro685_pin_config[] __initdata = { | ||
166 | /* Bluetooth attached to BT UART*/ | ||
167 | MFP_CFG_OUT(GPIO80, AF0, DRIVE_LOW), /* power: LOW = off */ | ||
168 | GPIO42_BTUART_RXD, | ||
169 | GPIO43_BTUART_TXD, | ||
170 | GPIO44_BTUART_CTS, | ||
171 | GPIO45_BTUART_RTS, | ||
172 | |||
173 | /* MATRIX KEYPAD - different wake up source */ | ||
174 | GPIO100_KP_MKIN_0, | ||
175 | GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, | ||
176 | }; | ||
177 | #endif /* CONFIG_MACH_CENTRO */ | ||
178 | |||
179 | /****************************************************************************** | ||
180 | * SD/MMC card controller | ||
181 | ******************************************************************************/ | ||
182 | #ifdef CONFIG_MACH_TREO680 | ||
183 | static struct pxamci_platform_data treo680_mci_platform_data = { | ||
184 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
185 | .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N, | ||
186 | .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY, | ||
187 | .gpio_power = GPIO_NR_TREO680_SD_POWER, | ||
188 | }; | ||
189 | #endif /* CONFIG_MACH_TREO680 */ | ||
190 | |||
191 | #ifdef CONFIG_MACH_CENTRO | ||
192 | static struct pxamci_platform_data centro_mci_platform_data = { | ||
193 | .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34, | ||
194 | .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N, | ||
195 | .gpio_card_ro = -1, | ||
196 | .gpio_power = GPIO_NR_CENTRO_SD_POWER, | ||
197 | .gpio_power_invert = 1, | ||
198 | }; | ||
199 | #endif /* CONFIG_MACH_CENTRO */ | ||
200 | |||
201 | /****************************************************************************** | ||
202 | * GPIO keyboard | ||
203 | ******************************************************************************/ | ||
204 | #ifdef CONFIG_MACH_TREO680 | ||
205 | static unsigned int treo680_matrix_keys[] = { | ||
206 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ | ||
207 | KEY(0, 1, KEY_LEFT), | ||
208 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ | ||
209 | KEY(0, 3, KEY_L), | ||
210 | KEY(0, 4, KEY_A), | ||
211 | KEY(0, 5, KEY_Q), | ||
212 | KEY(0, 6, KEY_P), | ||
213 | |||
214 | KEY(1, 0, KEY_RIGHTCTRL), /* Menu */ | ||
215 | KEY(1, 1, KEY_RIGHT), | ||
216 | KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */ | ||
217 | KEY(1, 3, KEY_Z), | ||
218 | KEY(1, 4, KEY_S), | ||
219 | KEY(1, 5, KEY_W), | ||
220 | |||
221 | KEY(2, 0, KEY_F1), /* Phone */ | ||
222 | KEY(2, 1, KEY_UP), | ||
223 | KEY(2, 2, KEY_0), | ||
224 | KEY(2, 3, KEY_X), | ||
225 | KEY(2, 4, KEY_D), | ||
226 | KEY(2, 5, KEY_E), | ||
227 | |||
228 | KEY(3, 0, KEY_F10), /* Calendar */ | ||
229 | KEY(3, 1, KEY_DOWN), | ||
230 | KEY(3, 2, KEY_SPACE), | ||
231 | KEY(3, 3, KEY_C), | ||
232 | KEY(3, 4, KEY_F), | ||
233 | KEY(3, 5, KEY_R), | ||
234 | |||
235 | KEY(4, 0, KEY_F12), /* Mail */ | ||
236 | KEY(4, 1, KEY_KPENTER), | ||
237 | KEY(4, 2, KEY_RIGHTALT), /* Alt */ | ||
238 | KEY(4, 3, KEY_V), | ||
239 | KEY(4, 4, KEY_G), | ||
240 | KEY(4, 5, KEY_T), | ||
241 | |||
242 | KEY(5, 0, KEY_F9), /* Home */ | ||
243 | KEY(5, 1, KEY_PAGEUP), /* Side up */ | ||
244 | KEY(5, 2, KEY_DOT), | ||
245 | KEY(5, 3, KEY_B), | ||
246 | KEY(5, 4, KEY_H), | ||
247 | KEY(5, 5, KEY_Y), | ||
248 | |||
249 | KEY(6, 0, KEY_TAB), /* Side Activate */ | ||
250 | KEY(6, 1, KEY_PAGEDOWN), /* Side down */ | ||
251 | KEY(6, 2, KEY_ENTER), | ||
252 | KEY(6, 3, KEY_N), | ||
253 | KEY(6, 4, KEY_J), | ||
254 | KEY(6, 5, KEY_U), | ||
255 | |||
256 | KEY(7, 0, KEY_F6), /* Green/Call */ | ||
257 | KEY(7, 1, KEY_O), | ||
258 | KEY(7, 2, KEY_BACKSPACE), | ||
259 | KEY(7, 3, KEY_M), | ||
260 | KEY(7, 4, KEY_K), | ||
261 | KEY(7, 5, KEY_I), | ||
262 | }; | ||
263 | |||
264 | static struct pxa27x_keypad_platform_data treo680_keypad_platform_data = { | ||
265 | .matrix_key_rows = 8, | ||
266 | .matrix_key_cols = 7, | ||
267 | .matrix_key_map = treo680_matrix_keys, | ||
268 | .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys), | ||
269 | .direct_key_map = { KEY_CONNECT }, | ||
270 | .direct_key_num = 1, | ||
271 | |||
272 | .debounce_interval = 30, | ||
273 | }; | ||
274 | #endif /* CONFIG_MACH_TREO680 */ | ||
275 | |||
276 | #ifdef CONFIG_MACH_CENTRO | ||
277 | static unsigned int centro_matrix_keys[] = { | ||
278 | KEY(0, 0, KEY_F9), /* Home */ | ||
279 | KEY(0, 1, KEY_LEFT), | ||
280 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ | ||
281 | KEY(0, 3, KEY_L), | ||
282 | KEY(0, 4, KEY_A), | ||
283 | KEY(0, 5, KEY_Q), | ||
284 | KEY(0, 6, KEY_P), | ||
285 | |||
286 | KEY(1, 0, KEY_RIGHTCTRL), /* Menu */ | ||
287 | KEY(1, 1, KEY_RIGHT), | ||
288 | KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */ | ||
289 | KEY(1, 3, KEY_Z), | ||
290 | KEY(1, 4, KEY_S), | ||
291 | KEY(1, 5, KEY_W), | ||
292 | |||
293 | KEY(2, 0, KEY_F1), /* Phone */ | ||
294 | KEY(2, 1, KEY_UP), | ||
295 | KEY(2, 2, KEY_0), | ||
296 | KEY(2, 3, KEY_X), | ||
297 | KEY(2, 4, KEY_D), | ||
298 | KEY(2, 5, KEY_E), | ||
299 | |||
300 | KEY(3, 0, KEY_F10), /* Calendar */ | ||
301 | KEY(3, 1, KEY_DOWN), | ||
302 | KEY(3, 2, KEY_SPACE), | ||
303 | KEY(3, 3, KEY_C), | ||
304 | KEY(3, 4, KEY_F), | ||
305 | KEY(3, 5, KEY_R), | ||
306 | |||
307 | KEY(4, 0, KEY_F12), /* Mail */ | ||
308 | KEY(4, 1, KEY_KPENTER), | ||
309 | KEY(4, 2, KEY_RIGHTALT), /* Alt */ | ||
310 | KEY(4, 3, KEY_V), | ||
311 | KEY(4, 4, KEY_G), | ||
312 | KEY(4, 5, KEY_T), | ||
313 | |||
314 | KEY(5, 0, KEY_F8), /* Red/Off/Power */ | ||
315 | KEY(5, 1, KEY_PAGEUP), /* Side up */ | ||
316 | KEY(5, 2, KEY_DOT), | ||
317 | KEY(5, 3, KEY_B), | ||
318 | KEY(5, 4, KEY_H), | ||
319 | KEY(5, 5, KEY_Y), | ||
320 | |||
321 | KEY(6, 0, KEY_TAB), /* Side Activate */ | ||
322 | KEY(6, 1, KEY_PAGEDOWN), /* Side down */ | ||
323 | KEY(6, 2, KEY_ENTER), | ||
324 | KEY(6, 3, KEY_N), | ||
325 | KEY(6, 4, KEY_J), | ||
326 | KEY(6, 5, KEY_U), | ||
327 | |||
328 | KEY(7, 0, KEY_F6), /* Green/Call */ | ||
329 | KEY(7, 1, KEY_O), | ||
330 | KEY(7, 2, KEY_BACKSPACE), | ||
331 | KEY(7, 3, KEY_M), | ||
332 | KEY(7, 4, KEY_K), | ||
333 | KEY(7, 5, KEY_I), | ||
334 | }; | ||
335 | |||
336 | static struct pxa27x_keypad_platform_data centro_keypad_platform_data = { | ||
337 | .matrix_key_rows = 8, | ||
338 | .matrix_key_cols = 7, | ||
339 | .matrix_key_map = centro_matrix_keys, | ||
340 | .matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys), | ||
341 | .direct_key_map = { KEY_CONNECT }, | ||
342 | .direct_key_num = 1, | ||
343 | |||
344 | .debounce_interval = 30, | ||
345 | }; | ||
346 | #endif /* CONFIG_MACH_CENTRO */ | ||
347 | |||
348 | /****************************************************************************** | ||
349 | * aSoC audio | ||
350 | ******************************************************************************/ | ||
351 | |||
352 | static pxa2xx_audio_ops_t treo_ac97_pdata = { | ||
353 | .reset_gpio = 95, | ||
354 | }; | ||
355 | |||
356 | /****************************************************************************** | ||
357 | * Backlight | ||
358 | ******************************************************************************/ | ||
359 | static int treo_backlight_init(struct device *dev) | ||
360 | { | ||
361 | int ret; | ||
362 | |||
363 | ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER"); | ||
364 | if (ret) | ||
365 | goto err; | ||
366 | ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0); | ||
367 | if (ret) | ||
368 | goto err2; | ||
369 | |||
370 | return 0; | ||
371 | |||
372 | err2: | ||
373 | gpio_free(GPIO_NR_TREO_BL_POWER); | ||
374 | err: | ||
375 | return ret; | ||
376 | } | ||
377 | |||
378 | static int treo_backlight_notify(int brightness) | ||
379 | { | ||
380 | gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness); | ||
381 | return TREO_MAX_INTENSITY - brightness; | ||
382 | }; | ||
383 | |||
384 | static void treo_backlight_exit(struct device *dev) | ||
385 | { | ||
386 | gpio_free(GPIO_NR_TREO_BL_POWER); | ||
387 | } | ||
388 | |||
389 | static struct platform_pwm_backlight_data treo_backlight_data = { | ||
390 | .pwm_id = 0, | ||
391 | .max_brightness = TREO_MAX_INTENSITY, | ||
392 | .dft_brightness = TREO_DEFAULT_INTENSITY, | ||
393 | .pwm_period_ns = TREO_PERIOD_NS, | ||
394 | .init = treo_backlight_init, | ||
395 | .notify = treo_backlight_notify, | ||
396 | .exit = treo_backlight_exit, | ||
397 | }; | ||
398 | |||
399 | static struct platform_device treo_backlight = { | ||
400 | .name = "pwm-backlight", | ||
401 | .dev = { | ||
402 | .parent = &pxa27x_device_pwm0.dev, | ||
403 | .platform_data = &treo_backlight_data, | ||
404 | }, | ||
405 | }; | ||
406 | |||
407 | /****************************************************************************** | ||
408 | * IrDA | ||
409 | ******************************************************************************/ | ||
410 | static struct pxaficp_platform_data treo_ficp_info = { | ||
411 | .gpio_pwdown = GPIO_NR_TREO_IR_EN, | ||
412 | .transceiver_cap = IR_SIRMODE | IR_OFF, | ||
413 | }; | ||
414 | |||
415 | /****************************************************************************** | ||
416 | * UDC | ||
417 | ******************************************************************************/ | ||
418 | static struct pxa2xx_udc_mach_info treo_udc_info __initdata = { | ||
419 | .gpio_vbus = GPIO_NR_TREO_USB_DETECT, | ||
420 | .gpio_vbus_inverted = 1, | ||
421 | .gpio_pullup = GPIO_NR_TREO_USB_PULLUP, | ||
422 | }; | ||
423 | |||
424 | |||
425 | /****************************************************************************** | ||
426 | * USB host | ||
427 | ******************************************************************************/ | ||
428 | #ifdef CONFIG_MACH_TREO680 | ||
429 | static struct pxaohci_platform_data treo680_ohci_info = { | ||
430 | .port_mode = PMM_PERPORT_MODE, | ||
431 | .flags = ENABLE_PORT1 | ENABLE_PORT3, | ||
432 | .power_budget = 0, | ||
433 | }; | ||
434 | #endif /* CONFIG_MACH_TREO680 */ | ||
435 | |||
436 | /****************************************************************************** | ||
437 | * Power supply | ||
438 | ******************************************************************************/ | ||
439 | static int power_supply_init(struct device *dev) | ||
440 | { | ||
441 | int ret; | ||
442 | |||
443 | ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC"); | ||
444 | if (ret) | ||
445 | goto err1; | ||
446 | ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT); | ||
447 | if (ret) | ||
448 | goto err2; | ||
449 | |||
450 | return 0; | ||
451 | |||
452 | err2: | ||
453 | gpio_free(GPIO_NR_TREO_POWER_DETECT); | ||
454 | err1: | ||
455 | return ret; | ||
456 | } | ||
457 | |||
458 | static int treo_is_ac_online(void) | ||
459 | { | ||
460 | return gpio_get_value(GPIO_NR_TREO_POWER_DETECT); | ||
461 | } | ||
462 | |||
463 | static void power_supply_exit(struct device *dev) | ||
464 | { | ||
465 | gpio_free(GPIO_NR_TREO_POWER_DETECT); | ||
466 | } | ||
467 | |||
468 | static char *treo_supplicants[] = { | ||
469 | "main-battery", | ||
470 | }; | ||
471 | |||
472 | static struct pda_power_pdata power_supply_info = { | ||
473 | .init = power_supply_init, | ||
474 | .is_ac_online = treo_is_ac_online, | ||
475 | .exit = power_supply_exit, | ||
476 | .supplied_to = treo_supplicants, | ||
477 | .num_supplicants = ARRAY_SIZE(treo_supplicants), | ||
478 | }; | ||
479 | |||
480 | static struct platform_device power_supply = { | ||
481 | .name = "pda-power", | ||
482 | .id = -1, | ||
483 | .dev = { | ||
484 | .platform_data = &power_supply_info, | ||
485 | }, | ||
486 | }; | ||
487 | |||
488 | /****************************************************************************** | ||
489 | * Vibra and LEDs | ||
490 | ******************************************************************************/ | ||
491 | #ifdef CONFIG_MACH_TREO680 | ||
492 | static struct gpio_led treo680_gpio_leds[] = { | ||
493 | { | ||
494 | .name = "treo680:vibra:vibra", | ||
495 | .default_trigger = "none", | ||
496 | .gpio = GPIO_NR_TREO680_VIBRATE_EN, | ||
497 | }, | ||
498 | { | ||
499 | .name = "treo680:green:led", | ||
500 | .default_trigger = "mmc0", | ||
501 | .gpio = GPIO_NR_TREO_GREEN_LED, | ||
502 | }, | ||
503 | { | ||
504 | .name = "treo680:white:keybbl", | ||
505 | .default_trigger = "none", | ||
506 | .gpio = GPIO_NR_TREO680_KEYB_BL, | ||
507 | }, | ||
508 | }; | ||
509 | |||
510 | static struct gpio_led_platform_data treo680_gpio_led_info = { | ||
511 | .leds = treo680_gpio_leds, | ||
512 | .num_leds = ARRAY_SIZE(treo680_gpio_leds), | ||
513 | }; | ||
514 | |||
515 | static struct platform_device treo680_leds = { | ||
516 | .name = "leds-gpio", | ||
517 | .id = -1, | ||
518 | .dev = { | ||
519 | .platform_data = &treo680_gpio_led_info, | ||
520 | } | ||
521 | }; | ||
522 | #endif /* CONFIG_MACH_TREO680 */ | ||
523 | |||
524 | #ifdef CONFIG_MACH_CENTRO | ||
525 | static struct gpio_led centro_gpio_leds[] = { | ||
526 | { | ||
527 | .name = "centro:vibra:vibra", | ||
528 | .default_trigger = "none", | ||
529 | .gpio = GPIO_NR_CENTRO_VIBRATE_EN, | ||
530 | }, | ||
531 | { | ||
532 | .name = "centro:green:led", | ||
533 | .default_trigger = "mmc0", | ||
534 | .gpio = GPIO_NR_TREO_GREEN_LED, | ||
535 | }, | ||
536 | { | ||
537 | .name = "centro:white:keybbl", | ||
538 | .default_trigger = "none", | ||
539 | .active_low = 1, | ||
540 | .gpio = GPIO_NR_CENTRO_KEYB_BL, | ||
541 | }, | ||
542 | }; | ||
543 | |||
544 | static struct gpio_led_platform_data centro_gpio_led_info = { | ||
545 | .leds = centro_gpio_leds, | ||
546 | .num_leds = ARRAY_SIZE(centro_gpio_leds), | ||
547 | }; | ||
548 | |||
549 | static struct platform_device centro_leds = { | ||
550 | .name = "leds-gpio", | ||
551 | .id = -1, | ||
552 | .dev = { | ||
553 | .platform_data = ¢ro_gpio_led_info, | ||
554 | } | ||
555 | }; | ||
556 | #endif /* CONFIG_MACH_CENTRO */ | ||
557 | |||
558 | /****************************************************************************** | ||
559 | * Framebuffer | ||
560 | ******************************************************************************/ | ||
561 | /* TODO: add support for 324x324 */ | ||
562 | static struct pxafb_mode_info treo_lcd_modes[] = { | ||
563 | { | ||
564 | .pixclock = 86538, | ||
565 | .xres = 320, | ||
566 | .yres = 320, | ||
567 | .bpp = 16, | ||
568 | |||
569 | .left_margin = 20, | ||
570 | .right_margin = 8, | ||
571 | .upper_margin = 8, | ||
572 | .lower_margin = 5, | ||
573 | |||
574 | .hsync_len = 4, | ||
575 | .vsync_len = 1, | ||
576 | }, | ||
577 | }; | ||
578 | |||
579 | static void treo_lcd_power(int on, struct fb_var_screeninfo *info) | ||
580 | { | ||
581 | gpio_set_value(GPIO_NR_TREO_BL_POWER, on); | ||
582 | } | ||
583 | |||
584 | static struct pxafb_mach_info treo_lcd_screen = { | ||
585 | .modes = treo_lcd_modes, | ||
586 | .num_modes = ARRAY_SIZE(treo_lcd_modes), | ||
587 | .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL, | ||
588 | }; | ||
589 | |||
590 | /****************************************************************************** | ||
591 | * Power management - standby | ||
592 | ******************************************************************************/ | ||
593 | static void __init treo_pm_init(void) | ||
594 | { | ||
595 | static u32 resume[] = { | ||
596 | 0xe3a00101, /* mov r0, #0x40000000 */ | ||
597 | 0xe380060f, /* orr r0, r0, #0x00f00000 */ | ||
598 | 0xe590f008, /* ldr pc, [r0, #0x08] */ | ||
599 | }; | ||
600 | |||
601 | /* this is where the bootloader jumps */ | ||
602 | memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume)); | ||
603 | } | ||
604 | |||
605 | /****************************************************************************** | ||
606 | * Machine init | ||
607 | ******************************************************************************/ | ||
608 | static struct platform_device *treo_devices[] __initdata = { | ||
609 | &treo_backlight, | ||
610 | &power_supply, | ||
611 | }; | ||
612 | |||
613 | #ifdef CONFIG_MACH_TREO680 | ||
614 | static struct platform_device *treo680_devices[] __initdata = { | ||
615 | &treo680_leds, | ||
616 | }; | ||
617 | #endif /* CONFIG_MACH_TREO680 */ | ||
618 | |||
619 | #ifdef CONFIG_MACH_CENTRO | ||
620 | static struct platform_device *centro_devices[] __initdata = { | ||
621 | ¢ro_leds, | ||
622 | }; | ||
623 | #endif /* CONFIG_MACH_CENTRO */ | ||
624 | |||
625 | /* setup udc GPIOs initial state */ | ||
626 | static void __init treo_udc_init(void) | ||
627 | { | ||
628 | if (!gpio_request(GPIO_NR_TREO_USB_PULLUP, "UDC Vbus")) { | ||
629 | gpio_direction_output(GPIO_NR_TREO_USB_PULLUP, 1); | ||
630 | gpio_free(GPIO_NR_TREO_USB_PULLUP); | ||
631 | } | ||
632 | } | ||
633 | |||
634 | static void __init treo_lcd_power_init(void) | ||
635 | { | ||
636 | int ret; | ||
637 | |||
638 | ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER"); | ||
639 | if (ret) { | ||
640 | pr_err("Treo680: LCD power GPIO request failed!\n"); | ||
641 | return; | ||
642 | } | ||
643 | |||
644 | ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0); | ||
645 | if (ret) { | ||
646 | pr_err("Treo680: setting LCD power GPIO direction failed!\n"); | ||
647 | gpio_free(GPIO_NR_TREO_LCD_POWER); | ||
648 | return; | ||
649 | } | ||
650 | |||
651 | treo_lcd_screen.pxafb_lcd_power = treo_lcd_power; | ||
652 | } | ||
653 | |||
654 | static void __init treo_init(void) | ||
655 | { | ||
656 | pxa_set_ffuart_info(NULL); | ||
657 | pxa_set_btuart_info(NULL); | ||
658 | pxa_set_stuart_info(NULL); | ||
659 | |||
660 | treo_pm_init(); | ||
661 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config)); | ||
662 | treo_lcd_power_init(); | ||
663 | set_pxa_fb_info(&treo_lcd_screen); | ||
664 | treo_udc_init(); | ||
665 | pxa_set_udc_info(&treo_udc_info); | ||
666 | pxa_set_ac97_info(&treo_ac97_pdata); | ||
667 | pxa_set_ficp_info(&treo_ficp_info); | ||
668 | |||
669 | platform_add_devices(ARRAY_AND_SIZE(treo_devices)); | ||
670 | } | ||
671 | |||
672 | #ifdef CONFIG_MACH_TREO680 | ||
673 | static void __init treo680_init(void) | ||
674 | { | ||
675 | treo_init(); | ||
676 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); | ||
677 | pxa_set_mci_info(&treo680_mci_platform_data); | ||
678 | pxa_set_keypad_info(&treo680_keypad_platform_data); | ||
679 | pxa_set_ohci_info(&treo680_ohci_info); | ||
680 | |||
681 | platform_add_devices(ARRAY_AND_SIZE(treo680_devices)); | ||
682 | } | ||
683 | |||
684 | MACHINE_START(TREO680, "Palm Treo 680") | ||
685 | .phys_io = TREO_PHYS_IO_START, | ||
686 | .io_pg_offst = io_p2v(0x40000000), | ||
687 | .boot_params = 0xa0000100, | ||
688 | .map_io = pxa_map_io, | ||
689 | .init_irq = pxa27x_init_irq, | ||
690 | .timer = &pxa_timer, | ||
691 | .init_machine = treo680_init, | ||
692 | MACHINE_END | ||
693 | #endif /* CONFIG_MACH_TREO680 */ | ||
694 | |||
695 | #ifdef CONFIG_MACH_CENTRO | ||
696 | static void __init centro_init(void) | ||
697 | { | ||
698 | treo_init(); | ||
699 | pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config)); | ||
700 | pxa_set_mci_info(¢ro_mci_platform_data); | ||
701 | |||
702 | pxa_set_keypad_info(¢ro_keypad_platform_data); | ||
703 | |||
704 | platform_add_devices(ARRAY_AND_SIZE(centro_devices)); | ||
705 | } | ||
706 | |||
707 | MACHINE_START(CENTRO, "Palm Centro 685") | ||
708 | .phys_io = TREO_PHYS_IO_START, | ||
709 | .io_pg_offst = io_p2v(0x40000000), | ||
710 | .boot_params = 0xa0000100, | ||
711 | .map_io = pxa_map_io, | ||
712 | .init_irq = pxa27x_init_irq, | ||
713 | .timer = &pxa_timer, | ||
714 | .init_machine = centro_init, | ||
715 | MACHINE_END | ||
716 | #endif /* CONFIG_MACH_CENTRO */ | ||