Patchwork [U-Boot,V2] mmc: mv_sdhci: Fix host version read for Armada100

login
register
mail settings
Submitter Ajay Bhargav
Date Nov. 14, 2011, 9:43 a.m.
Message ID <1321263792-24885-1-git-send-email-ajay.bhargav@einfochips.com>
Download mbox | patch
Permalink /patch/125510/
State Accepted
Commit 5af9a56999c3c7ec827447d0b957e3e234f5d9a4
Delegated to: Andy Fleming
Headers show

Comments

Ajay Bhargav - Nov. 14, 2011, 9:43 a.m.
sdhci_readw does not work for host version read in Armada100 series
SoCs. This patch fix this issue by making a sdhci_readl call to get host
version.

Signed-off-by: Ajay Bhargav <ajay.bhargav@einfochips.com>
---
Changes for v2:
	- Added quirk instead of #define (suggested by Marek)

 drivers/mmc/mv_sdhci.c |    5 ++++-
 include/sdhci.h        |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)
Andy Fleming - Nov. 25, 2011, 11:44 p.m.
On Mon, Nov 14, 2011 at 3:43 AM, Ajay Bhargav
<ajay.bhargav@einfochips.com> wrote:
> sdhci_readw does not work for host version read in Armada100 series
> SoCs. This patch fix this issue by making a sdhci_readl call to get host
> version.
>
> Signed-off-by: Ajay Bhargav <ajay.bhargav@einfochips.com>

Applied, thx

Patch

diff --git a/drivers/mmc/mv_sdhci.c b/drivers/mmc/mv_sdhci.c
index f92caeb..c9b7079 100644
--- a/drivers/mmc/mv_sdhci.c
+++ b/drivers/mmc/mv_sdhci.c
@@ -48,7 +48,10 @@  int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks)
 		mv_ops.write_b = mv_sdhci_writeb;
 	host->ops = &mv_ops;
 #endif
-	host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
+	if (quirks & SDHCI_QUIRK_REG32_RW)
+		host->version = sdhci_readl(host, SDHCI_HOST_VERSION - 2) >> 16;
+	else
+		host->version = sdhci_readw(host, SDHCI_HOST_VERSION);
 	add_sdhci(host, max_clk, min_clk);
 	return 0;
 }
diff --git a/include/sdhci.h b/include/sdhci.h
index 0690938..800f9d9 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -215,6 +215,7 @@ 
  * quirks
  */
 #define SDHCI_QUIRK_32BIT_DMA_ADDR	(1 << 0)
+#define SDHCI_QUIRK_REG32_RW		(1 << 1)
 
 /* to make gcc happy */
 struct sdhci_host;