16 #include <linux/types.h>
17 #include <linux/kernel.h>
18 #include <linux/ctype.h>
29 #define HB_DDR_ECC_OPT 0x128
30 #define HB_DDR_ECC_U_ERR_ADDR 0x130
31 #define HB_DDR_ECC_U_ERR_STAT 0x134
32 #define HB_DDR_ECC_U_ERR_DATAL 0x138
33 #define HB_DDR_ECC_U_ERR_DATAH 0x13c
34 #define HB_DDR_ECC_C_ERR_ADDR 0x140
35 #define HB_DDR_ECC_C_ERR_STAT 0x144
36 #define HB_DDR_ECC_C_ERR_DATAL 0x148
37 #define HB_DDR_ECC_C_ERR_DATAH 0x14c
38 #define HB_DDR_ECC_INT_STATUS 0x180
39 #define HB_DDR_ECC_INT_ACK 0x184
40 #define HB_DDR_ECC_U_ERR_ID 0x424
41 #define HB_DDR_ECC_C_ERR_ID 0x428
43 #define HB_DDR_ECC_INT_STAT_CE 0x8
44 #define HB_DDR_ECC_INT_STAT_DOUBLE_CE 0x10
45 #define HB_DDR_ECC_INT_STAT_UE 0x20
46 #define HB_DDR_ECC_INT_STAT_DOUBLE_UE 0x40
48 #define HB_DDR_ECC_OPT_MODE_MASK 0x3
49 #define HB_DDR_ECC_OPT_FWC 0x100
50 #define HB_DDR_ECC_OPT_XOR_SHIFT 16
75 syndrome = (syndrome >> 8) & 0xff;
89 #ifdef CONFIG_EDAC_DEBUG
91 const char __user *
data,
92 size_t count, loff_t *ppos)
101 buf_size =
min(count, (
sizeof(buf)-1));
116 static int debugfs_open(
struct inode *
inode,
struct file *file)
123 .
open = debugfs_open,
124 .write = highbank_mc_err_inject_write,
132 &highbank_mc_debug_inject_fops);
153 layers[0].is_virt_csrow =
true;
156 layers[1].is_virt_csrow =
false;
164 platform_set_drvdata(pdev, mci);
171 dev_err(&pdev->
dev,
"Unable to get mem resource\n");
177 resource_size(r), dev_name(&pdev->
dev))) {
178 dev_err(&pdev->
dev,
"Error while requesting mem region\n");
184 r->
start, resource_size(r));
192 if (!control || (control == 0x2)) {
193 dev_err(&pdev->
dev,
"No ECC present, or ECC disabled\n");
199 res = devm_request_irq(&pdev->
dev, irq, highbank_mc_err_handler,
200 0, dev_name(&pdev->
dev), mci);
202 dev_err(&pdev->
dev,
"Unable to request irq %d\n", irq);
226 highbank_mc_create_debugfs_nodes(mci);
245 static const struct of_device_id hb_ddr_ctrl_of_match[] = {
246 { .compatible =
"calxeda,hb-ddr-ctrl", },
252 .probe = highbank_mc_probe,
253 .remove = highbank_mc_remove,
255 .name =
"hb_mc_edac",
256 .of_match_table = hb_ddr_ctrl_of_match,