1264eaa0eSValentin Longchamp /*
2264eaa0eSValentin Longchamp  * Copyright (C) 2006 Freescale Semiconductor, Inc.
3264eaa0eSValentin Longchamp  *                    Dave Liu <daveliu@freescale.com>
4264eaa0eSValentin Longchamp  *
5264eaa0eSValentin Longchamp  * Copyright (C) 2007 Logic Product Development, Inc.
6264eaa0eSValentin Longchamp  *                    Peter Barada <peterb@logicpd.com>
7264eaa0eSValentin Longchamp  *
8264eaa0eSValentin Longchamp  * Copyright (C) 2007 MontaVista Software, Inc.
9264eaa0eSValentin Longchamp  *                    Anton Vorontsov <avorontsov@ru.mvista.com>
10264eaa0eSValentin Longchamp  *
11264eaa0eSValentin Longchamp  * (C) Copyright 2008
12264eaa0eSValentin Longchamp  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
13264eaa0eSValentin Longchamp  *
14264eaa0eSValentin Longchamp  * (C) Copyright 2010
15264eaa0eSValentin Longchamp  * Lukas Roggli, KEYMILE Ltd, lukas.roggli@keymile.com
16264eaa0eSValentin Longchamp  *
17264eaa0eSValentin Longchamp  * (C) Copyright 2010-2011
18264eaa0eSValentin Longchamp  * Thomas Reufer, KEYMILE Ltd, thomas.reufer@keymile.com
19264eaa0eSValentin Longchamp  *
201a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
21264eaa0eSValentin Longchamp  */
22264eaa0eSValentin Longchamp 
23264eaa0eSValentin Longchamp #ifndef __CONFIG_KM8321_COMMON_H
24264eaa0eSValentin Longchamp #define __CONFIG_KM8321_COMMON_H
25264eaa0eSValentin Longchamp 
26*fdfaa29eSKim Phillips #define CONFIG_SYS_GENERIC_BOARD
27*fdfaa29eSKim Phillips #define CONFIG_DISPLAY_BOARDINFO
28*fdfaa29eSKim Phillips 
29264eaa0eSValentin Longchamp /*
30264eaa0eSValentin Longchamp  * High Level Configuration Options
31264eaa0eSValentin Longchamp  */
32264eaa0eSValentin Longchamp #define CONFIG_QE	/* Has QE */
33264eaa0eSValentin Longchamp #define CONFIG_MPC832x	/* MPC832x CPU specific */
34264eaa0eSValentin Longchamp #define CONFIG_KM8321	/* Keymile PBEC8321 board specific */
35264eaa0eSValentin Longchamp 
36b648bfc2SHolger Brunck #define CONFIG_KM_DEF_ARCH	"arch=ppc_8xx\0"
37264eaa0eSValentin Longchamp 
38264eaa0eSValentin Longchamp /* include common defines/options for all 83xx Keymile boards */
39264eaa0eSValentin Longchamp #include "km83xx-common.h"
40264eaa0eSValentin Longchamp 
41264eaa0eSValentin Longchamp /*
42264eaa0eSValentin Longchamp  * System IO Config
43264eaa0eSValentin Longchamp  */
44264eaa0eSValentin Longchamp #define CONFIG_SYS_SICRL	SICRL_IRQ_CKS
45264eaa0eSValentin Longchamp 
46264eaa0eSValentin Longchamp /*
47264eaa0eSValentin Longchamp  * Hardware Reset Configuration Word
48264eaa0eSValentin Longchamp  */
49264eaa0eSValentin Longchamp #define CONFIG_SYS_HRCW_LOW (\
50264eaa0eSValentin Longchamp 	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 | \
51264eaa0eSValentin Longchamp 	HRCWL_DDR_TO_SCB_CLK_2X1 | \
52264eaa0eSValentin Longchamp 	HRCWL_CSB_TO_CLKIN_2X1 | \
53264eaa0eSValentin Longchamp 	HRCWL_CORE_TO_CSB_2_5X1 | \
54264eaa0eSValentin Longchamp 	HRCWL_CE_PLL_VCO_DIV_2 | \
55264eaa0eSValentin Longchamp 	HRCWL_CE_TO_PLL_1X3)
56264eaa0eSValentin Longchamp 
57264eaa0eSValentin Longchamp #define CONFIG_SYS_HRCW_HIGH (\
58264eaa0eSValentin Longchamp 	HRCWH_PCI_AGENT | \
59264eaa0eSValentin Longchamp 	HRCWH_PCI_ARBITER_DISABLE | \
60264eaa0eSValentin Longchamp 	HRCWH_CORE_ENABLE | \
61264eaa0eSValentin Longchamp 	HRCWH_FROM_0X00000100 | \
62264eaa0eSValentin Longchamp 	HRCWH_BOOTSEQ_DISABLE | \
63264eaa0eSValentin Longchamp 	HRCWH_SW_WATCHDOG_DISABLE | \
64264eaa0eSValentin Longchamp 	HRCWH_ROM_LOC_LOCAL_16BIT | \
65264eaa0eSValentin Longchamp 	HRCWH_BIG_ENDIAN | \
66264eaa0eSValentin Longchamp 	HRCWH_LALE_NORMAL)
67264eaa0eSValentin Longchamp 
68264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_CS0_BNDS		0x0000007f
69264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_SDRAM_CFG	(SDRAM_CFG_SDRAM_TYPE_DDR2 | \
70264eaa0eSValentin Longchamp 					 SDRAM_CFG_32_BE | \
71513e396bSMarco Schmid 					 SDRAM_CFG_SREN | \
72513e396bSMarco Schmid 					 SDRAM_CFG_HSE)
73264eaa0eSValentin Longchamp 
74264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_SDRAM_CFG2	0x00401000
75264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_CLK_CNTL		(DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05)
76264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_INTERVAL	((0x064 << SDRAM_INTERVAL_BSTOPRE_SHIFT) | \
77264eaa0eSValentin Longchamp 				 (0x200 << SDRAM_INTERVAL_REFINT_SHIFT))
78264eaa0eSValentin Longchamp 
79264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_CS0_CONFIG	(CSCONFIG_EN | CSCONFIG_AP | \
80264eaa0eSValentin Longchamp 					 CSCONFIG_ODT_WR_CFG | \
81264eaa0eSValentin Longchamp 					 CSCONFIG_ROW_BIT_13 | \
82264eaa0eSValentin Longchamp 					 CSCONFIG_COL_BIT_10)
83264eaa0eSValentin Longchamp 
84513e396bSMarco Schmid #define CONFIG_SYS_DDR_MODE	0x47860242
85264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_MODE2	0x8080c000
86264eaa0eSValentin Longchamp 
87264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_TIMING_0	((2 << TIMING_CFG0_MRS_CYC_SHIFT) | \
88264eaa0eSValentin Longchamp 				 (8 << TIMING_CFG0_ODT_PD_EXIT_SHIFT) | \
89264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG0_PRE_PD_EXIT_SHIFT) | \
90264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG0_ACT_PD_EXIT_SHIFT) | \
91264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_WWT_SHIFT) | \
92264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_RRT_SHIFT) | \
93264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_WRT_SHIFT) | \
94264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_RWT_SHIFT))
95264eaa0eSValentin Longchamp 
96513e396bSMarco Schmid #define CONFIG_SYS_DDR_TIMING_1	((TIMING_CFG1_CASLAT_40) | \
97264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG1_WRTORD_SHIFT) | \
98264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG1_ACTTOACT_SHIFT) | \
99513e396bSMarco Schmid 				 (3 << TIMING_CFG1_WRREC_SHIFT) | \
100513e396bSMarco Schmid 				 (7 << TIMING_CFG1_REFREC_SHIFT) | \
101513e396bSMarco Schmid 				 (3 << TIMING_CFG1_ACTTORW_SHIFT) | \
102513e396bSMarco Schmid 				 (7 << TIMING_CFG1_ACTTOPRE_SHIFT) | \
103513e396bSMarco Schmid 				 (3 << TIMING_CFG1_PRETOACT_SHIFT))
104264eaa0eSValentin Longchamp 
105264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_TIMING_2	((8 << TIMING_CFG2_FOUR_ACT_SHIFT) | \
106264eaa0eSValentin Longchamp 				 (3 << TIMING_CFG2_CKE_PLS_SHIFT) | \
107264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT) | \
108264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG2_RD_TO_PRE_SHIFT) | \
109513e396bSMarco Schmid 				 (3 << TIMING_CFG2_WR_LAT_DELAY_SHIFT) | \
110264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG2_ADD_LAT_SHIFT) | \
111264eaa0eSValentin Longchamp 				 (5 << TIMING_CFG2_CPO_SHIFT))
112264eaa0eSValentin Longchamp 
113264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_TIMING_3	0x00000000
114264eaa0eSValentin Longchamp 
115264eaa0eSValentin Longchamp #define CONFIG_SYS_KMBEC_FPGA_BASE	0xE8000000
116264eaa0eSValentin Longchamp #define CONFIG_SYS_KMBEC_FPGA_SIZE	128
117264eaa0eSValentin Longchamp 
118264eaa0eSValentin Longchamp /* EEprom support */
119264eaa0eSValentin Longchamp #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
120264eaa0eSValentin Longchamp 
121264eaa0eSValentin Longchamp /*
122264eaa0eSValentin Longchamp  * Local Bus Configuration & Clock Setup
123264eaa0eSValentin Longchamp  */
124513e396bSMarco Schmid #define CONFIG_SYS_LCRR_DBYP	0x80000000
125513e396bSMarco Schmid #define CONFIG_SYS_LCRR_EADC	0x00010000
126513e396bSMarco Schmid #define CONFIG_SYS_LCRR_CLKDIV	0x00000002
127513e396bSMarco Schmid 
128264eaa0eSValentin Longchamp #define CONFIG_SYS_LBC_LBCR	0x00000000
129264eaa0eSValentin Longchamp 
130264eaa0eSValentin Longchamp /*
131264eaa0eSValentin Longchamp  * MMU Setup
132264eaa0eSValentin Longchamp  */
133264eaa0eSValentin Longchamp #define CONFIG_SYS_IBAT7L	(0)
134264eaa0eSValentin Longchamp #define CONFIG_SYS_IBAT7U	(0)
135264eaa0eSValentin Longchamp #define CONFIG_SYS_DBAT7L	CONFIG_SYS_IBAT7L
136264eaa0eSValentin Longchamp #define CONFIG_SYS_DBAT7U	CONFIG_SYS_IBAT7U
137264eaa0eSValentin Longchamp 
138264eaa0eSValentin Longchamp #endif /* __CONFIG_KM8321_COMMON_H */
139