Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Configuration settings for the SAMA5D4EK board. |
| 3 | * |
| 4 | * Copyright (C) 2014 Atmel |
| 5 | * Bo Shen <voice.shen@atmel.com> |
| 6 | * |
| 7 | * SPDX-License-Identifier: GPL-2.0+ |
| 8 | */ |
| 9 | |
| 10 | #ifndef __CONFIG_H |
| 11 | #define __CONFIG_H |
| 12 | |
| 13 | #include <asm/hardware.h> |
| 14 | |
| 15 | #define CONFIG_SYS_TEXT_BASE 0x26f00000 |
| 16 | |
| 17 | /* ARM asynchronous clock */ |
| 18 | #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 |
| 19 | #define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ |
| 20 | |
| 21 | #define CONFIG_ARCH_CPU_INIT |
| 22 | |
Bo Shen | 05f9563 | 2014-12-15 13:24:38 +0800 | [diff] [blame] | 23 | #ifndef CONFIG_SPL_BUILD |
Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 24 | #define CONFIG_SKIP_LOWLEVEL_INIT |
Bo Shen | 05f9563 | 2014-12-15 13:24:38 +0800 | [diff] [blame] | 25 | #endif |
Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 26 | #define CONFIG_BOARD_EARLY_INIT_F |
| 27 | #define CONFIG_DISPLAY_CPUINFO |
| 28 | |
| 29 | #define CONFIG_CMD_BOOTZ |
| 30 | #define CONFIG_OF_LIBFDT /* Device Tree support */ |
| 31 | |
| 32 | #define CONFIG_SYS_GENERIC_BOARD |
| 33 | |
| 34 | /* general purpose I/O */ |
| 35 | #define CONFIG_AT91_GPIO |
| 36 | |
| 37 | /* serial console */ |
| 38 | #define CONFIG_ATMEL_USART |
| 39 | #define CONFIG_USART_BASE ATMEL_BASE_USART3 |
| 40 | #define CONFIG_USART_ID ATMEL_ID_USART3 |
| 41 | |
| 42 | #define CONFIG_BOOTDELAY 3 |
| 43 | |
| 44 | /* |
| 45 | * BOOTP options |
| 46 | */ |
| 47 | #define CONFIG_BOOTP_BOOTFILESIZE |
| 48 | #define CONFIG_BOOTP_BOOTPATH |
| 49 | #define CONFIG_BOOTP_GATEWAY |
| 50 | #define CONFIG_BOOTP_HOSTNAME |
| 51 | |
| 52 | /* No NOR flash */ |
| 53 | #define CONFIG_SYS_NO_FLASH |
| 54 | |
| 55 | /* |
| 56 | * Command line configuration. |
| 57 | */ |
| 58 | #include <config_cmd_default.h> |
| 59 | #undef CONFIG_CMD_FPGA |
| 60 | #undef CONFIG_CMD_IMI |
| 61 | #undef CONFIG_CMD_LOADS |
| 62 | #define CONFIG_CMD_PING |
| 63 | #define CONFIG_CMD_DHCP |
| 64 | #define CONFIG_CMD_SETEXPR |
| 65 | |
| 66 | /* SDRAM */ |
| 67 | #define CONFIG_NR_DRAM_BANKS 1 |
| 68 | #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS |
| 69 | #define CONFIG_SYS_SDRAM_SIZE 0x20000000 |
| 70 | |
Bo Shen | 05f9563 | 2014-12-15 13:24:38 +0800 | [diff] [blame] | 71 | #ifdef CONFIG_SPL_BUILD |
| 72 | #define CONFIG_SYS_INIT_SP_ADDR 0x210000 |
| 73 | #else |
Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 74 | #define CONFIG_SYS_INIT_SP_ADDR \ |
| 75 | (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) |
Bo Shen | 05f9563 | 2014-12-15 13:24:38 +0800 | [diff] [blame] | 76 | #endif |
Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 77 | |
| 78 | #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ |
| 79 | |
| 80 | /* SerialFlash */ |
| 81 | #define CONFIG_CMD_SF |
| 82 | |
| 83 | #ifdef CONFIG_CMD_SF |
| 84 | #define CONFIG_ATMEL_SPI |
| 85 | #define CONFIG_ATMEL_SPI0 |
| 86 | #define CONFIG_SPI_FLASH |
| 87 | #define CONFIG_SPI_FLASH_ATMEL |
| 88 | #define CONFIG_SF_DEFAULT_BUS 0 |
| 89 | #define CONFIG_SF_DEFAULT_CS 0 |
| 90 | #define CONFIG_SF_DEFAULT_SPEED 30000000 |
| 91 | #endif |
| 92 | |
| 93 | /* NAND flash */ |
| 94 | #define CONFIG_CMD_NAND |
| 95 | |
| 96 | #ifdef CONFIG_CMD_NAND |
| 97 | #define CONFIG_NAND_ATMEL |
| 98 | #define CONFIG_SYS_MAX_NAND_DEVICE 1 |
| 99 | #define CONFIG_SYS_NAND_BASE ATMEL_BASE_CS3 |
| 100 | /* our ALE is AD21 */ |
| 101 | #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) |
| 102 | /* our CLE is AD22 */ |
| 103 | #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) |
| 104 | #define CONFIG_SYS_NAND_ONFI_DETECTION |
| 105 | /* PMECC & PMERRLOC */ |
| 106 | #define CONFIG_ATMEL_NAND_HWECC |
| 107 | #define CONFIG_ATMEL_NAND_HW_PMECC |
| 108 | #endif |
| 109 | |
| 110 | /* MMC */ |
| 111 | #define CONFIG_CMD_MMC |
| 112 | |
| 113 | #ifdef CONFIG_CMD_MMC |
| 114 | #define CONFIG_MMC |
| 115 | #define CONFIG_GENERIC_MMC |
| 116 | #define CONFIG_GENERIC_ATMEL_MCI |
| 117 | #define ATMEL_BASE_MMCI ATMEL_BASE_MCI1 |
| 118 | #endif |
| 119 | |
| 120 | /* USB */ |
| 121 | #define CONFIG_CMD_USB |
| 122 | |
| 123 | #ifdef CONFIG_CMD_USB |
| 124 | #define CONFIG_USB_EHCI |
| 125 | #define CONFIG_USB_EHCI_ATMEL |
| 126 | #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 |
| 127 | #define CONFIG_USB_STORAGE |
| 128 | #endif |
| 129 | |
Bo Shen | 35ad5e3 | 2014-12-03 18:02:21 +0800 | [diff] [blame] | 130 | /* USB device */ |
| 131 | #define CONFIG_USB_GADGET |
| 132 | #define CONFIG_USB_GADGET_DUALSPEED |
| 133 | #define CONFIG_USB_GADGET_ATMEL_USBA |
| 134 | #define CONFIG_USB_ETHER |
| 135 | #define CONFIG_USB_ETH_RNDIS |
| 136 | #define CONFIG_USBNET_MANUFACTURER "Atmel SAMA5D4EK" |
| 137 | |
Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 138 | #if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC) |
| 139 | #define CONFIG_CMD_FAT |
| 140 | #define CONFIG_DOS_PARTITION |
| 141 | #endif |
| 142 | |
| 143 | /* Ethernet Hardware */ |
| 144 | #define CONFIG_MACB |
| 145 | #define CONFIG_RMII |
| 146 | #define CONFIG_NET_RETRY_COUNT 20 |
| 147 | #define CONFIG_MACB_SEARCH_PHY |
| 148 | |
| 149 | /* LCD */ |
| 150 | #define CONFIG_LCD |
| 151 | #define LCD_BPP LCD_COLOR16 |
| 152 | #define LCD_OUTPUT_BPP 18 |
| 153 | #define CONFIG_LCD_LOGO |
| 154 | #define CONFIG_LCD_INFO |
| 155 | #define CONFIG_LCD_INFO_BELOW_LOGO |
| 156 | #define CONFIG_SYS_WHITE_ON_BLACK |
| 157 | #define CONFIG_ATMEL_HLCD |
| 158 | #define CONFIG_ATMEL_LCD_RGB565 |
| 159 | #define CONFIG_SYS_CONSOLE_IS_IN_ENV |
| 160 | |
| 161 | #ifdef CONFIG_SYS_USE_SERIALFLASH |
| 162 | /* bootstrap + u-boot + env + linux in serial flash */ |
| 163 | #define CONFIG_ENV_IS_IN_SPI_FLASH |
| 164 | #define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS |
| 165 | #define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS |
| 166 | #define CONFIG_ENV_OFFSET 0x10000 |
| 167 | #define CONFIG_ENV_SIZE 0x10000 |
| 168 | #define CONFIG_ENV_SECT_SIZE 0x1000 |
| 169 | #define CONFIG_BOOTCOMMAND "sf probe 0; " \ |
| 170 | "sf read 0x21000000 0xa0000 0x60000; " \ |
| 171 | "sf read 0x22000000 0x100000 0x300000; " \ |
| 172 | "bootz 0x22000000 - 0x21000000" |
| 173 | #elif CONFIG_SYS_USE_NANDFLASH |
| 174 | /* bootstrap + u-boot + env in nandflash */ |
| 175 | #define CONFIG_ENV_IS_IN_NAND |
| 176 | #define CONFIG_ENV_OFFSET 0xc0000 |
| 177 | #define CONFIG_ENV_OFFSET_REDUND 0x100000 |
| 178 | #define CONFIG_ENV_SIZE 0x20000 |
| 179 | #define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ |
| 180 | "nand read 0x22000000 0x200000 0x600000;" \ |
| 181 | "bootz 0x22000000 - 0x21000000" |
| 182 | #elif CONFIG_SYS_USE_MMC |
| 183 | /* bootstrap + u-boot + env in sd card */ |
| 184 | #define CONFIG_ENV_IS_IN_FAT |
| 185 | #define CONFIG_FAT_WRITE |
| 186 | #define FAT_ENV_INTERFACE "mmc" |
| 187 | /* |
| 188 | * We don't specify the part number, if device 0 has partition table, it means |
| 189 | * the first partition; it no partition table, then take whole device as a |
| 190 | * FAT file system. |
| 191 | */ |
| 192 | #define FAT_ENV_DEVICE_AND_PART "0" |
| 193 | #define FAT_ENV_FILE "uboot.env" |
| 194 | #define CONFIG_ENV_SIZE 0x4000 |
| 195 | #define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 sama5d4ek.dtb; " \ |
| 196 | "fatload mmc 0:1 0x22000000 zImage; " \ |
| 197 | "bootz 0x22000000 - 0x21000000" |
| 198 | #endif |
| 199 | |
| 200 | #ifdef CONFIG_SYS_USE_MMC |
| 201 | #define CONFIG_BOOTARGS \ |
| 202 | "console=ttyS0,115200 earlyprintk " \ |
| 203 | "root=/dev/mmcblk0p2 rw rootwait" |
| 204 | #else |
| 205 | #define CONFIG_BOOTARGS \ |
| 206 | "console=ttyS0,115200 earlyprintk " \ |
| 207 | "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ |
| 208 | "256K(env),256k(evn_redundent),256k(spare)," \ |
| 209 | "512k(dtb),6M(kernel)ro,-(rootfs) " \ |
| 210 | "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" |
| 211 | #endif |
| 212 | |
| 213 | #define CONFIG_BAUDRATE 115200 |
| 214 | |
| 215 | #define CONFIG_SYS_PROMPT "U-Boot> " |
| 216 | #define CONFIG_SYS_CBSIZE 256 |
| 217 | #define CONFIG_SYS_MAXARGS 16 |
| 218 | #define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ |
| 219 | sizeof(CONFIG_SYS_PROMPT) + 16) |
| 220 | #define CONFIG_SYS_LONGHELP |
| 221 | #define CONFIG_CMDLINE_EDITING |
| 222 | #define CONFIG_AUTO_COMPLETE |
| 223 | #define CONFIG_SYS_HUSH_PARSER |
| 224 | |
| 225 | /* Size of malloc() pool */ |
| 226 | #define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) |
| 227 | |
Bo Shen | 05f9563 | 2014-12-15 13:24:38 +0800 | [diff] [blame] | 228 | |
| 229 | /* SPL */ |
| 230 | #define CONFIG_SPL_FRAMEWORK |
| 231 | #define CONFIG_SPL_TEXT_BASE 0x200000 |
| 232 | #define CONFIG_SPL_MAX_SIZE 0x10000 |
| 233 | #define CONFIG_SPL_BSS_START_ADDR 0x20000000 |
| 234 | #define CONFIG_SPL_BSS_MAX_SIZE 0x80000 |
| 235 | #define CONFIG_SYS_SPL_MALLOC_START 0x20080000 |
| 236 | #define CONFIG_SYS_SPL_MALLOC_SIZE 0x80000 |
| 237 | |
| 238 | #define CONFIG_SPL_LIBCOMMON_SUPPORT |
| 239 | #define CONFIG_SPL_LIBGENERIC_SUPPORT |
| 240 | #define CONFIG_SPL_GPIO_SUPPORT |
| 241 | #define CONFIG_SPL_SERIAL_SUPPORT |
| 242 | |
| 243 | #define CONFIG_SPL_BOARD_INIT |
| 244 | #define CONFIG_SYS_MONITOR_LEN (512 << 10) |
| 245 | |
| 246 | #ifdef CONFIG_SYS_USE_MMC |
| 247 | #define CONFIG_SPL_LDSCRIPT arch/arm/cpu/at91-common/u-boot-spl.lds |
| 248 | #define CONFIG_SPL_MMC_SUPPORT |
| 249 | #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS 0x400 |
| 250 | #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x200 |
| 251 | #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 |
| 252 | #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" |
| 253 | #define CONFIG_SPL_FAT_SUPPORT |
| 254 | #define CONFIG_SPL_LIBDISK_SUPPORT |
| 255 | |
| 256 | #elif CONFIG_SYS_USE_NANDFLASH |
| 257 | #define CONFIG_SPL_NAND_SUPPORT |
| 258 | #define CONFIG_SPL_NAND_DRIVERS |
| 259 | #define CONFIG_SPL_NAND_BASE |
| 260 | #define CONFIG_PMECC_CAP 8 |
| 261 | #define CONFIG_PMECC_SECTOR_SIZE 512 |
| 262 | #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x40000 |
| 263 | #define CONFIG_SYS_NAND_5_ADDR_CYCLE |
| 264 | #define CONFIG_SYS_NAND_PAGE_SIZE 0x1000 |
| 265 | #define CONFIG_SYS_NAND_PAGE_COUNT 64 |
| 266 | #define CONFIG_SYS_NAND_OOBSIZE 224 |
| 267 | #define CONFIG_SYS_NAND_BLOCK_SIZE 0x40000 |
| 268 | #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0x0 |
| 269 | #define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER |
| 270 | |
| 271 | #elif CONFIG_SYS_USE_SERIALFLASH |
| 272 | #define CONFIG_SPL_SPI_SUPPORT |
| 273 | #define CONFIG_SPL_SPI_FLASH_SUPPORT |
| 274 | #define CONFIG_SPL_SPI_LOAD |
| 275 | #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 |
| 276 | |
| 277 | #endif |
Bo Shen | 5864590 | 2014-11-10 15:24:02 +0800 | [diff] [blame] | 278 | #endif |