Patchwork [U-Boot,U-BOOT] mmc: sdhci: Enable 8-bit bus width only for 3.0 spec onwards

login
register
mail settings
Submitter Jagannadha Sutradharudu Teki
Date May 21, 2013, 9:31 a.m.
Message ID <805b0b76-9795-42e9-928c-9d7381c17ab5@VA3EHSMHS018.ehs.local>
Download mbox | patch
Permalink /patch/245235/
State Accepted, archived
Delegated to: Andy Fleming
Headers show

Comments

Jagannadha Sutradharudu Teki - May 21, 2013, 9:31 a.m.
CAP register don't have any information for 8-bit buswidth support
on 2.0 sdhci spec, only from 3.0 onwards bit[18] got this information.

Due to this misassignment in sdhci, mmc is setting 8-bit buswidth using
mmc_set_bus_width even if controller doesn't support.
Below change has code information.
"mmc: Properly determine maximum supported bus width"
(sha1: 7798f6dbd5e1a3030ed81a81da5dfb57c3307cac)

Bug log: <mmc plus and emmc cards)
-------
zynq-uboot> mmcinfo
Error detected in status(0x208100)!
Device: zynq_sdhci
Manufacturer ID: fe
.....

So enable 8-bit support only for 3.0 spec using CAP and for below 3.0
assign mmc->host_caps = MMC_MODE_8BIT on respective platform driver
if host have a support.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
---
 drivers/mmc/sdhci.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
Andy Fleming - June 13, 2013, 10:37 p.m.
On Tue, May 21, 2013 at 03:01:36PM +0530, Jagannadha Sutradharudu Teki wrote:
> CAP register don't have any information for 8-bit buswidth support
> on 2.0 sdhci spec, only from 3.0 onwards bit[18] got this information.
> 
> Due to this misassignment in sdhci, mmc is setting 8-bit buswidth using
> mmc_set_bus_width even if controller doesn't support.
> Below change has code information.
> "mmc: Properly determine maximum supported bus width"
> (sha1: 7798f6dbd5e1a3030ed81a81da5dfb57c3307cac)
> 
> Bug log: <mmc plus and emmc cards)
> -------
> zynq-uboot> mmcinfo
> Error detected in status(0x208100)!
> Device: zynq_sdhci
> Manufacturer ID: fe
> .....
> 
> So enable 8-bit support only for 3.0 spec using CAP and for below 3.0
> assign mmc->host_caps = MMC_MODE_8BIT on respective platform driver
> if host have a support.
> 
> Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>

Applied, thanks.

Andy

Patch

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 1eaea04..c5631bf 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -486,8 +486,10 @@  int add_sdhci(struct sdhci_host *host, u32 max_clk, u32 min_clk)
 		mmc->voltages |= host->voltages;
 
 	mmc->host_caps = MMC_MODE_HS | MMC_MODE_HS_52MHz | MMC_MODE_4BIT;
-	if (caps & SDHCI_CAN_DO_8BIT)
-		mmc->host_caps |= MMC_MODE_8BIT;
+	if ((host->version & SDHCI_SPEC_VER_MASK) >= SDHCI_SPEC_300) {
+		if (caps & SDHCI_CAN_DO_8BIT)
+			mmc->host_caps |= MMC_MODE_8BIT;
+	}
 	if (host->host_caps)
 		mmc->host_caps |= host->host_caps;