diff mbox

[3/4,V2] mmc: esdhc: Add quirks to support T4240QDS board

Message ID 1373267764-6364-2-git-send-email-Haijun.Zhang@freescale.com (mailing list archive)
State Superseded
Headers show

Commit Message

Haijun.Zhang July 8, 2013, 7:16 a.m. UTC
On T4240QDS board controllers has an unusable ADMA engine, so use SDMA instead.
Also 3.0v is support on T4240QDS board even if the capacity detailed only 1.8v
support. Without this quirk SD card will declare voltage not support and

Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
---
changes for v2:
	- Change the compatible for t4240qds board

 drivers/mmc/host/sdhci-pltfm.c | 7 ++++++-
 drivers/mmc/host/sdhci.c       | 3 +++
 include/linux/mmc/sdhci.h      | 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

Comments

Scott Wood July 8, 2013, 5:18 p.m. UTC | #1
On 07/08/2013 02:16:04 AM, Haijun Zhang wrote:
> On T4240QDS board controllers has an unusable ADMA engine, so use  
> SDMA instead.
> Also 3.0v is support on T4240QDS board even if the capacity detailed  
> only 1.8v
> support. Without this quirk SD card will declare voltage not support  
> and
> 
> Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>

...and what?

Why is this board-specific?  Isn't the controller part of the SoC, not  
part of the board?  If it really is board-specific, could you be more  
detailed about why (ideally with an erratum number), and check the  
toplevel board compatible (or get the information from platform code)  
rather than modify the device tree?

-Scott
Anton Vorontsov July 12, 2013, 6:35 p.m. UTC | #2
On Mon, Jul 08, 2013 at 12:18:39PM -0500, Scott Wood wrote:
> On 07/08/2013 02:16:04 AM, Haijun Zhang wrote:
> >On T4240QDS board controllers has an unusable ADMA engine, so use
> >SDMA instead.
> >Also 3.0v is support on T4240QDS board even if the capacity
> >detailed only 1.8v
> >support. Without this quirk SD card will declare voltage not
> >support and
> >
> >Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
> 
> ...and what?
> 
> Why is this board-specific?  Isn't the controller part of the SoC,
> not part of the board?  If it really is board-specific, could you be
> more detailed about why (ideally with an erratum number), and check
> the toplevel board compatible (or get the information from platform
> code) rather than modify the device tree?

Yup, and if anything, I would recommend to reuse voltage-ranges property,
it is already implemented for mmc spi driver,

drivers/mmc/host/of_mmc_spi.c
Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt

Thanks,

Anton
Anton Vorontsov July 16, 2013, 5:04 a.m. UTC | #3
On Tue, Jul 16, 2013 at 03:11:47AM +0000, Zhang Haijun-B42677 wrote:
> Hi, Anton
> 
> You mean get voltage support from DTS?
> Or get voltage both from DTS and host capacity register?

The logic might be that you first check device-tree, if it specifies
voltage ranges, assume that DTS knows better, otherwise read capabilities
from the register.

Anton

> Thanks.
> 
> Regards
> Haijun.
> 
> 
> > -----Original Message-----
> > From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc-
> > owner@vger.kernel.org] On Behalf Of Anton Vorontsov
> > Sent: Saturday, July 13, 2013 2:35 AM
> > To: Wood Scott-B07421
> > Cc: Zhang Haijun-B42677; linux-mmc@vger.kernel.org; linuxppc-
> > dev@lists.ozlabs.org; cjb@laptop.org; Fleming Andy-AFLEMING; Wrobel
> > Heinz-R39252
> > Subject: Re: [PATCH 3/4 V2] mmc: esdhc: Add quirks to support T4240QDS
> > board
> > 
> > On Mon, Jul 08, 2013 at 12:18:39PM -0500, Scott Wood wrote:
> > > On 07/08/2013 02:16:04 AM, Haijun Zhang wrote:
> > > >On T4240QDS board controllers has an unusable ADMA engine, so use
> > > >SDMA instead.
> > > >Also 3.0v is support on T4240QDS board even if the capacity detailed
> > > >only 1.8v support. Without this quirk SD card will declare voltage
> > > >not support and
> > > >
> > > >Signed-off-by: Haijun Zhang <haijun.zhang@freescale.com>
> > >
> > > ...and what?
> > >
> > > Why is this board-specific?  Isn't the controller part of the SoC, not
> > > part of the board?  If it really is board-specific, could you be more
> > > detailed about why (ideally with an erratum number), and check the
> > > toplevel board compatible (or get the information from platform
> > > code) rather than modify the device tree?
> > 
> > Yup, and if anything, I would recommend to reuse voltage-ranges property,
> > it is already implemented for mmc spi driver,
> > 
> > drivers/mmc/host/of_mmc_spi.c
> > Documentation/devicetree/bindings/mmc/mmc-spi-slot.txt
> > 
> > Thanks,
> > 
> > Anton
> > --
> > 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-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e2065a4..800e82f 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -92,9 +92,14 @@  void sdhci_get_of_property(struct platform_device *pdev)
 		if (of_device_is_compatible(np, "fsl,p2020-rev1-esdhc"))
 			host->quirks |= SDHCI_QUIRK_BROKEN_DMA;
 
+		if (of_device_is_compatible(np, "fsl,t4240qds-esdhc")) {
+			host->quirks |= SDHCI_QUIRK_BROKEN_ADMA;
+			host->quirks2 |= SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS30;
+		}
+
 		if (of_device_is_compatible(np, "fsl,p2020-esdhc") ||
 		    of_device_is_compatible(np, "fsl,p1010-esdhc") ||
-		    of_device_is_compatible(np, "fsl,t4240-esdhc") ||
+		    of_device_is_compatible(np, "fsl,t4240qds-esdhc") ||
 		    of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
 			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
 
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index a78bd4f..de7fa81 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -2797,6 +2797,9 @@  int sdhci_add_host(struct sdhci_host *host)
 			host->caps1 :
 			sdhci_readl(host, SDHCI_CAPABILITIES_1);
 
+	if (host->quirks2 & SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS30)
+		caps[0] = caps[0] | SDHCI_CAN_VDD_300;
+
 	if (host->quirks & SDHCI_QUIRK_FORCE_DMA)
 		host->flags |= SDHCI_USE_SDMA;
 	else if (!(caps[0] & SDHCI_CAN_DO_SDMA))
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index e3c6a74..dc608d7 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -98,6 +98,8 @@  struct sdhci_host {
 #define SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON		(1<<4)
 /* Controller has a non-standard host control register */
 #define SDHCI_QUIRK2_BROKEN_HOST_CONTROL		(1<<5)
+/* The host support VS300 even if the capacity detailed not */
+#define SDHCI_QUIRK2_CIRCUIT_SUPPORT_VS30		(1<<6)
 
 	int irq;		/* Device IRQ */
 	void __iomem *ioaddr;	/* Mapped address */