omap: fix bugs in automatic emif setup code
cover omap: fix bugs in automatic emif setup code
While bringing up a new OMAP4 based board I encountered a number of issues when attempting to use the automatic emif setup code.
This patch series fixes a compile error and two runtime issues.
Tested on the new custom OMAP4 board and Pandaboard
Steve Sakoman (3):
omap: fix compile error in emif-common.c
omap: emif: deal with rams that return duplicate mr data on all byte
lanes
omap: emif: fix bug in manufacturer code test
arch/arm/cpu/armv7/omap-common/emif-common.c | 9 +++++++-- arch/arm/cpu/armv7/omap4/sdram_elpida.c | 6 +++--- 2 files changed, 10 insertions(+), 5 deletions(-)
PATCH 1/3 omap: fix compile error in emif-common.c
ext_phy_ctrl_const_base is currently only defined if CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS is set.
If not set, the following error occurs:
In function `do_sdram_init':
| arch/arm/cpu/armv7/omap-common/emif-common.c:985: undefined reference to `ext_phy_ctrl_const_base'
--- arch/arm/cpu/armv7/omap4/sdram_elpida.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/omap4/sdram_elpida.c +3 -3
@@ -46,6 +46,9 @@* - emif_get_device_timings() */ +/* Dummy registers for OMAP44xx */ +const u32 ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; +#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS static const struct emif_regs emif_regs_elpida_200_mhz_2cs = {
@@ -90,9 +93,6 @@ const struct emif_regs emif_regs_elpida_400_mhz_2cs = { .emif_ddr_phy_ctlr_1 = 0x049ff418 }; -/* Dummy registers for OMAP44xx */ -const u32 ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; -const struct dmm_lisa_map_regs lisa_map_2G_x_1_x_2 = { .dmm_lisa_map_0 =0xFF020100 , .dmm_lisa_map_1 =0 ,
Signature · 1 line
1.7.1
R
PATCH 1/3 omap: fix compile error in emif-common.c
Hi Steve,
[snip]
Quoted 20 lines
--- arch/arm/cpu/armv7/omap4/sdram_elpida.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)arch/arm/cpu/armv7/omap4/sdram_elpida.c +3
-0@@ -46,6 +46,9 @@* - emif_get_device_timings() */ +/* Dummy registers for OMAP44xx */ +const u32 ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; +#ifdef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS static const struct emif_regs emif_regs_elpida_200_mhz_2cs = {
arch/arm/cpu/armv7/omap4/sdram_elpida.c const struct emif_regs emif_regs_elpida_400_mhz_2cs = { · line 98
Quoted 9 lines
arch/arm/cpu/armv7/omap4/sdram_elpida.c +0
-3@@ -90,9 +93,6 @@ const struct emif_regs emif_regs_elpida_400_mhz_2cs = { .emif_ddr_phy_ctlr_1 = 0x049ff418 }; -/* Dummy registers for OMAP44xx */ -const u32 ext_phy_ctrl_const_base[EMIF_EXT_PHY_CTRL_CONST_REG ]; -const struct dmm_lisa_map_regs lisa_map_2G_x_1_x_2 = { .dmm_lisa_map_0 =0xFF020100 , .dmm_lisa_map_1 =0 ,
In fact ext phy registers are not required for OMAP4 at all. Just posted a patch to fix this.
http://marc.info/?l=u-boot&m=133881742422888&w=2
Thanks,
Sricharan
PATCH 2/3 omap: emif: deal with rams that return duplicate mr data on all byte lanes
In reply to Steve SakomanSome 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.
--- arch/arm/cpu/armv7/omap-common/emif-common.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/emif-common.c +6 -1
@@ -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)
Signature · 1 line
1.7.1
R
PATCH 2/3 omap: emif: deal with rams that return duplicate mr data on all byte lanes
Hi,
Quoted 9 lines
arch/arm/cpu/armv7/omap-common/emif-common.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)arch/arm/cpu/armv7/omap-common/emif-common.c +0
-0
arch/arm/cpu/armv7/omap-common/emif-common.c static inline u32 get_mr(u32 base, u32 cs, u32 mr_addr) · line 64
Quoted 10 lines
arch/arm/cpu/armv7/omap-common/emif-common.c +6
-1@@ -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
PATCH 3/3 omap: emif: fix bug in manufacturer code test
In reply to Steve SakomanCode currently tests for <= 0xff. Micron manufacturer code is 0xff, so Micron memory will not be detected!
--- arch/arm/cpu/armv7/omap-common/emif-common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/cpu/armv7/omap-common/emif-common.c +1 -1
@@ -831,7 +831,7 @@ static u8 is_lpddr2_sdram_present(u32 base, u32 cs, } mr =get_mr (base, cs,LPDDR2_MR5 ); -if (mr >=0xFF ) { +if (mr >0xFF ) {/* Mode register value bigger than 8 bit */ return 0 ; }
Signature · 1 line
1.7.1
R
PATCH 3/3 omap: emif: fix bug in manufacturer code test
Quoted 14 lines
Code currently tests for <=
0xff. Micron manufacturer code is0xff, so Micron memory will not be detected!Signed-off-by Steve Sakoman <[email protected]>--- arch/arm/cpu/armv7/omap-common/emif-common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)arch/arm/cpu/armv7/omap-common/emif-common.c +0
-0
arch/arm/cpu/armv7/omap-common/emif-common.c static u8 is_lpddr2_sdram_present(u32 base, u32 cs, · line 834
Quoted 5 lines
arch/arm/cpu/armv7/omap-common/emif-common.c +1
-1@@ -831,7 +831,7 @@ static u8 is_lpddr2_sdram_present(u32 base, u32 cs, } mr =get_mr (base, cs,LPDDR2_MR5 ); -if (mr >=0xFF ) { +if (mr >0xFF ) {
Looks correct..
Thanks,
Sricharan
cover omap: fix bugs in automatic emif setup code
In reply to Steve SakomanQuoted 5 lines · Steve Sakoman
While bringing up a new OMAP4 based board I encountered a number of issues when attempting to use the automatic emif setup code.
This patch series fixes a compile error and two runtime issues.
Quoted 7 lines
Tested on the new custom OMAP4 board and Pandaboard
Steve Sakoman (3):
omap: fix compile error inemif-common.c
omap: emif: deal with rams that return duplicate mr data on all byte
lanes
omap: emif: fix bug in manufacturer code test
Parts 2 and 3 queued for u-boot-ti/master, for part 1 I took R Sricharan's patch instead. Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20120621/06d70505/attachment.pgp>