|
97 | 97 | #define SCRUB_MODE_MASK 0x7
|
98 | 98 | #define SCRUB_MODE_SECDED 0x4
|
99 | 99 |
|
| 100 | +/* DDR ECC Quirks */ |
| 101 | +#define DDR_ECC_INTR_SUPPORT BIT(0) |
| 102 | +#define DDR_ECC_DATA_POISON_SUPPORT BIT(1) |
| 103 | + |
| 104 | +/* ZynqMP Enhanced DDR memory controller registers that are relevant to ECC */ |
| 105 | +/* ECC Configuration Registers */ |
| 106 | +#define ECC_CFG0_OFST 0x70 |
| 107 | +#define ECC_CFG1_OFST 0x74 |
| 108 | + |
| 109 | +/* ECC Status Register */ |
| 110 | +#define ECC_STAT_OFST 0x78 |
| 111 | + |
| 112 | +/* ECC Clear Register */ |
| 113 | +#define ECC_CLR_OFST 0x7C |
| 114 | + |
| 115 | +/* ECC Error count Register */ |
| 116 | +#define ECC_ERRCNT_OFST 0x80 |
| 117 | + |
| 118 | +/* ECC Corrected Error Address Register */ |
| 119 | +#define ECC_CEADDR0_OFST 0x84 |
| 120 | +#define ECC_CEADDR1_OFST 0x88 |
| 121 | + |
| 122 | +/* ECC Syndrome Registers */ |
| 123 | +#define ECC_CSYND0_OFST 0x8C |
| 124 | +#define ECC_CSYND1_OFST 0x90 |
| 125 | +#define ECC_CSYND2_OFST 0x94 |
| 126 | + |
| 127 | +/* ECC Bit Mask0 Address Register */ |
| 128 | +#define ECC_BITMASK0_OFST 0x98 |
| 129 | +#define ECC_BITMASK1_OFST 0x9C |
| 130 | +#define ECC_BITMASK2_OFST 0xA0 |
| 131 | + |
| 132 | +/* ECC UnCorrected Error Address Register */ |
| 133 | +#define ECC_UEADDR0_OFST 0xA4 |
| 134 | +#define ECC_UEADDR1_OFST 0xA8 |
| 135 | + |
| 136 | +/* ECC Syndrome Registers */ |
| 137 | +#define ECC_UESYND0_OFST 0xAC |
| 138 | +#define ECC_UESYND1_OFST 0xB0 |
| 139 | +#define ECC_UESYND2_OFST 0xB4 |
| 140 | + |
| 141 | +/* ECC Poison Address Reg */ |
| 142 | +#define ECC_POISON0_OFST 0xB8 |
| 143 | +#define ECC_POISON1_OFST 0xBC |
| 144 | + |
| 145 | +#define ECC_ADDRMAP0_OFFSET 0x200 |
| 146 | + |
| 147 | +/* Control register bitfield definitions */ |
| 148 | +#define ECC_CTRL_BUSWIDTH_MASK 0x3000 |
| 149 | +#define ECC_CTRL_BUSWIDTH_SHIFT 12 |
| 150 | +#define ECC_CTRL_CLR_CE_ERRCNT BIT(2) |
| 151 | +#define ECC_CTRL_CLR_UE_ERRCNT BIT(3) |
| 152 | + |
| 153 | +/* DDR Control Register width definitions */ |
| 154 | +#define DDRCTL_EWDTH_16 2 |
| 155 | +#define DDRCTL_EWDTH_32 1 |
| 156 | +#define DDRCTL_EWDTH_64 0 |
| 157 | + |
| 158 | +/* ECC status register definitions */ |
| 159 | +#define ECC_STAT_UECNT_MASK 0xF0000 |
| 160 | +#define ECC_STAT_UECNT_SHIFT 16 |
| 161 | +#define ECC_STAT_CECNT_MASK 0xF00 |
| 162 | +#define ECC_STAT_CECNT_SHIFT 8 |
| 163 | +#define ECC_STAT_BITNUM_MASK 0x7F |
| 164 | + |
| 165 | +/* DDR QOS Interrupt register definitions */ |
| 166 | +#define DDR_QOS_IRQ_STAT_OFST 0x20200 |
| 167 | +#define DDR_QOSUE_MASK 0x4 |
| 168 | +#define DDR_QOSCE_MASK 0x2 |
| 169 | +#define ECC_CE_UE_INTR_MASK 0x6 |
| 170 | +#define DDR_QOS_IRQ_EN_OFST 0x20208 |
| 171 | +#define DDR_QOS_IRQ_DB_OFST 0x2020C |
| 172 | + |
| 173 | +/* ECC Corrected Error Register Mask and Shifts*/ |
| 174 | +#define ECC_CEADDR0_RW_MASK 0x3FFFF |
| 175 | +#define ECC_CEADDR0_RNK_MASK BIT(24) |
| 176 | +#define ECC_CEADDR1_BNKGRP_MASK 0x3000000 |
| 177 | +#define ECC_CEADDR1_BNKNR_MASK 0x70000 |
| 178 | +#define ECC_CEADDR1_BLKNR_MASK 0xFFF |
| 179 | +#define ECC_CEADDR1_BNKGRP_SHIFT 24 |
| 180 | +#define ECC_CEADDR1_BNKNR_SHIFT 16 |
| 181 | + |
| 182 | +/* ECC Poison register shifts */ |
| 183 | +#define ECC_POISON0_RANK_SHIFT 24 |
| 184 | +#define ECC_POISON0_RANK_MASK BIT(24) |
| 185 | +#define ECC_POISON0_COLUMN_SHIFT 0 |
| 186 | +#define ECC_POISON0_COLUMN_MASK 0xFFF |
| 187 | +#define ECC_POISON1_BG_SHIFT 28 |
| 188 | +#define ECC_POISON1_BG_MASK 0x30000000 |
| 189 | +#define ECC_POISON1_BANKNR_SHIFT 24 |
| 190 | +#define ECC_POISON1_BANKNR_MASK 0x7000000 |
| 191 | +#define ECC_POISON1_ROW_SHIFT 0 |
| 192 | +#define ECC_POISON1_ROW_MASK 0x3FFFF |
| 193 | + |
| 194 | +/* DDR Memory type defines */ |
| 195 | +#define MEM_TYPE_DDR3 0x1 |
| 196 | +#define MEM_TYPE_LPDDR3 0x8 |
| 197 | +#define MEM_TYPE_DDR2 0x4 |
| 198 | +#define MEM_TYPE_DDR4 0x10 |
| 199 | +#define MEM_TYPE_LPDDR4 0x20 |
| 200 | + |
| 201 | +/* DDRC Software control register */ |
| 202 | +#define DDRC_SWCTL 0x320 |
| 203 | + |
| 204 | +/* DDRC ECC CE & UE poison mask */ |
| 205 | +#define ECC_CEPOISON_MASK 0x3 |
| 206 | +#define ECC_UEPOISON_MASK 0x1 |
| 207 | + |
| 208 | +/* DDRC Device config masks */ |
| 209 | +#define DDRC_MSTR_CFG_MASK 0xC0000000 |
| 210 | +#define DDRC_MSTR_CFG_SHIFT 30 |
| 211 | +#define DDRC_MSTR_CFG_X4_MASK 0x0 |
| 212 | +#define DDRC_MSTR_CFG_X8_MASK 0x1 |
| 213 | +#define DDRC_MSTR_CFG_X16_MASK 0x2 |
| 214 | +#define DDRC_MSTR_CFG_X32_MASK 0x3 |
| 215 | + |
| 216 | +#define DDR_MAX_ROW_SHIFT 18 |
| 217 | +#define DDR_MAX_COL_SHIFT 14 |
| 218 | +#define DDR_MAX_BANK_SHIFT 3 |
| 219 | +#define DDR_MAX_BANKGRP_SHIFT 2 |
| 220 | + |
| 221 | +#define ROW_MAX_VAL_MASK 0xF |
| 222 | +#define COL_MAX_VAL_MASK 0xF |
| 223 | +#define BANK_MAX_VAL_MASK 0x1F |
| 224 | +#define BANKGRP_MAX_VAL_MASK 0x1F |
| 225 | +#define RANK_MAX_VAL_MASK 0x1F |
| 226 | + |
| 227 | +#define ROW_B0_BASE 6 |
| 228 | +#define ROW_B1_BASE 7 |
| 229 | +#define ROW_B2_BASE 8 |
| 230 | +#define ROW_B3_BASE 9 |
| 231 | +#define ROW_B4_BASE 10 |
| 232 | +#define ROW_B5_BASE 11 |
| 233 | +#define ROW_B6_BASE 12 |
| 234 | +#define ROW_B7_BASE 13 |
| 235 | +#define ROW_B8_BASE 14 |
| 236 | +#define ROW_B9_BASE 15 |
| 237 | +#define ROW_B10_BASE 16 |
| 238 | +#define ROW_B11_BASE 17 |
| 239 | +#define ROW_B12_BASE 18 |
| 240 | +#define ROW_B13_BASE 19 |
| 241 | +#define ROW_B14_BASE 20 |
| 242 | +#define ROW_B15_BASE 21 |
| 243 | +#define ROW_B16_BASE 22 |
| 244 | +#define ROW_B17_BASE 23 |
| 245 | + |
| 246 | +#define COL_B2_BASE 2 |
| 247 | +#define COL_B3_BASE 3 |
| 248 | +#define COL_B4_BASE 4 |
| 249 | +#define COL_B5_BASE 5 |
| 250 | +#define COL_B6_BASE 6 |
| 251 | +#define COL_B7_BASE 7 |
| 252 | +#define COL_B8_BASE 8 |
| 253 | +#define COL_B9_BASE 9 |
| 254 | +#define COL_B10_BASE 10 |
| 255 | +#define COL_B11_BASE 11 |
| 256 | +#define COL_B12_BASE 12 |
| 257 | +#define COL_B13_BASE 13 |
| 258 | + |
| 259 | +#define BANK_B0_BASE 2 |
| 260 | +#define BANK_B1_BASE 3 |
| 261 | +#define BANK_B2_BASE 4 |
| 262 | + |
| 263 | +#define BANKGRP_B0_BASE 2 |
| 264 | +#define BANKGRP_B1_BASE 3 |
| 265 | + |
| 266 | +#define RANK_B0_BASE 6 |
| 267 | + |
100 | 268 | /**
|
101 | 269 | * struct ecc_error_info - ECC error log information.
|
102 | 270 | * @row: Row number.
|
|
0 commit comments