summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mvebu/dram.c
diff options
context:
space:
mode:
authorChris Packham <judge.packham@gmail.com>2017-09-23 04:50:31 +1200
committerStefan Roese <sr@denx.de>2017-09-26 06:52:57 +0200
commitc3ab2744447db80de3c0a18422256a7b638253b3 (patch)
tree1d7bb978c2a310d6b6b26fc07758b601ef74583a /arch/arm/mach-mvebu/dram.c
parent0a91e1cce4497a50af00dc134af6bc19ec87fe34 (diff)
downloadu-boot-c3ab2744447db80de3c0a18422256a7b638253b3.tar.gz
u-boot-c3ab2744447db80de3c0a18422256a7b638253b3.tar.xz
u-boot-c3ab2744447db80de3c0a18422256a7b638253b3.zip
ARM: mvebu: handle unused DRAM banks with ECC enabled
dram_ecc_scrubbing() had code to skip unused DRAM banks but it would not work because mvebu_sdram_bs() returns 0 and the code was subtracting 1 before checking the size. Remove the -1 from the bank size and the +1 from the total which will skip unused banks and still calculate the correct size. Put the -1 where it is needed for scrubbing via the xor engine. Reported-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz> Signed-off-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'arch/arm/mach-mvebu/dram.c')
-rw-r--r--arch/arm/mach-mvebu/dram.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/mach-mvebu/dram.c b/arch/arm/mach-mvebu/dram.c
index 55e9ad726a..e634905618 100644
--- a/arch/arm/mach-mvebu/dram.c
+++ b/arch/arm/mach-mvebu/dram.c
@@ -179,11 +179,11 @@ static void dram_ecc_scrubbing(void)
reg_write(REG_SDRAM_CONFIG_ADDR, temp);
for (cs = 0; cs < CONFIG_NR_DRAM_BANKS; cs++) {
- size = mvebu_sdram_bs(cs) - 1;
+ size = mvebu_sdram_bs(cs);
if (size == 0)
continue;
- total = (u64)size + 1;
+ total = (u64)size;
total_mem += (u32)(total / (1 << 30));
start_addr = 0;
mv_xor_init2(cs);
@@ -194,7 +194,7 @@ static void dram_ecc_scrubbing(void)
size -= start_addr;
}
- mv_xor_mem_init(SCRB_XOR_CHAN, start_addr, size,
+ mv_xor_mem_init(SCRB_XOR_CHAN, start_addr, size - 1,
SCRUB_MAGIC, SCRUB_MAGIC);
/* Wait for previous transfer completion */