Patchwork mmc: Fix the wrong accessor to HOSTVER register

login
register
mail settings
Submitter Dave Liu
Date May 6, 2009, 10:40 a.m.
Message ID <1241606407-18685-1-git-send-email-daveliu@freescale.com>
Download mbox | patch
Permalink /patch/26905/
State Not Applicable, archived
Headers show

Comments

Dave Liu - May 6, 2009, 10:40 a.m.
Freescale eSDHC controller has the special order for
the HOST version register. that is not same as the other's
registers. The address of HOSTVER in spec is 0xFE, and
we need use the in_be16(0xFE) to access it, not in_be16(0xFC).

Signed-off-by: Dave Liu <daveliu@freescale.com>
---
 drivers/mmc/host/sdhci-of.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
Pierre Ossman - May 13, 2009, 7:47 p.m.
On Wed,  6 May 2009 18:40:07 +0800
Dave Liu <daveliu@freescale.com> wrote:

> Freescale eSDHC controller has the special order for
> the HOST version register. that is not same as the other's
> registers. The address of HOSTVER in spec is 0xFE, and
> we need use the in_be16(0xFE) to access it, not in_be16(0xFC).
> 
> Signed-off-by: Dave Liu <daveliu@freescale.com>
> ---

Any objections, Anton?

Rgds
Anton Vorontsov - June 2, 2009, 5:26 p.m.
On Wed, May 06, 2009 at 06:40:07PM +0800, Dave Liu wrote:
> Freescale eSDHC controller has the special order for
> the HOST version register. that is not same as the other's
> registers. The address of HOSTVER in spec is 0xFE, and
> we need use the in_be16(0xFE) to access it, not in_be16(0xFC).
> 
> Signed-off-by: Dave Liu <daveliu@freescale.com>

Sorry for the delay Dave. This patch is surely

Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>

> ---
>  drivers/mmc/host/sdhci-of.c |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c
> index 3ff4ac3..e167131 100644
> --- a/drivers/mmc/host/sdhci-of.c
> +++ b/drivers/mmc/host/sdhci-of.c
> @@ -55,7 +55,13 @@ static u32 esdhc_readl(struct sdhci_host *host, int reg)
>  
>  static u16 esdhc_readw(struct sdhci_host *host, int reg)
>  {
> -	return in_be16(host->ioaddr + (reg ^ 0x2));
> +	u16 ret;
> +
> +	if (unlikely(reg == SDHCI_HOST_VERSION))
> +		ret = in_be16(host->ioaddr + reg);
> +	else
> +		ret = in_be16(host->ioaddr + (reg ^ 0x2));
> +	return ret;
>  }
>  
>  static u8 esdhc_readb(struct sdhci_host *host, int reg)
> -- 
> 1.5.4

Thanks,
Pierre Ossman - June 3, 2009, 7:57 p.m.
On Tue, 2 Jun 2009 21:26:44 +0400
Anton Vorontsov <avorontsov@ru.mvista.com> wrote:

> On Wed, May 06, 2009 at 06:40:07PM +0800, Dave Liu wrote:
> > Freescale eSDHC controller has the special order for
> > the HOST version register. that is not same as the other's
> > registers. The address of HOSTVER in spec is 0xFE, and
> > we need use the in_be16(0xFE) to access it, not in_be16(0xFC).
> > 
> > Signed-off-by: Dave Liu <daveliu@freescale.com>
> 
> Sorry for the delay Dave. This patch is surely
> 
> Acked-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> 

Queued.

Rgds

Patch

diff --git a/drivers/mmc/host/sdhci-of.c b/drivers/mmc/host/sdhci-of.c
index 3ff4ac3..e167131 100644
--- a/drivers/mmc/host/sdhci-of.c
+++ b/drivers/mmc/host/sdhci-of.c
@@ -55,7 +55,13 @@  static u32 esdhc_readl(struct sdhci_host *host, int reg)
 
 static u16 esdhc_readw(struct sdhci_host *host, int reg)
 {
-	return in_be16(host->ioaddr + (reg ^ 0x2));
+	u16 ret;
+
+	if (unlikely(reg == SDHCI_HOST_VERSION))
+		ret = in_be16(host->ioaddr + reg);
+	else
+		ret = in_be16(host->ioaddr + (reg ^ 0x2));
+	return ret;
 }
 
 static u8 esdhc_readb(struct sdhci_host *host, int reg)