diff mbox

[1/2] mmc: sdhci: add SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33 quirk support

Message ID 1433228980-5676-1-git-send-email-yangbo.lu@freescale.com (mailing list archive)
State Superseded, archived
Headers show

Commit Message

yangbo lu June 2, 2015, 7:09 a.m. UTC
This quirk is used for controllers that can only support 1.8V
voltage but the peripheral hardware circuit has capability to
support 3.3V voltage.

Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
---
 drivers/mmc/host/sdhci.c | 3 +++
 drivers/mmc/host/sdhci.h | 4 ++++
 2 files changed, 7 insertions(+)

Comments

Ulf Hansson June 4, 2015, 7:48 a.m. UTC | #1
On 2 June 2015 at 09:09, Yangbo Lu <yangbo.lu@freescale.com> wrote:
> This quirk is used for controllers that can only support 1.8V
> voltage but the peripheral hardware circuit has capability to
> support 3.3V voltage.

Which voltage are you referring to? The I/O voltage or the power to
the card? VCC or VCCQ?

Kind regards
Uffe

>
> Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
> ---
>  drivers/mmc/host/sdhci.c | 3 +++
>  drivers/mmc/host/sdhci.h | 4 ++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index c80287a..40de0d3 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -2959,6 +2959,9 @@ int sdhci_add_host(struct sdhci_host *host)
>                         host->caps1 :
>                         sdhci_readl(host, SDHCI_CAPABILITIES_1);
>
> +       if (host->quirks2 & SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33)
> +               caps[0] = caps[0] | SDHCI_CAN_VDD_330;
> +
>         if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
>                 host->flags |= SDHCI_USE_SDMA;
>         else if (!(caps[0] & SDHCI_CAN_DO_SDMA))
> diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
> index e639b7f..2704daf1 100644
> --- a/drivers/mmc/host/sdhci.h
> +++ b/drivers/mmc/host/sdhci.h
> @@ -409,6 +409,10 @@ struct sdhci_host {
>  #define SDHCI_QUIRK2_SUPPORT_SINGLE                    (1<<13)
>  /* Controller broken with using ACMD23 */
>  #define SDHCI_QUIRK2_ACMD23_BROKEN                     (1<<14)
> +/* Controller only supports 1.8V, but the peripheral hardware
> + * circuit has capability to support 3.3V
> + */
> +#define SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33              (1<<15)
>
>         int irq;                /* Device IRQ */
>         void __iomem *ioaddr;   /* Mapped address */
> --
> 2.1.0.27.g96db324
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson June 4, 2015, 11:20 a.m. UTC | #2
On 4 June 2015 at 11:45, Lu Y.B. <yangbo.lu@freescale.com> wrote:
> Thanks Uffe, and see my comments below.
>
>> -----Original Message-----
>> From: Ulf Hansson [mailto:ulf.hansson@linaro.org]
>> Sent: Thursday, June 04, 2015 3:48 PM
>> To: Lu Yangbo-B47093
>> Cc: linux-mmc; Chris Ball
>> Subject: Re: [PATCH 1/2] mmc: sdhci: add
>> SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33 quirk support
>>
>> On 2 June 2015 at 09:09, Yangbo Lu <yangbo.lu@freescale.com> wrote:
>> > This quirk is used for controllers that can only support 1.8V voltage
>> > but the peripheral hardware circuit has capability to support 3.3V
>> > voltage.
>>
>> Which voltage are you referring to? The I/O voltage or the power to the
>> card? VCC or VCCQ?
>>
>> Kind regards
>> Uffe
>
> The voltage here means I/O voltage.
> Although the controller only supports 1.8v, the hardware circuit has a level translator for supporting 3.3v.

Thanks for clarifying.

>
>>
>> >
>> > Signed-off-by: Yangbo Lu <yangbo.lu@freescale.com>
>> > ---
>> >  drivers/mmc/host/sdhci.c | 3 +++
>> >  drivers/mmc/host/sdhci.h | 4 ++++
>> >  2 files changed, 7 insertions(+)
>> >
>> > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index
>> > c80287a..40de0d3 100644
>> > --- a/drivers/mmc/host/sdhci.c
>> > +++ b/drivers/mmc/host/sdhci.c
>> > @@ -2959,6 +2959,9 @@ int sdhci_add_host(struct sdhci_host *host)
>> >                         host->caps1 :
>> >                         sdhci_readl(host, SDHCI_CAPABILITIES_1);
>> >
>> > +       if (host->quirks2 & SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33)
>> > +               caps[0] = caps[0] | SDHCI_CAN_VDD_330;

Isn't SDHCI_CAN_VDD_330 used to indicate what ocr_avail mask that
shall be used? Thus it has nothing to do with the IO voltage.

>> > +
>> >         if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
>> >                 host->flags |= SDHCI_USE_SDMA;
>> >         else if (!(caps[0] & SDHCI_CAN_DO_SDMA)) diff --git
>> > a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index
>> > e639b7f..2704daf1 100644
>> > --- a/drivers/mmc/host/sdhci.h
>> > +++ b/drivers/mmc/host/sdhci.h
>> > @@ -409,6 +409,10 @@ struct sdhci_host {
>> >  #define SDHCI_QUIRK2_SUPPORT_SINGLE                    (1<<13)
>> >  /* Controller broken with using ACMD23 */
>> >  #define SDHCI_QUIRK2_ACMD23_BROKEN                     (1<<14)
>> > +/* Controller only supports 1.8V, but the peripheral hardware
>> > + * circuit has capability to support 3.3V  */
>> > +#define SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33              (1<<15)
>> >
>> >         int irq;                /* Device IRQ */
>> >         void __iomem *ioaddr;   /* Mapped address */
>> > --
>> > 2.1.0.27.g96db324
>> >

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson June 5, 2015, 8:32 a.m. UTC | #3
On 5 June 2015 at 10:10, Lu Y.B. <yangbo.lu@freescale.com> wrote:
>> >> On 2 June 2015 at 09:09, Yangbo Lu <yangbo.lu@freescale.com> wrote:
>> >> > This quirk is used for controllers that can only support 1.8V
>> >> > voltage but the peripheral hardware circuit has capability to
>> >> > support 3.3V voltage.
>> >>
>> >> Which voltage are you referring to? The I/O voltage or the power to
>> >> the card? VCC or VCCQ?
>> >>
>> >> Kind regards
>> >> Uffe
>> >
>> > The voltage here means I/O voltage.
>> > Although the controller only supports 1.8v, the hardware circuit has a
>> level translator for supporting 3.3v.
>>
>> Thanks for clarifying.
>
> Sorry, it should be power voltage...
> This quirk is used to set capability register "Voltage Support 3.3V" bit since the controller self doesn’t support but circuit supports.
>

Okay.

So then please tell me, exactly, how is the power being controlled
when using this "hardware circuit"?

This patchset only tries to change the content of the ocr_mask, but
there is no logic added to support changing voltage levels by using
the "external circuit". At least to my understanding.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson June 5, 2015, 8:54 a.m. UTC | #4
On 5 June 2015 at 10:49, Lu Y.B. <yangbo.lu@freescale.com> wrote:
>> On 5 June 2015 at 10:10, Lu Y.B. <yangbo.lu@freescale.com> wrote:
>> >> >> On 2 June 2015 at 09:09, Yangbo Lu <yangbo.lu@freescale.com> wrote:
>> >> >> > This quirk is used for controllers that can only support 1.8V
>> >> >> > voltage but the peripheral hardware circuit has capability to
>> >> >> > support 3.3V voltage.
>> >> >>
>> >> >> Which voltage are you referring to? The I/O voltage or the power
>> >> >> to the card? VCC or VCCQ?
>> >> >>
>> >> >> Kind regards
>> >> >> Uffe
>> >> >
>> >> > The voltage here means I/O voltage.
>> >> > Although the controller only supports 1.8v, the hardware circuit
>> >> > has a
>> >> level translator for supporting 3.3v.
>> >>
>> >> Thanks for clarifying.
>> >
>> > Sorry, it should be power voltage...
>> > This quirk is used to set capability register "Voltage Support 3.3V"
>> bit since the controller self doesn’t support but circuit supports.
>> >
>>
>> Okay.
>>
>> So then please tell me, exactly, how is the power being controlled when
>> using this "hardware circuit"?
>>
>> This patchset only tries to change the content of the ocr_mask, but there
>> is no logic added to support changing voltage levels by using the
>> "external circuit". At least to my understanding.
>>
>
> As I said, the controller only support 1.8v but we could use adapter card or add level translator on board directly to make sd *only* work on 3.3v power and 3.3v IO voltage.
> Thanks.

How does this level translator work? Doesn't it need to be controlled
somehow? Do you have a datasheet you can share for it?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson June 5, 2015, 9:32 a.m. UTC | #5
On 5 June 2015 at 11:09, Lu Y.B. <yangbo.lu@freescale.com> wrote:
>> On 5 June 2015 at 10:49, Lu Y.B. <yangbo.lu@freescale.com> wrote:
>> >> On 5 June 2015 at 10:10, Lu Y.B. <yangbo.lu@freescale.com> wrote:
>> >> >> >> On 2 June 2015 at 09:09, Yangbo Lu <yangbo.lu@freescale.com>
>> wrote:
>> >> >> >> > This quirk is used for controllers that can only support 1.8V
>> >> >> >> > voltage but the peripheral hardware circuit has capability to
>> >> >> >> > support 3.3V voltage.
>> >> >> >>
>> >> >> >> Which voltage are you referring to? The I/O voltage or the
>> >> >> >> power to the card? VCC or VCCQ?
>> >> >> >>
>> >> >> >> Kind regards
>> >> >> >> Uffe
>> >> >> >
>> >> >> > The voltage here means I/O voltage.
>> >> >> > Although the controller only supports 1.8v, the hardware circuit
>> >> >> > has a
>> >> >> level translator for supporting 3.3v.
>> >> >>
>> >> >> Thanks for clarifying.
>> >> >
>> >> > Sorry, it should be power voltage...
>> >> > This quirk is used to set capability register "Voltage Support 3.3V"
>> >> bit since the controller self doesn’t support but circuit supports.
>> >> >
>> >>
>> >> Okay.
>> >>
>> >> So then please tell me, exactly, how is the power being controlled
>> >> when using this "hardware circuit"?
>> >>
>> >> This patchset only tries to change the content of the ocr_mask, but
>> >> there is no logic added to support changing voltage levels by using
>> >> the "external circuit". At least to my understanding.
>> >>
>> >
>> > As I said, the controller only support 1.8v but we could use adapter
>> card or add level translator on board directly to make sd *only* work on
>> 3.3v power and 3.3v IO voltage.
>> > Thanks.
>>
>> How does this level translator work? Doesn't it need to be controlled
>> somehow? Do you have a datasheet you can share for it?
>>
>
> I attached a adapter picture for you.
> we would never control the power to change.
> Although the io voltage could be control in design, we would never control it either. Always connect Vccb_SEL to GND.
> Thanks.
>

This make it crystal clear to me, but I think you have some more
homework to do. :-)

This is a commonly used circuit to be able to boost the IO voltage
levels from the SoC, towards the card. According to the SD spec, all
cards needs to support the IO legacy voltage levels (2.7-3.6V).

UHS-I SD cards, are also operate using 1.8V IO voltage, but the early
initialization must be done using the legacy IO voltage level domain.

So, I assume that when grounding Vccb_SEL, the IO voltage will be 2.9
V, which means you will always remain in legacy IO voltage level
domain. That's fine, as long as you don't care about UHS cards.

So, again this patchset really doesn't make sense.

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index c80287a..40de0d3 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2959,6 +2959,9 @@  int sdhci_add_host(struct sdhci_host *host)
 			host->caps1 :
 			sdhci_readl(host, SDHCI_CAPABILITIES_1);
 
+	if (host->quirks2 & SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33)
+		caps[0] = caps[0] | SDHCI_CAN_VDD_330;
+
 	if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
 		host->flags |= SDHCI_USE_SDMA;
 	else if (!(caps[0] & SDHCI_CAN_DO_SDMA))
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index e639b7f..2704daf1 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -409,6 +409,10 @@  struct sdhci_host {
 #define SDHCI_QUIRK2_SUPPORT_SINGLE			(1<<13)
 /* Controller broken with using ACMD23 */
 #define SDHCI_QUIRK2_ACMD23_BROKEN			(1<<14)
+/* Controller only supports 1.8V, but the peripheral hardware
+ * circuit has capability to support 3.3V
+ */
+#define SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS33		(1<<15)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */