diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-06-14 06:42:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-07 08:22:02 -0400 |
commit | bf0116e54e185fd63025f2b975f0f1616ffe41f1 (patch) | |
tree | 75a5f8c22d438e3d8d3c06b5f3d0639b1ee04d1d /arch/arm/mach-pxa/tosa.c | |
parent | d6315949ac5527efd00d48283a9e33361c86e8e9 (diff) |
[ARM] 5097/1: Tosa: support TC6393XB device
Add definitions for Toshiba TC6393XB companion chip and register
the tc6393xb device.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 7a89f764acf3..2fe0998ac3fb 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -18,7 +18,10 @@ | |||
18 | #include <linux/major.h> | 18 | #include <linux/major.h> |
19 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/delay.h> | ||
22 | #include <linux/fb.h> | ||
21 | #include <linux/mmc/host.h> | 23 | #include <linux/mmc/host.h> |
24 | #include <linux/mfd/tc6393xb.h> | ||
22 | #include <linux/pm.h> | 25 | #include <linux/pm.h> |
23 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
24 | #include <linux/gpio_keys.h> | 27 | #include <linux/gpio_keys.h> |
@@ -509,9 +512,127 @@ static struct platform_device tosaled_device = { | |||
509 | }, | 512 | }, |
510 | }; | 513 | }; |
511 | 514 | ||
515 | /* | ||
516 | * Toshiba Mobile IO Controller | ||
517 | */ | ||
518 | static struct resource tc6393xb_resources[] = { | ||
519 | [0] = { | ||
520 | .start = TOSA_LCDC_PHYS, | ||
521 | .end = TOSA_LCDC_PHYS + 0x3ffffff, | ||
522 | .flags = IORESOURCE_MEM, | ||
523 | }, | ||
524 | |||
525 | [1] = { | ||
526 | .start = TOSA_IRQ_GPIO_TC6393XB_INT, | ||
527 | .end = TOSA_IRQ_GPIO_TC6393XB_INT, | ||
528 | .flags = IORESOURCE_IRQ, | ||
529 | }, | ||
530 | }; | ||
531 | |||
532 | |||
533 | static int tosa_tc6393xb_enable(struct platform_device *dev) | ||
534 | { | ||
535 | int rc; | ||
536 | |||
537 | rc = gpio_request(TOSA_GPIO_TC6393XB_REST_IN, "tc6393xb #pclr"); | ||
538 | if (rc) | ||
539 | goto err_req_pclr; | ||
540 | rc = gpio_request(TOSA_GPIO_TC6393XB_SUSPEND, "tc6393xb #suspend"); | ||
541 | if (rc) | ||
542 | goto err_req_suspend; | ||
543 | rc = gpio_request(TOSA_GPIO_TC6393XB_L3V_ON, "l3v"); | ||
544 | if (rc) | ||
545 | goto err_req_l3v; | ||
546 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_L3V_ON, 0); | ||
547 | if (rc) | ||
548 | goto err_dir_l3v; | ||
549 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_SUSPEND, 0); | ||
550 | if (rc) | ||
551 | goto err_dir_suspend; | ||
552 | rc = gpio_direction_output(TOSA_GPIO_TC6393XB_REST_IN, 0); | ||
553 | if (rc) | ||
554 | goto err_dir_pclr; | ||
555 | |||
556 | mdelay(1); | ||
557 | |||
558 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1); | ||
559 | |||
560 | mdelay(10); | ||
561 | |||
562 | gpio_set_value(TOSA_GPIO_TC6393XB_REST_IN, 1); | ||
563 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1); | ||
564 | |||
565 | return 0; | ||
566 | err_dir_pclr: | ||
567 | err_dir_suspend: | ||
568 | err_dir_l3v: | ||
569 | gpio_free(TOSA_GPIO_TC6393XB_L3V_ON); | ||
570 | err_req_l3v: | ||
571 | gpio_free(TOSA_GPIO_TC6393XB_SUSPEND); | ||
572 | err_req_suspend: | ||
573 | gpio_free(TOSA_GPIO_TC6393XB_REST_IN); | ||
574 | err_req_pclr: | ||
575 | return rc; | ||
576 | } | ||
577 | |||
578 | static int tosa_tc6393xb_disable(struct platform_device *dev) | ||
579 | { | ||
580 | gpio_free(TOSA_GPIO_TC6393XB_L3V_ON); | ||
581 | gpio_free(TOSA_GPIO_TC6393XB_SUSPEND); | ||
582 | gpio_free(TOSA_GPIO_TC6393XB_REST_IN); | ||
583 | |||
584 | return 0; | ||
585 | } | ||
586 | |||
587 | static int tosa_tc6393xb_resume(struct platform_device *dev) | ||
588 | { | ||
589 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 1); | ||
590 | mdelay(10); | ||
591 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 1); | ||
592 | mdelay(10); | ||
593 | |||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | static int tosa_tc6393xb_suspend(struct platform_device *dev) | ||
598 | { | ||
599 | gpio_set_value(TOSA_GPIO_TC6393XB_L3V_ON, 0); | ||
600 | gpio_set_value(TOSA_GPIO_TC6393XB_SUSPEND, 0); | ||
601 | return 0; | ||
602 | } | ||
603 | |||
604 | static struct tc6393xb_platform_data tosa_tc6393xb_setup = { | ||
605 | .scr_pll2cr = 0x0cc1, | ||
606 | .scr_gper = 0x3300, | ||
607 | .scr_gpo_dsr = | ||
608 | TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON), | ||
609 | .scr_gpo_doecr = | ||
610 | TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON), | ||
611 | |||
612 | .irq_base = IRQ_BOARD_START, | ||
613 | .gpio_base = TOSA_TC6393XB_GPIO_BASE, | ||
614 | |||
615 | .enable = tosa_tc6393xb_enable, | ||
616 | .disable = tosa_tc6393xb_disable, | ||
617 | .suspend = tosa_tc6393xb_suspend, | ||
618 | .resume = tosa_tc6393xb_resume, | ||
619 | }; | ||
620 | |||
621 | |||
622 | static struct platform_device tc6393xb_device = { | ||
623 | .name = "tc6393xb", | ||
624 | .id = -1, | ||
625 | .dev = { | ||
626 | .platform_data = &tosa_tc6393xb_setup, | ||
627 | }, | ||
628 | .num_resources = ARRAY_SIZE(tc6393xb_resources), | ||
629 | .resource = tc6393xb_resources, | ||
630 | }; | ||
631 | |||
512 | static struct platform_device *devices[] __initdata = { | 632 | static struct platform_device *devices[] __initdata = { |
513 | &tosascoop_device, | 633 | &tosascoop_device, |
514 | &tosascoop_jc_device, | 634 | &tosascoop_jc_device, |
635 | &tc6393xb_device, | ||
515 | &tosakbd_device, | 636 | &tosakbd_device, |
516 | &tosa_gpio_keys_device, | 637 | &tosa_gpio_keys_device, |
517 | &tosaled_device, | 638 | &tosaled_device, |
@@ -533,6 +654,8 @@ static void tosa_restart(char mode) | |||
533 | 654 | ||
534 | static void __init tosa_init(void) | 655 | static void __init tosa_init(void) |
535 | { | 656 | { |
657 | int dummy; | ||
658 | |||
536 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); | 659 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); |
537 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off)); | 660 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off)); |
538 | gpio_set_wake(MFP_PIN_GPIO1, 1); | 661 | gpio_set_wake(MFP_PIN_GPIO1, 1); |
@@ -548,6 +671,10 @@ static void __init tosa_init(void) | |||
548 | /* enable batt_fault */ | 671 | /* enable batt_fault */ |
549 | PMCR = 0x01; | 672 | PMCR = 0x01; |
550 | 673 | ||
674 | dummy = gpiochip_reserve(TOSA_SCOOP_GPIO_BASE, 12); | ||
675 | dummy = gpiochip_reserve(TOSA_SCOOP_JC_GPIO_BASE, 12); | ||
676 | dummy = gpiochip_reserve(TOSA_TC6393XB_GPIO_BASE, 16); | ||
677 | |||
551 | pxa_set_mci_info(&tosa_mci_platform_data); | 678 | pxa_set_mci_info(&tosa_mci_platform_data); |
552 | pxa_set_udc_info(&udc_info); | 679 | pxa_set_udc_info(&udc_info); |
553 | pxa_set_ficp_info(&tosa_ficp_platform_data); | 680 | pxa_set_ficp_info(&tosa_ficp_platform_data); |