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