diff options
-rw-r--r-- | arch/arm/mach-pxa/include/mach/tosa.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 35 | ||||
-rw-r--r-- | drivers/mfd/tc6393xb.c | 21 | ||||
-rw-r--r-- | include/linux/mfd/tc6393xb.h | 4 |
4 files changed, 45 insertions, 17 deletions
diff --git a/arch/arm/mach-pxa/include/mach/tosa.h b/arch/arm/mach-pxa/include/mach/tosa.h index a72803f0461b..8bce6d8615b9 100644 --- a/arch/arm/mach-pxa/include/mach/tosa.h +++ b/arch/arm/mach-pxa/include/mach/tosa.h | |||
@@ -59,8 +59,6 @@ | |||
59 | * TC6393XB GPIOs | 59 | * TC6393XB GPIOs |
60 | */ | 60 | */ |
61 | #define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12) | 61 | #define TOSA_TC6393XB_GPIO_BASE (NR_BUILTIN_GPIO + 2 * 12) |
62 | #define TOSA_TC6393XB_GPIO(i) (TOSA_TC6393XB_GPIO_BASE + (i)) | ||
63 | #define TOSA_TC6393XB_GPIO_BIT(gpio) (1 << (gpio - TOSA_TC6393XB_GPIO_BASE)) | ||
64 | 62 | ||
65 | #define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0) | 63 | #define TOSA_GPIO_TG_ON (TOSA_TC6393XB_GPIO_BASE + 0) |
66 | #define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1) | 64 | #define TOSA_GPIO_L_MUTE (TOSA_TC6393XB_GPIO_BASE + 1) |
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 130e37e4ebdd..fac846b0d070 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -706,16 +706,39 @@ static struct tmio_nand_data tosa_tc6393xb_nand_config = { | |||
706 | .badblock_pattern = &tosa_tc6393xb_nand_bbt, | 706 | .badblock_pattern = &tosa_tc6393xb_nand_bbt, |
707 | }; | 707 | }; |
708 | 708 | ||
709 | static struct tc6393xb_platform_data tosa_tc6393xb_setup = { | 709 | static int tosa_tc6393xb_setup(struct platform_device *dev) |
710 | { | ||
711 | int rc; | ||
712 | |||
713 | rc = gpio_request(TOSA_GPIO_CARD_VCC_ON, "CARD_VCC_ON"); | ||
714 | if (rc) | ||
715 | goto err_req; | ||
716 | |||
717 | rc = gpio_direction_output(TOSA_GPIO_CARD_VCC_ON, 1); | ||
718 | if (rc) | ||
719 | goto err_dir; | ||
720 | |||
721 | return rc; | ||
722 | |||
723 | err_dir: | ||
724 | gpio_free(TOSA_GPIO_CARD_VCC_ON); | ||
725 | err_req: | ||
726 | return rc; | ||
727 | } | ||
728 | |||
729 | static void tosa_tc6393xb_teardown(struct platform_device *dev) | ||
730 | { | ||
731 | gpio_free(TOSA_GPIO_CARD_VCC_ON); | ||
732 | } | ||
733 | |||
734 | static struct tc6393xb_platform_data tosa_tc6393xb_data = { | ||
710 | .scr_pll2cr = 0x0cc1, | 735 | .scr_pll2cr = 0x0cc1, |
711 | .scr_gper = 0x3300, | 736 | .scr_gper = 0x3300, |
712 | .scr_gpo_dsr = | ||
713 | TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON), | ||
714 | .scr_gpo_doecr = | ||
715 | TOSA_TC6393XB_GPIO_BIT(TOSA_GPIO_CARD_VCC_ON), | ||
716 | 737 | ||
717 | .irq_base = IRQ_BOARD_START, | 738 | .irq_base = IRQ_BOARD_START, |
718 | .gpio_base = TOSA_TC6393XB_GPIO_BASE, | 739 | .gpio_base = TOSA_TC6393XB_GPIO_BASE, |
740 | .setup = tosa_tc6393xb_setup, | ||
741 | .teardown = tosa_tc6393xb_teardown, | ||
719 | 742 | ||
720 | .enable = tosa_tc6393xb_enable, | 743 | .enable = tosa_tc6393xb_enable, |
721 | .disable = tosa_tc6393xb_disable, | 744 | .disable = tosa_tc6393xb_disable, |
@@ -730,7 +753,7 @@ static struct platform_device tc6393xb_device = { | |||
730 | .name = "tc6393xb", | 753 | .name = "tc6393xb", |
731 | .id = -1, | 754 | .id = -1, |
732 | .dev = { | 755 | .dev = { |
733 | .platform_data = &tosa_tc6393xb_setup, | 756 | .platform_data = &tosa_tc6393xb_data, |
734 | }, | 757 | }, |
735 | .num_resources = ARRAY_SIZE(tc6393xb_resources), | 758 | .num_resources = ARRAY_SIZE(tc6393xb_resources), |
736 | .resource = tc6393xb_resources, | 759 | .resource = tc6393xb_resources, |
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index e4c1c788b5f8..83dc703f3767 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c | |||
@@ -460,13 +460,6 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
460 | 460 | ||
461 | tc6393xb->suspend_state.fer = 0; | 461 | tc6393xb->suspend_state.fer = 0; |
462 | 462 | ||
463 | for (i = 0; i < 3; i++) { | ||
464 | tc6393xb->suspend_state.gpo_dsr[i] = | ||
465 | (tcpd->scr_gpo_dsr >> (8 * i)) & 0xff; | ||
466 | tc6393xb->suspend_state.gpo_doecr[i] = | ||
467 | (tcpd->scr_gpo_doecr >> (8 * i)) & 0xff; | ||
468 | } | ||
469 | |||
470 | tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 | | 463 | tc6393xb->suspend_state.ccr = SCR_CCR_UNK1 | |
471 | SCR_CCR_HCLK_48; | 464 | SCR_CCR_HCLK_48; |
472 | 465 | ||
@@ -488,6 +481,12 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
488 | 481 | ||
489 | tc6393xb_attach_irq(dev); | 482 | tc6393xb_attach_irq(dev); |
490 | 483 | ||
484 | if (tcpd->setup) { | ||
485 | ret = tcpd->setup(dev); | ||
486 | if (ret) | ||
487 | goto err_setup; | ||
488 | } | ||
489 | |||
491 | tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; | 490 | tc6393xb_cells[TC6393XB_CELL_NAND].driver_data = tcpd->nand_data; |
492 | tc6393xb_cells[TC6393XB_CELL_NAND].platform_data = | 491 | tc6393xb_cells[TC6393XB_CELL_NAND].platform_data = |
493 | &tc6393xb_cells[TC6393XB_CELL_NAND]; | 492 | &tc6393xb_cells[TC6393XB_CELL_NAND]; |
@@ -506,6 +505,10 @@ static int __devinit tc6393xb_probe(struct platform_device *dev) | |||
506 | if (!ret) | 505 | if (!ret) |
507 | return 0; | 506 | return 0; |
508 | 507 | ||
508 | if (tcpd->teardown) | ||
509 | tcpd->teardown(dev); | ||
510 | |||
511 | err_setup: | ||
509 | tc6393xb_detach_irq(dev); | 512 | tc6393xb_detach_irq(dev); |
510 | 513 | ||
511 | err_gpio_add: | 514 | err_gpio_add: |
@@ -535,6 +538,10 @@ static int __devexit tc6393xb_remove(struct platform_device *dev) | |||
535 | int ret; | 538 | int ret; |
536 | 539 | ||
537 | mfd_remove_devices(&dev->dev); | 540 | mfd_remove_devices(&dev->dev); |
541 | |||
542 | if (tcpd->teardown) | ||
543 | tcpd->teardown(dev); | ||
544 | |||
538 | tc6393xb_detach_irq(dev); | 545 | tc6393xb_detach_irq(dev); |
539 | 546 | ||
540 | if (tc6393xb->gpio.base != -1) { | 547 | if (tc6393xb->gpio.base != -1) { |
diff --git a/include/linux/mfd/tc6393xb.h b/include/linux/mfd/tc6393xb.h index fec7b3f7a81f..1fa820646d98 100644 --- a/include/linux/mfd/tc6393xb.h +++ b/include/linux/mfd/tc6393xb.h | |||
@@ -21,8 +21,6 @@ | |||
21 | struct tc6393xb_platform_data { | 21 | struct tc6393xb_platform_data { |
22 | u16 scr_pll2cr; /* PLL2 Control */ | 22 | u16 scr_pll2cr; /* PLL2 Control */ |
23 | u16 scr_gper; /* GP Enable */ | 23 | u16 scr_gper; /* GP Enable */ |
24 | u32 scr_gpo_doecr; /* GPO Data OE Control */ | ||
25 | u32 scr_gpo_dsr; /* GPO Data Set */ | ||
26 | 24 | ||
27 | int (*enable)(struct platform_device *dev); | 25 | int (*enable)(struct platform_device *dev); |
28 | int (*disable)(struct platform_device *dev); | 26 | int (*disable)(struct platform_device *dev); |
@@ -31,6 +29,8 @@ struct tc6393xb_platform_data { | |||
31 | 29 | ||
32 | int irq_base; /* base for subdevice irqs */ | 30 | int irq_base; /* base for subdevice irqs */ |
33 | int gpio_base; | 31 | int gpio_base; |
32 | int (*setup)(struct platform_device *dev); | ||
33 | void (*teardown)(struct platform_device *dev); | ||
34 | 34 | ||
35 | struct tmio_nand_data *nand_data; | 35 | struct tmio_nand_data *nand_data; |
36 | }; | 36 | }; |