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