aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-09-24 17:36:23 -0400
committerSamuel Ortiz <samuel@sortiz.org>2008-10-19 16:54:09 -0400
commit1c1b6ffce5737d764cc474b9bd6677bb9a344094 (patch)
treeb637110fe6282769104b72d08b3864ed1538bf96 /arch
parent80e74a805f0a6662b9b8de519439afd06ac35427 (diff)
mfd: provide and use setup hook for tc6393xb
Instead of using bitfields for initial gpio setup, provide generic setup/teardown hooks that can be used to set the gpio states, register child devices, etc. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-pxa/include/mach/tosa.h2
-rw-r--r--arch/arm/mach-pxa/tosa.c35
2 files changed, 29 insertions, 8 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
709static struct tc6393xb_platform_data tosa_tc6393xb_setup = { 709static 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
723err_dir:
724 gpio_free(TOSA_GPIO_CARD_VCC_ON);
725err_req:
726 return rc;
727}
728
729static void tosa_tc6393xb_teardown(struct platform_device *dev)
730{
731 gpio_free(TOSA_GPIO_CARD_VCC_ON);
732}
733
734static 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,