18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Freescale Memory Controller kernel module
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Support  Power-based SoCs including MPC85xx, MPC86xx, MPC83xx and
58c2ecf20Sopenharmony_ci * ARM-based Layerscape SoCs including LS2xxx and LS1021A. Originally
68c2ecf20Sopenharmony_ci * split out from mpc85xx_edac EDAC driver.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Author: Dave Jiang <djiang@mvista.com>
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * 2006-2007 (c) MontaVista Software, Inc. This file is licensed under
118c2ecf20Sopenharmony_ci * the terms of the GNU General Public License version 2. This program
128c2ecf20Sopenharmony_ci * is licensed "as is" without any warranty of any kind, whether express
138c2ecf20Sopenharmony_ci * or implied.
148c2ecf20Sopenharmony_ci *
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci#ifndef _FSL_DDR_EDAC_H_
178c2ecf20Sopenharmony_ci#define _FSL_DDR_EDAC_H_
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define fsl_mc_printk(mci, level, fmt, arg...) \
208c2ecf20Sopenharmony_ci	edac_mc_chipset_printk(mci, level, "FSL_DDR", fmt, ##arg)
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/*
238c2ecf20Sopenharmony_ci * DRAM error defines
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* DDR_SDRAM_CFG */
278c2ecf20Sopenharmony_ci#define FSL_MC_DDR_SDRAM_CFG	0x0110
288c2ecf20Sopenharmony_ci#define FSL_MC_CS_BNDS_0		0x0000
298c2ecf20Sopenharmony_ci#define FSL_MC_CS_BNDS_OFS		0x0008
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci#define FSL_MC_DATA_ERR_INJECT_HI	0x0e00
328c2ecf20Sopenharmony_ci#define FSL_MC_DATA_ERR_INJECT_LO	0x0e04
338c2ecf20Sopenharmony_ci#define FSL_MC_ECC_ERR_INJECT	0x0e08
348c2ecf20Sopenharmony_ci#define FSL_MC_CAPTURE_DATA_HI	0x0e20
358c2ecf20Sopenharmony_ci#define FSL_MC_CAPTURE_DATA_LO	0x0e24
368c2ecf20Sopenharmony_ci#define FSL_MC_CAPTURE_ECC		0x0e28
378c2ecf20Sopenharmony_ci#define FSL_MC_ERR_DETECT		0x0e40
388c2ecf20Sopenharmony_ci#define FSL_MC_ERR_DISABLE		0x0e44
398c2ecf20Sopenharmony_ci#define FSL_MC_ERR_INT_EN		0x0e48
408c2ecf20Sopenharmony_ci#define FSL_MC_CAPTURE_ATRIBUTES	0x0e4c
418c2ecf20Sopenharmony_ci#define FSL_MC_CAPTURE_ADDRESS	0x0e50
428c2ecf20Sopenharmony_ci#define FSL_MC_CAPTURE_EXT_ADDRESS	0x0e54
438c2ecf20Sopenharmony_ci#define FSL_MC_ERR_SBE		0x0e58
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define DSC_MEM_EN	0x80000000
468c2ecf20Sopenharmony_ci#define DSC_ECC_EN	0x20000000
478c2ecf20Sopenharmony_ci#define DSC_RD_EN	0x10000000
488c2ecf20Sopenharmony_ci#define DSC_DBW_MASK	0x00180000
498c2ecf20Sopenharmony_ci#define DSC_DBW_32	0x00080000
508c2ecf20Sopenharmony_ci#define DSC_DBW_64	0x00000000
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define DSC_SDTYPE_MASK		0x07000000
538c2ecf20Sopenharmony_ci#define DSC_X32_EN	0x00000020
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/* Err_Int_En */
568c2ecf20Sopenharmony_ci#define DDR_EIE_MSEE	0x1	/* memory select */
578c2ecf20Sopenharmony_ci#define DDR_EIE_SBEE	0x4	/* single-bit ECC error */
588c2ecf20Sopenharmony_ci#define DDR_EIE_MBEE	0x8	/* multi-bit ECC error */
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci/* Err_Detect */
618c2ecf20Sopenharmony_ci#define DDR_EDE_MSE		0x1	/* memory select */
628c2ecf20Sopenharmony_ci#define DDR_EDE_SBE		0x4	/* single-bit ECC error */
638c2ecf20Sopenharmony_ci#define DDR_EDE_MBE		0x8	/* multi-bit ECC error */
648c2ecf20Sopenharmony_ci#define DDR_EDE_MME		0x80000000	/* multiple memory errors */
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* Err_Disable */
678c2ecf20Sopenharmony_ci#define DDR_EDI_MSED	0x1	/* memory select disable */
688c2ecf20Sopenharmony_ci#define	DDR_EDI_SBED	0x4	/* single-bit ECC error disable */
698c2ecf20Sopenharmony_ci#define	DDR_EDI_MBED	0x8	/* multi-bit ECC error disable */
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_cistruct fsl_mc_pdata {
728c2ecf20Sopenharmony_ci	char *name;
738c2ecf20Sopenharmony_ci	int edac_idx;
748c2ecf20Sopenharmony_ci	void __iomem *mc_vbase;
758c2ecf20Sopenharmony_ci	int irq;
768c2ecf20Sopenharmony_ci};
778c2ecf20Sopenharmony_ciint fsl_mc_err_probe(struct platform_device *op);
788c2ecf20Sopenharmony_ciint fsl_mc_err_remove(struct platform_device *op);
798c2ecf20Sopenharmony_ci#endif
80