diff mbox

[U-Boot] mmc: sdhci: fix bus width switching on Samsung SoCs

Message ID 1424370173-63422-1-git-send-email-mreimer@sdgsystems.com
State Accepted
Delegated to: Pantelis Antoniou
Headers show

Commit Message

Matt Reimer Feb. 19, 2015, 6:22 p.m. UTC
Fix bus width switching from 8-bit mode down to 4-bit or 1-bit modes on
Samsung SoCs using SDHCI_QUIRK_USE_WIDE8.  These SoCs report controller
version 2.0 yet they support 8-bit bus widths.  If 8-bit mode was
previously enabled and then an operation like "mmc dev" caused a switch
back down to 4-bit or 1-bit mode, WIDE8 was left set, causing failures.

This problem was manifested by "mmc dev" timing out.

Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
---
 drivers/mmc/sdhci.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pantelis Antoniou Feb. 23, 2015, 5:52 p.m. UTC | #1
Hi Matt,

> On Feb 19, 2015, at 20:22 , Matt Reimer <mreimer@sdgsystems.com> wrote:
> 
> Fix bus width switching from 8-bit mode down to 4-bit or 1-bit modes on
> Samsung SoCs using SDHCI_QUIRK_USE_WIDE8.  These SoCs report controller
> version 2.0 yet they support 8-bit bus widths.  If 8-bit mode was
> previously enabled and then an operation like "mmc dev" caused a switch
> back down to 4-bit or 1-bit mode, WIDE8 was left set, causing failures.
> 
> This problem was manifested by "mmc dev" timing out.
> 
> Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
> ---
> drivers/mmc/sdhci.c |    3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
> index de88e19..82d7984 100644
> --- a/drivers/mmc/sdhci.c
> +++ b/drivers/mmc/sdhci.c
> @@ -374,7 +374,8 @@ static void sdhci_set_ios(struct mmc *mmc)
> 				(host->quirks & SDHCI_QUIRK_USE_WIDE8))
> 			ctrl |= SDHCI_CTRL_8BITBUS;
> 	} else {
> -		if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300)
> +		if ((SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) ||
> +				(host->quirks & SDHCI_QUIRK_USE_WIDE8))
> 			ctrl &= ~SDHCI_CTRL_8BITBUS;
> 		if (mmc->bus_width == 4)
> 			ctrl |= SDHCI_CTRL_4BITBUS;
> -- 
> 1.7.9.5
> 

Good catch, applied, thanks.

— Pantelis
diff mbox

Patch

diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index de88e19..82d7984 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -374,7 +374,8 @@  static void sdhci_set_ios(struct mmc *mmc)
 				(host->quirks & SDHCI_QUIRK_USE_WIDE8))
 			ctrl |= SDHCI_CTRL_8BITBUS;
 	} else {
-		if (SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300)
+		if ((SDHCI_GET_VERSION(host) >= SDHCI_SPEC_300) ||
+				(host->quirks & SDHCI_QUIRK_USE_WIDE8))
 			ctrl &= ~SDHCI_CTRL_8BITBUS;
 		if (mmc->bus_width == 4)
 			ctrl |= SDHCI_CTRL_4BITBUS;