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