Skip to contentSkip to conversation

ARM: mvebu: handle unused DRAM banks with ECC enabled

PATCH New Chris Packham 3 participants 3 messages Sep 22, 2017 – Sep 26, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

 arch/arm/mach-mvebu/dram.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-mvebu/dram.c +3 -3
index e3f304c366..f946c0cffe 100644
@@ -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 */
Signature · 1 line
2.14.1
#1 lore raw

PATCH 1/1 ARM: mvebu: handle unused DRAM banks with ECC enabled

I can confirm that this patch fixes the issue I was seeing (data_abort, single and dual-bit ecc errors during dram_ecc_scrubbing).

Tested on a board with the Marvell AlleyCat3 switch/SoC.

Cheers,
Joshua Scott

________________________________________
From: Chris Packham <[email protected]>
Sent: Saturday, 23 September 2017 4:50 a.m.
To: u-boot at lists.denx.de
Cc: Joshua Scott; Chris Packham; Prafulla Wadaskar; Albert Aribaud; Luka Perkov; Stefan Roese
Subject: [PATCH] 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.

---

 arch/arm/mach-mvebu/dram.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-mvebu/dram.c +3 -3
index e3f304c366..f946c0cffe 100644
@@ -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 */

--
2.14.1

#2 lore raw

PATCH 1/1 ARM: mvebu: handle unused DRAM banks with ECC enabled

In reply to Chris Packham
Quoted 9 lines · Chris Packham

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.

Applied to u-boot-marvell/master.

Thanks,
Stefan