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  *
20*1a459660SWolfgang 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 
26264eaa0eSValentin Longchamp /*
27264eaa0eSValentin Longchamp  * High Level Configuration Options
28264eaa0eSValentin Longchamp  */
29264eaa0eSValentin Longchamp #define CONFIG_QE	/* Has QE */
30264eaa0eSValentin Longchamp #define CONFIG_MPC832x	/* MPC832x CPU specific */
31264eaa0eSValentin Longchamp #define CONFIG_KM8321	/* Keymile PBEC8321 board specific */
32264eaa0eSValentin Longchamp 
33b648bfc2SHolger Brunck #define CONFIG_KM_DEF_ARCH	"arch=ppc_8xx\0"
34264eaa0eSValentin Longchamp 
35264eaa0eSValentin Longchamp /* include common defines/options for all 83xx Keymile boards */
36264eaa0eSValentin Longchamp #include "km83xx-common.h"
37264eaa0eSValentin Longchamp 
38264eaa0eSValentin Longchamp /*
39264eaa0eSValentin Longchamp  * System IO Config
40264eaa0eSValentin Longchamp  */
41264eaa0eSValentin Longchamp #define CONFIG_SYS_SICRL	SICRL_IRQ_CKS
42264eaa0eSValentin Longchamp 
43264eaa0eSValentin Longchamp /*
44264eaa0eSValentin Longchamp  * Hardware Reset Configuration Word
45264eaa0eSValentin Longchamp  */
46264eaa0eSValentin Longchamp #define CONFIG_SYS_HRCW_LOW (\
47264eaa0eSValentin Longchamp 	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 | \
48264eaa0eSValentin Longchamp 	HRCWL_DDR_TO_SCB_CLK_2X1 | \
49264eaa0eSValentin Longchamp 	HRCWL_CSB_TO_CLKIN_2X1 | \
50264eaa0eSValentin Longchamp 	HRCWL_CORE_TO_CSB_2_5X1 | \
51264eaa0eSValentin Longchamp 	HRCWL_CE_PLL_VCO_DIV_2 | \
52264eaa0eSValentin Longchamp 	HRCWL_CE_TO_PLL_1X3)
53264eaa0eSValentin Longchamp 
54264eaa0eSValentin Longchamp #define CONFIG_SYS_HRCW_HIGH (\
55264eaa0eSValentin Longchamp 	HRCWH_PCI_AGENT | \
56264eaa0eSValentin Longchamp 	HRCWH_PCI_ARBITER_DISABLE | \
57264eaa0eSValentin Longchamp 	HRCWH_CORE_ENABLE | \
58264eaa0eSValentin Longchamp 	HRCWH_FROM_0X00000100 | \
59264eaa0eSValentin Longchamp 	HRCWH_BOOTSEQ_DISABLE | \
60264eaa0eSValentin Longchamp 	HRCWH_SW_WATCHDOG_DISABLE | \
61264eaa0eSValentin Longchamp 	HRCWH_ROM_LOC_LOCAL_16BIT | \
62264eaa0eSValentin Longchamp 	HRCWH_BIG_ENDIAN | \
63264eaa0eSValentin Longchamp 	HRCWH_LALE_NORMAL)
64264eaa0eSValentin Longchamp 
65264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_CS0_BNDS		0x0000007f
66264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_SDRAM_CFG	(SDRAM_CFG_SDRAM_TYPE_DDR2 | \
67264eaa0eSValentin Longchamp 					 SDRAM_CFG_32_BE | \
68513e396bSMarco Schmid 					 SDRAM_CFG_SREN | \
69513e396bSMarco Schmid 					 SDRAM_CFG_HSE)
70264eaa0eSValentin Longchamp 
71264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_SDRAM_CFG2	0x00401000
72264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_CLK_CNTL		(DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05)
73264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_INTERVAL	((0x064 << SDRAM_INTERVAL_BSTOPRE_SHIFT) | \
74264eaa0eSValentin Longchamp 				 (0x200 << SDRAM_INTERVAL_REFINT_SHIFT))
75264eaa0eSValentin Longchamp 
76264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_CS0_CONFIG	(CSCONFIG_EN | CSCONFIG_AP | \
77264eaa0eSValentin Longchamp 					 CSCONFIG_ODT_WR_CFG | \
78264eaa0eSValentin Longchamp 					 CSCONFIG_ROW_BIT_13 | \
79264eaa0eSValentin Longchamp 					 CSCONFIG_COL_BIT_10)
80264eaa0eSValentin Longchamp 
81513e396bSMarco Schmid #define CONFIG_SYS_DDR_MODE	0x47860242
82264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_MODE2	0x8080c000
83264eaa0eSValentin Longchamp 
84264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_TIMING_0	((2 << TIMING_CFG0_MRS_CYC_SHIFT) | \
85264eaa0eSValentin Longchamp 				 (8 << TIMING_CFG0_ODT_PD_EXIT_SHIFT) | \
86264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG0_PRE_PD_EXIT_SHIFT) | \
87264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG0_ACT_PD_EXIT_SHIFT) | \
88264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_WWT_SHIFT) | \
89264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_RRT_SHIFT) | \
90264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_WRT_SHIFT) | \
91264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG0_RWT_SHIFT))
92264eaa0eSValentin Longchamp 
93513e396bSMarco Schmid #define CONFIG_SYS_DDR_TIMING_1	((TIMING_CFG1_CASLAT_40) | \
94264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG1_WRTORD_SHIFT) | \
95264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG1_ACTTOACT_SHIFT) | \
96513e396bSMarco Schmid 				 (3 << TIMING_CFG1_WRREC_SHIFT) | \
97513e396bSMarco Schmid 				 (7 << TIMING_CFG1_REFREC_SHIFT) | \
98513e396bSMarco Schmid 				 (3 << TIMING_CFG1_ACTTORW_SHIFT) | \
99513e396bSMarco Schmid 				 (7 << TIMING_CFG1_ACTTOPRE_SHIFT) | \
100513e396bSMarco Schmid 				 (3 << TIMING_CFG1_PRETOACT_SHIFT))
101264eaa0eSValentin Longchamp 
102264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_TIMING_2	((8 << TIMING_CFG2_FOUR_ACT_SHIFT) | \
103264eaa0eSValentin Longchamp 				 (3 << TIMING_CFG2_CKE_PLS_SHIFT) | \
104264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT) | \
105264eaa0eSValentin Longchamp 				 (2 << TIMING_CFG2_RD_TO_PRE_SHIFT) | \
106513e396bSMarco Schmid 				 (3 << TIMING_CFG2_WR_LAT_DELAY_SHIFT) | \
107264eaa0eSValentin Longchamp 				 (0 << TIMING_CFG2_ADD_LAT_SHIFT) | \
108264eaa0eSValentin Longchamp 				 (5 << TIMING_CFG2_CPO_SHIFT))
109264eaa0eSValentin Longchamp 
110264eaa0eSValentin Longchamp #define CONFIG_SYS_DDR_TIMING_3	0x00000000
111264eaa0eSValentin Longchamp 
112264eaa0eSValentin Longchamp #define CONFIG_SYS_KMBEC_FPGA_BASE	0xE8000000
113264eaa0eSValentin Longchamp #define CONFIG_SYS_KMBEC_FPGA_SIZE	128
114264eaa0eSValentin Longchamp 
115264eaa0eSValentin Longchamp /* EEprom support */
116264eaa0eSValentin Longchamp #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
117264eaa0eSValentin Longchamp 
118264eaa0eSValentin Longchamp /*
119264eaa0eSValentin Longchamp  * Local Bus Configuration & Clock Setup
120264eaa0eSValentin Longchamp  */
121513e396bSMarco Schmid #define CONFIG_SYS_LCRR_DBYP	0x80000000
122513e396bSMarco Schmid #define CONFIG_SYS_LCRR_EADC	0x00010000
123513e396bSMarco Schmid #define CONFIG_SYS_LCRR_CLKDIV	0x00000002
124513e396bSMarco Schmid 
125264eaa0eSValentin Longchamp #define CONFIG_SYS_LBC_LBCR	0x00000000
126264eaa0eSValentin Longchamp 
127264eaa0eSValentin Longchamp /*
128264eaa0eSValentin Longchamp  * MMU Setup
129264eaa0eSValentin Longchamp  */
130264eaa0eSValentin Longchamp #define CONFIG_SYS_IBAT7L	(0)
131264eaa0eSValentin Longchamp #define CONFIG_SYS_IBAT7U	(0)
132264eaa0eSValentin Longchamp #define CONFIG_SYS_DBAT7L	CONFIG_SYS_IBAT7L
133264eaa0eSValentin Longchamp #define CONFIG_SYS_DBAT7U	CONFIG_SYS_IBAT7U
134264eaa0eSValentin Longchamp 
135264eaa0eSValentin Longchamp #endif /* __CONFIG_KM8321_COMMON_H */
136