diff mbox

[U-Boot,2/3] omap: emif: deal with rams that return duplicate mr data on all byte lanes

Message ID 1338399488-2095-3-git-send-email-steve@sakoman.com
State Accepted
Commit 55c1284942b18cf83a297d33c8746aadcbf5f096
Delegated to: Tom Rini
Headers show

Commit Message

Steve Sakoman May 30, 2012, 5:38 p.m. UTC
Some rams (Micron for example) return duplicate mr data on all byte lanes.

Users of the get_mr function currently don't deal with this duplicated
data gracefully.  This patch detects the duplicated data and returns only
the expected 8 bit mr data.

Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 arch/arm/cpu/armv7/omap-common/emif-common.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

SRICHARAN R June 4, 2012, 8:50 a.m. UTC | #1
Hi,

>  arch/arm/cpu/armv7/omap-common/emif-common.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c
> b/arch/arm/cpu/armv7/omap-common/emif-common.c
> index db509c9..176520c 100644
> --- a/arch/arm/cpu/armv7/omap-common/emif-common.c
> +++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
> @@ -56,7 +56,12 @@ static inline u32 get_mr(u32 base, u32 cs, u32 mr_addr)
>  		mr = readl(&emif->emif_lpddr2_mode_reg_data);
>  	debug("get_mr: EMIF%d cs %d mr %08x val 0x%x\n", emif_num(base),
>  	      cs, mr_addr, mr);
> -	return mr;
> +	if (((mr & 0x0000ff00) >>  8) == (mr & 0xff) &&
> +	    ((mr & 0x00ff0000) >> 16) == (mr & 0xff) &&
> +	    ((mr & 0xff000000) >> 24) == (mr & 0xff))
> +		return mr & 0xff;
> +	else
> +		return mr;
  This is much needed. Thanks.

Thanks,
 Sricharan
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c b/arch/arm/cpu/armv7/omap-common/emif-common.c
index db509c9..176520c 100644
--- a/arch/arm/cpu/armv7/omap-common/emif-common.c
+++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
@@ -56,7 +56,12 @@  static inline u32 get_mr(u32 base, u32 cs, u32 mr_addr)
 		mr = readl(&emif->emif_lpddr2_mode_reg_data);
 	debug("get_mr: EMIF%d cs %d mr %08x val 0x%x\n", emif_num(base),
 	      cs, mr_addr, mr);
-	return mr;
+	if (((mr & 0x0000ff00) >>  8) == (mr & 0xff) &&
+	    ((mr & 0x00ff0000) >> 16) == (mr & 0xff) &&
+	    ((mr & 0xff000000) >> 24) == (mr & 0xff))
+		return mr & 0xff;
+	else
+		return mr;
 }
 
 static inline void set_mr(u32 base, u32 cs, u32 mr_addr, u32 mr_val)