]>
Commit | Line | Data |
---|---|---|
e6c3f4b8 | 1 | /* |
bb2ae8f0 TČ |
2 | * Hardware definitions for Palm Treo smartphones |
3 | * | |
4 | * currently supported: | |
5 | * Palm Treo 680 (GSM) | |
d0a92fd3 | 6 | * Palm Centro 685 (GSM) |
e6c3f4b8 TSC |
7 | * |
8 | * Author: Tomas Cech <[email protected]> | |
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> | |
8d717a52 | 23 | #include <linux/memblock.h> |
e6c3f4b8 TSC |
24 | #include <linux/pda_power.h> |
25 | #include <linux/pwm_backlight.h> | |
26 | #include <linux/gpio.h> | |
e6c3f4b8 TSC |
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> | |
bb2ae8f0 | 38 | #include <mach/palmtreo.h> |
e6c3f4b8 TSC |
39 | #include <mach/mmc.h> |
40 | #include <mach/pxafb.h> | |
41 | #include <mach/irda.h> | |
4a2490ea | 42 | #include <plat/pxa27x_keypad.h> |
e6c3f4b8 TSC |
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> | |
31620e21 | 48 | #include <mach/palm27x.h> |
e6c3f4b8 TSC |
49 | |
50 | #include <sound/pxa2xx-lib.h> | |
51 | ||
52 | #include "generic.h" | |
53 | #include "devices.h" | |
54 | ||
55 | /****************************************************************************** | |
56 | * Pin configuration | |
57 | ******************************************************************************/ | |
bb2ae8f0 | 58 | static unsigned long treo_pin_config[] __initdata = { |
e6c3f4b8 TSC |
59 | /* MMC */ |
60 | GPIO32_MMC_CLK, | |
61 | GPIO92_MMC_DAT_0, | |
62 | GPIO109_MMC_DAT_1, | |
63 | GPIO110_MMC_DAT_2, | |
64 | GPIO111_MMC_DAT_3, | |
65 | GPIO112_MMC_CMD, | |
e6c3f4b8 TSC |
66 | GPIO113_GPIO, /* SD detect */ |
67 | ||
68 | /* AC97 */ | |
69 | GPIO28_AC97_BITCLK, | |
70 | GPIO29_AC97_SDATA_IN_0, | |
71 | GPIO30_AC97_SDATA_OUT, | |
72 | GPIO31_AC97_SYNC, | |
73 | GPIO89_AC97_SYSCLK, | |
74 | GPIO95_AC97_nRESET, | |
75 | ||
76 | /* IrDA */ | |
77 | GPIO46_FICP_RXD, | |
78 | GPIO47_FICP_TXD, | |
79 | ||
80 | /* PWM */ | |
81 | GPIO16_PWM0_OUT, | |
82 | ||
83 | /* USB */ | |
84 | GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH, /* usb detect */ | |
85 | ||
86 | /* MATRIX KEYPAD */ | |
e6c3f4b8 TSC |
87 | GPIO101_KP_MKIN_1, |
88 | GPIO102_KP_MKIN_2, | |
89 | GPIO97_KP_MKIN_3, | |
90 | GPIO98_KP_MKIN_4, | |
e6c3f4b8 TSC |
91 | GPIO91_KP_MKIN_6, |
92 | GPIO13_KP_MKIN_7, | |
93 | GPIO103_KP_MKOUT_0 | MFP_LPM_DRIVE_HIGH, | |
94 | GPIO104_KP_MKOUT_1, | |
95 | GPIO105_KP_MKOUT_2, | |
96 | GPIO106_KP_MKOUT_3, | |
97 | GPIO107_KP_MKOUT_4, | |
98 | GPIO108_KP_MKOUT_5, | |
99 | GPIO96_KP_MKOUT_6, | |
100 | GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */ | |
101 | ||
102 | /* LCD */ | |
bedbda97 | 103 | GPIOxx_LCD_TFT_16BPP, |
e6c3f4b8 TSC |
104 | |
105 | /* Quick Capture Interface */ | |
106 | GPIO84_CIF_FV, | |
107 | GPIO85_CIF_LV, | |
108 | GPIO53_CIF_MCLK, | |
109 | GPIO54_CIF_PCLK, | |
110 | GPIO81_CIF_DD_0, | |
111 | GPIO55_CIF_DD_1, | |
112 | GPIO51_CIF_DD_2, | |
113 | GPIO50_CIF_DD_3, | |
114 | GPIO52_CIF_DD_4, | |
115 | GPIO48_CIF_DD_5, | |
116 | GPIO17_CIF_DD_6, | |
117 | GPIO12_CIF_DD_7, | |
118 | ||
119 | /* I2C */ | |
120 | GPIO117_I2C_SCL, | |
121 | GPIO118_I2C_SDA, | |
122 | ||
123 | /* GSM */ | |
124 | GPIO14_GPIO | WAKEUP_ON_EDGE_BOTH, /* GSM host wake up */ | |
125 | GPIO34_FFUART_RXD, | |
126 | GPIO35_FFUART_CTS, | |
127 | GPIO39_FFUART_TXD, | |
128 | GPIO41_FFUART_RTS, | |
129 | ||
130 | /* MISC. */ | |
131 | GPIO0_GPIO | WAKEUP_ON_EDGE_BOTH, /* external power detect */ | |
132 | GPIO15_GPIO | WAKEUP_ON_EDGE_BOTH, /* silent switch */ | |
133 | GPIO116_GPIO, /* headphone detect */ | |
134 | GPIO11_GPIO | WAKEUP_ON_EDGE_BOTH, /* bluetooth host wake up */ | |
135 | }; | |
136 | ||
bb2ae8f0 TČ |
137 | #ifdef CONFIG_MACH_TREO680 |
138 | static unsigned long treo680_pin_config[] __initdata = { | |
139 | GPIO33_GPIO, /* SD read only */ | |
140 | ||
141 | /* MATRIX KEYPAD - different wake up source */ | |
142 | GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, | |
143 | GPIO99_KP_MKIN_5, | |
144 | }; | |
145 | #endif /* CONFIG_MACH_TREO680 */ | |
146 | ||
d0a92fd3 TČ |
147 | #ifdef CONFIG_MACH_CENTRO |
148 | static unsigned long centro685_pin_config[] __initdata = { | |
149 | /* Bluetooth attached to BT UART*/ | |
150 | MFP_CFG_OUT(GPIO80, AF0, DRIVE_LOW), /* power: LOW = off */ | |
151 | GPIO42_BTUART_RXD, | |
152 | GPIO43_BTUART_TXD, | |
153 | GPIO44_BTUART_CTS, | |
154 | GPIO45_BTUART_RTS, | |
155 | ||
156 | /* MATRIX KEYPAD - different wake up source */ | |
157 | GPIO100_KP_MKIN_0, | |
158 | GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, | |
159 | }; | |
160 | #endif /* CONFIG_MACH_CENTRO */ | |
161 | ||
e6c3f4b8 TSC |
162 | /****************************************************************************** |
163 | * GPIO keyboard | |
164 | ******************************************************************************/ | |
31620e21 | 165 | #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) |
e6c3f4b8 TSC |
166 | static unsigned int treo680_matrix_keys[] = { |
167 | KEY(0, 0, KEY_F8), /* Red/Off/Power */ | |
168 | KEY(0, 1, KEY_LEFT), | |
169 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ | |
170 | KEY(0, 3, KEY_L), | |
171 | KEY(0, 4, KEY_A), | |
172 | KEY(0, 5, KEY_Q), | |
173 | KEY(0, 6, KEY_P), | |
174 | ||
175 | KEY(1, 0, KEY_RIGHTCTRL), /* Menu */ | |
176 | KEY(1, 1, KEY_RIGHT), | |
177 | KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */ | |
178 | KEY(1, 3, KEY_Z), | |
179 | KEY(1, 4, KEY_S), | |
180 | KEY(1, 5, KEY_W), | |
181 | ||
182 | KEY(2, 0, KEY_F1), /* Phone */ | |
183 | KEY(2, 1, KEY_UP), | |
184 | KEY(2, 2, KEY_0), | |
185 | KEY(2, 3, KEY_X), | |
186 | KEY(2, 4, KEY_D), | |
187 | KEY(2, 5, KEY_E), | |
188 | ||
189 | KEY(3, 0, KEY_F10), /* Calendar */ | |
190 | KEY(3, 1, KEY_DOWN), | |
191 | KEY(3, 2, KEY_SPACE), | |
192 | KEY(3, 3, KEY_C), | |
193 | KEY(3, 4, KEY_F), | |
194 | KEY(3, 5, KEY_R), | |
195 | ||
196 | KEY(4, 0, KEY_F12), /* Mail */ | |
197 | KEY(4, 1, KEY_KPENTER), | |
198 | KEY(4, 2, KEY_RIGHTALT), /* Alt */ | |
199 | KEY(4, 3, KEY_V), | |
200 | KEY(4, 4, KEY_G), | |
201 | KEY(4, 5, KEY_T), | |
202 | ||
203 | KEY(5, 0, KEY_F9), /* Home */ | |
204 | KEY(5, 1, KEY_PAGEUP), /* Side up */ | |
205 | KEY(5, 2, KEY_DOT), | |
206 | KEY(5, 3, KEY_B), | |
207 | KEY(5, 4, KEY_H), | |
208 | KEY(5, 5, KEY_Y), | |
209 | ||
210 | KEY(6, 0, KEY_TAB), /* Side Activate */ | |
211 | KEY(6, 1, KEY_PAGEDOWN), /* Side down */ | |
212 | KEY(6, 2, KEY_ENTER), | |
213 | KEY(6, 3, KEY_N), | |
214 | KEY(6, 4, KEY_J), | |
215 | KEY(6, 5, KEY_U), | |
216 | ||
217 | KEY(7, 0, KEY_F6), /* Green/Call */ | |
218 | KEY(7, 1, KEY_O), | |
219 | KEY(7, 2, KEY_BACKSPACE), | |
220 | KEY(7, 3, KEY_M), | |
221 | KEY(7, 4, KEY_K), | |
222 | KEY(7, 5, KEY_I), | |
223 | }; | |
224 | ||
d0a92fd3 TČ |
225 | static unsigned int centro_matrix_keys[] = { |
226 | KEY(0, 0, KEY_F9), /* Home */ | |
227 | KEY(0, 1, KEY_LEFT), | |
228 | KEY(0, 2, KEY_LEFTCTRL), /* Alternate */ | |
229 | KEY(0, 3, KEY_L), | |
230 | KEY(0, 4, KEY_A), | |
231 | KEY(0, 5, KEY_Q), | |
232 | KEY(0, 6, KEY_P), | |
233 | ||
234 | KEY(1, 0, KEY_RIGHTCTRL), /* Menu */ | |
235 | KEY(1, 1, KEY_RIGHT), | |
236 | KEY(1, 2, KEY_LEFTSHIFT), /* Left shift */ | |
237 | KEY(1, 3, KEY_Z), | |
238 | KEY(1, 4, KEY_S), | |
239 | KEY(1, 5, KEY_W), | |
240 | ||
241 | KEY(2, 0, KEY_F1), /* Phone */ | |
242 | KEY(2, 1, KEY_UP), | |
243 | KEY(2, 2, KEY_0), | |
244 | KEY(2, 3, KEY_X), | |
245 | KEY(2, 4, KEY_D), | |
246 | KEY(2, 5, KEY_E), | |
247 | ||
248 | KEY(3, 0, KEY_F10), /* Calendar */ | |
249 | KEY(3, 1, KEY_DOWN), | |
250 | KEY(3, 2, KEY_SPACE), | |
251 | KEY(3, 3, KEY_C), | |
252 | KEY(3, 4, KEY_F), | |
253 | KEY(3, 5, KEY_R), | |
254 | ||
255 | KEY(4, 0, KEY_F12), /* Mail */ | |
256 | KEY(4, 1, KEY_KPENTER), | |
257 | KEY(4, 2, KEY_RIGHTALT), /* Alt */ | |
258 | KEY(4, 3, KEY_V), | |
259 | KEY(4, 4, KEY_G), | |
260 | KEY(4, 5, KEY_T), | |
261 | ||
262 | KEY(5, 0, KEY_F8), /* Red/Off/Power */ | |
263 | KEY(5, 1, KEY_PAGEUP), /* Side up */ | |
264 | KEY(5, 2, KEY_DOT), | |
265 | KEY(5, 3, KEY_B), | |
266 | KEY(5, 4, KEY_H), | |
267 | KEY(5, 5, KEY_Y), | |
268 | ||
269 | KEY(6, 0, KEY_TAB), /* Side Activate */ | |
270 | KEY(6, 1, KEY_PAGEDOWN), /* Side down */ | |
271 | KEY(6, 2, KEY_ENTER), | |
272 | KEY(6, 3, KEY_N), | |
273 | KEY(6, 4, KEY_J), | |
274 | KEY(6, 5, KEY_U), | |
275 | ||
276 | KEY(7, 0, KEY_F6), /* Green/Call */ | |
277 | KEY(7, 1, KEY_O), | |
278 | KEY(7, 2, KEY_BACKSPACE), | |
279 | KEY(7, 3, KEY_M), | |
280 | KEY(7, 4, KEY_K), | |
281 | KEY(7, 5, KEY_I), | |
282 | }; | |
283 | ||
31620e21 | 284 | static struct pxa27x_keypad_platform_data treo680_keypad_pdata = { |
d0a92fd3 TČ |
285 | .matrix_key_rows = 8, |
286 | .matrix_key_cols = 7, | |
31620e21 MV |
287 | .matrix_key_map = treo680_matrix_keys, |
288 | .matrix_key_map_size = ARRAY_SIZE(treo680_matrix_keys), | |
d0a92fd3 TČ |
289 | .direct_key_map = { KEY_CONNECT }, |
290 | .direct_key_num = 1, | |
291 | ||
292 | .debounce_interval = 30, | |
293 | }; | |
d0a92fd3 | 294 | |
31620e21 | 295 | static void __init palmtreo_kpc_init(void) |
e6c3f4b8 | 296 | { |
31620e21 | 297 | static struct pxa27x_keypad_platform_data *data = &treo680_keypad_pdata; |
28d7a946 | 298 | |
31620e21 MV |
299 | if (machine_is_centro()) { |
300 | data->matrix_key_map = centro_matrix_keys; | |
301 | data->matrix_key_map_size = ARRAY_SIZE(centro_matrix_keys); | |
302 | } | |
e6c3f4b8 | 303 | |
31620e21 | 304 | pxa_set_keypad_info(&treo680_keypad_pdata); |
e6c3f4b8 | 305 | } |
31620e21 MV |
306 | #else |
307 | static inline void palmtreo_kpc_init(void) {} | |
308 | #endif | |
e6c3f4b8 TSC |
309 | |
310 | /****************************************************************************** | |
311 | * USB host | |
312 | ******************************************************************************/ | |
31620e21 | 313 | #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) |
e6c3f4b8 TSC |
314 | static struct pxaohci_platform_data treo680_ohci_info = { |
315 | .port_mode = PMM_PERPORT_MODE, | |
316 | .flags = ENABLE_PORT1 | ENABLE_PORT3, | |
317 | .power_budget = 0, | |
318 | }; | |
319 | ||
31620e21 | 320 | static void __init palmtreo_uhc_init(void) |
e6c3f4b8 | 321 | { |
31620e21 MV |
322 | if (machine_is_treo680()) |
323 | pxa_set_ohci_info(&treo680_ohci_info); | |
e6c3f4b8 | 324 | } |
31620e21 MV |
325 | #else |
326 | static inline void palmtreo_uhc_init(void) {} | |
327 | #endif | |
e6c3f4b8 TSC |
328 | |
329 | /****************************************************************************** | |
330 | * Vibra and LEDs | |
331 | ******************************************************************************/ | |
bb2ae8f0 TČ |
332 | #ifdef CONFIG_MACH_TREO680 |
333 | static struct gpio_led treo680_gpio_leds[] = { | |
e6c3f4b8 TSC |
334 | { |
335 | .name = "treo680:vibra:vibra", | |
336 | .default_trigger = "none", | |
337 | .gpio = GPIO_NR_TREO680_VIBRATE_EN, | |
338 | }, | |
339 | { | |
340 | .name = "treo680:green:led", | |
341 | .default_trigger = "mmc0", | |
bb2ae8f0 | 342 | .gpio = GPIO_NR_TREO_GREEN_LED, |
e6c3f4b8 TSC |
343 | }, |
344 | { | |
bb2ae8f0 | 345 | .name = "treo680:white:keybbl", |
e6c3f4b8 TSC |
346 | .default_trigger = "none", |
347 | .gpio = GPIO_NR_TREO680_KEYB_BL, | |
348 | }, | |
349 | }; | |
350 | ||
bb2ae8f0 TČ |
351 | static struct gpio_led_platform_data treo680_gpio_led_info = { |
352 | .leds = treo680_gpio_leds, | |
353 | .num_leds = ARRAY_SIZE(treo680_gpio_leds), | |
e6c3f4b8 TSC |
354 | }; |
355 | ||
d0a92fd3 TČ |
356 | static struct gpio_led centro_gpio_leds[] = { |
357 | { | |
358 | .name = "centro:vibra:vibra", | |
359 | .default_trigger = "none", | |
360 | .gpio = GPIO_NR_CENTRO_VIBRATE_EN, | |
361 | }, | |
362 | { | |
363 | .name = "centro:green:led", | |
364 | .default_trigger = "mmc0", | |
365 | .gpio = GPIO_NR_TREO_GREEN_LED, | |
366 | }, | |
367 | { | |
368 | .name = "centro:white:keybbl", | |
369 | .default_trigger = "none", | |
370 | .active_low = 1, | |
371 | .gpio = GPIO_NR_CENTRO_KEYB_BL, | |
372 | }, | |
373 | }; | |
374 | ||
375 | static struct gpio_led_platform_data centro_gpio_led_info = { | |
376 | .leds = centro_gpio_leds, | |
377 | .num_leds = ARRAY_SIZE(centro_gpio_leds), | |
378 | }; | |
379 | ||
31620e21 | 380 | static struct platform_device palmtreo_leds = { |
d0a92fd3 TČ |
381 | .name = "leds-gpio", |
382 | .id = -1, | |
383 | .dev = { | |
31620e21 | 384 | .platform_data = &treo680_gpio_led_info, |
d0a92fd3 TČ |
385 | } |
386 | }; | |
e6c3f4b8 | 387 | |
31620e21 | 388 | static void __init palmtreo_leds_init(void) |
28d7a946 | 389 | { |
31620e21 MV |
390 | if (machine_is_centro()) |
391 | palmtreo_leds.dev.platform_data = ¢ro_gpio_led_info; | |
e6c3f4b8 | 392 | |
31620e21 | 393 | platform_device_register(&palmtreo_leds); |
e6c3f4b8 | 394 | } |
31620e21 MV |
395 | #else |
396 | static inline void palmtreo_leds_init(void) {} | |
397 | #endif | |
e6c3f4b8 TSC |
398 | |
399 | /****************************************************************************** | |
400 | * Machine init | |
401 | ******************************************************************************/ | |
98c672cf RK |
402 | static void __init treo_reserve(void) |
403 | { | |
8d717a52 RK |
404 | memblock_reserve(0xa0000000, 0x1000); |
405 | memblock_reserve(0xa2000000, 0x1000); | |
98c672cf RK |
406 | } |
407 | ||
31620e21 | 408 | static void __init palmphone_common_init(void) |
bb2ae8f0 | 409 | { |
31620e21 | 410 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config)); |
cc155c6f RK |
411 | pxa_set_ffuart_info(NULL); |
412 | pxa_set_btuart_info(NULL); | |
413 | pxa_set_stuart_info(NULL); | |
31620e21 MV |
414 | palm27x_pm_init(TREO_STR_BASE); |
415 | palm27x_lcd_init(GPIO_NR_TREO_BL_POWER, &palm_320x320_new_lcd_mode); | |
416 | palm27x_udc_init(GPIO_NR_TREO_USB_DETECT, GPIO_NR_TREO_USB_PULLUP, 1); | |
417 | palm27x_irda_init(GPIO_NR_TREO_IR_EN); | |
418 | palm27x_ac97_init(-1, -1, -1, 95); | |
419 | palm27x_pwm_init(GPIO_NR_TREO_BL_POWER, -1); | |
420 | palm27x_power_init(GPIO_NR_TREO_POWER_DETECT, -1); | |
421 | palm27x_pmic_init(); | |
422 | palmtreo_kpc_init(); | |
423 | palmtreo_uhc_init(); | |
424 | palmtreo_leds_init(); | |
bb2ae8f0 TČ |
425 | } |
426 | ||
e6c3f4b8 TSC |
427 | static void __init treo680_init(void) |
428 | { | |
e6c3f4b8 | 429 | pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); |
31620e21 MV |
430 | palmphone_common_init(); |
431 | palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, | |
432 | GPIO_NR_TREO680_SD_POWER, 0); | |
433 | } | |
e6c3f4b8 | 434 | |
31620e21 MV |
435 | static void __init centro_init(void) |
436 | { | |
437 | pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config)); | |
438 | palmphone_common_init(); | |
439 | palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, -1, | |
440 | GPIO_NR_CENTRO_SD_POWER, 1); | |
e6c3f4b8 TSC |
441 | } |
442 | ||
443 | MACHINE_START(TREO680, "Palm Treo 680") | |
bb2ae8f0 | 444 | .boot_params = 0xa0000100, |
851982c1 | 445 | .map_io = pxa27x_map_io, |
98c672cf | 446 | .reserve = treo_reserve, |
bb2ae8f0 TČ |
447 | .init_irq = pxa27x_init_irq, |
448 | .timer = &pxa_timer, | |
449 | .init_machine = treo680_init, | |
e6c3f4b8 | 450 | MACHINE_END |
d0a92fd3 TČ |
451 | |
452 | MACHINE_START(CENTRO, "Palm Centro 685") | |
d0a92fd3 | 453 | .boot_params = 0xa0000100, |
851982c1 | 454 | .map_io = pxa27x_map_io, |
98c672cf | 455 | .reserve = treo_reserve, |
d0a92fd3 TČ |
456 | .init_irq = pxa27x_init_irq, |
457 | .timer = &pxa_timer, | |
f165eb77 | 458 | .init_machine = centro_init, |
d0a92fd3 | 459 | MACHINE_END |