blob: 29d3bdacacbb75ceca848002135e46e6b6c17f23 [file] [log] [blame]
Christian Riesch3d908862012-02-02 00:44:42 +00001/*
Christian Riesch00247602014-06-12 08:11:53 +02002 * Copyright (C) 2011-2014 OMICRON electronics GmbH
Christian Riesch3d908862012-02-02 00:44:42 +00003 *
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 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Christian Riesch3d908862012-02-02 00:44:42 +000010 */
11
12#ifndef __CONFIG_H
13#define __CONFIG_H
14
15/*
16 * Board
17 */
18#define CONFIG_DRIVER_TI_EMAC
Christian Riesch3d908862012-02-02 00:44:42 +000019#define CONFIG_MACH_TYPE MACH_TYPE_CALIMAIN
20
21/*
22 * SoC Configuration
23 */
24#define CONFIG_MACH_DAVINCI_CALIMAIN
Christian Riesch3d908862012-02-02 00:44:42 +000025#define CONFIG_SOC_DA8XX /* TI DA8xx SoC */
26#define CONFIG_SOC_DA850 /* TI DA850 SoC */
27#define CONFIG_SYS_EXCEPTION_VECTORS_HIGH
28#define CONFIG_SYS_CLK_FREQ clk_get(DAVINCI_ARM_CLKID)
29#define CONFIG_SYS_OSCIN_FREQ calimain_get_osc_freq()
30#define CONFIG_SYS_TIMERBASE DAVINCI_TIMER0_BASE
31#define CONFIG_SYS_HZ_CLOCK clk_get(DAVINCI_AUXCLK_CLKID)
Christian Riesch3d908862012-02-02 00:44:42 +000032#define CONFIG_SYS_TEXT_BASE 0x60000000
33#define CONFIG_DA850_LOWLEVEL
Christian Riesch3d908862012-02-02 00:44:42 +000034#define CONFIG_ARCH_CPU_INIT
35#define CONFIG_DA8XX_GPIO
36#define CONFIG_HW_WATCHDOG
37#define CONFIG_SYS_WDTTIMERBASE DAVINCI_TIMER1_BASE
38#define CONFIG_SYS_WDT_PERIOD_LOW \
39 (60 * CONFIG_SYS_OSCIN_FREQ) /* 60 s heartbeat */
40#define CONFIG_SYS_WDT_PERIOD_HIGH 0x0
41#define CONFIG_SYS_DV_NOR_BOOT_CFG (0x11)
42
43/*
44 * PLL configuration
45 */
46#define CONFIG_SYS_DV_CLKMODE 0
47#define CONFIG_SYS_DA850_PLL0_POSTDIV 1
48#define CONFIG_SYS_DA850_PLL0_PLLDIV1 0x8000
49#define CONFIG_SYS_DA850_PLL0_PLLDIV2 0x8001
50#define CONFIG_SYS_DA850_PLL0_PLLDIV3 0x8002
51#define CONFIG_SYS_DA850_PLL0_PLLDIV4 0x8003
52#define CONFIG_SYS_DA850_PLL0_PLLDIV5 0x8002
53#define CONFIG_SYS_DA850_PLL0_PLLDIV6 CONFIG_SYS_DA850_PLL0_PLLDIV1
54#define CONFIG_SYS_DA850_PLL0_PLLDIV7 0x8005
55
56#define CONFIG_SYS_DA850_PLL1_POSTDIV 1
57#define CONFIG_SYS_DA850_PLL1_PLLDIV1 0x8000
58#define CONFIG_SYS_DA850_PLL1_PLLDIV2 0x8001
59#define CONFIG_SYS_DA850_PLL1_PLLDIV3 0x8002
60
61#define CONFIG_SYS_DA850_PLL0_PLLM \
62 ((calimain_get_osc_freq() == 25000000) ? 23 : 24)
63#define CONFIG_SYS_DA850_PLL1_PLLM \
64 ((calimain_get_osc_freq() == 25000000) ? 20 : 21)
65
66/*
67 * DDR2 memory configuration
68 */
69#define CONFIG_SYS_DA850_DDR2_DDRPHYCR (DV_DDR_PHY_PWRDNEN | \
70 DV_DDR_PHY_EXT_STRBEN | \
71 (0x4 << DV_DDR_PHY_RD_LATENCY_SHIFT))
72
73#define CONFIG_SYS_DA850_DDR2_SDBCR ( \
74 (1 << DV_DDR_SDCR_DDR2EN_SHIFT) | \
75 (1 << DV_DDR_SDCR_DDRDRIVE0_SHIFT) | \
76 (1 << DV_DDR_SDCR_DDREN_SHIFT) | \
77 (1 << DV_DDR_SDCR_SDRAMEN_SHIFT) | \
78 (1 << DV_DDR_SDCR_BUS_WIDTH_SHIFT) | \
79 (0x3 << DV_DDR_SDCR_CL_SHIFT) | \
80 (0x3 << DV_DDR_SDCR_IBANK_SHIFT) | \
81 (0x2 << DV_DDR_SDCR_PAGESIZE_SHIFT))
82
83/* SDBCR2 is only used if IBANK_POS bit in SDBCR is set */
84#define CONFIG_SYS_DA850_DDR2_SDBCR2 0
85
86#define CONFIG_SYS_DA850_DDR2_SDTIMR ( \
87 (16 << DV_DDR_SDTMR1_RFC_SHIFT) | \
88 (1 << DV_DDR_SDTMR1_RP_SHIFT) | \
89 (1 << DV_DDR_SDTMR1_RCD_SHIFT) | \
90 (1 << DV_DDR_SDTMR1_WR_SHIFT) | \
91 (5 << DV_DDR_SDTMR1_RAS_SHIFT) | \
92 (7 << DV_DDR_SDTMR1_RC_SHIFT) | \
93 (1 << DV_DDR_SDTMR1_RRD_SHIFT) | \
94 (1 << DV_DDR_SDTMR1_WTR_SHIFT))
95
96#define CONFIG_SYS_DA850_DDR2_SDTIMR2 ( \
97 (7 << DV_DDR_SDTMR2_RASMAX_SHIFT) | \
98 (2 << DV_DDR_SDTMR2_XP_SHIFT) | \
99 (0 << DV_DDR_SDTMR2_ODT_SHIFT) | \
100 (18 << DV_DDR_SDTMR2_XSNR_SHIFT) | \
101 (199 << DV_DDR_SDTMR2_XSRD_SHIFT) | \
102 (0 << DV_DDR_SDTMR2_RTP_SHIFT) | \
103 (2 << DV_DDR_SDTMR2_CKE_SHIFT))
104
105#define CONFIG_SYS_DA850_DDR2_SDRCR 0x000003FF
106#define CONFIG_SYS_DA850_DDR2_PBBPR 0x30
107
108/*
109 * Flash memory timing
110 */
111
112#define CONFIG_SYS_DA850_CS2CFG ( \
113 DAVINCI_ABCR_WSETUP(2) | \
114 DAVINCI_ABCR_WSTROBE(5) | \
115 DAVINCI_ABCR_WHOLD(3) | \
116 DAVINCI_ABCR_RSETUP(1) | \
117 DAVINCI_ABCR_RSTROBE(14) | \
118 DAVINCI_ABCR_RHOLD(0) | \
119 DAVINCI_ABCR_TA(3) | \
120 DAVINCI_ABCR_ASIZE_16BIT)
121
122/* single 64 MB NOR flash device connected to CS2 and CS3 */
123#define CONFIG_SYS_DA850_CS3CFG CONFIG_SYS_DA850_CS2CFG
124
125/*
126 * Memory Info
127 */
128#define CONFIG_SYS_MALLOC_LEN (0x10000 + 1*1024*1024) /* malloc() len */
129#define PHYS_SDRAM_1 DAVINCI_DDR_EMIF_DATA_BASE /* DDR Start */
130#define PHYS_SDRAM_1_SIZE (128 << 20) /* SDRAM size 128MB */
131#define CONFIG_MAX_RAM_BANK_SIZE (512 << 20) /* max size from SPRS586*/
132
133#define CONFIG_SYS_DA850_SYSCFG_SUSPSRC ( \
134 DAVINCI_SYSCFG_SUSPSRC_TIMER0 | \
135 DAVINCI_SYSCFG_SUSPSRC_SPI1 | \
136 DAVINCI_SYSCFG_SUSPSRC_UART2 | \
137 DAVINCI_SYSCFG_SUSPSRC_EMAC | \
138 DAVINCI_SYSCFG_SUSPSRC_I2C)
139
140/* memtest start addr */
141#define CONFIG_SYS_MEMTEST_START (PHYS_SDRAM_1 + 0x2000000)
142
143/* memtest will be run on 16MB */
144#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_MEMTEST_START + (16 << 20))
145
146#define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */
Christian Riesch3d908862012-02-02 00:44:42 +0000147
148/*
149 * Serial Driver info
150 */
Christian Riesch3d908862012-02-02 00:44:42 +0000151#define CONFIG_SYS_NS16550_SERIAL
152#define CONFIG_SYS_NS16550_REG_SIZE -4 /* NS16550 register size */
153#define CONFIG_SYS_NS16550_COM1 DAVINCI_UART2_BASE /* Base address of UART2 */
154#define CONFIG_SYS_NS16550_CLK clk_get(DAVINCI_UART2_CLKID)
155#define CONFIG_CONS_INDEX 1 /* use UART0 for console */
Christian Riesch3d908862012-02-02 00:44:42 +0000156
157#define CONFIG_ENV_IS_IN_FLASH
158#define CONFIG_FLASH_CFI_DRIVER
159#define CONFIG_SYS_FLASH_CFI
160#define CONFIG_SYS_FLASH_PROTECTION
161#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
162#define CONFIG_SYS_MAX_FLASH_BANKS 1 /* max number of flash banks */
163#define CONFIG_SYS_FLASH_SECT_SZ (128 << 10) /* 128KB */
164#define CONFIG_SYS_FLASH_BASE DAVINCI_ASYNC_EMIF_DATA_CE2_BASE
165#define CONFIG_ENV_SECT_SIZE CONFIG_SYS_FLASH_SECT_SZ
166#define CONFIG_ENV_ADDR \
167 (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_FLASH_SECT_SZ * 2)
168#define CONFIG_ENV_SIZE (128 << 10)
169#define CONFIG_ENV_ADDR_REDUND (CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE)
170#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE
171#define PHYS_FLASH_SIZE (64 << 20) /* Flash size 64MB */
172#define CONFIG_SYS_MAX_FLASH_SECT \
173 ((PHYS_FLASH_SIZE/CONFIG_SYS_FLASH_SECT_SZ) + 3)
174
175/*
176 * Network & Ethernet Configuration
177 */
178#ifdef CONFIG_DRIVER_TI_EMAC
Christian Riesch3d908862012-02-02 00:44:42 +0000179#define CONFIG_MII
Christian Riesch3d908862012-02-02 00:44:42 +0000180#define CONFIG_BOOTP_DNS
181#define CONFIG_BOOTP_DNS2
182#define CONFIG_BOOTP_SEND_HOSTNAME
183#define CONFIG_NET_RETRY_COUNT 10
184#endif
185
186/*
187 * U-Boot general configuration
188 */
189#define CONFIG_BOOTFILE "uImage" /* Boot file name */
Christian Riesch3d908862012-02-02 00:44:42 +0000190#define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size */
191#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16)
192#define CONFIG_SYS_MAXARGS 16 /* max number of command args */
193#define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE /* Boot Args Buffer Size */
194#define CONFIG_SYS_LOAD_ADDR (PHYS_SDRAM_1 + 0x700000)
195#define CONFIG_LOADADDR 0xc0700000
Christian Riesch3d908862012-02-02 00:44:42 +0000196#define CONFIG_AUTO_COMPLETE
Christian Riesch3d908862012-02-02 00:44:42 +0000197#define CONFIG_CMDLINE_EDITING
198#define CONFIG_SYS_LONGHELP
Christian Riesch3d908862012-02-02 00:44:42 +0000199#define CONFIG_MX_CYCLIC
200
201/*
202 * Linux Information
203 */
204#define LINUX_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
205#define CONFIG_CMDLINE_TAG
206#define CONFIG_REVISION_TAG
207#define CONFIG_SETUP_MEMORY_TAGS
208#define CONFIG_BOOTARGS ""
209#define CONFIG_BOOTCOMMAND "run checkupdate; run checkbutton;"
Christian Riesch3d908862012-02-02 00:44:42 +0000210#define CONFIG_BOOT_RETRY_TIME 60 /* continue boot after 60 s inactivity */
Christian Riesch3d908862012-02-02 00:44:42 +0000211#define CONFIG_RESET_TO_RETRY
212
213/*
214 * Default environment settings
215 * gpio0 = button, gpio1 = led green, gpio2 = led red
216 * verify = n ... disable kernel checksum verification for faster booting
217 */
218#define CONFIG_EXTRA_ENV_SETTINGS \
219 "tftpdir=calimero\0" \
220 "flashkernel=tftpboot $loadaddr $tftpdir/uImage; " \
221 "erase 0x60800000 +0x400000; " \
222 "cp.b $loadaddr 0x60800000 $filesize\0" \
223 "flashrootfs=" \
224 "tftpboot $loadaddr $tftpdir/rootfs.jffs2; " \
225 "erase 0x60c00000 +0x2e00000; " \
226 "cp.b $loadaddr 0x60c00000 $filesize\0" \
227 "flashuboot=tftpboot $loadaddr $tftpdir/u-boot.bin; " \
228 "protect off all; " \
229 "erase 0x60000000 +0x80000; " \
230 "cp.b $loadaddr 0x60000000 $filesize\0" \
231 "flashrlk=tftpboot $loadaddr $tftpdir/uImage-rlk; " \
232 "erase 0x60080000 +0x780000; " \
233 "cp.b $loadaddr 0x60080000 $filesize\0" \
234 "erase_persistent=erase 0x63a00000 +0x600000;\0" \
235 "bootnor=setenv bootargs console=ttyS2,115200n8 " \
236 "root=/dev/mtdblock3 rw rootfstype=jffs2 " \
237 "rootwait ethaddr=$ethaddr; " \
238 "gpio c 1; gpio s 2; bootm 0x60800000\0" \
239 "bootrlk=gpio s 1; gpio s 2;" \
240 "setenv bootargs console=ttyS2,115200n8 " \
241 "ethaddr=$ethaddr; bootm 0x60080000\0" \
242 "boottftp=setenv bootargs console=ttyS2,115200n8 " \
243 "root=/dev/mtdblock3 rw rootfstype=jffs2 " \
244 "rootwait ethaddr=$ethaddr; " \
245 "tftpboot $loadaddr $tftpdir/uImage;" \
246 "gpio c 1; gpio s 2; bootm $loadaddr\0" \
247 "checkupdate=if test -n $update_flag; then " \
248 "echo Previous update failed - starting RLK; " \
249 "run bootrlk; fi; " \
250 "if test -n $initial_setup; then " \
251 "echo Running initial setup procedure; " \
252 "sleep 1; run flashall; fi\0" \
253 "product=accessory\0" \
254 "serial=XX12345\0" \
255 "checknor=" \
256 "if gpio i 0; then run bootnor; fi;\0" \
257 "checkrlk=" \
258 "if gpio i 0; then run bootrlk; fi;\0" \
259 "checkbutton=" \
260 "run checknor; sleep 1;" \
261 "run checknor; sleep 1;" \
262 "run checknor; sleep 1;" \
263 "run checknor; sleep 1;" \
264 "run checknor;" \
265 "gpio s 1; gpio s 2;" \
266 "echo ---- Release button to boot RLK ----;" \
267 "run checkrlk; sleep 1;" \
268 "run checkrlk; sleep 1;" \
269 "run checkrlk; sleep 1;" \
270 "run checkrlk; sleep 1;" \
271 "run checkrlk; sleep 1;" \
272 "run checkrlk;" \
273 "echo ---- Factory reset requested ----;" \
274 "gpio c 1;" \
275 "setenv factory_reset true;" \
276 "saveenv;" \
277 "run bootnor;\0" \
278 "flashall=run flashrlk;" \
279 "run flashkernel;" \
280 "run flashrootfs;" \
281 "setenv erase_datafs true;" \
282 "setenv initial_setup;" \
283 "saveenv;" \
284 "run bootnor;\0" \
285 "verify=n\0" \
286 "clearenv=protect off all;" \
287 "erase 0x60040000 +0x40000;\0" \
288 "bootlimit=3\0" \
289 "altbootcmd=run bootrlk\0"
290
291#define CONFIG_PREBOOT \
292 "echo Version: $ver; " \
293 "echo Serial: $serial; " \
294 "echo MAC: $ethaddr; " \
295 "echo Product: $product; " \
296 "gpio c 1; gpio c 2;"
297
298/*
299 * U-Boot commands
300 */
Christian Riesch3d908862012-02-02 00:44:42 +0000301#define CONFIG_CMD_SAVES
Christian Riesch3d908862012-02-02 00:44:42 +0000302
303#ifndef CONFIG_DRIVER_TI_EMAC
Christian Riesch3d908862012-02-02 00:44:42 +0000304#endif
305
306/* additions for new relocation code, must added to all boards */
307#define CONFIG_SYS_SDRAM_BASE 0xc0000000
308/* initial stack pointer in internal SRAM */
309#define CONFIG_SYS_INIT_SP_ADDR (0x8001ff00)
310
311#define CONFIG_BOOTCOUNT_LIMIT
Stefan Roese033848e2012-08-16 17:55:41 +0000312#define CONFIG_SYS_BOOTCOUNT_LE /* Use little-endian accessors */
Christian Riesch3d908862012-02-02 00:44:42 +0000313#define CONFIG_SYS_BOOTCOUNT_ADDR DAVINCI_RTC_BASE
314
315#ifndef __ASSEMBLY__
316int calimain_get_osc_freq(void);
317#endif
318
319#endif /* __CONFIG_H */