aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-01-31 06:31:16 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-03-01 17:30:20 -0500
commitcd2fa6d6035adb92b49ef04cbd1950c59f592cf6 (patch)
tree3c0b6c89bcea8c61a4d562e2c54a08e73484595d /arch/arm
parent874c920241640595da77622b6ee98c14e79296e4 (diff)
ARM: ux500: Use the GPIO regulator framework for SDI0's 'en' and 'vsel'
To prevent lots of unnecessary call-backs into platform code, we're now using the GPIO regulator framework to control the 'enable' (en) and 'voltage select' (vsel) GPIO pins which in turn control the MMCI's secondary regulator settings. This already works with Device Tree, but when booting with ATAGs we need to register it as a platform device. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.c14
-rw-r--r--arch/arm/mach-ux500/board-mop500-regulators.h1
-rw-r--r--arch/arm/mach-ux500/board-mop500.c45
3 files changed, 60 insertions, 0 deletions
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 2a17bc506cff..cb7540573a85 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -28,6 +28,20 @@ struct regulator_init_data gpio_en_3v3_regulator = {
28 .consumer_supplies = gpio_en_3v3_consumers, 28 .consumer_supplies = gpio_en_3v3_consumers,
29}; 29};
30 30
31static struct regulator_consumer_supply sdi0_reg_consumers[] = {
32 REGULATOR_SUPPLY("vqmmc", "sdi0"),
33};
34
35struct regulator_init_data sdi0_reg_init_data = {
36 .constraints = {
37 .min_uV = 1800000,
38 .max_uV = 2900000,
39 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE|REGULATOR_CHANGE_STATUS,
40 },
41 .num_consumer_supplies = ARRAY_SIZE(sdi0_reg_consumers),
42 .consumer_supplies = sdi0_reg_consumers,
43};
44
31/* 45/*
32 * TPS61052 regulator 46 * TPS61052 regulator
33 */ 47 */
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
index 78a0642a2206..0c79d902f904 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.h
+++ b/arch/arm/mach-ux500/board-mop500-regulators.h
@@ -19,5 +19,6 @@ ab8500_regulator_reg_init[AB8500_NUM_REGULATOR_REGISTERS];
19extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS]; 19extern struct regulator_init_data ab8500_regulators[AB8500_NUM_REGULATORS];
20extern struct regulator_init_data tps61052_regulator; 20extern struct regulator_init_data tps61052_regulator;
21extern struct regulator_init_data gpio_en_3v3_regulator; 21extern struct regulator_init_data gpio_en_3v3_regulator;
22extern struct regulator_init_data sdi0_reg_init_data;
22 23
23#endif 24#endif
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index b03457881c4b..cd100d569f4d 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -24,6 +24,8 @@
24#include <linux/mfd/abx500/ab8500.h> 24#include <linux/mfd/abx500/ab8500.h>
25#include <linux/regulator/ab8500.h> 25#include <linux/regulator/ab8500.h>
26#include <linux/regulator/fixed.h> 26#include <linux/regulator/fixed.h>
27#include <linux/regulator/driver.h>
28#include <linux/regulator/gpio-regulator.h>
27#include <linux/mfd/tc3589x.h> 29#include <linux/mfd/tc3589x.h>
28#include <linux/mfd/tps6105x.h> 30#include <linux/mfd/tps6105x.h>
29#include <linux/mfd/abx500/ab8500-gpio.h> 31#include <linux/mfd/abx500/ab8500-gpio.h>
@@ -89,6 +91,37 @@ static struct platform_device snowball_gpio_en_3v3_regulator_dev = {
89 }, 91 },
90}; 92};
91 93
94/* Dynamically populated. */
95static struct gpio sdi0_reg_gpios[] = {
96 { 0, GPIOF_OUT_INIT_LOW, "mmci_vsel" },
97};
98
99static struct gpio_regulator_state sdi0_reg_states[] = {
100 { .value = 2900000, .gpios = (0 << 0) },
101 { .value = 1800000, .gpios = (1 << 0) },
102};
103
104static struct gpio_regulator_config sdi0_reg_info = {
105 .supply_name = "ext-mmc-level-shifter",
106 .gpios = sdi0_reg_gpios,
107 .nr_gpios = ARRAY_SIZE(sdi0_reg_gpios),
108 .states = sdi0_reg_states,
109 .nr_states = ARRAY_SIZE(sdi0_reg_states),
110 .type = REGULATOR_VOLTAGE,
111 .enable_high = 1,
112 .enabled_at_boot = 0,
113 .init_data = &sdi0_reg_init_data,
114 .startup_delay = 100,
115};
116
117static struct platform_device sdi0_regulator = {
118 .name = "gpio-regulator",
119 .id = -1,
120 .dev = {
121 .platform_data = &sdi0_reg_info,
122 },
123};
124
92static struct abx500_gpio_platform_data ab8500_gpio_pdata = { 125static struct abx500_gpio_platform_data ab8500_gpio_pdata = {
93 .gpio_base = MOP500_AB8500_PIN_GPIO(1), 126 .gpio_base = MOP500_AB8500_PIN_GPIO(1),
94}; 127};
@@ -481,6 +514,7 @@ static struct hash_platform_data u8500_hash1_platform_data = {
481/* add any platform devices here - TODO */ 514/* add any platform devices here - TODO */
482static struct platform_device *mop500_platform_devs[] __initdata = { 515static struct platform_device *mop500_platform_devs[] __initdata = {
483 &mop500_gpio_keys_device, 516 &mop500_gpio_keys_device,
517 &sdi0_regulator,
484}; 518};
485 519
486#ifdef CONFIG_STE_DMA40 520#ifdef CONFIG_STE_DMA40
@@ -624,6 +658,7 @@ static struct platform_device *snowball_platform_devs[] __initdata = {
624 &snowball_gpio_en_3v3_regulator_dev, 658 &snowball_gpio_en_3v3_regulator_dev,
625 &u8500_thsens_device, 659 &u8500_thsens_device,
626 &u8500_cpufreq_cooling_device, 660 &u8500_cpufreq_cooling_device,
661 &sdi0_regulator,
627}; 662};
628 663
629static void __init mop500_init_machine(void) 664static void __init mop500_init_machine(void)
@@ -635,6 +670,9 @@ static void __init mop500_init_machine(void)
635 platform_device_register(&db8500_prcmu_device); 670 platform_device_register(&db8500_prcmu_device);
636 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR; 671 mop500_gpio_keys[0].gpio = GPIO_PROX_SENSOR;
637 672
673 sdi0_reg_info.enable_gpio = GPIO_SDMMC_EN;
674 sdi0_reg_info.gpios[0].gpio = GPIO_SDMMC_1V8_3V_SEL;
675
638 mop500_pinmaps_init(); 676 mop500_pinmaps_init();
639 parent = u8500_init_devices(&ab8500_platdata); 677 parent = u8500_init_devices(&ab8500_platdata);
640 678
@@ -668,6 +706,10 @@ static void __init snowball_init_machine(void)
668 int i; 706 int i;
669 707
670 platform_device_register(&db8500_prcmu_device); 708 platform_device_register(&db8500_prcmu_device);
709
710 sdi0_reg_info.enable_gpio = SNOWBALL_SDMMC_EN_GPIO;
711 sdi0_reg_info.gpios[0].gpio = SNOWBALL_SDMMC_1V8_3V_GPIO;
712
671 snowball_pinmaps_init(); 713 snowball_pinmaps_init();
672 parent = u8500_init_devices(&ab8500_platdata); 714 parent = u8500_init_devices(&ab8500_platdata);
673 715
@@ -701,6 +743,9 @@ static void __init hrefv60_init_machine(void)
701 */ 743 */
702 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO; 744 mop500_gpio_keys[0].gpio = HREFV60_PROX_SENSE_GPIO;
703 745
746 sdi0_reg_info.enable_gpio = HREFV60_SDMMC_EN_GPIO;
747 sdi0_reg_info.gpios[0].gpio = HREFV60_SDMMC_1V8_3V_GPIO;
748
704 hrefv60_pinmaps_init(); 749 hrefv60_pinmaps_init();
705 parent = u8500_init_devices(&ab8500_platdata); 750 parent = u8500_init_devices(&ab8500_platdata);
706 751