Skip to content

Commit aa1f06d

Browse files
Thor Thayersuryasaimadhu
authored andcommitted
EDAC, altera: Make OCRAM ECC dependency check generic
In preparation for the Arria10 peripheral ECCs, move the OCRAM ECC dependency check into the general ECC area since this same function can be used by other memories. Signed-off-by: Thor Thayer <tthayer@opensource.altera.com> Cc: devicetree@vger.kernel.org Cc: dinguyen@opensource.altera.com Cc: linux-arm-kernel@lists.infradead.org Cc: linux@arm.linux.org.uk Cc: linux-edac <linux-edac@vger.kernel.org> Link: http://lkml.kernel.org/r/1459450087-24792-4-git-send-email-tthayer@opensource.altera.com Signed-off-by: Borislav Petkov <bp@suse.de>
1 parent 943ad91 commit aa1f06d

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

drivers/edac/altera_edac.c

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,26 @@ static ssize_t altr_edac_device_trig(struct file *file,
648648
return count;
649649
}
650650

651+
/*
652+
* Test for memory's ECC dependencies upon entry because platform specific
653+
* startup should have initialized the memory and enabled the ECC.
654+
* Can't turn on ECC here because accessing un-initialized memory will
655+
* cause CE/UE errors possibly causing an ABORT.
656+
*/
657+
static int altr_check_ecc_deps(struct altr_edac_device_dev *device)
658+
{
659+
void __iomem *base = device->base;
660+
const struct edac_device_prv_data *prv = device->data;
661+
662+
if (readl(base + prv->ecc_en_ofst) & prv->ecc_enable_mask)
663+
return 0;
664+
665+
edac_printk(KERN_ERR, EDAC_DEVICE,
666+
"%s: No ECC present or ECC disabled.\n",
667+
device->edac_dev_name);
668+
return -ENODEV;
669+
}
670+
651671
static const struct file_operations altr_edac_device_inject_fops = {
652672
.open = simple_open,
653673
.write = altr_edac_device_trig,
@@ -853,29 +873,8 @@ static void ocram_free_mem(void *p, size_t size, void *other)
853873
gen_pool_free((struct gen_pool *)other, (u32)p, size);
854874
}
855875

856-
/*
857-
* altr_ocram_check_deps()
858-
* Test for OCRAM cache ECC dependencies upon entry because
859-
* platform specific startup should have initialized the
860-
* On-Chip RAM memory and enabled the ECC.
861-
* Can't turn on ECC here because accessing un-initialized
862-
* memory will cause CE/UE errors possibly causing an ABORT.
863-
*/
864-
static int altr_ocram_check_deps(struct altr_edac_device_dev *device)
865-
{
866-
void __iomem *base = device->base;
867-
const struct edac_device_prv_data *prv = device->data;
868-
869-
if (readl(base + prv->ecc_en_ofst) & prv->ecc_enable_mask)
870-
return 0;
871-
872-
edac_printk(KERN_ERR, EDAC_DEVICE,
873-
"OCRAM: No ECC present or ECC disabled.\n");
874-
return -ENODEV;
875-
}
876-
877876
const struct edac_device_prv_data ocramecc_data = {
878-
.setup = altr_ocram_check_deps,
877+
.setup = altr_check_ecc_deps,
879878
.ce_clear_mask = (ALTR_OCR_ECC_EN | ALTR_OCR_ECC_SERR),
880879
.ue_clear_mask = (ALTR_OCR_ECC_EN | ALTR_OCR_ECC_DERR),
881880
.dbgfs_name = "altr_ocram_trigger",

0 commit comments

Comments
 (0)