mpc83xx: spd_sdram: fix ddr sdram base address assignment bug
PATCH 1/1 mpc83xx: spd_sdram: fix ddr sdram base address assignment bug
The spd_dram code shifts the base address, then masks 20 bits, but forgets to shift the base address back. Fix this by just masking the base address correctly.
Found this bug while trying to relocate a DDR memory at the base != 0.
Signed-off-by Anton Vorontsov <[email protected]>
--- cpu/mpc83xx/spd_sdram.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
cpu/mpc83xx/spd_sdram.c +1 -1
@@ -274,7 +274,7 @@ long int spd_sdram()/* * Set up LAWBAR for all of DDR. */ - ecm->bar = ((CFG_DDR_SDRAM_BASE >>12 ) &0xfffff ); + ecm->bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; ecm->ar = (LAWAR_EN |LAWAR_TRGT_IF_DDR | (LAWAR_SIZE & law_size));debug ("DDR:bar=0x%08x\n" , ecm->bar);debug ("DDR:ar=0x%08x\n" , ecm->ar);
Signature · 1 line
1.5.6.3
PATCH 1/1 mpc83xx: spd_sdram: fix ddr sdram base address assignment bug
Quoted 10 lines · On Thu, 11 Sep 2008 21:35:36 +0400 Anton Vorontsov <[email protected]>…
The
spd_dramcode shifts the base address, then masks 20 bits, but forgets to shift the base address back. Fix this by just masking the base address correctly.Found this bug while trying to relocate a DDR memory at the base != 0.
Signed-off-by Anton Vorontsov <[email protected]>--- cpu/mpc83xx/spd_sdram.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
83xx is always so special :)
I'll extend this to get the other occurrences:
board/freescale/mpc8313erdb/sdram.c +1 -1
@@ -64,7 +64,7 @@ static long fixed_sdram(void)volatile immap_t *im = (volatile immap_t *)CFG_IMMR ;u32 msize_log2 =__ilog2 (msize); - im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE >>12 ; + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LBLAWAR_EN | (msize_log2 -1 ); im->sysconf.ddrcdr =CFG_DDRCDR_VALUE ;
board/freescale/mpc8315erdb/sdram.c +1 -1
@@ -60,7 +60,7 @@ static long fixed_sdram(void)u32 msize =CFG_DDR_SIZE *1024 *1024 ;u32 msize_log2 =__ilog2 (msize); - im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE >>12 ; + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LBLAWAR_EN | (msize_log2 -1 ); im->sysconf.ddrcdr =CFG_DDRCDR_VALUE ;
board/freescale/mpc8349emds/mpc8349emds.c +1 -1
@@ -109,7 +109,7 @@ int fixed_sdram(void)return -1 ; } } - im->sysconf.ddrlaw[0 ].bar = ((CFG_DDR_SDRAM_BASE >>12 ) &0xfffff ); + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LAWAR_EN | ((ddr_size_log2 -1 ) &LAWAR_SIZE );#if (CFG_DDR_SIZE !=256 )
board/freescale/mpc8349itx/mpc8349itx.c +1 -1
@@ -55,7 +55,7 @@ int fixed_sdram(void) im->sysconf.ddrlaw[0 ].ar =LAWAR_EN | ((ddr_size_log2 -1 ) &LAWAR_SIZE ); - im->sysconf.ddrlaw[0 ].bar = (CFG_DDR_SDRAM_BASE >>12 ) &0xfffff ; + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ;/* Only one CS0 for DDR */ im->ddr.csbnds[0 ].csbnds =0x0000000f ;
board/freescale/mpc837xemds/mpc837xemds.c +1 -1
@@ -108,7 +108,7 @@ int fixed_sdram(void)u32 msize =CFG_DDR_SIZE *1024 *1024 ;u32 msize_log2 =__ilog2 (msize); - im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE >>12 ; + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LBLAWAR_EN | (msize_log2 -1 );#if (CFG_DDR_SIZE !=512 )
board/freescale/mpc837xerdb/mpc837xerdb.c +1 -1
@@ -96,7 +96,7 @@ int fixed_sdram(void)u32 msize =CFG_DDR_SIZE *1024 *1024 ;u32 msize_log2 =__ilog2 (msize); - im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE >>12 ; + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LBLAWAR_EN | (msize_log2 -1 ); im->sysconf.ddrcdr =CFG_DDRCDR_VALUE ;
board/matrix_vision/mvblm7/mvblm7.c +1 -1
@@ -50,7 +50,7 @@ int fixed_sdram(void)if (ddr_size &1 )return -1 ; } - im->sysconf.ddrlaw[0 ].bar = ((CFG_DDR_SDRAM_BASE >>12 ) &0xfffff ); + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LAWAR_EN | ((ddr_size_log2 -1 ) &LAWAR_SIZE );
board/sbc8349/sbc8349.c +1 -1
@@ -101,7 +101,7 @@ int fixed_sdram(void)return -1 ; } } - im->sysconf.ddrlaw[0 ].bar = ((CFG_DDR_SDRAM_BASE >>12 ) &0xfffff ); + im->sysconf.ddrlaw[0 ].bar =CFG_DDR_SDRAM_BASE &0xfffff000 ; im->sysconf.ddrlaw[0 ].ar =LAWAR_EN | ((ddr_size_log2 -1 ) &LAWAR_SIZE );#if (CFG_DDR_SIZE !=256 )