1 /*
2  * Copyright (C) 2006 Freescale Semiconductor, Inc.
3  *                    Dave Liu <daveliu@freescale.com>
4  *
5  * Copyright (C) 2007 Logic Product Development, Inc.
6  *                    Peter Barada <peterb@logicpd.com>
7  *
8  * Copyright (C) 2007 MontaVista Software, Inc.
9  *                    Anton Vorontsov <avorontsov@ru.mvista.com>
10  *
11  * (C) Copyright 2008
12  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
13  *
14  * (C) Copyright 2010
15  * Lukas Roggli, KEYMILE Ltd, lukas.roggli@keymile.com
16  *
17  * (C) Copyright 2010-2011
18  * Thomas Reufer, KEYMILE Ltd, thomas.reufer@keymile.com
19  *
20  * This program is free software; you can redistribute it and/or
21  * modify it under the terms of the GNU General Public License as
22  * published by the Free Software Foundation; either version 2 of
23  * the License, or (at your option) any later version.
24  */
25 
26 #ifndef __CONFIG_KM8321_COMMON_H
27 #define __CONFIG_KM8321_COMMON_H
28 
29 /*
30  * High Level Configuration Options
31  */
32 #define CONFIG_QE	/* Has QE */
33 #define CONFIG_MPC832x	/* MPC832x CPU specific */
34 #define CONFIG_KM8321	/* Keymile PBEC8321 board specific */
35 
36 #define CONFIG_KM_DEF_ARCH	"arch=ppc_8xx\0"
37 
38 /* include common defines/options for all 83xx Keymile boards */
39 #include "km83xx-common.h"
40 
41 #define CONFIG_MISC_INIT_R
42 
43 /*
44  * System IO Config
45  */
46 #define CONFIG_SYS_SICRL	SICRL_IRQ_CKS
47 
48 /*
49  * Hardware Reset Configuration Word
50  */
51 #define CONFIG_SYS_HRCW_LOW (\
52 	HRCWL_LCL_BUS_TO_SCB_CLK_1X1 | \
53 	HRCWL_DDR_TO_SCB_CLK_2X1 | \
54 	HRCWL_CSB_TO_CLKIN_2X1 | \
55 	HRCWL_CORE_TO_CSB_2_5X1 | \
56 	HRCWL_CE_PLL_VCO_DIV_2 | \
57 	HRCWL_CE_TO_PLL_1X3)
58 
59 #define CONFIG_SYS_HRCW_HIGH (\
60 	HRCWH_PCI_AGENT | \
61 	HRCWH_PCI_ARBITER_DISABLE | \
62 	HRCWH_CORE_ENABLE | \
63 	HRCWH_FROM_0X00000100 | \
64 	HRCWH_BOOTSEQ_DISABLE | \
65 	HRCWH_SW_WATCHDOG_DISABLE | \
66 	HRCWH_ROM_LOC_LOCAL_16BIT | \
67 	HRCWH_BIG_ENDIAN | \
68 	HRCWH_LALE_NORMAL)
69 
70 #define CONFIG_SYS_DDR_CS0_BNDS		0x0000007f
71 #define CONFIG_SYS_DDR_SDRAM_CFG	(SDRAM_CFG_SDRAM_TYPE_DDR2 | \
72 					 SDRAM_CFG_32_BE | \
73 					 SDRAM_CFG_SREN)
74 
75 #define CONFIG_SYS_DDR_SDRAM_CFG2	0x00401000
76 #define CONFIG_SYS_DDR_CLK_CNTL		(DDR_SDRAM_CLK_CNTL_CLK_ADJUST_05)
77 #define CONFIG_SYS_DDR_INTERVAL	((0x064 << SDRAM_INTERVAL_BSTOPRE_SHIFT) | \
78 				 (0x200 << SDRAM_INTERVAL_REFINT_SHIFT))
79 
80 #define CONFIG_SYS_DDR_CS0_CONFIG	(CSCONFIG_EN | CSCONFIG_AP | \
81 					 CSCONFIG_ODT_WR_CFG | \
82 					 CSCONFIG_ROW_BIT_13 | \
83 					 CSCONFIG_COL_BIT_10)
84 
85 #define CONFIG_SYS_DDR_MODE	0x47860252
86 #define CONFIG_SYS_DDR_MODE2	0x8080c000
87 
88 #define CONFIG_SYS_DDR_TIMING_0	((2 << TIMING_CFG0_MRS_CYC_SHIFT) | \
89 				 (8 << TIMING_CFG0_ODT_PD_EXIT_SHIFT) | \
90 				 (2 << TIMING_CFG0_PRE_PD_EXIT_SHIFT) | \
91 				 (2 << TIMING_CFG0_ACT_PD_EXIT_SHIFT) | \
92 				 (0 << TIMING_CFG0_WWT_SHIFT) | \
93 				 (0 << TIMING_CFG0_RRT_SHIFT) | \
94 				 (0 << TIMING_CFG0_WRT_SHIFT) | \
95 				 (0 << TIMING_CFG0_RWT_SHIFT))
96 
97 #define CONFIG_SYS_DDR_TIMING_1	((TIMING_CFG1_CASLAT_50) | \
98 				 (2 << TIMING_CFG1_WRTORD_SHIFT) | \
99 				 (2 << TIMING_CFG1_ACTTOACT_SHIFT) | \
100 				 (2 << TIMING_CFG1_WRREC_SHIFT) | \
101 				 (6 << TIMING_CFG1_REFREC_SHIFT) | \
102 				 (2 << TIMING_CFG1_ACTTORW_SHIFT) | \
103 				 (6 << TIMING_CFG1_ACTTOPRE_SHIFT) | \
104 				 (2 << TIMING_CFG1_PRETOACT_SHIFT))
105 
106 #define CONFIG_SYS_DDR_TIMING_2	((8 << TIMING_CFG2_FOUR_ACT_SHIFT) | \
107 				 (3 << TIMING_CFG2_CKE_PLS_SHIFT) | \
108 				 (2 << TIMING_CFG2_WR_DATA_DELAY_SHIFT) | \
109 				 (2 << TIMING_CFG2_RD_TO_PRE_SHIFT) | \
110 				 (4 << TIMING_CFG2_WR_LAT_DELAY_SHIFT) | \
111 				 (0 << TIMING_CFG2_ADD_LAT_SHIFT) | \
112 				 (5 << TIMING_CFG2_CPO_SHIFT))
113 
114 #define CONFIG_SYS_DDR_TIMING_3	0x00000000
115 
116 #define CONFIG_SYS_KMBEC_FPGA_BASE	0xE8000000
117 #define	CONFIG_SYS_KMBEC_FPGA_SIZE	128
118 
119 /* EEprom support */
120 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN	1
121 
122 /*
123  * Local Bus Configuration & Clock Setup
124  */
125 #define CONFIG_SYS_LCRR		(LCRR_DBYP | LCRR_EADC_1 | LCRR_CLKDIV_2)
126 #define CONFIG_SYS_LBC_LBCR	0x00000000
127 
128 /*
129  * MMU Setup
130  */
131 #define CONFIG_SYS_IBAT7L	(0)
132 #define CONFIG_SYS_IBAT7U	(0)
133 #define CONFIG_SYS_DBAT7L	CONFIG_SYS_IBAT7L
134 #define CONFIG_SYS_DBAT7U	CONFIG_SYS_IBAT7U
135 
136 #endif /* __CONFIG_KM8321_COMMON_H */
137