aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-shmobile/board-lager.c83
1 files changed, 82 insertions, 1 deletions
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index 04cb93293617..267f2b390b11 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -31,7 +31,9 @@
31#include <linux/platform_data/rcar-du.h> 31#include <linux/platform_data/rcar-du.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/phy.h> 33#include <linux/phy.h>
34#include <linux/regulator/driver.h>
34#include <linux/regulator/fixed.h> 35#include <linux/regulator/fixed.h>
36#include <linux/regulator/gpio-regulator.h>
35#include <linux/regulator/machine.h> 37#include <linux/regulator/machine.h>
36#include <linux/sh_eth.h> 38#include <linux/sh_eth.h>
37#include <mach/common.h> 39#include <mach/common.h>
@@ -146,6 +148,71 @@ static struct regulator_consumer_supply fixed3v3_power_consumers[] =
146 REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"), 148 REGULATOR_SUPPLY("vmmc", "sh_mmcif.1"),
147}; 149};
148 150
151/*
152 * SDHI regulator macro
153 *
154 ** FIXME**
155 * Lager board vqmmc is provided via DA9063 PMIC chip,
156 * and we should use ${LINK}/drivers/mfd/da9063-* driver for it.
157 * but, it doesn't have regulator support at this point.
158 * It uses gpio-regulator for vqmmc as quick-hack.
159 */
160#define SDHI_REGULATOR(idx, vdd_pin, vccq_pin) \
161static struct regulator_consumer_supply vcc_sdhi##idx##_consumer = \
162 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi." #idx); \
163 \
164static struct regulator_init_data vcc_sdhi##idx##_init_data = { \
165 .constraints = { \
166 .valid_ops_mask = REGULATOR_CHANGE_STATUS, \
167 }, \
168 .consumer_supplies = &vcc_sdhi##idx##_consumer, \
169 .num_consumer_supplies = 1, \
170}; \
171 \
172static const struct fixed_voltage_config vcc_sdhi##idx##_info __initconst = {\
173 .supply_name = "SDHI" #idx "Vcc", \
174 .microvolts = 3300000, \
175 .gpio = vdd_pin, \
176 .enable_high = 1, \
177 .init_data = &vcc_sdhi##idx##_init_data, \
178}; \
179 \
180static struct regulator_consumer_supply vccq_sdhi##idx##_consumer = \
181 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi." #idx); \
182 \
183static struct regulator_init_data vccq_sdhi##idx##_init_data = { \
184 .constraints = { \
185 .input_uV = 3300000, \
186 .min_uV = 1800000, \
187 .max_uV = 3300000, \
188 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE | \
189 REGULATOR_CHANGE_STATUS, \
190 }, \
191 .consumer_supplies = &vccq_sdhi##idx##_consumer, \
192 .num_consumer_supplies = 1, \
193}; \
194 \
195static struct gpio vccq_sdhi##idx##_gpio = \
196 { vccq_pin, GPIOF_OUT_INIT_HIGH, "vccq-sdhi" #idx }; \
197 \
198static struct gpio_regulator_state vccq_sdhi##idx##_states[] = { \
199 { .value = 1800000, .gpios = 0 }, \
200 { .value = 3300000, .gpios = 1 }, \
201}; \
202 \
203static const struct gpio_regulator_config vccq_sdhi##idx##_info __initconst = {\
204 .supply_name = "vqmmc", \
205 .gpios = &vccq_sdhi##idx##_gpio, \
206 .nr_gpios = 1, \
207 .states = vccq_sdhi##idx##_states, \
208 .nr_states = ARRAY_SIZE(vccq_sdhi##idx##_states), \
209 .type = REGULATOR_VOLTAGE, \
210 .init_data = &vccq_sdhi##idx##_init_data, \
211};
212
213SDHI_REGULATOR(0, RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 29));
214SDHI_REGULATOR(2, RCAR_GP_PIN(5, 25), RCAR_GP_PIN(5, 30));
215
149/* MMCIF */ 216/* MMCIF */
150static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = { 217static const struct sh_mmcif_plat_data mmcif1_pdata __initconst = {
151 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE, 218 .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE,
@@ -256,6 +323,9 @@ static const struct pinctrl_map lager_pinctrl_map[] = {
256 323
257static void __init lager_add_standard_devices(void) 324static void __init lager_add_standard_devices(void)
258{ 325{
326 int fixed_regulator_idx = 0;
327 int gpio_regulator_idx = 0;
328
259 r8a7790_clock_init(); 329 r8a7790_clock_init();
260 330
261 pinctrl_register_mappings(lager_pinctrl_map, 331 pinctrl_register_mappings(lager_pinctrl_map,
@@ -269,7 +339,8 @@ static void __init lager_add_standard_devices(void)
269 platform_device_register_data(&platform_bus, "gpio-keys", -1, 339 platform_device_register_data(&platform_bus, "gpio-keys", -1,
270 &lager_keys_pdata, 340 &lager_keys_pdata,
271 sizeof(lager_keys_pdata)); 341 sizeof(lager_keys_pdata));
272 regulator_register_always_on(0, "fixed-3.3V", fixed3v3_power_consumers, 342 regulator_register_always_on(fixed_regulator_idx++,
343 "fixed-3.3V", fixed3v3_power_consumers,
273 ARRAY_SIZE(fixed3v3_power_consumers), 3300000); 344 ARRAY_SIZE(fixed3v3_power_consumers), 3300000);
274 platform_device_register_resndata(&platform_bus, "sh_mmcif", 1, 345 platform_device_register_resndata(&platform_bus, "sh_mmcif", 1,
275 mmcif1_resources, ARRAY_SIZE(mmcif1_resources), 346 mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
@@ -287,6 +358,16 @@ static void __init lager_add_standard_devices(void)
287 ARRAY_SIZE(qspi_resources), 358 ARRAY_SIZE(qspi_resources),
288 &qspi_pdata, sizeof(qspi_pdata)); 359 &qspi_pdata, sizeof(qspi_pdata));
289 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info)); 360 spi_register_board_info(spi_info, ARRAY_SIZE(spi_info));
361
362 platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
363 &vcc_sdhi0_info, sizeof(struct fixed_voltage_config));
364 platform_device_register_data(&platform_bus, "reg-fixed-voltage", fixed_regulator_idx++,
365 &vcc_sdhi2_info, sizeof(struct fixed_voltage_config));
366
367 platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
368 &vccq_sdhi0_info, sizeof(struct gpio_regulator_config));
369 platform_device_register_data(&platform_bus, "gpio-regulator", gpio_regulator_idx++,
370 &vccq_sdhi2_info, sizeof(struct gpio_regulator_config));
290} 371}
291 372
292/* 373/*