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