]> bbs.cooldavid.org Git - net-next-2.6.git/blame - arch/arm/mach-pxa/palmtreo.c
[ARM] pxa: update pwm_backlight->notify() to include missed 'struct device *'
[net-next-2.6.git] / arch / arm / mach-pxa / palmtreo.c
CommitLineData
e6c3f4b8 1/*
bb2ae8f0
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 57static 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 */
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
bb2ae8f0
154#ifdef CONFIG_MACH_TREO680
155static 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
d0a92fd3
164#ifdef CONFIG_MACH_CENTRO
165static 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
e6c3f4b8
TSC
179/******************************************************************************
180 * SD/MMC card controller
181 ******************************************************************************/
bb2ae8f0 182#ifdef CONFIG_MACH_TREO680
e6c3f4b8 183static struct pxamci_platform_data treo680_mci_platform_data = {
7dafdf3d 184 .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
bb2ae8f0 185 .gpio_card_detect = GPIO_NR_TREO_SD_DETECT_N,
7dafdf3d 186 .gpio_card_ro = GPIO_NR_TREO680_SD_READONLY,
187 .gpio_power = GPIO_NR_TREO680_SD_POWER,
e6c3f4b8 188};
bb2ae8f0 189#endif /* CONFIG_MACH_TREO680 */
e6c3f4b8 190
d0a92fd3
191#ifdef CONFIG_MACH_CENTRO
192static 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
e6c3f4b8
TSC
201/******************************************************************************
202 * GPIO keyboard
203 ******************************************************************************/
bb2ae8f0 204#ifdef CONFIG_MACH_TREO680
e6c3f4b8
TSC
205static 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
264static 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};
bb2ae8f0 274#endif /* CONFIG_MACH_TREO680 */
e6c3f4b8 275
d0a92fd3
276#ifdef CONFIG_MACH_CENTRO
277static 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
336static 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
e6c3f4b8
TSC
348/******************************************************************************
349 * aSoC audio
350 ******************************************************************************/
351
bb2ae8f0 352static pxa2xx_audio_ops_t treo_ac97_pdata = {
e6c3f4b8
TSC
353 .reset_gpio = 95,
354};
355
356/******************************************************************************
357 * Backlight
358 ******************************************************************************/
bb2ae8f0 359static int treo_backlight_init(struct device *dev)
e6c3f4b8
TSC
360{
361 int ret;
362
bb2ae8f0 363 ret = gpio_request(GPIO_NR_TREO_BL_POWER, "BL POWER");
e6c3f4b8
TSC
364 if (ret)
365 goto err;
bb2ae8f0 366 ret = gpio_direction_output(GPIO_NR_TREO_BL_POWER, 0);
e6c3f4b8
TSC
367 if (ret)
368 goto err2;
e6c3f4b8
TSC
369
370 return 0;
28d7a946 371
e6c3f4b8 372err2:
bb2ae8f0 373 gpio_free(GPIO_NR_TREO_BL_POWER);
e6c3f4b8
TSC
374err:
375 return ret;
376}
377
2d51a521 378static int treo_backlight_notify(struct device *dev, int brightness)
e6c3f4b8 379{
bb2ae8f0
380 gpio_set_value(GPIO_NR_TREO_BL_POWER, brightness);
381 return TREO_MAX_INTENSITY - brightness;
e6c3f4b8
TSC
382};
383
bb2ae8f0 384static void treo_backlight_exit(struct device *dev)
e6c3f4b8 385{
bb2ae8f0 386 gpio_free(GPIO_NR_TREO_BL_POWER);
e6c3f4b8
TSC
387}
388
bb2ae8f0 389static struct platform_pwm_backlight_data treo_backlight_data = {
e6c3f4b8 390 .pwm_id = 0,
bb2ae8f0
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,
e6c3f4b8
TSC
397};
398
bb2ae8f0 399static struct platform_device treo_backlight = {
e6c3f4b8
TSC
400 .name = "pwm-backlight",
401 .dev = {
402 .parent = &pxa27x_device_pwm0.dev,
bb2ae8f0 403 .platform_data = &treo_backlight_data,
e6c3f4b8
TSC
404 },
405};
406
407/******************************************************************************
408 * IrDA
409 ******************************************************************************/
bb2ae8f0
410static struct pxaficp_platform_data treo_ficp_info = {
411 .gpio_pwdown = GPIO_NR_TREO_IR_EN,
c4bd0172 412 .transceiver_cap = IR_SIRMODE | IR_OFF,
e6c3f4b8
TSC
413};
414
415/******************************************************************************
416 * UDC
417 ******************************************************************************/
bb2ae8f0
418static struct pxa2xx_udc_mach_info treo_udc_info __initdata = {
419 .gpio_vbus = GPIO_NR_TREO_USB_DETECT,
e6c3f4b8 420 .gpio_vbus_inverted = 1,
bb2ae8f0 421 .gpio_pullup = GPIO_NR_TREO_USB_PULLUP,
e6c3f4b8
TSC
422};
423
424
425/******************************************************************************
426 * USB host
427 ******************************************************************************/
bb2ae8f0 428#ifdef CONFIG_MACH_TREO680
e6c3f4b8
TSC
429static struct pxaohci_platform_data treo680_ohci_info = {
430 .port_mode = PMM_PERPORT_MODE,
431 .flags = ENABLE_PORT1 | ENABLE_PORT3,
432 .power_budget = 0,
433};
bb2ae8f0 434#endif /* CONFIG_MACH_TREO680 */
e6c3f4b8
TSC
435
436/******************************************************************************
437 * Power supply
438 ******************************************************************************/
439static int power_supply_init(struct device *dev)
440{
441 int ret;
442
bb2ae8f0 443 ret = gpio_request(GPIO_NR_TREO_POWER_DETECT, "CABLE_STATE_AC");
e6c3f4b8
TSC
444 if (ret)
445 goto err1;
bb2ae8f0 446 ret = gpio_direction_input(GPIO_NR_TREO_POWER_DETECT);
e6c3f4b8
TSC
447 if (ret)
448 goto err2;
449
450 return 0;
451
452err2:
bb2ae8f0 453 gpio_free(GPIO_NR_TREO_POWER_DETECT);
e6c3f4b8
TSC
454err1:
455 return ret;
456}
457
bb2ae8f0 458static int treo_is_ac_online(void)
e6c3f4b8 459{
bb2ae8f0 460 return gpio_get_value(GPIO_NR_TREO_POWER_DETECT);
e6c3f4b8
TSC
461}
462
463static void power_supply_exit(struct device *dev)
464{
bb2ae8f0 465 gpio_free(GPIO_NR_TREO_POWER_DETECT);
e6c3f4b8
TSC
466}
467
bb2ae8f0 468static char *treo_supplicants[] = {
e6c3f4b8
TSC
469 "main-battery",
470};
471
472static struct pda_power_pdata power_supply_info = {
473 .init = power_supply_init,
bb2ae8f0 474 .is_ac_online = treo_is_ac_online,
e6c3f4b8 475 .exit = power_supply_exit,
bb2ae8f0
476 .supplied_to = treo_supplicants,
477 .num_supplicants = ARRAY_SIZE(treo_supplicants),
e6c3f4b8
TSC
478};
479
480static 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 ******************************************************************************/
bb2ae8f0
491#ifdef CONFIG_MACH_TREO680
492static struct gpio_led treo680_gpio_leds[] = {
e6c3f4b8
TSC
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",
bb2ae8f0 501 .gpio = GPIO_NR_TREO_GREEN_LED,
e6c3f4b8
TSC
502 },
503 {
bb2ae8f0 504 .name = "treo680:white:keybbl",
e6c3f4b8
TSC
505 .default_trigger = "none",
506 .gpio = GPIO_NR_TREO680_KEYB_BL,
507 },
508};
509
bb2ae8f0
510static struct gpio_led_platform_data treo680_gpio_led_info = {
511 .leds = treo680_gpio_leds,
512 .num_leds = ARRAY_SIZE(treo680_gpio_leds),
e6c3f4b8
TSC
513};
514
515static struct platform_device treo680_leds = {
516 .name = "leds-gpio",
517 .id = -1,
518 .dev = {
bb2ae8f0 519 .platform_data = &treo680_gpio_led_info,
e6c3f4b8
TSC
520 }
521};
bb2ae8f0 522#endif /* CONFIG_MACH_TREO680 */
e6c3f4b8 523
d0a92fd3
524#ifdef CONFIG_MACH_CENTRO
525static 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
544static struct gpio_led_platform_data centro_gpio_led_info = {
545 .leds = centro_gpio_leds,
546 .num_leds = ARRAY_SIZE(centro_gpio_leds),
547};
548
549static struct platform_device centro_leds = {
550 .name = "leds-gpio",
551 .id = -1,
552 .dev = {
553 .platform_data = &centro_gpio_led_info,
554 }
555};
556#endif /* CONFIG_MACH_CENTRO */
557
e6c3f4b8
TSC
558/******************************************************************************
559 * Framebuffer
560 ******************************************************************************/
561/* TODO: add support for 324x324 */
bb2ae8f0 562static struct pxafb_mode_info treo_lcd_modes[] = {
e6c3f4b8
TSC
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
bb2ae8f0 579static void treo_lcd_power(int on, struct fb_var_screeninfo *info)
28d7a946 580{
bb2ae8f0 581 gpio_set_value(GPIO_NR_TREO_BL_POWER, on);
28d7a946
582}
583
bb2ae8f0
584static struct pxafb_mach_info treo_lcd_screen = {
585 .modes = treo_lcd_modes,
586 .num_modes = ARRAY_SIZE(treo_lcd_modes),
e6c3f4b8
TSC
587 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
588};
589
590/******************************************************************************
591 * Power management - standby
592 ******************************************************************************/
bb2ae8f0 593static void __init treo_pm_init(void)
e6c3f4b8
TSC
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 */
bb2ae8f0 602 memcpy(phys_to_virt(TREO_STR_BASE), resume, sizeof(resume));
e6c3f4b8
TSC
603}
604
605/******************************************************************************
606 * Machine init
607 ******************************************************************************/
bb2ae8f0
608static struct platform_device *treo_devices[] __initdata = {
609 &treo_backlight,
e6c3f4b8
TSC
610 &power_supply,
611};
612
bb2ae8f0
613#ifdef CONFIG_MACH_TREO680
614static struct platform_device *treo680_devices[] __initdata = {
615 &treo680_leds,
616};
617#endif /* CONFIG_MACH_TREO680 */
618
d0a92fd3
619#ifdef CONFIG_MACH_CENTRO
620static struct platform_device *centro_devices[] __initdata = {
621 &centro_leds,
622};
623#endif /* CONFIG_MACH_CENTRO */
624
e6c3f4b8 625/* setup udc GPIOs initial state */
bb2ae8f0 626static void __init treo_udc_init(void)
e6c3f4b8 627{
bb2ae8f0
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);
e6c3f4b8
TSC
631 }
632}
633
bb2ae8f0 634static void __init treo_lcd_power_init(void)
28d7a946
635{
636 int ret;
637
bb2ae8f0 638 ret = gpio_request(GPIO_NR_TREO_LCD_POWER, "LCD POWER");
28d7a946
639 if (ret) {
640 pr_err("Treo680: LCD power GPIO request failed!\n");
641 return;
642 }
643
bb2ae8f0 644 ret = gpio_direction_output(GPIO_NR_TREO_LCD_POWER, 0);
28d7a946
645 if (ret) {
646 pr_err("Treo680: setting LCD power GPIO direction failed!\n");
bb2ae8f0 647 gpio_free(GPIO_NR_TREO_LCD_POWER);
28d7a946
648 return;
649 }
650
bb2ae8f0 651 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
28d7a946
652}
653
bb2ae8f0
654static void __init treo_init(void)
655{
cc155c6f
RK
656 pxa_set_ffuart_info(NULL);
657 pxa_set_btuart_info(NULL);
658 pxa_set_stuart_info(NULL);
659
bb2ae8f0
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
e6c3f4b8
TSC
673static void __init treo680_init(void)
674{
bb2ae8f0 675 treo_init();
e6c3f4b8 676 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
e6c3f4b8 677 pxa_set_mci_info(&treo680_mci_platform_data);
bb2ae8f0 678 pxa_set_keypad_info(&treo680_keypad_platform_data);
e6c3f4b8
TSC
679 pxa_set_ohci_info(&treo680_ohci_info);
680
bb2ae8f0 681 platform_add_devices(ARRAY_AND_SIZE(treo680_devices));
e6c3f4b8
TSC
682}
683
684MACHINE_START(TREO680, "Palm Treo 680")
bb2ae8f0
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,
e6c3f4b8 692MACHINE_END
bb2ae8f0 693#endif /* CONFIG_MACH_TREO680 */
d0a92fd3
694
695#ifdef CONFIG_MACH_CENTRO
696static void __init centro_init(void)
697{
698 treo_init();
699 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config));
700 pxa_set_mci_info(&centro_mci_platform_data);
701
702 pxa_set_keypad_info(&centro_keypad_platform_data);
703
704 platform_add_devices(ARRAY_AND_SIZE(centro_devices));
705}
706
707MACHINE_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,
715MACHINE_END
716#endif /* CONFIG_MACH_CENTRO */