aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2013-02-13 05:34:03 -0500
committerSimon Horman <horms+renesas@verge.net.au>2013-03-18 08:27:01 -0400
commit3a5eed5f9e0734c4d3b5b42f7db443a33e2ba665 (patch)
tree800d2b96f54bd7c423915e3c345fb3648d34ec83 /arch
parentaee14423e79eddf3c4fa97d7015164d150b75e45 (diff)
ARM: shmobile: switch SDHI0 to GPIO regulator on armadillo800eva
When regulators are used with MMC devices, explicitly provided OCR masks are ignored, they can be removed from platform data. Also switch SDHI0 from fixed regulator with hard-wired GPIO levels to a proper GPIO regulator instance to enable dynamic voltage switching. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c101
1 files changed, 86 insertions, 15 deletions
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 60694e866d1a..f322a18b55b6 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -28,8 +28,10 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/gpio.h> 29#include <linux/gpio.h>
30#include <linux/gpio_keys.h> 30#include <linux/gpio_keys.h>
31#include <linux/regulator/driver.h>
31#include <linux/pinctrl/machine.h> 32#include <linux/pinctrl/machine.h>
32#include <linux/regulator/fixed.h> 33#include <linux/regulator/fixed.h>
34#include <linux/regulator/gpio-regulator.h>
33#include <linux/regulator/machine.h> 35#include <linux/regulator/machine.h>
34#include <linux/sh_eth.h> 36#include <linux/sh_eth.h>
35#include <linux/videodev2.h> 37#include <linux/videodev2.h>
@@ -555,17 +557,94 @@ static struct platform_device gpio_keys_device = {
555 }, 557 },
556}; 558};
557 559
558/* Fixed 3.3V regulator to be used by SDHI0, SDHI1, MMCIF */ 560/* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
559static struct regulator_consumer_supply fixed3v3_power_consumers[] = 561static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
560{
561 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
562 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
563 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"), 562 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
564 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"), 563 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
565 REGULATOR_SUPPLY("vmmc", "sh_mmcif"), 564 REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
566 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"), 565 REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
567}; 566};
568 567
568/* Fixed 3.3V regulator to be used by SDHI0 */
569static struct regulator_consumer_supply vcc_sdhi0_consumers[] = {
570 REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.0"),
571};
572
573static struct regulator_init_data vcc_sdhi0_init_data = {
574 .constraints = {
575 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
576 },
577 .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi0_consumers),
578 .consumer_supplies = vcc_sdhi0_consumers,
579};
580
581static struct fixed_voltage_config vcc_sdhi0_info = {
582 .supply_name = "SDHI0 Vcc",
583 .microvolts = 3300000,
584 .gpio = GPIO_PORT75,
585 .enable_high = 1,
586 .init_data = &vcc_sdhi0_init_data,
587};
588
589static struct platform_device vcc_sdhi0 = {
590 .name = "reg-fixed-voltage",
591 .id = 1,
592 .dev = {
593 .platform_data = &vcc_sdhi0_info,
594 },
595};
596
597/* 1.8 / 3.3V SDHI0 VccQ regulator */
598static struct regulator_consumer_supply vccq_sdhi0_consumers[] = {
599 REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.0"),
600};
601
602static struct regulator_init_data vccq_sdhi0_init_data = {
603 .constraints = {
604 .input_uV = 3300000,
605 .min_uV = 1800000,
606 .max_uV = 3300000,
607 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
608 REGULATOR_CHANGE_STATUS,
609 },
610 .num_consumer_supplies = ARRAY_SIZE(vccq_sdhi0_consumers),
611 .consumer_supplies = vccq_sdhi0_consumers,
612};
613
614static struct gpio vccq_sdhi0_gpios[] = {
615 {GPIO_PORT17, GPIOF_OUT_INIT_LOW, "vccq-sdhi0" },
616};
617
618static struct gpio_regulator_state vccq_sdhi0_states[] = {
619 { .value = 3300000, .gpios = (0 << 0) },
620 { .value = 1800000, .gpios = (1 << 0) },
621};
622
623static struct gpio_regulator_config vccq_sdhi0_info = {
624 .supply_name = "vqmmc",
625
626 .enable_gpio = GPIO_PORT74,
627 .enable_high = 1,
628 .enabled_at_boot = 0,
629
630 .gpios = vccq_sdhi0_gpios,
631 .nr_gpios = ARRAY_SIZE(vccq_sdhi0_gpios),
632
633 .states = vccq_sdhi0_states,
634 .nr_states = ARRAY_SIZE(vccq_sdhi0_states),
635
636 .type = REGULATOR_VOLTAGE,
637 .init_data = &vccq_sdhi0_init_data,
638};
639
640static struct platform_device vccq_sdhi0 = {
641 .name = "gpio-regulator",
642 .id = -1,
643 .dev = {
644 .platform_data = &vccq_sdhi0_info,
645 },
646};
647
569/* SDHI0 */ 648/* SDHI0 */
570/* 649/*
571 * FIXME 650 * FIXME
@@ -580,7 +659,6 @@ static struct sh_mobile_sdhi_info sdhi0_info = {
580 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, 659 .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
581 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX, 660 .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
582 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 661 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
583 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
584 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 662 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
585 .cd_gpio = GPIO_PORT167, 663 .cd_gpio = GPIO_PORT167,
586}; 664};
@@ -622,7 +700,6 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
622 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, 700 .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
623 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 701 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
624 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ, 702 .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
625 .tmio_ocr_mask = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
626 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD, 703 .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
627 /* Port72 cannot generate IRQs, will be used in polling mode. */ 704 /* Port72 cannot generate IRQs, will be used in polling mode. */
628 .cd_gpio = GPIO_PORT72, 705 .cd_gpio = GPIO_PORT72,
@@ -673,7 +750,6 @@ static const struct pinctrl_map eva_sdhi1_pinctrl_map[] = {
673/* MMCIF */ 750/* MMCIF */
674static struct sh_mmcif_plat_data sh_mmcif_plat = { 751static struct sh_mmcif_plat_data sh_mmcif_plat = {
675 .sup_pclk = 0, 752 .sup_pclk = 0,
676 .ocr = MMC_VDD_165_195 | MMC_VDD_32_33 | MMC_VDD_33_34,
677 .caps = MMC_CAP_4_BIT_DATA | 753 .caps = MMC_CAP_4_BIT_DATA |
678 MMC_CAP_8_BIT_DATA | 754 MMC_CAP_8_BIT_DATA |
679 MMC_CAP_NONREMOVABLE, 755 MMC_CAP_NONREMOVABLE,
@@ -926,6 +1002,8 @@ static struct platform_device *eva_devices[] __initdata = {
926 &fsi_wm8978_device, 1002 &fsi_wm8978_device,
927 &fsi_hdmi_device, 1003 &fsi_hdmi_device,
928 &i2c_gpio_device, 1004 &i2c_gpio_device,
1005 &vcc_sdhi0,
1006 &vccq_sdhi0,
929}; 1007};
930 1008
931static const struct pinctrl_map eva_pinctrl_map[] = { 1009static const struct pinctrl_map eva_pinctrl_map[] = {
@@ -1060,13 +1138,6 @@ static void __init eva_init(void)
1060 usb = &usbhsf_device; 1138 usb = &usbhsf_device;
1061 } 1139 }
1062 1140
1063 /* SDHI0 */
1064 gpio_request_one(17, GPIOF_OUT_INIT_LOW, NULL); /* SDHI0_18/33_B */
1065 gpio_request_one(74, GPIOF_OUT_INIT_HIGH, NULL); /* SDHI0_PON */
1066 gpio_request_one(75, GPIOF_OUT_INIT_HIGH, NULL); /* SDSLOT1_PON */
1067
1068 /* we can use GPIO_FN_IRQ31_PORT167 here for SDHI0 CD irq */
1069
1070 /* CEU0 */ 1141 /* CEU0 */
1071 gpio_request(GPIO_FN_VIO0_D7, NULL); 1142 gpio_request(GPIO_FN_VIO0_D7, NULL);
1072 gpio_request(GPIO_FN_VIO0_D6, NULL); 1143 gpio_request(GPIO_FN_VIO0_D6, NULL);