13 #include <linux/module.h>
24 static const char *mv64x60_ctl_name =
"MV64x60";
25 static int edac_dev_idx;
26 static int edac_pci_idx;
27 static int edac_mc_idx;
31 static void mv64x60_pci_check(
struct edac_pci_ctl_info *pci)
33 struct mv64x60_pci_pdata *
pdata = pci->pvt_info;
36 cause =
in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
43 in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_ADDR_LO));
45 in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_ADDR_HI));
47 in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_ATTR));
49 in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CMD));
50 out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE, ~cause);
52 if (cause & MV64X60_PCI_PE_MASK)
55 if (!(cause & MV64X60_PCI_PE_MASK))
61 struct edac_pci_ctl_info *pci =
dev_id;
62 struct mv64x60_pci_pdata *pdata = pci->pvt_info;
65 val =
in_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE);
69 mv64x60_pci_check(pci);
89 "PCI err regs\n", __func__);
105 struct edac_pci_ctl_info *pci;
106 struct mv64x60_pci_pdata *
pdata;
117 pdata = pci->pvt_info;
119 pdata->pci_hose = pdev->
id;
120 pdata->name =
"mpc85xx_pci_err";
122 platform_set_drvdata(pdev, pci);
123 pci->dev = &pdev->
dev;
124 pci->dev_name = dev_name(&pdev->
dev);
126 pci->ctl_name = pdata->name;
129 pci->edac_check = mv64x60_pci_check;
131 pdata->edac_idx = edac_pci_idx++;
136 "PCI err regs\n", __func__);
154 if (!pdata->pci_vbase) {
160 res = mv64x60_pci_fixup(pdev);
166 out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_CAUSE, 0);
167 out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_MASK, 0);
168 out_le32(pdata->pci_vbase + MV64X60_PCI_ERROR_MASK,
169 MV64X60_PCIx_ERR_MASK_VAL);
172 edac_dbg(3,
"failed edac_pci_add_device()\n");
178 res = devm_request_irq(&pdev->
dev,
186 "MV64x60 PCI ERR\n", __func__, pdata->irq);
211 struct edac_pci_ctl_info *pci = platform_get_drvdata(pdev);
223 .
probe = mv64x60_pci_err_probe,
226 .name =
"mv64x60_pci_err",
259 static irqreturn_t mv64x60_sram_isr(
int irq,
void *dev_id)
269 mv64x60_sram_check(edac_dev);
293 pdata->
name =
"mv64x60_sram_err";
295 edac_dev->
dev = &pdev->
dev;
296 platform_set_drvdata(pdev, edac_dev);
302 "SRAM err regs\n", __func__);
339 edac_dbg(3,
"failed edac_device_add_device()\n");
345 res = devm_request_irq(&pdev->
dev,
353 "%s: Unable to request irq %d for "
354 "MV64x60 SRAM ERR\n", __func__, pdata->
irq);
391 .probe = mv64x60_sram_err_probe,
392 .remove = mv64x60_sram_err_remove,
394 .name =
"mv64x60_sram_err",
426 static irqreturn_t mv64x60_cpu_isr(
int irq,
void *dev_id)
437 mv64x60_cpu_check(edac_dev);
461 pdata->
name =
"mv64x60_cpu_err";
463 edac_dev->
dev = &pdev->
dev;
464 platform_set_drvdata(pdev, edac_dev);
470 "CPU err regs\n", __func__);
497 "CPU err regs\n", __func__);
534 edac_dbg(3,
"failed edac_device_add_device()\n");
540 res = devm_request_irq(&pdev->
dev,
548 "%s: Unable to request irq %d for MV64x60 "
549 "CPU ERR\n", __func__, pdata->
irq);
555 " acquired irq %d for CPU Err\n", pdata->
irq);
585 .probe = mv64x60_cpu_err_probe,
586 .remove = mv64x60_cpu_err_remove,
588 .name =
"mv64x60_cpu_err",
607 err_addr = reg & ~0x3;
610 syndrome = sdram_ecc ^ comp_ecc;
630 static irqreturn_t mv64x60_mc_isr(
int irq,
void *dev_id)
641 mv64x60_mc_check(mci);
649 const unsigned int *
reg;
660 static void mv64x60_init_csrows(
struct mem_ctl_info *mci,
669 get_total_mem(pdata);
681 devtype = (ctl >> 20) & 0x3;
714 layers[0].is_virt_csrow =
true;
717 layers[1].is_virt_csrow =
false;
728 platform_set_drvdata(pdev, mci);
729 pdata->
name =
"mv64x60_mc_err";
737 "MC err regs\n", __func__);
784 mv64x60_init_csrows(mci, pdata);
789 ctl = (ctl & 0xff00ffff) | 0x10000;
793 edac_dbg(3,
"failed edac_mc_add_mc()\n");
800 res = devm_request_irq(&pdev->
dev,
808 "MV64x60 DRAM ERR\n", __func__, pdata->
irq);
842 .probe = mv64x60_mc_err_probe,
843 .remove = mv64x60_mc_err_remove,
845 .name =
"mv64x60_mc_err",
849 static int __init mv64x60_edac_init(
void)
872 "CPU err failed to register\n");
877 "SRAM err failed to register\n");
883 "PCI err failed to register\n");
890 static void __exit mv64x60_edac_exit(
void)
905 "EDAC Error Reporting state: 0=Poll, 2=Interrupt");