Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2012 Altera Corporation <www.altera.com> |
| 3 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 5 | */ |
| 6 | #ifndef __CONFIG_H |
| 7 | #define __CONFIG_H |
| 8 | |
| 9 | #include <asm/arch/socfpga_base_addrs.h> |
Chin Liang See | 70fa4e7 | 2013-09-11 11:24:48 -0500 | [diff] [blame] | 10 | #include "../../board/altera/socfpga/pinmux_config.h" |
Chin Liang See | 6355024 | 2014-06-10 01:17:42 -0500 | [diff] [blame] | 11 | #include "../../board/altera/socfpga/iocsr_config.h" |
Chin Liang See | cb35060 | 2014-03-04 22:13:53 -0600 | [diff] [blame] | 12 | #include "../../board/altera/socfpga/pll_config.h" |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 13 | |
| 14 | /* |
| 15 | * High level configuration |
| 16 | */ |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 17 | /* Virtual target or real hardware */ |
Chin Liang See | 112cb0d | 2014-07-22 04:28:35 -0500 | [diff] [blame] | 18 | #undef CONFIG_SOCFPGA_VIRTUAL_TARGET |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 19 | |
| 20 | #define CONFIG_ARMV7 |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 21 | #define CONFIG_SYS_DCACHE_OFF |
| 22 | #undef CONFIG_USE_IRQ |
| 23 | |
| 24 | #define CONFIG_MISC_INIT_R |
| 25 | #define CONFIG_SINGLE_BOOTLOADER |
| 26 | #define CONFIG_SOCFPGA |
Pavel Machek | 7c8d5a6 | 2014-09-08 14:08:45 +0200 | [diff] [blame] | 27 | #define CONFIG_CLOCKS |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 28 | |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 29 | /* base address for .text section */ |
| 30 | #ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 31 | #define CONFIG_SYS_TEXT_BASE 0x08000040 |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 32 | #else |
| 33 | #define CONFIG_SYS_TEXT_BASE 0x01000040 |
| 34 | #endif |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 35 | #define CONFIG_SYS_LOAD_ADDR 0x7fc0 |
| 36 | |
| 37 | /* Console I/O Buffer Size */ |
| 38 | #define CONFIG_SYS_CBSIZE 256 |
| 39 | /* Monitor Command Prompt */ |
| 40 | #define CONFIG_SYS_PROMPT "SOCFPGA_CYCLONE5 # " |
| 41 | #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ |
| 42 | sizeof(CONFIG_SYS_PROMPT) + 16) |
| 43 | |
| 44 | /* |
| 45 | * Display CPU and Board Info |
| 46 | */ |
| 47 | #define CONFIG_DISPLAY_CPUINFO |
| 48 | #define CONFIG_DISPLAY_BOARDINFO |
| 49 | |
| 50 | /* |
| 51 | * Enable early stage initialization at C environment |
| 52 | */ |
| 53 | #define CONFIG_BOARD_EARLY_INIT_F |
| 54 | |
| 55 | /* flat device tree */ |
| 56 | #define CONFIG_OF_LIBFDT |
| 57 | /* skip updating the FDT blob */ |
| 58 | #define CONFIG_FDT_BLOB_SKIP_UPDATE |
| 59 | /* Initial Memory map size for Linux, minus 4k alignment for DFT blob */ |
| 60 | #define CONFIG_SYS_BOOTMAPSZ ((256*1024*1024) - (4*1024)) |
| 61 | |
| 62 | #define CONFIG_SPL_RAM_DEVICE |
Albert ARIBAUD | facdae5 | 2013-01-08 10:18:02 +0000 | [diff] [blame] | 63 | #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 64 | #define CONFIG_SYS_SPL_MALLOC_START ((unsigned long) (&__malloc_start)) |
| 65 | #define CONFIG_SYS_SPL_MALLOC_SIZE (&__malloc_end - &__malloc_start) |
| 66 | |
| 67 | /* |
| 68 | * Memory allocation (MALLOC) |
| 69 | */ |
| 70 | /* Room required on the stack for the environment data */ |
| 71 | #define CONFIG_ENV_SIZE 1024 |
| 72 | /* Size of DRAM reserved for malloc() use */ |
| 73 | #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 128*1024) |
| 74 | |
| 75 | /* SP location before relocation, must use scratch RAM */ |
| 76 | #define CONFIG_SYS_INIT_RAM_ADDR 0xFFFF0000 |
| 77 | /* Reserving 0x100 space at back of scratch RAM for debug info */ |
| 78 | #define CONFIG_SYS_INIT_RAM_SIZE (0x10000 - 0x100) |
| 79 | /* Stack pointer prior relocation, must situated at on-chip RAM */ |
| 80 | #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \ |
| 81 | CONFIG_SYS_INIT_RAM_SIZE - \ |
| 82 | GENERATED_GBL_DATA_SIZE) |
| 83 | |
| 84 | |
| 85 | /* |
| 86 | * Command line configuration. |
| 87 | */ |
| 88 | #define CONFIG_SYS_NO_FLASH |
| 89 | #include <config_cmd_default.h> |
| 90 | /* FAT file system support */ |
| 91 | #define CONFIG_CMD_FAT |
| 92 | |
| 93 | |
| 94 | /* |
| 95 | * Misc |
| 96 | */ |
| 97 | #define CONFIG_DOS_PARTITION 1 |
| 98 | |
| 99 | #ifdef CONFIG_SPL_BUILD |
| 100 | #undef CONFIG_PARTITIONS |
| 101 | #endif |
| 102 | |
| 103 | /* |
| 104 | * Environment setup |
| 105 | */ |
| 106 | |
| 107 | /* Delay before automatically booting the default image */ |
| 108 | #define CONFIG_BOOTDELAY 3 |
| 109 | /* Enable auto completion of commands using TAB */ |
| 110 | #define CONFIG_AUTO_COMPLETE |
| 111 | /* use "hush" command parser */ |
| 112 | #define CONFIG_SYS_HUSH_PARSER |
| 113 | #define CONFIG_SYS_PROMPT_HUSH_PS2 "> " |
| 114 | #define CONFIG_CMD_RUN |
| 115 | |
| 116 | #define CONFIG_BOOTCOMMAND "run ramboot" |
| 117 | |
| 118 | /* |
| 119 | * arguments passed to the bootm command. The value of |
| 120 | * CONFIG_BOOTARGS goes into the environment value "bootargs". |
| 121 | * Do note the value will overide also the chosen node in FDT blob. |
| 122 | */ |
| 123 | #define CONFIG_BOOTARGS "console=ttyS0,57600,mem=256M@0x0" |
| 124 | |
| 125 | #define CONFIG_EXTRA_ENV_SETTINGS \ |
| 126 | "verify=n\0" \ |
Marek Vasut | 0b3176c | 2012-09-23 17:41:24 +0200 | [diff] [blame] | 127 | "loadaddr= " __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \ |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 128 | "ramboot=setenv bootargs " CONFIG_BOOTARGS ";" \ |
| 129 | "bootm ${loadaddr} - ${fdt_addr}\0" \ |
| 130 | "bootimage=uImage\0" \ |
| 131 | "fdt_addr=100\0" \ |
| 132 | "fsloadcmd=ext2load\0" \ |
| 133 | "bootm ${loadaddr} - ${fdt_addr}\0" \ |
| 134 | "qspiroot=/dev/mtdblock0\0" \ |
| 135 | "qspirootfstype=jffs2\0" \ |
| 136 | "qspiboot=setenv bootargs " CONFIG_BOOTARGS \ |
| 137 | " root=${qspiroot} rw rootfstype=${qspirootfstype};"\ |
| 138 | "bootm ${loadaddr} - ${fdt_addr}\0" |
| 139 | |
| 140 | /* using environment setting for stdin, stdout, stderr */ |
| 141 | #define CONFIG_SYS_CONSOLE_IS_IN_ENV |
| 142 | /* Enable the call to overwrite_console() */ |
| 143 | #define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE |
| 144 | /* Enable overwrite of previous console environment settings */ |
| 145 | #define CONFIG_SYS_CONSOLE_ENV_OVERWRITE |
| 146 | |
| 147 | /* max number of command args */ |
| 148 | #define CONFIG_SYS_MAXARGS 16 |
| 149 | |
| 150 | |
| 151 | /* |
| 152 | * Hardware drivers |
| 153 | */ |
| 154 | |
| 155 | /* |
| 156 | * SDRAM Memory Map |
| 157 | */ |
| 158 | /* We have 1 bank of DRAM */ |
| 159 | #define CONFIG_NR_DRAM_BANKS 1 |
| 160 | /* SDRAM Bank #1 */ |
| 161 | #define CONFIG_SYS_SDRAM_BASE 0x00000000 |
| 162 | /* SDRAM memory size */ |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 163 | #define PHYS_SDRAM_1_SIZE 0x40000000 |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 164 | |
| 165 | #define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE |
| 166 | #define CONFIG_SYS_MEMTEST_START 0x00000000 |
| 167 | #define CONFIG_SYS_MEMTEST_END PHYS_SDRAM_1_SIZE |
| 168 | |
| 169 | /* |
| 170 | * NS16550 Configuration |
| 171 | */ |
| 172 | #define UART0_BASE SOCFPGA_UART0_ADDRESS |
| 173 | #define CONFIG_SYS_NS16550 |
| 174 | #define CONFIG_SYS_NS16550_SERIAL |
| 175 | #define CONFIG_SYS_NS16550_REG_SIZE -4 |
| 176 | #define CONFIG_SYS_NS16550_CLK V_NS16550_CLK |
| 177 | #define CONFIG_CONS_INDEX 1 |
| 178 | #define CONFIG_SYS_NS16550_COM1 UART0_BASE |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 179 | #define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600, 115200} |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 180 | #ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET |
| 181 | #define V_NS16550_CLK 1000000 |
| 182 | #else |
| 183 | #define V_NS16550_CLK 100000000 |
| 184 | #endif |
| 185 | #define CONFIG_BAUDRATE 115200 |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 186 | |
| 187 | /* |
| 188 | * FLASH |
| 189 | */ |
| 190 | #define CONFIG_SYS_NO_FLASH |
| 191 | |
| 192 | /* |
| 193 | * L4 OSC1 Timer 0 |
| 194 | */ |
| 195 | /* This timer use eosc1 where the clock frequency is fixed |
| 196 | * throughout any condition */ |
| 197 | #define CONFIG_SYS_TIMERBASE SOCFPGA_OSC1TIMER0_ADDRESS |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 198 | /* Timer info */ |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 199 | #ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET |
Rob Herring | 55d2326 | 2013-10-04 10:22:46 -0500 | [diff] [blame] | 200 | #define CONFIG_SYS_TIMER_RATE 2400000 |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 201 | #else |
Rob Herring | 55d2326 | 2013-10-04 10:22:46 -0500 | [diff] [blame] | 202 | #define CONFIG_SYS_TIMER_RATE 25000000 |
Chin Liang See | 9cd1204 | 2013-08-07 10:06:56 -0500 | [diff] [blame] | 203 | #endif |
Pavel Machek | 3f8ee65 | 2014-07-13 13:10:45 +0200 | [diff] [blame] | 204 | #define CONFIG_SYS_TIMER_COUNTS_DOWN |
Rob Herring | 55d2326 | 2013-10-04 10:22:46 -0500 | [diff] [blame] | 205 | #define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMERBASE + 0x4) |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 206 | |
| 207 | #define CONFIG_ENV_IS_NOWHERE |
| 208 | |
| 209 | /* |
Pavel Machek | ce340e9 | 2014-07-14 14:14:17 +0200 | [diff] [blame] | 210 | * network support |
| 211 | */ |
| 212 | #ifndef CONFIG_SOCFPGA_VIRTUAL_TARGET |
| 213 | #define CONFIG_DESIGNWARE_ETH 1 |
| 214 | #endif |
| 215 | |
| 216 | #ifdef CONFIG_DESIGNWARE_ETH |
| 217 | #define CONFIG_EMAC0_BASE SOCFPGA_EMAC0_ADDRESS |
| 218 | #define CONFIG_EMAC1_BASE SOCFPGA_EMAC1_ADDRESS |
| 219 | /* console support for network */ |
| 220 | #define CONFIG_CMD_DHCP |
| 221 | #define CONFIG_CMD_MII |
| 222 | #define CONFIG_CMD_NET |
| 223 | #define CONFIG_CMD_PING |
| 224 | /* designware */ |
| 225 | #define CONFIG_NET_MULTI |
| 226 | #define CONFIG_DW_ALTDESCRIPTOR |
Pavel Machek | ce340e9 | 2014-07-14 14:14:17 +0200 | [diff] [blame] | 227 | #define CONFIG_MII |
| 228 | #define CONFIG_PHY_GIGE |
| 229 | #define CONFIG_DW_AUTONEG |
| 230 | #define CONFIG_AUTONEG_TIMEOUT (15 * CONFIG_SYS_HZ) |
| 231 | #define CONFIG_PHYLIB |
| 232 | #define CONFIG_PHY_MICREL |
| 233 | #define CONFIG_PHY_MICREL_KSZ9021 |
| 234 | /* EMAC controller and PHY used */ |
| 235 | #define CONFIG_EMAC_BASE CONFIG_EMAC1_BASE |
| 236 | #define CONFIG_EPHY_PHY_ADDR CONFIG_EPHY1_PHY_ADDR |
| 237 | #define CONFIG_PHY_INTERFACE_MODE PHY_INTERFACE_MODE_RGMII |
| 238 | #endif /* CONFIG_DESIGNWARE_ETH */ |
| 239 | |
| 240 | /* |
Chin Liang See | 561c9d4 | 2014-06-10 01:11:04 -0500 | [diff] [blame] | 241 | * L4 Watchdog |
| 242 | */ |
| 243 | #define CONFIG_HW_WATCHDOG |
| 244 | #define CONFIG_HW_WATCHDOG_TIMEOUT_MS 2000 |
| 245 | #define CONFIG_DESIGNWARE_WATCHDOG |
| 246 | #define CONFIG_DW_WDT_BASE SOCFPGA_L4WD0_ADDRESS |
| 247 | /* Clocks source frequency to watchdog timer */ |
| 248 | #define CONFIG_DW_WDT_CLOCK_KHZ 25000 |
| 249 | |
| 250 | |
| 251 | /* |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 252 | * SPL "Second Program Loader" aka Initial Software |
| 253 | */ |
| 254 | |
| 255 | /* Enable building of SPL globally */ |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 256 | #define CONFIG_SPL_FRAMEWORK |
| 257 | |
| 258 | /* TEXT_BASE for linking the SPL binary */ |
| 259 | #define CONFIG_SPL_TEXT_BASE 0xFFFF0000 |
| 260 | |
| 261 | /* Stack size for SPL */ |
| 262 | #define CONFIG_SPL_STACK_SIZE (4 * 1024) |
| 263 | |
| 264 | /* MALLOC size for SPL */ |
| 265 | #define CONFIG_SPL_MALLOC_SIZE (5 * 1024) |
| 266 | |
| 267 | #define CONFIG_SPL_SERIAL_SUPPORT |
| 268 | #define CONFIG_SPL_BOARD_INIT |
| 269 | |
| 270 | #define CHUNKSZ_CRC32 (1 * 1024) |
| 271 | |
| 272 | #define CONFIG_CRC32_VERIFY |
| 273 | |
| 274 | /* Linker script for SPL */ |
| 275 | #define CONFIG_SPL_LDSCRIPT "arch/arm/cpu/armv7/socfpga/u-boot-spl.lds" |
| 276 | |
| 277 | /* Support for common/libcommon.o in SPL binary */ |
| 278 | #define CONFIG_SPL_LIBCOMMON_SUPPORT |
| 279 | /* Support for lib/libgeneric.o in SPL binary */ |
| 280 | #define CONFIG_SPL_LIBGENERIC_SUPPORT |
| 281 | |
Chin Liang See | 561c9d4 | 2014-06-10 01:11:04 -0500 | [diff] [blame] | 282 | /* Support for watchdog */ |
| 283 | #define CONFIG_SPL_WATCHDOG_SUPPORT |
| 284 | |
Dinh Nguyen | ad51f7c | 2012-10-04 06:46:02 +0000 | [diff] [blame] | 285 | #endif /* __CONFIG_H */ |