2 * Hardware definitions for Palm Treo smartphones
6 * Palm Centro 685 (GSM)
8 * Author: Tomas Cech <sleep_walker@suse.cz>
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.
14 * (find more info at www.hackndev.com)
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/memblock.h>
24 #include <linux/pda_power.h>
25 #include <linux/pwm_backlight.h>
26 #include <linux/gpio.h>
27 #include <linux/power_supply.h>
28 #include <linux/sysdev.h>
29 #include <linux/w1-gpio.h>
31 #include <asm/mach-types.h>
32 #include <asm/mach/arch.h>
33 #include <asm/mach/map.h>
35 #include <mach/pxa27x.h>
36 #include <mach/pxa27x-udc.h>
37 #include <mach/audio.h>
38 #include <mach/palmtreo.h>
40 #include <mach/pxafb.h>
41 #include <mach/irda.h>
42 #include <plat/pxa27x_keypad.h>
44 #include <mach/ohci.h>
45 #include <mach/pxa2xx-regs.h>
46 #include <mach/palmasoc.h>
47 #include <mach/camera.h>
48 #include <mach/palm27x.h>
50 #include <sound/pxa2xx-lib.h>
55 /******************************************************************************
57 ******************************************************************************/
58 static unsigned long treo_pin_config
[] __initdata
= {
66 GPIO113_GPIO
, /* SD detect */
70 GPIO29_AC97_SDATA_IN_0
,
71 GPIO30_AC97_SDATA_OUT
,
84 GPIO1_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* usb detect */
93 GPIO103_KP_MKOUT_0
| MFP_LPM_DRIVE_HIGH
,
100 GPIO93_KP_DKIN_0
| WAKEUP_ON_LEVEL_HIGH
, /* Hotsync button */
103 GPIOxx_LCD_TFT_16BPP
,
105 /* Quick Capture Interface */
124 GPIO14_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* GSM host wake up */
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 */
137 #ifdef CONFIG_MACH_TREO680
138 static unsigned long treo680_pin_config
[] __initdata
= {
139 GPIO33_GPIO
, /* SD read only */
141 /* MATRIX KEYPAD - different wake up source */
142 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
145 #endif /* CONFIG_MACH_TREO680 */
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 */
156 /* MATRIX KEYPAD - different wake up source */
158 GPIO99_KP_MKIN_5
| WAKEUP_ON_LEVEL_HIGH
,
160 #endif /* CONFIG_MACH_CENTRO */
162 /******************************************************************************
164 ******************************************************************************/
165 #if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE)
166 static unsigned int treo680_matrix_keys
[] = {
167 KEY(0, 0, KEY_F8
), /* Red/Off/Power */
169 KEY(0, 2, KEY_LEFTCTRL
), /* Alternate */
175 KEY(1, 0, KEY_RIGHTCTRL
), /* Menu */
176 KEY(1, 1, KEY_RIGHT
),
177 KEY(1, 2, KEY_LEFTSHIFT
), /* Left shift */
182 KEY(2, 0, KEY_F1
), /* Phone */
189 KEY(3, 0, KEY_F10
), /* Calendar */
191 KEY(3, 2, KEY_SPACE
),
196 KEY(4, 0, KEY_F12
), /* Mail */
197 KEY(4, 1, KEY_KPENTER
),
198 KEY(4, 2, KEY_RIGHTALT
), /* Alt */
203 KEY(5, 0, KEY_F9
), /* Home */
204 KEY(5, 1, KEY_PAGEUP
), /* Side up */
210 KEY(6, 0, KEY_TAB
), /* Side Activate */
211 KEY(6, 1, KEY_PAGEDOWN
), /* Side down */
212 KEY(6, 2, KEY_ENTER
),
217 KEY(7, 0, KEY_F6
), /* Green/Call */
219 KEY(7, 2, KEY_BACKSPACE
),
225 static unsigned int centro_matrix_keys
[] = {
226 KEY(0, 0, KEY_F9
), /* Home */
228 KEY(0, 2, KEY_LEFTCTRL
), /* Alternate */
234 KEY(1, 0, KEY_RIGHTCTRL
), /* Menu */
235 KEY(1, 1, KEY_RIGHT
),
236 KEY(1, 2, KEY_LEFTSHIFT
), /* Left shift */
241 KEY(2, 0, KEY_F1
), /* Phone */
248 KEY(3, 0, KEY_F10
), /* Calendar */
250 KEY(3, 2, KEY_SPACE
),
255 KEY(4, 0, KEY_F12
), /* Mail */
256 KEY(4, 1, KEY_KPENTER
),
257 KEY(4, 2, KEY_RIGHTALT
), /* Alt */
262 KEY(5, 0, KEY_F8
), /* Red/Off/Power */
263 KEY(5, 1, KEY_PAGEUP
), /* Side up */
269 KEY(6, 0, KEY_TAB
), /* Side Activate */
270 KEY(6, 1, KEY_PAGEDOWN
), /* Side down */
271 KEY(6, 2, KEY_ENTER
),
276 KEY(7, 0, KEY_F6
), /* Green/Call */
278 KEY(7, 2, KEY_BACKSPACE
),
284 static struct pxa27x_keypad_platform_data treo680_keypad_pdata
= {
285 .matrix_key_rows
= 8,
286 .matrix_key_cols
= 7,
287 .matrix_key_map
= treo680_matrix_keys
,
288 .matrix_key_map_size
= ARRAY_SIZE(treo680_matrix_keys
),
289 .direct_key_map
= { KEY_CONNECT
},
292 .debounce_interval
= 30,
295 static void __init
palmtreo_kpc_init(void)
297 static struct pxa27x_keypad_platform_data
*data
= &treo680_keypad_pdata
;
299 if (machine_is_centro()) {
300 data
->matrix_key_map
= centro_matrix_keys
;
301 data
->matrix_key_map_size
= ARRAY_SIZE(centro_matrix_keys
);
304 pxa_set_keypad_info(&treo680_keypad_pdata
);
307 static inline void palmtreo_kpc_init(void) {}
310 /******************************************************************************
312 ******************************************************************************/
313 #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
314 static struct pxaohci_platform_data treo680_ohci_info
= {
315 .port_mode
= PMM_PERPORT_MODE
,
316 .flags
= ENABLE_PORT1
| ENABLE_PORT3
,
320 static void __init
palmtreo_uhc_init(void)
322 if (machine_is_treo680())
323 pxa_set_ohci_info(&treo680_ohci_info
);
326 static inline void palmtreo_uhc_init(void) {}
329 /******************************************************************************
331 ******************************************************************************/
332 #ifdef CONFIG_MACH_TREO680
333 static struct gpio_led treo680_gpio_leds
[] = {
335 .name
= "treo680:vibra:vibra",
336 .default_trigger
= "none",
337 .gpio
= GPIO_NR_TREO680_VIBRATE_EN
,
340 .name
= "treo680:green:led",
341 .default_trigger
= "mmc0",
342 .gpio
= GPIO_NR_TREO_GREEN_LED
,
345 .name
= "treo680:white:keybbl",
346 .default_trigger
= "none",
347 .gpio
= GPIO_NR_TREO680_KEYB_BL
,
351 static struct gpio_led_platform_data treo680_gpio_led_info
= {
352 .leds
= treo680_gpio_leds
,
353 .num_leds
= ARRAY_SIZE(treo680_gpio_leds
),
356 static struct gpio_led centro_gpio_leds
[] = {
358 .name
= "centro:vibra:vibra",
359 .default_trigger
= "none",
360 .gpio
= GPIO_NR_CENTRO_VIBRATE_EN
,
363 .name
= "centro:green:led",
364 .default_trigger
= "mmc0",
365 .gpio
= GPIO_NR_TREO_GREEN_LED
,
368 .name
= "centro:white:keybbl",
369 .default_trigger
= "none",
371 .gpio
= GPIO_NR_CENTRO_KEYB_BL
,
375 static struct gpio_led_platform_data centro_gpio_led_info
= {
376 .leds
= centro_gpio_leds
,
377 .num_leds
= ARRAY_SIZE(centro_gpio_leds
),
380 static struct platform_device palmtreo_leds
= {
384 .platform_data
= &treo680_gpio_led_info
,
388 static void __init
palmtreo_leds_init(void)
390 if (machine_is_centro())
391 palmtreo_leds
.dev
.platform_data
= ¢ro_gpio_led_info
;
393 platform_device_register(&palmtreo_leds
);
396 static inline void palmtreo_leds_init(void) {}
399 /******************************************************************************
401 ******************************************************************************/
402 static void __init
treo_reserve(void)
404 memblock_reserve(0xa0000000, 0x1000);
405 memblock_reserve(0xa2000000, 0x1000);
408 static void __init
palmphone_common_init(void)
410 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config
));
411 pxa_set_ffuart_info(NULL
);
412 pxa_set_btuart_info(NULL
);
413 pxa_set_stuart_info(NULL
);
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);
424 palmtreo_leds_init();
427 static void __init
treo680_init(void)
429 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config
));
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);
435 static void __init
centro_init(void)
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);
443 MACHINE_START(TREO680
, "Palm Treo 680")
444 .boot_params
= 0xa0000100,
445 .map_io
= pxa27x_map_io
,
446 .reserve
= treo_reserve
,
447 .init_irq
= pxa27x_init_irq
,
449 .init_machine
= treo680_init
,
452 MACHINE_START(CENTRO
, "Palm Centro 685")
453 .boot_params
= 0xa0000100,
454 .map_io
= pxa27x_map_io
,
455 .reserve
= treo_reserve
,
456 .init_irq
= pxa27x_init_irq
,
458 .init_machine
= centro_init
,