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 #define CONFIG_SKIP_LOWLEVEL_INIT
24 #define CONFIG_BOARD_EARLY_INIT_F
25 #define CONFIG_DISPLAY_CPUINFO
26 
27 #define CONFIG_CMD_BOOTZ
28 #define CONFIG_OF_LIBFDT		/* Device Tree support */
29 
30 #define CONFIG_SYS_GENERIC_BOARD
31 
32 /* general purpose I/O */
33 #define CONFIG_AT91_GPIO
34 
35 /* serial console */
36 #define CONFIG_ATMEL_USART
37 #define CONFIG_USART_BASE		ATMEL_BASE_USART3
38 #define CONFIG_USART_ID			ATMEL_ID_USART3
39 
40 #define CONFIG_BOOTDELAY		3
41 
42 /*
43  * BOOTP options
44  */
45 #define CONFIG_BOOTP_BOOTFILESIZE
46 #define CONFIG_BOOTP_BOOTPATH
47 #define CONFIG_BOOTP_GATEWAY
48 #define CONFIG_BOOTP_HOSTNAME
49 
50 /* No NOR flash */
51 #define CONFIG_SYS_NO_FLASH
52 
53 /*
54  * Command line configuration.
55  */
56 #include <config_cmd_default.h>
57 #undef CONFIG_CMD_FPGA
58 #undef CONFIG_CMD_IMI
59 #undef CONFIG_CMD_LOADS
60 #define CONFIG_CMD_PING
61 #define CONFIG_CMD_DHCP
62 #define CONFIG_CMD_SETEXPR
63 
64 /* SDRAM */
65 #define CONFIG_NR_DRAM_BANKS		1
66 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
67 #define CONFIG_SYS_SDRAM_SIZE		0x20000000
68 
69 #define CONFIG_SYS_INIT_SP_ADDR \
70 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
71 
72 #define CONFIG_SYS_LOAD_ADDR		0x22000000 /* load address */
73 
74 /* SerialFlash */
75 #define CONFIG_CMD_SF
76 
77 #ifdef CONFIG_CMD_SF
78 #define CONFIG_ATMEL_SPI
79 #define CONFIG_ATMEL_SPI0
80 #define CONFIG_SPI_FLASH
81 #define CONFIG_SPI_FLASH_ATMEL
82 #define CONFIG_SF_DEFAULT_BUS		0
83 #define CONFIG_SF_DEFAULT_CS		0
84 #define CONFIG_SF_DEFAULT_SPEED		30000000
85 #endif
86 
87 /* NAND flash */
88 #define CONFIG_CMD_NAND
89 
90 #ifdef CONFIG_CMD_NAND
91 #define CONFIG_NAND_ATMEL
92 #define CONFIG_SYS_MAX_NAND_DEVICE	1
93 #define CONFIG_SYS_NAND_BASE		ATMEL_BASE_CS3
94 /* our ALE is AD21 */
95 #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
96 /* our CLE is AD22 */
97 #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
98 #define CONFIG_SYS_NAND_ONFI_DETECTION
99 /* PMECC & PMERRLOC */
100 #define CONFIG_ATMEL_NAND_HWECC
101 #define CONFIG_ATMEL_NAND_HW_PMECC
102 #endif
103 
104 /* MMC */
105 #define CONFIG_CMD_MMC
106 
107 #ifdef CONFIG_CMD_MMC
108 #define CONFIG_MMC
109 #define CONFIG_GENERIC_MMC
110 #define CONFIG_GENERIC_ATMEL_MCI
111 #define ATMEL_BASE_MMCI			ATMEL_BASE_MCI1
112 #endif
113 
114 /* USB */
115 #define CONFIG_CMD_USB
116 
117 #ifdef CONFIG_CMD_USB
118 #define CONFIG_USB_EHCI
119 #define CONFIG_USB_EHCI_ATMEL
120 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	3
121 #define CONFIG_USB_STORAGE
122 #endif
123 
124 #if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC)
125 #define CONFIG_CMD_FAT
126 #define CONFIG_DOS_PARTITION
127 #endif
128 
129 /* Ethernet Hardware */
130 #define CONFIG_MACB
131 #define CONFIG_RMII
132 #define CONFIG_NET_RETRY_COUNT		20
133 #define CONFIG_MACB_SEARCH_PHY
134 
135 /* LCD */
136 /* #define CONFIG_LCD */
137 #ifdef CONFIG_LCD
138 #define LCD_BPP				LCD_COLOR16
139 #define LCD_OUTPUT_BPP                  24
140 #define CONFIG_LCD_LOGO
141 #define CONFIG_LCD_INFO
142 #define CONFIG_LCD_INFO_BELOW_LOGO
143 #define CONFIG_SYS_WHITE_ON_BLACK
144 #define CONFIG_ATMEL_HLCD
145 #define CONFIG_ATMEL_LCD_RGB565
146 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
147 #endif
148 
149 #ifdef CONFIG_SYS_USE_SERIALFLASH
150 /* bootstrap + u-boot + env + linux in serial flash */
151 #define CONFIG_ENV_IS_IN_SPI_FLASH
152 #define CONFIG_ENV_SPI_BUS	CONFIG_SF_DEFAULT_BUS
153 #define CONFIG_ENV_SPI_CS	CONFIG_SF_DEFAULT_CS
154 #define CONFIG_ENV_OFFSET       0x10000
155 #define CONFIG_ENV_SIZE         0x10000
156 #define CONFIG_ENV_SECT_SIZE    0x1000
157 #define CONFIG_BOOTCOMMAND      "sf probe 0; " \
158 				"sf read 0x21000000 0xa0000 0x60000; " \
159 				"sf read 0x22000000 0x100000 0x300000; " \
160 				"bootz 0x22000000 - 0x21000000"
161 #elif CONFIG_SYS_USE_NANDFLASH
162 /* bootstrap + u-boot + env in nandflash */
163 #define CONFIG_ENV_IS_IN_NAND
164 #define CONFIG_ENV_OFFSET		0xc0000
165 #define CONFIG_ENV_OFFSET_REDUND	0x100000
166 #define CONFIG_ENV_SIZE			0x20000
167 #define CONFIG_BOOTCOMMAND	"nand read 0x21000000 0x180000 0x80000;" \
168 				"nand read 0x22000000 0x200000 0x600000;" \
169 				"bootz 0x22000000 - 0x21000000"
170 #elif CONFIG_SYS_USE_MMC
171 /* bootstrap + u-boot + env in sd card */
172 #define CONFIG_ENV_IS_IN_FAT
173 #define CONFIG_FAT_WRITE
174 #define FAT_ENV_INTERFACE	"mmc"
175 /*
176  * We don't specify the part number, if device 0 has partition table, it means
177  * the first partition; it no partition table, then take whole device as a
178  * FAT file system.
179  */
180 #define FAT_ENV_DEVICE_AND_PART	"0"
181 #define FAT_ENV_FILE		"uboot.env"
182 #define CONFIG_ENV_SIZE		0x4000
183 #define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d4_xplained.dtb; " \
184 				"fatload mmc 0:1 0x22000000 zImage; " \
185 				"bootz 0x22000000 - 0x21000000"
186 #endif
187 
188 #ifdef CONFIG_SYS_USE_MMC
189 #define CONFIG_BOOTARGS							\
190 	"console=ttyS0,115200 earlyprintk "				\
191 	"root=/dev/mmcblk0p2 rw rootwait"
192 #else
193 #define CONFIG_BOOTARGS							\
194 	"console=ttyS0,115200 earlyprintk "				\
195 	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
196 	"256K(env),256k(evn_redundent),256k(spare),"			\
197 	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
198 	"rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
199 #endif
200 
201 #define CONFIG_BAUDRATE			115200
202 
203 #define CONFIG_SYS_PROMPT		"U-Boot> "
204 #define CONFIG_SYS_CBSIZE		256
205 #define CONFIG_SYS_MAXARGS		16
206 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
207 					sizeof(CONFIG_SYS_PROMPT) + 16)
208 #define CONFIG_SYS_LONGHELP
209 #define CONFIG_CMDLINE_EDITING
210 #define CONFIG_AUTO_COMPLETE
211 #define CONFIG_SYS_HUSH_PARSER
212 
213 /* Size of malloc() pool */
214 #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
215 
216 #endif
217