* [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits workaround
@ 2010-07-30 3:52 Roy Zang
2010-07-30 7:06 ` Anton Vorontsov
0 siblings, 1 reply; 4+ messages in thread
From: Roy Zang @ 2010-07-30 3:52 UTC (permalink / raw)
To: linux-mmc; +Cc: linuxppc-dev, akpm
P4080 ESDHC controller does not support 1.8V and 3.0V voltage. but the
host controller capabilities register wrongly set the bits.
This patch adds the workaround to correct the weird voltage setting bits.
Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
---
This is the second version of patch
http://patchwork.ozlabs.org/patch/60106/
According to the comment, remove some un-necessary setting.
Together with patch
http://patchwork.ozlabs.org/patch/60111/
http://patchwork.ozlabs.org/patch/60116/
This serial patches add mmc support for p4080 silicon
drivers/mmc/host/sdhci-of-core.c | 4 ++++
drivers/mmc/host/sdhci.c | 8 ++++++++
drivers/mmc/host/sdhci.h | 4 ++++
3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
index 0c30242..1f3913d 100644
--- a/drivers/mmc/host/sdhci-of-core.c
+++ b/drivers/mmc/host/sdhci-of-core.c
@@ -164,6 +164,10 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
if (sdhci_of_wp_inverted(np))
host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
+ if (of_device_is_compatible(np, "fsl,p4080-esdhc"))
+ host->quirks |= (SDHCI_QUIRK_QORIQ_NO_VDD_180
+ |SDHCI_QUIRK_QORIQ_NO_VDD_300);
+
clk = of_get_property(np, "clock-frequency", &size);
if (clk && size == sizeof(*clk) && *clk)
of_host->clock = *clk;
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 1424d08..a667790 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1699,6 +1699,14 @@ int sdhci_add_host(struct sdhci_host *host)
caps = sdhci_readl(host, SDHCI_CAPABILITIES);
+ /* Workaround for P4080 host controller capabilities
+ * 1.8V and 3.0V do not supported*/
+ if (host->quirks & SDHCI_QUIRK_QORIQ_NO_VDD_180)
+ caps &= ~SDHCI_CAN_VDD_180;
+
+ if (host->quirks & SDHCI_QUIRK_QORIQ_NO_VDD_300)
+ caps &= ~SDHCI_CAN_VDD_300;
+
if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
host->flags |= SDHCI_USE_SDMA;
else if (!(caps & SDHCI_CAN_DO_SDMA))
diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h
index aa112aa..389b58c 100644
--- a/drivers/mmc/host/sdhci.h
+++ b/drivers/mmc/host/sdhci.h
@@ -243,6 +243,10 @@ struct sdhci_host {
#define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26)
/* Controller uses Auto CMD12 command to stop the transfer */
#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<27)
+/* Controller cannot support 1.8V */
+#define SDHCI_QUIRK_QORIQ_NO_VDD_180 (1<<28)
+/* Controller cannot support 3.0V */
+#define SDHCI_QUIRK_QORIQ_NO_VDD_300 (1<<29)
int irq; /* Device IRQ */
void __iomem * ioaddr; /* Mapped address */
--
1.5.6.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits workaround
2010-07-30 3:52 [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits workaround Roy Zang
@ 2010-07-30 7:06 ` Anton Vorontsov
2010-08-02 6:19 ` Zang Roy-R61911
0 siblings, 1 reply; 4+ messages in thread
From: Anton Vorontsov @ 2010-07-30 7:06 UTC (permalink / raw)
To: Roy Zang; +Cc: linuxppc-dev, akpm, linux-mmc
On Fri, Jul 30, 2010 at 11:52:57AM +0800, Roy Zang wrote:
> P4080 ESDHC controller does not support 1.8V and 3.0V voltage. but the
> host controller capabilities register wrongly set the bits.
> This patch adds the workaround to correct the weird voltage setting bits.
>
> Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> ---
[...]
> diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c
> index 0c30242..1f3913d 100644
> --- a/drivers/mmc/host/sdhci-of-core.c
> +++ b/drivers/mmc/host/sdhci-of-core.c
> @@ -164,6 +164,10 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev,
> if (sdhci_of_wp_inverted(np))
> host->quirks |= SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
>
> + if (of_device_is_compatible(np, "fsl,p4080-esdhc"))
> + host->quirks |= (SDHCI_QUIRK_QORIQ_NO_VDD_180
> + |SDHCI_QUIRK_QORIQ_NO_VDD_300);
> +
It should be two properties, something like sdhci,no-vdd-180
and sdhci,no-vdd-300. But it might be even better: we have
voltage-ranges for mmc-spi case, see
Documentation/powerpc/dts-bindings/mmc-spi-slot.txt.
If voltage-ranges specified, then we use it, not capabilities
register.
For p4080 it will be 'voltage-ranges = <3200 3400>;'. So, with
voltage-ranges we can do fine grained VDD control without
introducing anything new.
As for implementation, you might just factor out voltage-ranges
parsing from drivers/mmc/host/of_mmc_spi.c, and then in sdhci
driver you could do.
if (host->ocr_avail)
mmc->ocr_avail = host->ocr_avail.
> clk = of_get_property(np, "clock-frequency", &size);
> if (clk && size == sizeof(*clk) && *clk)
> of_host->clock = *clk;
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 1424d08..a667790 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1699,6 +1699,14 @@ int sdhci_add_host(struct sdhci_host *host)
>
> caps = sdhci_readl(host, SDHCI_CAPABILITIES);
>
> + /* Workaround for P4080 host controller capabilities
> + * 1.8V and 3.0V do not supported*/
> + if (host->quirks & SDHCI_QUIRK_QORIQ_NO_VDD_180)
The point of making NO_VDD stuff is to make these quirks
"chip-agnostic". Ideally, sdhci.c should never know about
particular chips.
So, you shouldn't name quirks with QORIQ.
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits workaround
2010-07-30 7:06 ` Anton Vorontsov
@ 2010-08-02 6:19 ` Zang Roy-R61911
2010-08-02 6:52 ` Anton Vorontsov
0 siblings, 1 reply; 4+ messages in thread
From: Zang Roy-R61911 @ 2010-08-02 6:19 UTC (permalink / raw)
To: Anton Vorontsov; +Cc: linuxppc-dev, akpm, linux-mmc
=20
> -----Original Message-----
> From: Anton Vorontsov [mailto:cbouatmailru@gmail.com]=20
> Sent: Friday, July 30, 2010 15:06 PM
> To: Zang Roy-R61911
> Cc: linux-mmc@vger.kernel.org; linuxppc-dev@ozlabs.org;=20
> akpm@linux-foundation.org
> Subject: Re: [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits=20
> workaround
>=20
> On Fri, Jul 30, 2010 at 11:52:57AM +0800, Roy Zang wrote:
> > P4080 ESDHC controller does not support 1.8V and 3.0V=20
> voltage. but the
> > host controller capabilities register wrongly set the bits.
> > This patch adds the workaround to correct the weird voltage=20
> setting bits.
> >=20
> > Signed-off-by: Roy Zang <tie-fei.zang@freescale.com>
> > ---
> [...]
> > diff --git a/drivers/mmc/host/sdhci-of-core.c=20
> b/drivers/mmc/host/sdhci-of-core.c
> > index 0c30242..1f3913d 100644
> > --- a/drivers/mmc/host/sdhci-of-core.c
> > +++ b/drivers/mmc/host/sdhci-of-core.c
> > @@ -164,6 +164,10 @@ static int __devinit=20
> sdhci_of_probe(struct of_device *ofdev,
> > if (sdhci_of_wp_inverted(np))
> > host->quirks |=3D SDHCI_QUIRK_INVERTED_WRITE_PROTECT;
> > =20
> > + if (of_device_is_compatible(np, "fsl,p4080-esdhc"))
> > + host->quirks |=3D (SDHCI_QUIRK_QORIQ_NO_VDD_180
> > + |SDHCI_QUIRK_QORIQ_NO_VDD_300);
> > +
>=20
> It should be two properties, something like sdhci,no-vdd-180
> and sdhci,no-vdd-300. But it might be even better: we have
> voltage-ranges for mmc-spi case, see
> Documentation/powerpc/dts-bindings/mmc-spi-slot.txt.
>=20
> If voltage-ranges specified, then we use it, not capabilities
> register.
>=20
> For p4080 it will be 'voltage-ranges =3D <3200 3400>;'. So, with
> voltage-ranges we can do fine grained VDD control without
> introducing anything new.
why not
voltage-ranges =3D <3300 3300>;
?
Roy
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits workaround
2010-08-02 6:19 ` Zang Roy-R61911
@ 2010-08-02 6:52 ` Anton Vorontsov
0 siblings, 0 replies; 4+ messages in thread
From: Anton Vorontsov @ 2010-08-02 6:52 UTC (permalink / raw)
To: Zang Roy-R61911; +Cc: linuxppc-dev, akpm, linux-mmc
On Mon, Aug 02, 2010 at 02:19:58PM +0800, Zang Roy-R61911 wrote:
[...]
> > For p4080 it will be 'voltage-ranges = <3200 3400>;'. So, with
> > voltage-ranges we can do fine grained VDD control without
> > introducing anything new.
> why not
> voltage-ranges = <3300 3300>;
Right you are, both will be 3300.
Thanks,
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-02 6:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-30 3:52 [PATCH 3/3 v2] mmc: Add ESDHC weird voltage bits workaround Roy Zang
2010-07-30 7:06 ` Anton Vorontsov
2010-08-02 6:19 ` Zang Roy-R61911
2010-08-02 6:52 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).