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/w1-gpio.h>
30 #include <asm/mach-types.h>
31 #include <asm/mach/arch.h>
32 #include <asm/mach/map.h>
34 #include <mach/pxa27x.h>
35 #include <mach/pxa27x-udc.h>
36 #include <mach/audio.h>
37 #include <mach/palmtreo.h>
38 #include <linux/platform_data/mmc-pxamci.h>
39 #include <linux/platform_data/video-pxafb.h>
40 #include <linux/platform_data/irda-pxaficp.h>
41 #include <linux/platform_data/keypad-pxa27x.h>
43 #include <linux/platform_data/usb-ohci-pxa27x.h>
44 #include <mach/pxa2xx-regs.h>
45 #include <linux/platform_data/asoc-palm27x.h>
46 #include <linux/platform_data/camera-pxa.h>
47 #include <mach/palm27x.h>
49 #include <sound/pxa2xx-lib.h>
54 /******************************************************************************
56 ******************************************************************************/
57 static unsigned long treo_pin_config
[] __initdata
= {
65 GPIO113_GPIO
, /* SD detect */
69 GPIO29_AC97_SDATA_IN_0
,
70 GPIO30_AC97_SDATA_OUT
,
83 GPIO1_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* usb detect */
92 GPIO103_KP_MKOUT_0
| MFP_LPM_DRIVE_HIGH
,
99 GPIO93_KP_DKIN_0
| WAKEUP_ON_LEVEL_HIGH
, /* Hotsync button */
101 /* Quick Capture Interface */
120 GPIO14_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* GSM host wake up */
127 GPIO0_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* external power detect */
128 GPIO15_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* silent switch */
129 GPIO116_GPIO
, /* headphone detect */
130 GPIO11_GPIO
| WAKEUP_ON_EDGE_BOTH
, /* bluetooth host wake up */
133 #ifdef CONFIG_MACH_TREO680
134 static unsigned long treo680_pin_config
[] __initdata
= {
135 GPIO33_GPIO
, /* SD read only */
137 /* MATRIX KEYPAD - different wake up source */
138 GPIO100_KP_MKIN_0
| WAKEUP_ON_LEVEL_HIGH
,
141 /* LCD... L_BIAS alt fn not configured on Treo680; is GPIO instead */
147 #endif /* CONFIG_MACH_TREO680 */
149 #ifdef CONFIG_MACH_CENTRO
150 static unsigned long centro685_pin_config
[] __initdata
= {
151 /* Bluetooth attached to BT UART*/
152 MFP_CFG_OUT(GPIO80
, AF0
, DRIVE_LOW
), /* power: LOW = off */
158 /* MATRIX KEYPAD - different wake up source */
160 GPIO99_KP_MKIN_5
| WAKEUP_ON_LEVEL_HIGH
,
163 GPIOxx_LCD_TFT_16BPP
,
165 #endif /* CONFIG_MACH_CENTRO */
167 /******************************************************************************
169 ******************************************************************************/
170 #if IS_ENABLED(CONFIG_KEYBOARD_PXA27x)
171 static unsigned int treo680_matrix_keys
[] = {
172 KEY(0, 0, KEY_F8
), /* Red/Off/Power */
174 KEY(0, 2, KEY_LEFTCTRL
), /* Alternate */
180 KEY(1, 0, KEY_RIGHTCTRL
), /* Menu */
181 KEY(1, 1, KEY_RIGHT
),
182 KEY(1, 2, KEY_LEFTSHIFT
), /* Left shift */
187 KEY(2, 0, KEY_F1
), /* Phone */
194 KEY(3, 0, KEY_F10
), /* Calendar */
196 KEY(3, 2, KEY_SPACE
),
201 KEY(4, 0, KEY_F12
), /* Mail */
202 KEY(4, 1, KEY_KPENTER
),
203 KEY(4, 2, KEY_RIGHTALT
), /* Alt */
208 KEY(5, 0, KEY_F9
), /* Home */
209 KEY(5, 1, KEY_PAGEUP
), /* Side up */
215 KEY(6, 0, KEY_TAB
), /* Side Activate */
216 KEY(6, 1, KEY_PAGEDOWN
), /* Side down */
217 KEY(6, 2, KEY_ENTER
),
222 KEY(7, 0, KEY_F6
), /* Green/Call */
224 KEY(7, 2, KEY_BACKSPACE
),
230 static unsigned int centro_matrix_keys
[] = {
231 KEY(0, 0, KEY_F9
), /* Home */
233 KEY(0, 2, KEY_LEFTCTRL
), /* Alternate */
239 KEY(1, 0, KEY_RIGHTCTRL
), /* Menu */
240 KEY(1, 1, KEY_RIGHT
),
241 KEY(1, 2, KEY_LEFTSHIFT
), /* Left shift */
246 KEY(2, 0, KEY_F1
), /* Phone */
253 KEY(3, 0, KEY_F10
), /* Calendar */
255 KEY(3, 2, KEY_SPACE
),
260 KEY(4, 0, KEY_F12
), /* Mail */
261 KEY(4, 1, KEY_KPENTER
),
262 KEY(4, 2, KEY_RIGHTALT
), /* Alt */
267 KEY(5, 0, KEY_F8
), /* Red/Off/Power */
268 KEY(5, 1, KEY_PAGEUP
), /* Side up */
274 KEY(6, 0, KEY_TAB
), /* Side Activate */
275 KEY(6, 1, KEY_PAGEDOWN
), /* Side down */
276 KEY(6, 2, KEY_ENTER
),
281 KEY(7, 0, KEY_F6
), /* Green/Call */
283 KEY(7, 2, KEY_BACKSPACE
),
289 static struct pxa27x_keypad_platform_data treo680_keypad_pdata
= {
290 .matrix_key_rows
= 8,
291 .matrix_key_cols
= 7,
292 .matrix_key_map
= treo680_matrix_keys
,
293 .matrix_key_map_size
= ARRAY_SIZE(treo680_matrix_keys
),
294 .direct_key_map
= { KEY_CONNECT
},
297 .debounce_interval
= 30,
300 static void __init
palmtreo_kpc_init(void)
302 static struct pxa27x_keypad_platform_data
*data
= &treo680_keypad_pdata
;
304 if (machine_is_centro()) {
305 data
->matrix_key_map
= centro_matrix_keys
;
306 data
->matrix_key_map_size
= ARRAY_SIZE(centro_matrix_keys
);
309 pxa_set_keypad_info(&treo680_keypad_pdata
);
312 static inline void palmtreo_kpc_init(void) {}
315 /******************************************************************************
317 ******************************************************************************/
318 #if IS_ENABLED(CONFIG_USB_OHCI_HCD)
319 static struct pxaohci_platform_data treo680_ohci_info
= {
320 .port_mode
= PMM_PERPORT_MODE
,
321 .flags
= ENABLE_PORT1
| ENABLE_PORT3
,
325 static void __init
palmtreo_uhc_init(void)
327 if (machine_is_treo680())
328 pxa_set_ohci_info(&treo680_ohci_info
);
331 static inline void palmtreo_uhc_init(void) {}
334 /******************************************************************************
336 ******************************************************************************/
337 static struct gpio_led treo680_gpio_leds
[] = {
339 .name
= "treo680:vibra:vibra",
340 .default_trigger
= "none",
341 .gpio
= GPIO_NR_TREO680_VIBRATE_EN
,
344 .name
= "treo680:green:led",
345 .default_trigger
= "mmc0",
346 .gpio
= GPIO_NR_TREO_GREEN_LED
,
349 .name
= "treo680:white:keybbl",
350 .default_trigger
= "none",
351 .gpio
= GPIO_NR_TREO680_KEYB_BL
,
355 static struct gpio_led_platform_data treo680_gpio_led_info
= {
356 .leds
= treo680_gpio_leds
,
357 .num_leds
= ARRAY_SIZE(treo680_gpio_leds
),
360 static struct gpio_led centro_gpio_leds
[] = {
362 .name
= "centro:vibra:vibra",
363 .default_trigger
= "none",
364 .gpio
= GPIO_NR_CENTRO_VIBRATE_EN
,
367 .name
= "centro:green:led",
368 .default_trigger
= "mmc0",
369 .gpio
= GPIO_NR_TREO_GREEN_LED
,
372 .name
= "centro:white:keybbl",
373 .default_trigger
= "none",
375 .gpio
= GPIO_NR_CENTRO_KEYB_BL
,
379 static struct gpio_led_platform_data centro_gpio_led_info
= {
380 .leds
= centro_gpio_leds
,
381 .num_leds
= ARRAY_SIZE(centro_gpio_leds
),
384 static struct platform_device palmtreo_leds
= {
389 static void __init
palmtreo_leds_init(void)
391 if (machine_is_centro())
392 palmtreo_leds
.dev
.platform_data
= ¢ro_gpio_led_info
;
393 else if (machine_is_treo680())
394 palmtreo_leds
.dev
.platform_data
= &treo680_gpio_led_info
;
396 platform_device_register(&palmtreo_leds
);
399 /******************************************************************************
400 * diskonchip docg4 flash
401 ******************************************************************************/
402 #if defined(CONFIG_MACH_TREO680)
403 /* REVISIT: does the centro have this device also? */
404 #if IS_ENABLED(CONFIG_MTD_NAND_DOCG4)
405 static struct resource docg4_resources
[] = {
409 .flags
= IORESOURCE_MEM
,
413 static struct platform_device treo680_docg4_flash
= {
416 .resource
= docg4_resources
,
417 .num_resources
= ARRAY_SIZE(docg4_resources
),
420 static void __init
treo680_docg4_flash_init(void)
422 platform_device_register(&treo680_docg4_flash
);
425 static inline void treo680_docg4_flash_init(void) {}
429 /******************************************************************************
431 ******************************************************************************/
432 static void __init
treo_reserve(void)
434 memblock_reserve(0xa0000000, 0x1000);
435 memblock_reserve(0xa2000000, 0x1000);
438 static void __init
palmphone_common_init(void)
440 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo_pin_config
));
441 pxa_set_ffuart_info(NULL
);
442 pxa_set_btuart_info(NULL
);
443 pxa_set_stuart_info(NULL
);
444 palm27x_pm_init(TREO_STR_BASE
);
445 palm27x_lcd_init(GPIO_NR_TREO_BL_POWER
, &palm_320x320_new_lcd_mode
);
446 palm27x_udc_init(GPIO_NR_TREO_USB_DETECT
, GPIO_NR_TREO_USB_PULLUP
, 1);
447 palm27x_irda_init(GPIO_NR_TREO_IR_EN
);
448 palm27x_ac97_init(-1, -1, -1, 95);
449 palm27x_pwm_init(GPIO_NR_TREO_BL_POWER
, -1);
450 palm27x_power_init(GPIO_NR_TREO_POWER_DETECT
, -1);
454 palmtreo_leds_init();
457 #ifdef CONFIG_MACH_TREO680
458 void __init
treo680_gpio_init(void)
462 /* drive all three lcd gpios high initially */
463 const unsigned long lcd_flags
= GPIOF_INIT_HIGH
| GPIOF_DIR_OUT
;
466 * LCD GPIO initialization...
470 * This is likely the power to the lcd. Toggling it low/high appears to
471 * turn the lcd off/on. Can be toggled after lcd is initialized without
472 * any apparent adverse effects to the lcd operation. Note that this
473 * gpio line is used by the lcd controller as the L_BIAS signal, but
474 * treo680 configures it as gpio.
476 gpio
= GPIO_NR_TREO680_LCD_POWER
;
477 if (gpio_request_one(gpio
, lcd_flags
, "LCD power") < 0)
481 * These two are called "enables", for lack of a better understanding.
482 * If either of these are toggled after the lcd is initialized, the
483 * image becomes degraded. N.B. The IPL shipped with the treo
484 * configures GPIO_NR_TREO680_LCD_EN_N as output and drives it high. If
485 * the IPL is ever reprogrammed, this initialization may be need to be
488 gpio
= GPIO_NR_TREO680_LCD_EN
;
489 if (gpio_request_one(gpio
, lcd_flags
, "LCD enable") < 0)
491 gpio
= GPIO_NR_TREO680_LCD_EN_N
;
492 if (gpio_request_one(gpio
, lcd_flags
, "LCD enable_n") < 0)
495 /* driving this low turns LCD on */
496 gpio_set_value(GPIO_NR_TREO680_LCD_EN_N
, 0);
500 pr_err("gpio %d initialization failed\n", gpio
);
501 gpio_free(GPIO_NR_TREO680_LCD_POWER
);
502 gpio_free(GPIO_NR_TREO680_LCD_EN
);
503 gpio_free(GPIO_NR_TREO680_LCD_EN_N
);
506 static void __init
treo680_init(void)
508 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config
));
509 palmphone_common_init();
511 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N
, GPIO_NR_TREO680_SD_READONLY
,
512 GPIO_NR_TREO680_SD_POWER
, 0);
513 treo680_docg4_flash_init();
517 #ifdef CONFIG_MACH_CENTRO
518 static void __init
centro_init(void)
520 pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config
));
521 palmphone_common_init();
522 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N
, -1,
523 GPIO_NR_CENTRO_SD_POWER
, 1);
527 #ifdef CONFIG_MACH_TREO680
528 MACHINE_START(TREO680
, "Palm Treo 680")
529 .atag_offset
= 0x100,
530 .map_io
= pxa27x_map_io
,
531 .reserve
= treo_reserve
,
532 .nr_irqs
= PXA_NR_IRQS
,
533 .init_irq
= pxa27x_init_irq
,
534 .handle_irq
= pxa27x_handle_irq
,
535 .init_time
= pxa_timer_init
,
536 .init_machine
= treo680_init
,
537 .restart
= pxa_restart
,
541 #ifdef CONFIG_MACH_CENTRO
542 MACHINE_START(CENTRO
, "Palm Centro 685")
543 .atag_offset
= 0x100,
544 .map_io
= pxa27x_map_io
,
545 .reserve
= treo_reserve
,
546 .nr_irqs
= PXA_NR_IRQS
,
547 .init_irq
= pxa27x_init_irq
,
548 .handle_irq
= pxa27x_handle_irq
,
549 .init_time
= pxa_timer_init
,
550 .init_machine
= centro_init
,
551 .restart
= pxa_restart
,