1 /*
2  * Configuration settings for the SAMA5D4 Xplained ultra 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 
23 #ifndef CONFIG_SPL_BUILD
24 #define CONFIG_SKIP_LOWLEVEL_INIT
25 #endif
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 
71 #ifdef CONFIG_SPL_BUILD
72 #define CONFIG_SYS_INIT_SP_ADDR		0x210000
73 #else
74 #define CONFIG_SYS_INIT_SP_ADDR \
75 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
76 #endif
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 
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 
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 #ifdef CONFIG_LCD
152 #define LCD_BPP				LCD_COLOR16
153 #define LCD_OUTPUT_BPP                  24
154 #define CONFIG_LCD_LOGO
155 #define CONFIG_LCD_INFO
156 #define CONFIG_LCD_INFO_BELOW_LOGO
157 #define CONFIG_SYS_WHITE_ON_BLACK
158 #define CONFIG_ATMEL_HLCD
159 #define CONFIG_ATMEL_LCD_RGB565
160 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
161 #endif
162 
163 #ifdef CONFIG_SYS_USE_SERIALFLASH
164 /* bootstrap + u-boot + env + linux in serial flash */
165 #define CONFIG_ENV_IS_IN_SPI_FLASH
166 #define CONFIG_ENV_SPI_BUS	CONFIG_SF_DEFAULT_BUS
167 #define CONFIG_ENV_SPI_CS	CONFIG_SF_DEFAULT_CS
168 #define CONFIG_ENV_OFFSET       0x10000
169 #define CONFIG_ENV_SIZE         0x10000
170 #define CONFIG_ENV_SECT_SIZE    0x1000
171 #define CONFIG_BOOTCOMMAND      "sf probe 0; " \
172 				"sf read 0x21000000 0xa0000 0x60000; " \
173 				"sf read 0x22000000 0x100000 0x300000; " \
174 				"bootz 0x22000000 - 0x21000000"
175 #elif CONFIG_SYS_USE_NANDFLASH
176 /* bootstrap + u-boot + env in nandflash */
177 #define CONFIG_ENV_IS_IN_NAND
178 #define CONFIG_ENV_OFFSET		0xc0000
179 #define CONFIG_ENV_OFFSET_REDUND	0x100000
180 #define CONFIG_ENV_SIZE			0x20000
181 #define CONFIG_BOOTCOMMAND	"nand read 0x21000000 0x180000 0x80000;" \
182 				"nand read 0x22000000 0x200000 0x600000;" \
183 				"bootz 0x22000000 - 0x21000000"
184 #elif CONFIG_SYS_USE_MMC
185 /* bootstrap + u-boot + env in sd card */
186 #define CONFIG_ENV_IS_IN_FAT
187 #define CONFIG_FAT_WRITE
188 #define FAT_ENV_INTERFACE	"mmc"
189 /*
190  * We don't specify the part number, if device 0 has partition table, it means
191  * the first partition; it no partition table, then take whole device as a
192  * FAT file system.
193  */
194 #define FAT_ENV_DEVICE_AND_PART	"0"
195 #define FAT_ENV_FILE		"uboot.env"
196 #define CONFIG_ENV_SIZE		0x4000
197 #define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d4_xplained.dtb; " \
198 				"fatload mmc 0:1 0x22000000 zImage; " \
199 				"bootz 0x22000000 - 0x21000000"
200 #endif
201 
202 #ifdef CONFIG_SYS_USE_MMC
203 #define CONFIG_BOOTARGS							\
204 	"console=ttyS0,115200 earlyprintk "				\
205 	"root=/dev/mmcblk0p2 rw rootwait"
206 #else
207 #define CONFIG_BOOTARGS							\
208 	"console=ttyS0,115200 earlyprintk "				\
209 	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
210 	"256K(env),256k(evn_redundent),256k(spare),"			\
211 	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
212 	"rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
213 #endif
214 
215 #define CONFIG_BAUDRATE			115200
216 
217 #define CONFIG_SYS_PROMPT		"U-Boot> "
218 #define CONFIG_SYS_CBSIZE		256
219 #define CONFIG_SYS_MAXARGS		16
220 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
221 					sizeof(CONFIG_SYS_PROMPT) + 16)
222 #define CONFIG_SYS_LONGHELP
223 #define CONFIG_CMDLINE_EDITING
224 #define CONFIG_AUTO_COMPLETE
225 #define CONFIG_SYS_HUSH_PARSER
226 
227 /* Size of malloc() pool */
228 #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
229 
230 
231 /* SPL */
232 #define CONFIG_SPL_FRAMEWORK
233 #define CONFIG_SPL_TEXT_BASE		0x200000
234 #define CONFIG_SPL_MAX_SIZE		0x10000
235 #define CONFIG_SPL_BSS_START_ADDR	0x20000000
236 #define CONFIG_SPL_BSS_MAX_SIZE		0x80000
237 #define CONFIG_SYS_SPL_MALLOC_START	0x20080000
238 #define CONFIG_SYS_SPL_MALLOC_SIZE	0x80000
239 
240 #define CONFIG_SPL_LIBCOMMON_SUPPORT
241 #define CONFIG_SPL_LIBGENERIC_SUPPORT
242 #define CONFIG_SPL_GPIO_SUPPORT
243 #define CONFIG_SPL_SERIAL_SUPPORT
244 
245 #define CONFIG_SPL_BOARD_INIT
246 #define CONFIG_SYS_MONITOR_LEN		(512 << 10)
247 
248 #ifdef CONFIG_SYS_USE_MMC
249 #define CONFIG_SPL_LDSCRIPT		arch/arm/cpu/at91-common/u-boot-spl.lds
250 #define CONFIG_SPL_MMC_SUPPORT
251 #define CONFIG_SYS_U_BOOT_MAX_SIZE_SECTORS	0x400
252 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x200
253 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
254 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
255 #define CONFIG_SPL_FAT_SUPPORT
256 #define CONFIG_SPL_LIBDISK_SUPPORT
257 
258 #elif CONFIG_SYS_USE_NANDFLASH
259 #define CONFIG_SPL_NAND_SUPPORT
260 #define CONFIG_SPL_NAND_DRIVERS
261 #define CONFIG_SPL_NAND_BASE
262 #define CONFIG_PMECC_CAP		8
263 #define CONFIG_PMECC_SECTOR_SIZE	512
264 #define CONFIG_SYS_NAND_U_BOOT_OFFS	0x40000
265 #define CONFIG_SYS_NAND_5_ADDR_CYCLE
266 #define CONFIG_SYS_NAND_PAGE_SIZE	0x1000
267 #define CONFIG_SYS_NAND_PAGE_COUNT	64
268 #define CONFIG_SYS_NAND_OOBSIZE		224
269 #define CONFIG_SYS_NAND_BLOCK_SIZE	0x40000
270 #define CONFIG_SYS_NAND_BAD_BLOCK_POS	0x0
271 #define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER
272 
273 #elif CONFIG_SYS_USE_SERIALFLASH
274 #define CONFIG_SPL_SPI_SUPPORT
275 #define CONFIG_SPL_SPI_FLASH_SUPPORT
276 #define CONFIG_SPL_SPI_LOAD
277 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
278 
279 #endif
280 #endif
281