Kirkwood: bugfix: DRAM size initialization
PATCH 1/1 Kirkwood: bugfix: DRAM size initialization
If start of any DRAM bank is greater than total DDR size, remaining DDR bank sizes were left un-initialized in dram_init function. This could break other functions who uses array 'gd->bd->bi_dram'.Kirkwood network driver is one example.
--- arch/arm/cpu/arm926ejs/kirkwood/dram.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/cpu/arm926ejs/kirkwood/dram.c +7 -0
@@ -81,6 +81,13 @@ int dram_init(void) gd->ram_size += gd->bd->bi_dram[i].size; } + +for (; i <CONFIG_NR_DRAM_BANKS ; i++) { +/* If above loop terminated prematurely, we need to set +* remaining bank sizes as 0 */ + gd->bd->bi_dram[i].size =0 ; + } +return 0 ; }
Signature · 1 line
1.6.6.1
PATCH 1/1 Kirkwood: bugfix: DRAM size initialization
Do we want them set to zero regardless of their size, or do we just want to not include the further banks in gd->ram_size.
(quoted diff) +0 -0
b/arch/arm/cpu/arm926ejs/kirkwood/dram.c
index 7439c87..3f5eae5 100644
arch/arm/cpu/arm926ejs/kirkwood/dram.c +2 -4
@@ -75,10 +75,8 @@ int dram_init(void)* If the gap is found, ram_size will be reported for * consecutive memory only */ -if (gd->bd->bi_dram[i].start != gd->ram_size) -break ; - - gd->ram_size += gd->bd->bi_dram[i].size; +if (gd->bd->bi_dram[i].start == gd->ram_size) + gd->ram_size += gd->bd->bi_dram[i].size; }return 0 ;
PATCH 1/1 Kirkwood: bugfix: DRAM size initialization
In reply to Tanmay UpadhyayHi All,
I was a bit hasty in providing the patch. Given patch solves u-boot stuff, but Linux kernel still has some trouble. I am providing second version of this patch which takes care of start address also. This fixes Linux kernel issue.
Please ignore this version.
Sorry,
Tanmay
Quoted 29 lines · Tanmay Upadhyay
If start of any DRAM bank is greater than total DDR size, remaining DDR bank sizes were left un-initialized in
dram_initfunction. This could break other functions who uses array 'gd->bd->bi_dram'.Kirkwood network driver is one example.Signed-off-by Tanmay Upadhyay<[email protected]>--- arch/arm/cpu/arm926ejs/kirkwood/dram.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)arch/arm/cpu/arm926ejs/kirkwood/dram.c +7
-0@@ -81,6 +81,13 @@ int dram_init(void) gd->ram_size += gd->bd->bi_dram[i].size; } + +for (; i<CONFIG_NR_DRAM_BANKS ; i++) { +/* If above loop terminated prematurely, we need to set +* remaining bank sizes as 0 */ + gd->bd->bi_dram[i].size =0 ; + } +return 0 ; }