blob: 2f2c2b1890b98bf5d00d4969e16012481df20511 [file] [log] [blame]
York Sunea2eb9a2016-08-11 13:15:18 -07001/*
2 * Freescale Memory Controller kernel module
3 *
4 * Support Power-based SoCs including MPC85xx, MPC86xx, MPC83xx and
5 * ARM-based Layerscape SoCs including LS2xxx. Originally split
6 * out from mpc85xx_edac EDAC driver.
7 *
8 * Author: Dave Jiang <djiang@mvista.com>
9 *
10 * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under
11 * the terms of the GNU General Public License version 2. This program
12 * is licensed "as is" without any warranty of any kind, whether express
13 * or implied.
14 *
15 */
16#ifndef _FSL_DDR_EDAC_H_
17#define _FSL_DDR_EDAC_H_
18
19#define mpc85xx_mc_printk(mci, level, fmt, arg...) \
20 edac_mc_chipset_printk(mci, level, "FSL_DDR", fmt, ##arg)
21
22/*
23 * DRAM error defines
24 */
25
26/* DDR_SDRAM_CFG */
27#define MPC85XX_MC_DDR_SDRAM_CFG 0x0110
28#define MPC85XX_MC_CS_BNDS_0 0x0000
29#define MPC85XX_MC_CS_BNDS_1 0x0008
30#define MPC85XX_MC_CS_BNDS_2 0x0010
31#define MPC85XX_MC_CS_BNDS_3 0x0018
32#define MPC85XX_MC_CS_BNDS_OFS 0x0008
33
34#define MPC85XX_MC_DATA_ERR_INJECT_HI 0x0e00
35#define MPC85XX_MC_DATA_ERR_INJECT_LO 0x0e04
36#define MPC85XX_MC_ECC_ERR_INJECT 0x0e08
37#define MPC85XX_MC_CAPTURE_DATA_HI 0x0e20
38#define MPC85XX_MC_CAPTURE_DATA_LO 0x0e24
39#define MPC85XX_MC_CAPTURE_ECC 0x0e28
40#define MPC85XX_MC_ERR_DETECT 0x0e40
41#define MPC85XX_MC_ERR_DISABLE 0x0e44
42#define MPC85XX_MC_ERR_INT_EN 0x0e48
43#define MPC85XX_MC_CAPTURE_ATRIBUTES 0x0e4c
44#define MPC85XX_MC_CAPTURE_ADDRESS 0x0e50
45#define MPC85XX_MC_CAPTURE_EXT_ADDRESS 0x0e54
46#define MPC85XX_MC_ERR_SBE 0x0e58
47
48#define DSC_MEM_EN 0x80000000
49#define DSC_ECC_EN 0x20000000
50#define DSC_RD_EN 0x10000000
51#define DSC_DBW_MASK 0x00180000
52#define DSC_DBW_32 0x00080000
53#define DSC_DBW_64 0x00000000
54
55#define DSC_SDTYPE_MASK 0x07000000
56
57#define DSC_SDTYPE_DDR 0x02000000
58#define DSC_SDTYPE_DDR2 0x03000000
59#define DSC_SDTYPE_DDR3 0x07000000
60#define DSC_X32_EN 0x00000020
61
62/* Err_Int_En */
63#define DDR_EIE_MSEE 0x1 /* memory select */
64#define DDR_EIE_SBEE 0x4 /* single-bit ECC error */
65#define DDR_EIE_MBEE 0x8 /* multi-bit ECC error */
66
67/* Err_Detect */
68#define DDR_EDE_MSE 0x1 /* memory select */
69#define DDR_EDE_SBE 0x4 /* single-bit ECC error */
70#define DDR_EDE_MBE 0x8 /* multi-bit ECC error */
71#define DDR_EDE_MME 0x80000000 /* multiple memory errors */
72
73/* Err_Disable */
74#define DDR_EDI_MSED 0x1 /* memory select disable */
75#define DDR_EDI_SBED 0x4 /* single-bit ECC error disable */
76#define DDR_EDI_MBED 0x8 /* multi-bit ECC error disable */
77
78struct mpc85xx_mc_pdata {
79 char *name;
80 int edac_idx;
81 void __iomem *mc_vbase;
82 int irq;
83};
84int mpc85xx_mc_err_probe(struct platform_device *op);
85int mpc85xx_mc_err_remove(struct platform_device *op);
86#endif