| .. | .. |
|---|
| 156 | 156 | #define A10_INTMASK_CLR_OFST 0x10 |
|---|
| 157 | 157 | #define A10_DDR0_IRQ_MASK BIT(17) |
|---|
| 158 | 158 | |
|---|
| 159 | | -/************* Stratix10 Defines **************/ |
|---|
| 160 | | - |
|---|
| 161 | | -/* SDRAM Controller EccCtrl Register */ |
|---|
| 162 | | -#define S10_ECCCTRL1_OFST 0xF8011100 |
|---|
| 163 | | - |
|---|
| 164 | | -/* SDRAM Controller DRAM IRQ Register */ |
|---|
| 165 | | -#define S10_ERRINTEN_OFST 0xF8011110 |
|---|
| 166 | | - |
|---|
| 167 | | -/* SDRAM Interrupt Mode Register */ |
|---|
| 168 | | -#define S10_INTMODE_OFST 0xF801111C |
|---|
| 169 | | - |
|---|
| 170 | | -/* SDRAM Controller Error Status Register */ |
|---|
| 171 | | -#define S10_INTSTAT_OFST 0xF8011120 |
|---|
| 172 | | - |
|---|
| 173 | | -/* SDRAM Controller ECC Error Address Register */ |
|---|
| 174 | | -#define S10_DERRADDR_OFST 0xF801112C |
|---|
| 175 | | -#define S10_SERRADDR_OFST 0xF8011130 |
|---|
| 176 | | - |
|---|
| 177 | | -/* SDRAM Controller ECC Diagnostic Register */ |
|---|
| 178 | | -#define S10_DIAGINTTEST_OFST 0xF8011124 |
|---|
| 179 | | - |
|---|
| 180 | | -/* SDRAM Single Bit Error Count Compare Set Register */ |
|---|
| 181 | | -#define S10_SERRCNTREG_OFST 0xF801113C |
|---|
| 182 | | - |
|---|
| 183 | | -/* Sticky registers for Uncorrected Errors */ |
|---|
| 184 | | -#define S10_SYSMGR_UE_VAL_OFST 0xFFD12220 |
|---|
| 185 | | -#define S10_SYSMGR_UE_ADDR_OFST 0xFFD12224 |
|---|
| 186 | | - |
|---|
| 187 | 159 | struct altr_sdram_prv_data { |
|---|
| 188 | 160 | int ecc_ctrl_offset; |
|---|
| 189 | 161 | int ecc_ctl_en_mask; |
|---|
| .. | .. |
|---|
| 317 | 289 | #define ALTR_A10_ECC_INIT_WATCHDOG_10US 10000 |
|---|
| 318 | 290 | |
|---|
| 319 | 291 | /************* Stratix10 Defines **************/ |
|---|
| 292 | +#define ALTR_S10_ECC_CTRL_SDRAM_OFST 0x00 |
|---|
| 293 | +#define ALTR_S10_ECC_EN BIT(0) |
|---|
| 294 | + |
|---|
| 295 | +#define ALTR_S10_ECC_ERRINTEN_OFST 0x10 |
|---|
| 296 | +#define ALTR_S10_ECC_ERRINTENS_OFST 0x14 |
|---|
| 297 | +#define ALTR_S10_ECC_ERRINTENR_OFST 0x18 |
|---|
| 298 | +#define ALTR_S10_ECC_SERRINTEN BIT(0) |
|---|
| 299 | + |
|---|
| 300 | +#define ALTR_S10_ECC_INTMODE_OFST 0x1C |
|---|
| 301 | +#define ALTR_S10_ECC_INTMODE BIT(0) |
|---|
| 302 | + |
|---|
| 303 | +#define ALTR_S10_ECC_INTSTAT_OFST 0x20 |
|---|
| 304 | +#define ALTR_S10_ECC_SERRPENA BIT(0) |
|---|
| 305 | +#define ALTR_S10_ECC_DERRPENA BIT(8) |
|---|
| 306 | +#define ALTR_S10_ECC_ERRPENA_MASK (ALTR_S10_ECC_SERRPENA | \ |
|---|
| 307 | + ALTR_S10_ECC_DERRPENA) |
|---|
| 308 | + |
|---|
| 309 | +#define ALTR_S10_ECC_INTTEST_OFST 0x24 |
|---|
| 310 | +#define ALTR_S10_ECC_TSERRA BIT(0) |
|---|
| 311 | +#define ALTR_S10_ECC_TDERRA BIT(8) |
|---|
| 312 | +#define ALTR_S10_ECC_TSERRB BIT(16) |
|---|
| 313 | +#define ALTR_S10_ECC_TDERRB BIT(24) |
|---|
| 314 | + |
|---|
| 315 | +#define ALTR_S10_DERR_ADDRA_OFST 0x2C |
|---|
| 320 | 316 | |
|---|
| 321 | 317 | /* Stratix10 ECC Manager Defines */ |
|---|
| 322 | | -#define S10_SYSMGR_ECC_INTMASK_VAL_OFST 0xFFD12090 |
|---|
| 323 | | -#define S10_SYSMGR_ECC_INTMASK_SET_OFST 0xFFD12094 |
|---|
| 324 | | -#define S10_SYSMGR_ECC_INTMASK_CLR_OFST 0xFFD12098 |
|---|
| 318 | +#define S10_SYSMGR_ECC_INTMASK_CLR_OFST 0x98 |
|---|
| 319 | +#define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xA0 |
|---|
| 325 | 320 | |
|---|
| 326 | | -#define S10_SYSMGR_ECC_INTSTAT_SERR_OFST 0xFFD1209C |
|---|
| 327 | | -#define S10_SYSMGR_ECC_INTSTAT_DERR_OFST 0xFFD120A0 |
|---|
| 321 | +/* Sticky registers for Uncorrected Errors */ |
|---|
| 322 | +#define S10_SYSMGR_UE_VAL_OFST 0x220 |
|---|
| 323 | +#define S10_SYSMGR_UE_ADDR_OFST 0x224 |
|---|
| 328 | 324 | |
|---|
| 329 | 325 | #define S10_DDR0_IRQ_MASK BIT(16) |
|---|
| 326 | +#define S10_DBE_IRQ_MASK 0x3FFFE |
|---|
| 327 | + |
|---|
| 328 | +/* Define ECC Block Offsets for peripherals */ |
|---|
| 329 | +#define ECC_BLK_ADDRESS_OFST 0x40 |
|---|
| 330 | +#define ECC_BLK_RDATA0_OFST 0x44 |
|---|
| 331 | +#define ECC_BLK_RDATA1_OFST 0x48 |
|---|
| 332 | +#define ECC_BLK_RDATA2_OFST 0x4C |
|---|
| 333 | +#define ECC_BLK_RDATA3_OFST 0x50 |
|---|
| 334 | +#define ECC_BLK_WDATA0_OFST 0x54 |
|---|
| 335 | +#define ECC_BLK_WDATA1_OFST 0x58 |
|---|
| 336 | +#define ECC_BLK_WDATA2_OFST 0x5C |
|---|
| 337 | +#define ECC_BLK_WDATA3_OFST 0x60 |
|---|
| 338 | +#define ECC_BLK_RECC0_OFST 0x64 |
|---|
| 339 | +#define ECC_BLK_RECC1_OFST 0x68 |
|---|
| 340 | +#define ECC_BLK_WECC0_OFST 0x6C |
|---|
| 341 | +#define ECC_BLK_WECC1_OFST 0x70 |
|---|
| 342 | +#define ECC_BLK_DBYTECTRL_OFST 0x74 |
|---|
| 343 | +#define ECC_BLK_ACCCTRL_OFST 0x78 |
|---|
| 344 | +#define ECC_BLK_STARTACC_OFST 0x7C |
|---|
| 345 | + |
|---|
| 346 | +#define ECC_XACT_KICK 0x10000 |
|---|
| 347 | +#define ECC_WORD_WRITE 0xFF |
|---|
| 348 | +#define ECC_WRITE_DOVR 0x101 |
|---|
| 349 | +#define ECC_WRITE_EDOVR 0x103 |
|---|
| 350 | +#define ECC_READ_EOVR 0x2 |
|---|
| 351 | +#define ECC_READ_EDOVR 0x3 |
|---|
| 330 | 352 | |
|---|
| 331 | 353 | struct altr_edac_device_dev; |
|---|
| 332 | 354 | |
|---|
| .. | .. |
|---|
| 370 | 392 | struct irq_domain *domain; |
|---|
| 371 | 393 | struct irq_chip irq_chip; |
|---|
| 372 | 394 | struct list_head a10_ecc_devices; |
|---|
| 373 | | -}; |
|---|
| 374 | | - |
|---|
| 375 | | -/* |
|---|
| 376 | | - * Functions specified by ARM SMC Calling convention: |
|---|
| 377 | | - * |
|---|
| 378 | | - * FAST call executes atomic operations, returns when the requested operation |
|---|
| 379 | | - * has completed. |
|---|
| 380 | | - * STD call starts a operation which can be preempted by a non-secure |
|---|
| 381 | | - * interrupt. The call can return before the requested operation has |
|---|
| 382 | | - * completed. |
|---|
| 383 | | - * |
|---|
| 384 | | - * a0..a7 is used as register names in the descriptions below, on arm32 |
|---|
| 385 | | - * that translates to r0..r7 and on arm64 to w0..w7. |
|---|
| 386 | | - */ |
|---|
| 387 | | - |
|---|
| 388 | | -#define INTEL_SIP_SMC_STD_CALL_VAL(func_num) \ |
|---|
| 389 | | - ARM_SMCCC_CALL_VAL(ARM_SMCCC_STD_CALL, ARM_SMCCC_SMC_64, \ |
|---|
| 390 | | - ARM_SMCCC_OWNER_SIP, (func_num)) |
|---|
| 391 | | - |
|---|
| 392 | | -#define INTEL_SIP_SMC_FAST_CALL_VAL(func_num) \ |
|---|
| 393 | | - ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL, ARM_SMCCC_SMC_64, \ |
|---|
| 394 | | - ARM_SMCCC_OWNER_SIP, (func_num)) |
|---|
| 395 | | - |
|---|
| 396 | | -#define INTEL_SIP_SMC_RETURN_UNKNOWN_FUNCTION 0xFFFFFFFF |
|---|
| 397 | | -#define INTEL_SIP_SMC_STATUS_OK 0x0 |
|---|
| 398 | | -#define INTEL_SIP_SMC_REG_ERROR 0x5 |
|---|
| 399 | | - |
|---|
| 400 | | -/* |
|---|
| 401 | | - * Request INTEL_SIP_SMC_REG_READ |
|---|
| 402 | | - * |
|---|
| 403 | | - * Read a protected register using SMCCC |
|---|
| 404 | | - * |
|---|
| 405 | | - * Call register usage: |
|---|
| 406 | | - * a0: INTEL_SIP_SMC_REG_READ. |
|---|
| 407 | | - * a1: register address. |
|---|
| 408 | | - * a2-7: not used. |
|---|
| 409 | | - * |
|---|
| 410 | | - * Return status: |
|---|
| 411 | | - * a0: INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_REG_ERROR, or |
|---|
| 412 | | - * INTEL_SIP_SMC_RETURN_UNKNOWN_FUNCTION |
|---|
| 413 | | - * a1: Value in the register |
|---|
| 414 | | - * a2-3: not used. |
|---|
| 415 | | - */ |
|---|
| 416 | | -#define INTEL_SIP_SMC_FUNCID_REG_READ 7 |
|---|
| 417 | | -#define INTEL_SIP_SMC_REG_READ \ |
|---|
| 418 | | - INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_REG_READ) |
|---|
| 419 | | - |
|---|
| 420 | | -/* |
|---|
| 421 | | - * Request INTEL_SIP_SMC_REG_WRITE |
|---|
| 422 | | - * |
|---|
| 423 | | - * Write a protected register using SMCCC |
|---|
| 424 | | - * |
|---|
| 425 | | - * Call register usage: |
|---|
| 426 | | - * a0: INTEL_SIP_SMC_REG_WRITE. |
|---|
| 427 | | - * a1: register address |
|---|
| 428 | | - * a2: value to program into register. |
|---|
| 429 | | - * a3-7: not used. |
|---|
| 430 | | - * |
|---|
| 431 | | - * Return status: |
|---|
| 432 | | - * a0: INTEL_SIP_SMC_STATUS_OK, INTEL_SIP_SMC_REG_ERROR, or |
|---|
| 433 | | - * INTEL_SIP_SMC_RETURN_UNKNOWN_FUNCTION |
|---|
| 434 | | - * a1-3: not used. |
|---|
| 435 | | - */ |
|---|
| 436 | | -#define INTEL_SIP_SMC_FUNCID_REG_WRITE 8 |
|---|
| 437 | | -#define INTEL_SIP_SMC_REG_WRITE \ |
|---|
| 438 | | - INTEL_SIP_SMC_FAST_CALL_VAL(INTEL_SIP_SMC_FUNCID_REG_WRITE) |
|---|
| 439 | | - |
|---|
| 440 | | -struct altr_stratix10_edac { |
|---|
| 441 | | - struct device *dev; |
|---|
| 442 | | - int sb_irq; |
|---|
| 443 | | - struct irq_domain *domain; |
|---|
| 444 | | - struct irq_chip irq_chip; |
|---|
| 445 | | - struct list_head s10_ecc_devices; |
|---|
| 446 | 395 | struct notifier_block panic_notifier; |
|---|
| 447 | 396 | }; |
|---|
| 448 | 397 | |
|---|