aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/palmtreo.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-pxa/palmtreo.c')
-rw-r--r--arch/arm/mach-pxa/palmtreo.c105
1 files changed, 93 insertions, 12 deletions
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index 3f3c48f2f7ce..d82a50b4a803 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -98,9 +98,6 @@ static unsigned long treo_pin_config[] __initdata = {
98 GPIO96_KP_MKOUT_6, 98 GPIO96_KP_MKOUT_6,
99 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */ 99 GPIO93_KP_DKIN_0 | WAKEUP_ON_LEVEL_HIGH, /* Hotsync button */
100 100
101 /* LCD */
102 GPIOxx_LCD_TFT_16BPP,
103
104 /* Quick Capture Interface */ 101 /* Quick Capture Interface */
105 GPIO84_CIF_FV, 102 GPIO84_CIF_FV,
106 GPIO85_CIF_LV, 103 GPIO85_CIF_LV,
@@ -140,6 +137,12 @@ static unsigned long treo680_pin_config[] __initdata = {
140 /* MATRIX KEYPAD - different wake up source */ 137 /* MATRIX KEYPAD - different wake up source */
141 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH, 138 GPIO100_KP_MKIN_0 | WAKEUP_ON_LEVEL_HIGH,
142 GPIO99_KP_MKIN_5, 139 GPIO99_KP_MKIN_5,
140
141 /* LCD... L_BIAS alt fn not configured on Treo680; is GPIO instead */
142 GPIOxx_LCD_16BPP,
143 GPIO74_LCD_FCLK,
144 GPIO75_LCD_LCLK,
145 GPIO76_LCD_PCLK,
143}; 146};
144#endif /* CONFIG_MACH_TREO680 */ 147#endif /* CONFIG_MACH_TREO680 */
145 148
@@ -155,13 +158,16 @@ static unsigned long centro685_pin_config[] __initdata = {
155 /* MATRIX KEYPAD - different wake up source */ 158 /* MATRIX KEYPAD - different wake up source */
156 GPIO100_KP_MKIN_0, 159 GPIO100_KP_MKIN_0,
157 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH, 160 GPIO99_KP_MKIN_5 | WAKEUP_ON_LEVEL_HIGH,
161
162 /* LCD */
163 GPIOxx_LCD_TFT_16BPP,
158}; 164};
159#endif /* CONFIG_MACH_CENTRO */ 165#endif /* CONFIG_MACH_CENTRO */
160 166
161/****************************************************************************** 167/******************************************************************************
162 * GPIO keyboard 168 * GPIO keyboard
163 ******************************************************************************/ 169 ******************************************************************************/
164#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULE) 170#if IS_ENABLED(CONFIG_KEYBOARD_PXA27x)
165static unsigned int treo680_matrix_keys[] = { 171static unsigned int treo680_matrix_keys[] = {
166 KEY(0, 0, KEY_F8), /* Red/Off/Power */ 172 KEY(0, 0, KEY_F8), /* Red/Off/Power */
167 KEY(0, 1, KEY_LEFT), 173 KEY(0, 1, KEY_LEFT),
@@ -309,7 +315,7 @@ static inline void palmtreo_kpc_init(void) {}
309/****************************************************************************** 315/******************************************************************************
310 * USB host 316 * USB host
311 ******************************************************************************/ 317 ******************************************************************************/
312#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 318#if IS_ENABLED(CONFIG_USB_OHCI_HCD)
313static struct pxaohci_platform_data treo680_ohci_info = { 319static struct pxaohci_platform_data treo680_ohci_info = {
314 .port_mode = PMM_PERPORT_MODE, 320 .port_mode = PMM_PERPORT_MODE,
315 .flags = ENABLE_PORT1 | ENABLE_PORT3, 321 .flags = ENABLE_PORT1 | ENABLE_PORT3,
@@ -328,7 +334,6 @@ static inline void palmtreo_uhc_init(void) {}
328/****************************************************************************** 334/******************************************************************************
329 * Vibra and LEDs 335 * Vibra and LEDs
330 ******************************************************************************/ 336 ******************************************************************************/
331#ifdef CONFIG_MACH_TREO680
332static struct gpio_led treo680_gpio_leds[] = { 337static struct gpio_led treo680_gpio_leds[] = {
333 { 338 {
334 .name = "treo680:vibra:vibra", 339 .name = "treo680:vibra:vibra",
@@ -379,20 +384,46 @@ static struct gpio_led_platform_data centro_gpio_led_info = {
379static struct platform_device palmtreo_leds = { 384static struct platform_device palmtreo_leds = {
380 .name = "leds-gpio", 385 .name = "leds-gpio",
381 .id = -1, 386 .id = -1,
382 .dev = {
383 .platform_data = &treo680_gpio_led_info,
384 }
385}; 387};
386 388
387static void __init palmtreo_leds_init(void) 389static void __init palmtreo_leds_init(void)
388{ 390{
389 if (machine_is_centro()) 391 if (machine_is_centro())
390 palmtreo_leds.dev.platform_data = &centro_gpio_led_info; 392 palmtreo_leds.dev.platform_data = &centro_gpio_led_info;
393 else if (machine_is_treo680())
394 palmtreo_leds.dev.platform_data = &treo680_gpio_led_info;
391 395
392 platform_device_register(&palmtreo_leds); 396 platform_device_register(&palmtreo_leds);
393} 397}
398
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)
405static struct resource docg4_resources[] = {
406 {
407 .start = 0x00000000,
408 .end = 0x00001FFF,
409 .flags = IORESOURCE_MEM,
410 },
411};
412
413static struct platform_device treo680_docg4_flash = {
414 .name = "docg4",
415 .id = -1,
416 .resource = docg4_resources,
417 .num_resources = ARRAY_SIZE(docg4_resources),
418};
419
420static void __init treo680_docg4_flash_init(void)
421{
422 platform_device_register(&treo680_docg4_flash);
423}
394#else 424#else
395static inline void palmtreo_leds_init(void) {} 425static inline void treo680_docg4_flash_init(void) {}
426#endif
396#endif 427#endif
397 428
398/****************************************************************************** 429/******************************************************************************
@@ -424,12 +455,62 @@ static void __init palmphone_common_init(void)
424} 455}
425 456
426#ifdef CONFIG_MACH_TREO680 457#ifdef CONFIG_MACH_TREO680
458void __init treo680_gpio_init(void)
459{
460 unsigned int gpio;
461
462 /* drive all three lcd gpios high initially */
463 const unsigned long lcd_flags = GPIOF_INIT_HIGH | GPIOF_DIR_OUT;
464
465 /*
466 * LCD GPIO initialization...
467 */
468
469 /*
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.
475 */
476 gpio = GPIO_NR_TREO680_LCD_POWER;
477 if (gpio_request_one(gpio, lcd_flags, "LCD power") < 0)
478 goto fail;
479
480 /*
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
486 * revisited.
487 */
488 gpio = GPIO_NR_TREO680_LCD_EN;
489 if (gpio_request_one(gpio, lcd_flags, "LCD enable") < 0)
490 goto fail;
491 gpio = GPIO_NR_TREO680_LCD_EN_N;
492 if (gpio_request_one(gpio, lcd_flags, "LCD enable_n") < 0)
493 goto fail;
494
495 /* driving this low turns LCD on */
496 gpio_set_value(GPIO_NR_TREO680_LCD_EN_N, 0);
497
498 return;
499 fail:
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);
504}
505
427static void __init treo680_init(void) 506static void __init treo680_init(void)
428{ 507{
429 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); 508 pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config));
430 palmphone_common_init(); 509 palmphone_common_init();
510 treo680_gpio_init();
431 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, 511 palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY,
432 GPIO_NR_TREO680_SD_POWER, 0); 512 GPIO_NR_TREO680_SD_POWER, 0);
513 treo680_docg4_flash_init();
433} 514}
434#endif 515#endif
435 516
@@ -451,7 +532,7 @@ MACHINE_START(TREO680, "Palm Treo 680")
451 .nr_irqs = PXA_NR_IRQS, 532 .nr_irqs = PXA_NR_IRQS,
452 .init_irq = pxa27x_init_irq, 533 .init_irq = pxa27x_init_irq,
453 .handle_irq = pxa27x_handle_irq, 534 .handle_irq = pxa27x_handle_irq,
454 .timer = &pxa_timer, 535 .init_time = pxa_timer_init,
455 .init_machine = treo680_init, 536 .init_machine = treo680_init,
456 .restart = pxa_restart, 537 .restart = pxa_restart,
457MACHINE_END 538MACHINE_END
@@ -465,7 +546,7 @@ MACHINE_START(CENTRO, "Palm Centro 685")
465 .nr_irqs = PXA_NR_IRQS, 546 .nr_irqs = PXA_NR_IRQS,
466 .init_irq = pxa27x_init_irq, 547 .init_irq = pxa27x_init_irq,
467 .handle_irq = pxa27x_handle_irq, 548 .handle_irq = pxa27x_handle_irq,
468 .timer = &pxa_timer, 549 .init_time = pxa_timer_init,
469 .init_machine = centro_init, 550 .init_machine = centro_init,
470 .restart = pxa_restart, 551 .restart = pxa_restart,
471MACHINE_END 552MACHINE_END