fsl_ddr_edac.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Freescale Memory Controller kernel module
  4. *
  5. * Support Power-based SoCs including MPC85xx, MPC86xx, MPC83xx and
  6. * ARM-based Layerscape SoCs including LS2xxx and LS1021A. Originally
  7. * split out from mpc85xx_edac EDAC driver.
  8. *
  9. * Author: Dave Jiang <djiang@mvista.com>
  10. *
  11. * 2006-2007 (c) MontaVista Software, Inc.
  12. */
  13. #ifndef _FSL_DDR_EDAC_H_
  14. #define _FSL_DDR_EDAC_H_
  15. #define fsl_mc_printk(mci, level, fmt, arg...) \
  16. edac_mc_chipset_printk(mci, level, "FSL_DDR", fmt, ##arg)
  17. /*
  18. * DRAM error defines
  19. */
  20. /* DDR_SDRAM_CFG */
  21. #define FSL_MC_DDR_SDRAM_CFG 0x0110
  22. #define FSL_MC_CS_BNDS_0 0x0000
  23. #define FSL_MC_CS_BNDS_OFS 0x0008
  24. #define FSL_MC_DATA_ERR_INJECT_HI 0x0e00
  25. #define FSL_MC_DATA_ERR_INJECT_LO 0x0e04
  26. #define FSL_MC_ECC_ERR_INJECT 0x0e08
  27. #define FSL_MC_CAPTURE_DATA_HI 0x0e20
  28. #define FSL_MC_CAPTURE_DATA_LO 0x0e24
  29. #define FSL_MC_CAPTURE_ECC 0x0e28
  30. #define FSL_MC_ERR_DETECT 0x0e40
  31. #define FSL_MC_ERR_DISABLE 0x0e44
  32. #define FSL_MC_ERR_INT_EN 0x0e48
  33. #define FSL_MC_CAPTURE_ATRIBUTES 0x0e4c
  34. #define FSL_MC_CAPTURE_ADDRESS 0x0e50
  35. #define FSL_MC_CAPTURE_EXT_ADDRESS 0x0e54
  36. #define FSL_MC_ERR_SBE 0x0e58
  37. #define IMX9_MC_ERR_EN 0x1000
  38. #define IMX9_MC_DATA_ERR_INJECT_OFF 0x100
  39. #define DSC_MEM_EN 0x80000000
  40. #define DSC_ECC_EN 0x20000000
  41. #define DSC_RD_EN 0x10000000
  42. #define DSC_DBW_MASK 0x00180000
  43. #define DSC_DBW_32 0x00080000
  44. #define DSC_DBW_64 0x00000000
  45. #define ERR_ECC_EN 0x80000000
  46. #define ERR_INLINE_ECC 0x40000000
  47. #define DSC_SDTYPE_MASK 0x07000000
  48. #define DSC_X32_EN 0x00000020
  49. /* Err_Int_En */
  50. #define DDR_EIE_MSEE 0x1 /* memory select */
  51. #define DDR_EIE_SBEE 0x4 /* single-bit ECC error */
  52. #define DDR_EIE_MBEE 0x8 /* multi-bit ECC error */
  53. /* Err_Detect */
  54. #define DDR_EDE_MSE 0x1 /* memory select */
  55. #define DDR_EDE_SBE 0x4 /* single-bit ECC error */
  56. #define DDR_EDE_MBE 0x8 /* multi-bit ECC error */
  57. #define DDR_EDE_MME 0x80000000 /* multiple memory errors */
  58. /* Err_Disable */
  59. #define DDR_EDI_MSED 0x1 /* memory select disable */
  60. #define DDR_EDI_SBED 0x4 /* single-bit ECC error disable */
  61. #define DDR_EDI_MBED 0x8 /* multi-bit ECC error disable */
  62. #define TYPE_IMX9 0x1 /* MC used by iMX9 having registers changed */
  63. struct fsl_mc_pdata {
  64. char *name;
  65. int edac_idx;
  66. void __iomem *mc_vbase;
  67. void __iomem *inject_vbase;
  68. int irq;
  69. u32 orig_ddr_err_disable;
  70. u32 orig_ddr_err_sbe;
  71. bool little_endian;
  72. unsigned long flag;
  73. };
  74. int fsl_mc_err_probe(struct platform_device *op);
  75. void fsl_mc_err_remove(struct platform_device *op);
  76. #endif