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