xref: /openbmc/u-boot/include/configs/calimain.h (revision 725e09b8)
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2011-2014 OMICRON electronics GmbH
4  *
5  * Based on da850evm.h. Original Copyrights follow:
6  *
7  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
8  * Copyright (C) 2007 Sergey Kubushyn <ksi@koi8.net>
9  */
10 
11 #ifndef __CONFIG_H
12 #define __CONFIG_H
13 
14 /*
15  * Board
16  */
17 #define CONFIG_DRIVER_TI_EMAC
18 #define CONFIG_MACH_TYPE	MACH_TYPE_CALIMAIN
19 
20 /*
21  * SoC Configuration
22  */
23 #define CONFIG_SYS_EXCEPTION_VECTORS_HIGH
24 #define CONFIG_SYS_CLK_FREQ		clk_get(DAVINCI_ARM_CLKID)
25 #define CONFIG_SYS_OSCIN_FREQ		calimain_get_osc_freq()
26 #define CONFIG_SYS_TIMERBASE		DAVINCI_TIMER0_BASE
27 #define CONFIG_SYS_HZ_CLOCK		clk_get(DAVINCI_AUXCLK_CLKID)
28 #define CONFIG_ARCH_CPU_INIT
29 #define CONFIG_HW_WATCHDOG
30 #define CONFIG_SYS_WDTTIMERBASE	DAVINCI_TIMER1_BASE
31 #define CONFIG_SYS_WDT_PERIOD_LOW \
32 	(60 * CONFIG_SYS_OSCIN_FREQ) /* 60 s heartbeat */
33 #define CONFIG_SYS_WDT_PERIOD_HIGH	0x0
34 #define CONFIG_SYS_DV_NOR_BOOT_CFG	(0x11)
35 
36 /*
37  * PLL configuration
38  */
39 
40 #define CONFIG_SYS_DA850_PLL0_PLLM \
41 	((calimain_get_osc_freq() == 25000000) ? 23 : 24)
42 #define CONFIG_SYS_DA850_PLL1_PLLM \
43 	((calimain_get_osc_freq() == 25000000) ? 20 : 21)
44 
45 /*
46  * DDR2 memory configuration
47  */
48 #define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
49 					DV_DDR_PHY_EXT_STRBEN | \
50 					(0x4 << DV_DDR_PHY_RD_LATENCY_SHIFT))
51 
52 #define CONFIG_SYS_DA850_DDR2_SDBCR (		\
53 	(1 << DV_DDR_SDCR_DDR2EN_SHIFT) |	\
54 	(1 << DV_DDR_SDCR_DDRDRIVE0_SHIFT) |	\
55 	(1 << DV_DDR_SDCR_DDREN_SHIFT) |	\
56 	(1 << DV_DDR_SDCR_SDRAMEN_SHIFT) |	\
57 	(1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT) |	\
58 	(0x3 << DV_DDR_SDCR_CL_SHIFT) |		\
59 	(0x3 << DV_DDR_SDCR_IBANK_SHIFT) |	\
60 	(0x2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
61 
62 /* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
63 #define CONFIG_SYS_DA850_DDR2_SDBCR2	0
64 
65 #define CONFIG_SYS_DA850_DDR2_SDTIMR (		\
66 	(16 << DV_DDR_SDTMR1_RFC_SHIFT) |	\
67 	(1 << DV_DDR_SDTMR1_RP_SHIFT) |		\
68 	(1 << DV_DDR_SDTMR1_RCD_SHIFT) |	\
69 	(1 << DV_DDR_SDTMR1_WR_SHIFT) |		\
70 	(5 << DV_DDR_SDTMR1_RAS_SHIFT) |	\
71 	(7 << DV_DDR_SDTMR1_RC_SHIFT) |		\
72 	(1 << DV_DDR_SDTMR1_RRD_SHIFT) |	\
73 	(1 << DV_DDR_SDTMR1_WTR_SHIFT))
74 
75 #define CONFIG_SYS_DA850_DDR2_SDTIMR2 (		\
76 	(7 << DV_DDR_SDTMR2_RASMAX_SHIFT) |	\
77 	(2 << DV_DDR_SDTMR2_XP_SHIFT) |		\
78 	(0 << DV_DDR_SDTMR2_ODT_SHIFT) |	\
79 	(18 << DV_DDR_SDTMR2_XSNR_SHIFT) |	\
80 	(199 << DV_DDR_SDTMR2_XSRD_SHIFT) |	\
81 	(0 << DV_DDR_SDTMR2_RTP_SHIFT) |	\
82 	(2 << DV_DDR_SDTMR2_CKE_SHIFT))
83 
84 #define CONFIG_SYS_DA850_DDR2_SDRCR	0x000003FF
85 #define CONFIG_SYS_DA850_DDR2_PBBPR	0x30
86 
87 /*
88  * Flash memory timing
89  */
90 
91 #define CONFIG_SYS_DA850_CS2CFG	(	\
92 	DAVINCI_ABCR_WSETUP(2) |	\
93 	DAVINCI_ABCR_WSTROBE(5)	|	\
94 	DAVINCI_ABCR_WHOLD(3) |		\
95 	DAVINCI_ABCR_RSETUP(1) |	\
96 	DAVINCI_ABCR_RSTROBE(14) |	\
97 	DAVINCI_ABCR_RHOLD(0) |		\
98 	DAVINCI_ABCR_TA(3) |		\
99 	DAVINCI_ABCR_ASIZE_16BIT)
100 
101 /* single 64 MB NOR flash device connected to CS2 and CS3 */
102 #define CONFIG_SYS_DA850_CS3CFG CONFIG_SYS_DA850_CS2CFG
103 
104 /*
105  * Memory Info
106  */
107 #define CONFIG_SYS_MALLOC_LEN	(0x10000 + 1*1024*1024) /* malloc() len */
108 #define PHYS_SDRAM_1		DAVINCI_DDR_EMIF_DATA_BASE /* DDR Start */
109 #define PHYS_SDRAM_1_SIZE	(128 << 20) /* SDRAM size 128MB */
110 #define CONFIG_MAX_RAM_BANK_SIZE (512 << 20) /* max size from SPRS586*/
111 
112 #define CONFIG_SYS_DA850_SYSCFG_SUSPSRC (	\
113 	DAVINCI_SYSCFG_SUSPSRC_TIMER0 |		\
114 	DAVINCI_SYSCFG_SUSPSRC_SPI1 |		\
115 	DAVINCI_SYSCFG_SUSPSRC_UART2 |		\
116 	DAVINCI_SYSCFG_SUSPSRC_EMAC |		\
117 	DAVINCI_SYSCFG_SUSPSRC_I2C)
118 
119 /* memtest start addr */
120 #define CONFIG_SYS_MEMTEST_START	(PHYS_SDRAM_1 + 0x2000000)
121 
122 /* memtest will be run on 16MB */
123 #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_MEMTEST_START + (16 << 20))
124 
125 #define CONFIG_NR_DRAM_BANKS	1 /* we have 1 bank of DRAM */
126 
127 /*
128  * Serial Driver info
129  */
130 #define CONFIG_SYS_NS16550_SERIAL
131 #define CONFIG_SYS_NS16550_REG_SIZE	-4	/* NS16550 register size */
132 #define CONFIG_SYS_NS16550_COM1	DAVINCI_UART2_BASE /* Base address of UART2 */
133 #define CONFIG_SYS_NS16550_CLK	clk_get(DAVINCI_UART2_CLKID)
134 
135 #define CONFIG_FLASH_CFI_DRIVER
136 #define CONFIG_SYS_FLASH_CFI
137 #define CONFIG_SYS_FLASH_PROTECTION
138 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
139 #define CONFIG_SYS_MAX_FLASH_BANKS  1 /* max number of flash banks */
140 #define CONFIG_SYS_FLASH_SECT_SZ    (128 << 10) /* 128KB */
141 #define CONFIG_SYS_FLASH_BASE       DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
142 #define CONFIG_ENV_SECT_SIZE        CONFIG_SYS_FLASH_SECT_SZ
143 #define CONFIG_ENV_ADDR \
144 	(CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SECT_SZ * 2)
145 #define CONFIG_ENV_SIZE             (128 << 10)
146 #define CONFIG_ENV_ADDR_REDUND      (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
147 #define CONFIG_ENV_SIZE_REDUND      CONFIG_ENV_SIZE
148 #define PHYS_FLASH_SIZE             (64 << 20) /* Flash size 64MB */
149 #define CONFIG_SYS_MAX_FLASH_SECT \
150 	((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ) + 3)
151 
152 /*
153  * Network & Ethernet Configuration
154  */
155 #ifdef CONFIG_DRIVER_TI_EMAC
156 #define CONFIG_MII
157 #define CONFIG_BOOTP_DNS2
158 #define CONFIG_BOOTP_SEND_HOSTNAME
159 #define CONFIG_NET_RETRY_COUNT	10
160 #endif
161 
162 /*
163  * U-Boot general configuration
164  */
165 #define CONFIG_BOOTFILE        "uImage" /* Boot file name */
166 #define CONFIG_SYS_CBSIZE      1024 /* Console I/O Buffer Size	*/
167 #define CONFIG_SYS_BARGSIZE    CONFIG_SYS_CBSIZE /* Boot Args Buffer Size */
168 #define CONFIG_SYS_LOAD_ADDR   (PHYS_SDRAM_1 + 0x700000)
169 #define CONFIG_LOADADDR        0xc0700000
170 #define CONFIG_MX_CYCLIC
171 
172 /*
173  * Linux Information
174  */
175 #define LINUX_BOOT_PARAM_ADDR     (PHYS_SDRAM_1 + 0x100)
176 #define CONFIG_CMDLINE_TAG
177 #define CONFIG_REVISION_TAG
178 #define CONFIG_SETUP_MEMORY_TAGS
179 #define CONFIG_BOOTCOMMAND        "run checkupdate; run checkbutton;"
180 #define CONFIG_BOOT_RETRY_TIME    60  /* continue boot after 60 s inactivity */
181 #define CONFIG_RESET_TO_RETRY
182 
183 /*
184  * Default environment settings
185  * gpio0 = button, gpio1 = led green, gpio2 = led red
186  * verify = n ... disable kernel checksum verification for faster booting
187  */
188 #define CONFIG_EXTRA_ENV_SETTINGS					\
189 	"tftpdir=calimero\0"						\
190 	"flashkernel=tftpboot $loadaddr $tftpdir/uImage; "		\
191 		"erase 0x60800000 +0x400000; "				\
192 		"cp.b $loadaddr 0x60800000 $filesize\0"			\
193 	"flashrootfs="							\
194 		"tftpboot $loadaddr $tftpdir/rootfs.jffs2; "		\
195 		"erase 0x60c00000 +0x2e00000; "				\
196 		"cp.b $loadaddr 0x60c00000 $filesize\0"			\
197 	"flashuboot=tftpboot $loadaddr $tftpdir/u-boot.bin; "		\
198 		"protect off all; "					\
199 		"erase 0x60000000 +0x80000; "				\
200 		"cp.b $loadaddr 0x60000000 $filesize\0"			\
201 	"flashrlk=tftpboot $loadaddr $tftpdir/uImage-rlk; "		\
202 		"erase 0x60080000 +0x780000; "				\
203 		"cp.b $loadaddr 0x60080000 $filesize\0"			\
204 	"erase_persistent=erase 0x63a00000 +0x600000;\0"		\
205 	"bootnor=setenv bootargs console=ttyS2,115200n8 "		\
206 		"root=/dev/mtdblock3 rw rootfstype=jffs2 "		\
207 		"rootwait ethaddr=$ethaddr; "				\
208 		"gpio c 1; gpio s 2; bootm 0x60800000\0"		\
209 	"bootrlk=gpio s 1; gpio s 2;"					\
210 		"setenv bootargs console=ttyS2,115200n8 "		\
211 		"ethaddr=$ethaddr; bootm 0x60080000\0"			\
212 	"boottftp=setenv bootargs console=ttyS2,115200n8 "		\
213 		"root=/dev/mtdblock3 rw rootfstype=jffs2 "		\
214 		"rootwait ethaddr=$ethaddr; "				\
215 		"tftpboot $loadaddr $tftpdir/uImage;"			\
216 		"gpio c 1; gpio s 2; bootm $loadaddr\0"			\
217 	"checkupdate=if test -n $update_flag; then "			\
218 		"echo Previous update failed - starting RLK; "		\
219 		"run bootrlk; fi; "					\
220 		"if test -n $initial_setup; then "			\
221 		"echo Running initial setup procedure; "		\
222 		"sleep 1; run flashall; fi\0"				\
223 	"product=accessory\0"						\
224 	"serial=XX12345\0"						\
225 	"checknor="							\
226 		"if gpio i 0; then run bootnor; fi;\0"			\
227 	"checkrlk="							\
228 		"if gpio i 0; then run bootrlk; fi;\0"			\
229 	"checkbutton="							\
230 		"run checknor; sleep 1;"				\
231 		"run checknor; sleep 1;"				\
232 		"run checknor; sleep 1;"				\
233 		"run checknor; sleep 1;"				\
234 		"run checknor;"						\
235 		"gpio s 1; gpio s 2;"					\
236 		"echo ---- Release button to boot RLK ----;"		\
237 		"run checkrlk; sleep 1;"				\
238 		"run checkrlk; sleep 1;"				\
239 		"run checkrlk; sleep 1;"				\
240 		"run checkrlk; sleep 1;"				\
241 		"run checkrlk; sleep 1;"				\
242 		"run checkrlk;"						\
243 		"echo ---- Factory reset requested ----;"		\
244 		"gpio c 1;"						\
245 		"setenv factory_reset true;"				\
246 		"saveenv;"						\
247 		"run bootnor;\0"					\
248 	"flashall=run flashrlk;"					\
249 		"run flashkernel;"					\
250 		"run flashrootfs;"					\
251 		"setenv erase_datafs true;"				\
252 		"setenv initial_setup;"					\
253 		"saveenv;"						\
254 		"run bootnor;\0"					\
255 	"verify=n\0"							\
256 	"clearenv=protect off all;"					\
257 		"erase 0x60040000 +0x40000;\0"				\
258 	"bootlimit=3\0"							\
259 	"altbootcmd=run bootrlk\0"
260 
261 #define CONFIG_PREBOOT			\
262 	"echo Version: $ver; "		\
263 	"echo Serial: $serial; "	\
264 	"echo MAC: $ethaddr; "		\
265 	"echo Product: $product; "	\
266 	"gpio c 1; gpio c 2;"
267 
268 /* additions for new relocation code, must added to all boards */
269 #define CONFIG_SYS_SDRAM_BASE		0xc0000000
270 /* initial stack pointer in internal SRAM */
271 #define CONFIG_SYS_INIT_SP_ADDR		(0x8001ff00)
272 
273 #define CONFIG_SYS_BOOTCOUNT_LE		/* Use little-endian accessors */
274 
275 #ifndef __ASSEMBLY__
276 int calimain_get_osc_freq(void);
277 #endif
278 
279 #include <asm/arch/hardware.h>
280 
281 #endif /* __CONFIG_H */
282