* [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1
@ 2013-03-18 18:26 Guennadi Liakhovetski
2013-03-21 10:32 ` Simon Horman
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-18 18:26 UTC (permalink / raw)
To: linux-sh
The SDHI1 power supply on armadillo800eva can be switched on and off. In
the current version this is not used and the regulator is hard-wired to
"on." This patch switches SDHI1 to a proper fixed-voltage regulator,
using a GPIO to enable and disable it. Both SDHI0 and SDHI1 ports shall
now be specifying the MMC_CAP_POWER_OFF_CARD MMC capability. Both
interfaces tested with an SDIO card.
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
arch/arm/mach-shmobile/board-armadillo800eva.c | 45 +++++++++++++++++++-----
1 files changed, 36 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index f322a18..7a78f94 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -559,8 +559,6 @@ static struct platform_device gpio_keys_device = {
/* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
- REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
- REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
};
@@ -645,6 +643,35 @@ static struct platform_device vccq_sdhi0 = {
},
};
+/* Fixed 3.3V regulator to be used by SDHI1 */
+static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
+ REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
+};
+
+static struct regulator_init_data vcc_sdhi1_init_data = {
+ .constraints = {
+ .valid_ops_mask = REGULATOR_CHANGE_STATUS,
+ },
+ .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
+ .consumer_supplies = vcc_sdhi1_consumers,
+};
+
+static struct fixed_voltage_config vcc_sdhi1_info = {
+ .supply_name = "SDHI1 Vcc",
+ .microvolts = 3300000,
+ .gpio = GPIO_PORT16,
+ .enable_high = 1,
+ .init_data = &vcc_sdhi1_init_data,
+};
+
+static struct platform_device vcc_sdhi1 = {
+ .name = "reg-fixed-voltage",
+ .id = 2,
+ .dev = {
+ .platform_data = &vcc_sdhi1_info,
+ },
+};
+
/* SDHI0 */
/*
* FIXME
@@ -658,7 +685,8 @@ static struct platform_device vccq_sdhi0 = {
static struct sh_mobile_sdhi_info sdhi0_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
- .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+ .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+ MMC_CAP_POWER_OFF_CARD,
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
.cd_gpio = GPIO_PORT167,
};
@@ -699,7 +727,8 @@ static struct platform_device sdhi0_device = {
static struct sh_mobile_sdhi_info sdhi1_info = {
.dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
.dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
- .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
+ .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
+ MMC_CAP_POWER_OFF_CARD,
.tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
/* Port72 cannot generate IRQs, will be used in polling mode. */
.cd_gpio = GPIO_PORT72,
@@ -992,6 +1021,8 @@ static struct platform_device *eva_devices[] __initdata = {
&lcdc0_device,
&gpio_keys_device,
&sh_eth_device,
+ &vcc_sdhi0,
+ &vccq_sdhi0,
&sdhi0_device,
&sh_mmcif_device,
&hdmi_device,
@@ -1002,8 +1033,6 @@ static struct platform_device *eva_devices[] __initdata = {
&fsi_wm8978_device,
&fsi_hdmi_device,
&i2c_gpio_device,
- &vcc_sdhi0,
- &vccq_sdhi0,
};
static const struct pinctrl_map eva_pinctrl_map[] = {
@@ -1198,9 +1227,7 @@ static void __init eva_init(void)
pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
ARRAY_SIZE(eva_sdhi1_pinctrl_map));
- /* SDSLOT2_PON */
- gpio_request_one(16, GPIOF_OUT_INIT_HIGH, NULL);
-
+ platform_device_register(&vcc_sdhi1);
platform_device_register(&sdhi1_device);
}
--
1.7.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1
2013-03-18 18:26 [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1 Guennadi Liakhovetski
@ 2013-03-21 10:32 ` Simon Horman
2013-03-21 10:36 ` Simon Horman
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-03-21 10:32 UTC (permalink / raw)
To: linux-sh
On Mon, Mar 18, 2013 at 07:26:40PM +0100, Guennadi Liakhovetski wrote:
> The SDHI1 power supply on armadillo800eva can be switched on and off. In
> the current version this is not used and the regulator is hard-wired to
> "on." This patch switches SDHI1 to a proper fixed-voltage regulator,
> using a GPIO to enable and disable it. Both SDHI0 and SDHI1 ports shall
> now be specifying the MMC_CAP_POWER_OFF_CARD MMC capability. Both
> interfaces tested with an SDIO card.
This seems reasonable to me.
Is there any reason this and the next patch are marked RFC?
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
> arch/arm/mach-shmobile/board-armadillo800eva.c | 45 +++++++++++++++++++-----
> 1 files changed, 36 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
> index f322a18..7a78f94 100644
> --- a/arch/arm/mach-shmobile/board-armadillo800eva.c
> +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
> @@ -559,8 +559,6 @@ static struct platform_device gpio_keys_device = {
>
> /* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
> static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
> - REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
> - REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
> REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
> REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
> };
> @@ -645,6 +643,35 @@ static struct platform_device vccq_sdhi0 = {
> },
> };
>
> +/* Fixed 3.3V regulator to be used by SDHI1 */
> +static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
> + REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
> +};
> +
> +static struct regulator_init_data vcc_sdhi1_init_data = {
> + .constraints = {
> + .valid_ops_mask = REGULATOR_CHANGE_STATUS,
> + },
> + .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
> + .consumer_supplies = vcc_sdhi1_consumers,
> +};
> +
> +static struct fixed_voltage_config vcc_sdhi1_info = {
> + .supply_name = "SDHI1 Vcc",
> + .microvolts = 3300000,
> + .gpio = GPIO_PORT16,
> + .enable_high = 1,
> + .init_data = &vcc_sdhi1_init_data,
> +};
> +
> +static struct platform_device vcc_sdhi1 = {
> + .name = "reg-fixed-voltage",
> + .id = 2,
> + .dev = {
> + .platform_data = &vcc_sdhi1_info,
> + },
> +};
> +
> /* SDHI0 */
> /*
> * FIXME
> @@ -658,7 +685,8 @@ static struct platform_device vccq_sdhi0 = {
> static struct sh_mobile_sdhi_info sdhi0_info = {
> .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
> .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
> - .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> + .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> + MMC_CAP_POWER_OFF_CARD,
> .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
> .cd_gpio = GPIO_PORT167,
> };
> @@ -699,7 +727,8 @@ static struct platform_device sdhi0_device = {
> static struct sh_mobile_sdhi_info sdhi1_info = {
> .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
> .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
> - .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> + .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> + MMC_CAP_POWER_OFF_CARD,
> .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
> /* Port72 cannot generate IRQs, will be used in polling mode. */
> .cd_gpio = GPIO_PORT72,
> @@ -992,6 +1021,8 @@ static struct platform_device *eva_devices[] __initdata = {
> &lcdc0_device,
> &gpio_keys_device,
> &sh_eth_device,
> + &vcc_sdhi0,
> + &vccq_sdhi0,
> &sdhi0_device,
> &sh_mmcif_device,
> &hdmi_device,
> @@ -1002,8 +1033,6 @@ static struct platform_device *eva_devices[] __initdata = {
> &fsi_wm8978_device,
> &fsi_hdmi_device,
> &i2c_gpio_device,
> - &vcc_sdhi0,
> - &vccq_sdhi0,
> };
>
> static const struct pinctrl_map eva_pinctrl_map[] = {
> @@ -1198,9 +1227,7 @@ static void __init eva_init(void)
> pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
> ARRAY_SIZE(eva_sdhi1_pinctrl_map));
>
> - /* SDSLOT2_PON */
> - gpio_request_one(16, GPIOF_OUT_INIT_HIGH, NULL);
> -
> + platform_device_register(&vcc_sdhi1);
> platform_device_register(&sdhi1_device);
> }
>
> --
> 1.7.2.5
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1
2013-03-18 18:26 [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1 Guennadi Liakhovetski
2013-03-21 10:32 ` Simon Horman
@ 2013-03-21 10:36 ` Simon Horman
2013-03-21 10:38 ` Simon Horman
2013-03-21 16:32 ` Guennadi Liakhovetski
3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-03-21 10:36 UTC (permalink / raw)
To: linux-sh
On Thu, Mar 21, 2013 at 07:32:26PM +0900, Simon Horman wrote:
> On Mon, Mar 18, 2013 at 07:26:40PM +0100, Guennadi Liakhovetski wrote:
> > The SDHI1 power supply on armadillo800eva can be switched on and off. In
> > the current version this is not used and the regulator is hard-wired to
> > "on." This patch switches SDHI1 to a proper fixed-voltage regulator,
> > using a GPIO to enable and disable it. Both SDHI0 and SDHI1 ports shall
> > now be specifying the MMC_CAP_POWER_OFF_CARD MMC capability. Both
> > interfaces tested with an SDIO card.
>
> This seems reasonable to me.
> Is there any reason this and the next patch are marked RFC?
Sorry for that noise, I see your explanation in the cover email.
I am intending to apply these patches.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1
2013-03-18 18:26 [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1 Guennadi Liakhovetski
2013-03-21 10:32 ` Simon Horman
2013-03-21 10:36 ` Simon Horman
@ 2013-03-21 10:38 ` Simon Horman
2013-03-21 16:32 ` Guennadi Liakhovetski
3 siblings, 0 replies; 5+ messages in thread
From: Simon Horman @ 2013-03-21 10:38 UTC (permalink / raw)
To: linux-sh
On Thu, Mar 21, 2013 at 07:36:07PM +0900, Simon Horman wrote:
> On Thu, Mar 21, 2013 at 07:32:26PM +0900, Simon Horman wrote:
> > On Mon, Mar 18, 2013 at 07:26:40PM +0100, Guennadi Liakhovetski wrote:
> > > The SDHI1 power supply on armadillo800eva can be switched on and off. In
> > > the current version this is not used and the regulator is hard-wired to
> > > "on." This patch switches SDHI1 to a proper fixed-voltage regulator,
> > > using a GPIO to enable and disable it. Both SDHI0 and SDHI1 ports shall
> > > now be specifying the MMC_CAP_POWER_OFF_CARD MMC capability. Both
> > > interfaces tested with an SDIO card.
> >
> > This seems reasonable to me.
> > Is there any reason this and the next patch are marked RFC?
>
> Sorry for that noise, I see your explanation in the cover email.
> I am intending to apply these patches.
Both patches applied to the boards branch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1
2013-03-18 18:26 [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1 Guennadi Liakhovetski
` (2 preceding siblings ...)
2013-03-21 10:38 ` Simon Horman
@ 2013-03-21 16:32 ` Guennadi Liakhovetski
3 siblings, 0 replies; 5+ messages in thread
From: Guennadi Liakhovetski @ 2013-03-21 16:32 UTC (permalink / raw)
To: linux-sh
Hi Simon
On Thu, 21 Mar 2013, Simon Horman wrote:
> On Mon, Mar 18, 2013 at 07:26:40PM +0100, Guennadi Liakhovetski wrote:
> > The SDHI1 power supply on armadillo800eva can be switched on and off. In
> > the current version this is not used and the regulator is hard-wired to
> > "on." This patch switches SDHI1 to a proper fixed-voltage regulator,
> > using a GPIO to enable and disable it. Both SDHI0 and SDHI1 ports shall
> > now be specifying the MMC_CAP_POWER_OFF_CARD MMC capability. Both
> > interfaces tested with an SDIO card.
>
> This seems reasonable to me.
> Is there any reason this and the next patch are marked RFC?
Just trying to be prudent, I guess :) This isn't fixing any bugs, and I
don't know about any user, needing this feature, and this is a change in
behaviour, so, being a bit careful doesn't hurt, I think. But in theory it
should be an improvement, it should help save power in some cases, so,
taking it might be a good idea unless there are any objections.
Thanks
Guennadi
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > ---
> > arch/arm/mach-shmobile/board-armadillo800eva.c | 45 +++++++++++++++++++-----
> > 1 files changed, 36 insertions(+), 9 deletions(-)
> >
> > diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
> > index f322a18..7a78f94 100644
> > --- a/arch/arm/mach-shmobile/board-armadillo800eva.c
> > +++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
> > @@ -559,8 +559,6 @@ static struct platform_device gpio_keys_device = {
> >
> > /* Fixed 3.3V regulator to be used by SDHI1, MMCIF */
> > static struct regulator_consumer_supply fixed3v3_power_consumers[] = {
> > - REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
> > - REGULATOR_SUPPLY("vqmmc", "sh_mobile_sdhi.1"),
> > REGULATOR_SUPPLY("vmmc", "sh_mmcif"),
> > REGULATOR_SUPPLY("vqmmc", "sh_mmcif"),
> > };
> > @@ -645,6 +643,35 @@ static struct platform_device vccq_sdhi0 = {
> > },
> > };
> >
> > +/* Fixed 3.3V regulator to be used by SDHI1 */
> > +static struct regulator_consumer_supply vcc_sdhi1_consumers[] = {
> > + REGULATOR_SUPPLY("vmmc", "sh_mobile_sdhi.1"),
> > +};
> > +
> > +static struct regulator_init_data vcc_sdhi1_init_data = {
> > + .constraints = {
> > + .valid_ops_mask = REGULATOR_CHANGE_STATUS,
> > + },
> > + .num_consumer_supplies = ARRAY_SIZE(vcc_sdhi1_consumers),
> > + .consumer_supplies = vcc_sdhi1_consumers,
> > +};
> > +
> > +static struct fixed_voltage_config vcc_sdhi1_info = {
> > + .supply_name = "SDHI1 Vcc",
> > + .microvolts = 3300000,
> > + .gpio = GPIO_PORT16,
> > + .enable_high = 1,
> > + .init_data = &vcc_sdhi1_init_data,
> > +};
> > +
> > +static struct platform_device vcc_sdhi1 = {
> > + .name = "reg-fixed-voltage",
> > + .id = 2,
> > + .dev = {
> > + .platform_data = &vcc_sdhi1_info,
> > + },
> > +};
> > +
> > /* SDHI0 */
> > /*
> > * FIXME
> > @@ -658,7 +685,8 @@ static struct platform_device vccq_sdhi0 = {
> > static struct sh_mobile_sdhi_info sdhi0_info = {
> > .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX,
> > .dma_slave_rx = SHDMA_SLAVE_SDHI0_RX,
> > - .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> > + .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> > + MMC_CAP_POWER_OFF_CARD,
> > .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
> > .cd_gpio = GPIO_PORT167,
> > };
> > @@ -699,7 +727,8 @@ static struct platform_device sdhi0_device = {
> > static struct sh_mobile_sdhi_info sdhi1_info = {
> > .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX,
> > .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
> > - .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ,
> > + .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ |
> > + MMC_CAP_POWER_OFF_CARD,
> > .tmio_flags = TMIO_MMC_HAS_IDLE_WAIT | TMIO_MMC_USE_GPIO_CD,
> > /* Port72 cannot generate IRQs, will be used in polling mode. */
> > .cd_gpio = GPIO_PORT72,
> > @@ -992,6 +1021,8 @@ static struct platform_device *eva_devices[] __initdata = {
> > &lcdc0_device,
> > &gpio_keys_device,
> > &sh_eth_device,
> > + &vcc_sdhi0,
> > + &vccq_sdhi0,
> > &sdhi0_device,
> > &sh_mmcif_device,
> > &hdmi_device,
> > @@ -1002,8 +1033,6 @@ static struct platform_device *eva_devices[] __initdata = {
> > &fsi_wm8978_device,
> > &fsi_hdmi_device,
> > &i2c_gpio_device,
> > - &vcc_sdhi0,
> > - &vccq_sdhi0,
> > };
> >
> > static const struct pinctrl_map eva_pinctrl_map[] = {
> > @@ -1198,9 +1227,7 @@ static void __init eva_init(void)
> > pinctrl_register_mappings(eva_sdhi1_pinctrl_map,
> > ARRAY_SIZE(eva_sdhi1_pinctrl_map));
> >
> > - /* SDSLOT2_PON */
> > - gpio_request_one(16, GPIOF_OUT_INIT_HIGH, NULL);
> > -
> > + platform_device_register(&vcc_sdhi1);
> > platform_device_register(&sdhi1_device);
> > }
> >
> > --
> > 1.7.2.5
> >
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-03-21 16:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-18 18:26 [PATCH/RFC 1/2] ARM: shmobile: armadillo800eva: add a fixed voltage regulator for SDHI1 Guennadi Liakhovetski
2013-03-21 10:32 ` Simon Horman
2013-03-21 10:36 ` Simon Horman
2013-03-21 10:38 ` Simon Horman
2013-03-21 16:32 ` Guennadi Liakhovetski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.