aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-06-14 06:42:02 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-07 08:22:02 -0400
commitbf0116e54e185fd63025f2b975f0f1616ffe41f1 (patch)
tree75a5f8c22d438e3d8d3c06b5f3d0639b1ee04d1d
parentd6315949ac5527efd00d48283a9e33361c86e8e9 (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>
-rw-r--r--arch/arm/mach-pxa/tosa.c127
-rw-r--r--include/asm-arm/arch-pxa/irqs.h1
-rw-r--r--include/asm-arm/arch-pxa/tosa.h44
3 files changed, 158 insertions, 14 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 */
518static 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
533static 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;
566err_dir_pclr:
567err_dir_suspend:
568err_dir_l3v:
569 gpio_free(TOSA_GPIO_TC6393XB_L3V_ON);
570err_req_l3v:
571 gpio_free(TOSA_GPIO_TC6393XB_SUSPEND);
572err_req_suspend:
573 gpio_free(TOSA_GPIO_TC6393XB_REST_IN);
574err_req_pclr:
575 return rc;
576}
577
578static 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
587static 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
597static 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
604static 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
622static 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
512static struct platform_device *devices[] __initdata = { 632static 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
534static void __init tosa_init(void) 655static 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);
diff --git a/include/asm-arm/arch-pxa/irqs.h b/include/asm-arm/arch-pxa/irqs.h
index b6c8fe377683..fa05e76f64e8 100644
--- a/include/asm-arm/arch-pxa/irqs.h
+++ b/include/asm-arm/arch-pxa/irqs.h
@@ -180,6 +180,7 @@
180#define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1) 180#define NR_IRQS (IRQ_LOCOMO_SPI_TEND + 1)
181#elif defined(CONFIG_ARCH_LUBBOCK) || \ 181#elif defined(CONFIG_ARCH_LUBBOCK) || \
182 defined(CONFIG_MACH_LOGICPD_PXA270) || \ 182 defined(CONFIG_MACH_LOGICPD_PXA270) || \
183 defined(CONFIG_MACH_TOSA) || \
183 defined(CONFIG_MACH_MAINSTONE) || \ 184 defined(CONFIG_MACH_MAINSTONE) || \
184 defined(CONFIG_MACH_PCM027) || \ 185 defined(CONFIG_MACH_PCM027) || \
185 defined(CONFIG_MACH_MAGICIAN) 186 defined(CONFIG_MACH_MAGICIAN)
diff --git a/include/asm-arm/arch-pxa/tosa.h b/include/asm-arm/arch-pxa/tosa.h
index 188226216154..a16c103b7251 100644
--- a/include/asm-arm/arch-pxa/tosa.h
+++ b/include/asm-arm/arch-pxa/tosa.h
@@ -25,7 +25,7 @@
25 */ 25 */
26#define TOSA_SCOOP_GPIO_BASE NR_BUILTIN_GPIO 26#define TOSA_SCOOP_GPIO_BASE NR_BUILTIN_GPIO
27#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11 27#define TOSA_SCOOP_PXA_VCORE1 SCOOP_GPCR_PA11
28#define TOSA_SCOOP_TC6393_REST_IN SCOOP_GPCR_PA12 28#define TOSA_GPIO_TC6393XB_REST_IN (TOSA_SCOOP_GPIO_BASE + 1)
29#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2) 29#define TOSA_GPIO_IR_POWERDWN (TOSA_SCOOP_GPIO_BASE + 2)
30#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3) 30#define TOSA_GPIO_SD_WP (TOSA_SCOOP_GPIO_BASE + 3)
31#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4) 31#define TOSA_GPIO_PWR_ON (TOSA_SCOOP_GPIO_BASE + 4)
@@ -35,11 +35,9 @@
35#define TOSA_SCOOP_AC_IN_OL SCOOP_GPCR_PA19 35#define TOSA_SCOOP_AC_IN_OL SCOOP_GPCR_PA19
36 36
37/* GPIO Direction 1 : output mode / 0:input mode */ 37/* GPIO Direction 1 : output mode / 0:input mode */
38#define TOSA_SCOOP_IO_DIR ( TOSA_SCOOP_PXA_VCORE1 | TOSA_SCOOP_TC6393_REST_IN | \ 38#define TOSA_SCOOP_IO_DIR (TOSA_SCOOP_PXA_VCORE1 | \
39 TOSA_SCOOP_AUD_PWR_ON |\ 39 TOSA_SCOOP_AUD_PWR_ON |\
40 TOSA_SCOOP_BT_RESET | TOSA_SCOOP_BT_PWR_EN ) 40 TOSA_SCOOP_BT_RESET | TOSA_SCOOP_BT_PWR_EN)
41/* GPIO out put level when init 1: Hi */
42#define TOSA_SCOOP_IO_OUT ( TOSA_SCOOP_TC6393_REST_IN )
43 41
44/* 42/*
45 * SCOOP2 jacket GPIOs 43 * SCOOP2 jacket GPIOs
@@ -49,16 +47,34 @@
49#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1) 47#define TOSA_GPIO_NOTE_LED (TOSA_SCOOP_JC_GPIO_BASE + 1)
50#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2) 48#define TOSA_GPIO_CHRG_ERR_LED (TOSA_SCOOP_JC_GPIO_BASE + 2)
51#define TOSA_GPIO_USB_PULLUP (TOSA_SCOOP_JC_GPIO_BASE + 3) 49#define TOSA_GPIO_USB_PULLUP (TOSA_SCOOP_JC_GPIO_BASE + 3)
52#define TOSA_SCOOP_JC_TC6393_SUSPEND SCOOP_GPCR_PA15 50#define TOSA_GPIO_TC6393XB_SUSPEND (TOSA_SCOOP_JC_GPIO_BASE + 4)
53#define TOSA_SCOOP_JC_TC3693_L3V_ON SCOOP_GPCR_PA16 51#define TOSA_GPIO_TC6393XB_L3V_ON (TOSA_SCOOP_JC_GPIO_BASE + 5)
54#define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17 52#define TOSA_SCOOP_JC_WLAN_DETECT SCOOP_GPCR_PA17
55#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7) 53#define TOSA_GPIO_WLAN_LED (TOSA_SCOOP_JC_GPIO_BASE + 7)
56#define TOSA_SCOOP_JC_CARD_LIMIT_SEL SCOOP_GPCR_PA19 54#define TOSA_SCOOP_JC_CARD_LIMIT_SEL SCOOP_GPCR_PA19
57 55
58/* GPIO Direction 1 : output mode / 0:input mode */ 56/* GPIO Direction 1 : output mode / 0:input mode */
59#define TOSA_SCOOP_JC_IO_DIR ( \ 57#define TOSA_SCOOP_JC_IO_DIR (TOSA_SCOOP_JC_CARD_LIMIT_SEL)
60 TOSA_SCOOP_JC_TC6393_SUSPEND | TOSA_SCOOP_JC_TC3693_L3V_ON | \ 58
61 TOSA_SCOOP_JC_CARD_LIMIT_SEL ) 59/*
60 * TC6393XB GPIOs
61 */
62#define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12)
63#define TOSA_TC6393XB_GPIO(i) (TOSA_TC6393XB_GPIO_BASE + (i))
64#define TOSA_TC6393XB_GPIO_BIT(gpio) (1 << (gpio - TOSA_TC6393XB_GPIO_BASE))
65
66#define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0)
67#define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1)
68#define TOSA_GPIO_BL_C20MA (TOSA_TC6393XB_GPIO_BASE + 3)
69#define TOSA_GPIO_CARD_VCC_ON (TOSA_TC6393XB_GPIO_BASE + 4)
70#define TOSA_GPIO_CHARGE_OFF (TOSA_TC6393XB_GPIO_BASE + 6)
71#define TOSA_GPIO_CHARGE_OFF_JC (TOSA_TC6393XB_GPIO_BASE + 7)
72#define TOSA_GPIO_BAT0_V_ON (TOSA_TC6393XB_GPIO_BASE + 9)
73#define TOSA_GPIO_BAT1_V_ON (TOSA_TC6393XB_GPIO_BASE + 10)
74#define TOSA_GPIO_BU_CHRG_ON (TOSA_TC6393XB_GPIO_BASE + 11)
75#define TOSA_GPIO_BAT_SW_ON (TOSA_TC6393XB_GPIO_BASE + 12)
76#define TOSA_GPIO_BAT0_TH_ON (TOSA_TC6393XB_GPIO_BASE + 14)
77#define TOSA_GPIO_BAT1_TH_ON (TOSA_TC6393XB_GPIO_BASE + 15)
62 78
63/* 79/*
64 * Timing Generator 80 * Timing Generator
@@ -84,13 +100,13 @@
84#define TOSA_GPIO_JACKET_DETECT (7) 100#define TOSA_GPIO_JACKET_DETECT (7)
85#define TOSA_GPIO_nSD_DETECT (9) 101#define TOSA_GPIO_nSD_DETECT (9)
86#define TOSA_GPIO_nSD_INT (10) 102#define TOSA_GPIO_nSD_INT (10)
87#define TOSA_GPIO_TC6393_CLK (11) 103#define TOSA_GPIO_TC6393XB_CLK (11)
88#define TOSA_GPIO_BAT1_CRG (12) 104#define TOSA_GPIO_BAT1_CRG (12)
89#define TOSA_GPIO_CF_CD (13) 105#define TOSA_GPIO_CF_CD (13)
90#define TOSA_GPIO_BAT0_CRG (14) 106#define TOSA_GPIO_BAT0_CRG (14)
91#define TOSA_GPIO_TC6393_INT (15) 107#define TOSA_GPIO_TC6393XB_INT (15)
92#define TOSA_GPIO_BAT0_LOW (17) 108#define TOSA_GPIO_BAT0_LOW (17)
93#define TOSA_GPIO_TC6393_RDY (18) 109#define TOSA_GPIO_TC6393XB_RDY (18)
94#define TOSA_GPIO_ON_RESET (19) 110#define TOSA_GPIO_ON_RESET (19)
95#define TOSA_GPIO_EAR_IN (20) 111#define TOSA_GPIO_EAR_IN (20)
96#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */ 112#define TOSA_GPIO_CF_IRQ (21) /* CF slot0 Ready */
@@ -138,7 +154,7 @@
138#define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG) 154#define TOSA_IRQ_GPIO_BAT1_CRG IRQ_GPIO(TOSA_GPIO_BAT1_CRG)
139#define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD) 155#define TOSA_IRQ_GPIO_CF_CD IRQ_GPIO(TOSA_GPIO_CF_CD)
140#define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG) 156#define TOSA_IRQ_GPIO_BAT0_CRG IRQ_GPIO(TOSA_GPIO_BAT0_CRG)
141#define TOSA_IRQ_GPIO_TC6393_INT IRQ_GPIO(TOSA_GPIO_TC6393_INT) 157#define TOSA_IRQ_GPIO_TC6393XB_INT IRQ_GPIO(TOSA_GPIO_TC6393XB_INT)
142#define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW) 158#define TOSA_IRQ_GPIO_BAT0_LOW IRQ_GPIO(TOSA_GPIO_BAT0_LOW)
143#define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN) 159#define TOSA_IRQ_GPIO_EAR_IN IRQ_GPIO(TOSA_GPIO_EAR_IN)
144#define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ) 160#define TOSA_IRQ_GPIO_CF_IRQ IRQ_GPIO(TOSA_GPIO_CF_IRQ)