Skip to content

Commit fd3ecda

Browse files
rabarabp3tk0v
authored andcommitted
EDAC/altera: Handle OCRAM ECC enable after warm reset
The OCRAM ECC is always enabled either by the BootROM or by the Secure Device Manager (SDM) during a power-on reset on SoCFPGA. However, during a warm reset, the OCRAM content is retained to preserve data, while the control and status registers are reset to their default values. As a result, ECC must be explicitly re-enabled after a warm reset. Fixes: 17e47dc ("EDAC/altera: Add Stratix10 OCRAM ECC support") Signed-off-by: Niravkumar L Rabara <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Acked-by: Dinh Nguyen <[email protected]> Cc: [email protected] Link: https://patch.msgid.link/[email protected]
1 parent 2cf95b9 commit fd3ecda

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/edac/altera_edac.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,10 +1184,22 @@ altr_check_ocram_deps_init(struct altr_edac_device_dev *device)
11841184
if (ret)
11851185
return ret;
11861186

1187-
/* Verify OCRAM has been initialized */
1187+
/*
1188+
* Verify that OCRAM has been initialized.
1189+
* During a warm reset, OCRAM contents are retained, but the control
1190+
* and status registers are reset to their default values. Therefore,
1191+
* ECC must be explicitly re-enabled in the control register.
1192+
* Error condition: if INITCOMPLETEA is clear and ECC_EN is already set.
1193+
*/
11881194
if (!ecc_test_bits(ALTR_A10_ECC_INITCOMPLETEA,
1189-
(base + ALTR_A10_ECC_INITSTAT_OFST)))
1190-
return -ENODEV;
1195+
(base + ALTR_A10_ECC_INITSTAT_OFST))) {
1196+
if (!ecc_test_bits(ALTR_A10_ECC_EN,
1197+
(base + ALTR_A10_ECC_CTRL_OFST)))
1198+
ecc_set_bits(ALTR_A10_ECC_EN,
1199+
(base + ALTR_A10_ECC_CTRL_OFST));
1200+
else
1201+
return -ENODEV;
1202+
}
11911203

11921204
/* Enable IRQ on Single Bit Error */
11931205
writel(ALTR_A10_ECC_SERRINTEN, (base + ALTR_A10_ECC_ERRINTENS_OFST));

0 commit comments

Comments
 (0)