1 /*
2  * Configuration settings for the SAMA5D3 Xplained board.
3  *
4  * Copyright (C) 2014 Atmel Corporation
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_AT91FAMILY
22 #define CONFIG_ARCH_CPU_INIT
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 /* general purpose I/O */
31 #define CONFIG_AT91_GPIO
32 
33 /* serial console */
34 #define CONFIG_ATMEL_USART
35 #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
36 #define CONFIG_USART_ID			ATMEL_ID_DBGU
37 
38 /*
39  * This needs to be defined for the OHCI code to work but it is defined as
40  * ATMEL_ID_UHPHS in the CPU specific header files.
41  */
42 #define ATMEL_ID_UHP			ATMEL_ID_UHPHS
43 
44 /*
45  * Specify the clock enable bit in the PMC_SCER register.
46  */
47 #define ATMEL_PMC_UHP			AT91SAM926x_PMC_UHP
48 
49 #define CONFIG_BOOTDELAY		3
50 
51 /*
52  * BOOTP options
53  */
54 #define CONFIG_BOOTP_BOOTFILESIZE
55 #define CONFIG_BOOTP_BOOTPATH
56 #define CONFIG_BOOTP_GATEWAY
57 #define CONFIG_BOOTP_HOSTNAME
58 
59 /* No NOR flash */
60 #define CONFIG_SYS_NO_FLASH
61 
62 /*
63  * Command line configuration.
64  */
65 #include <config_cmd_default.h>
66 #undef CONFIG_CMD_FPGA
67 #undef CONFIG_CMD_IMI
68 #undef CONFIG_CMD_LOADS
69 #define CONFIG_CMD_PING
70 #define CONFIG_CMD_DHCP
71 
72 /* SDRAM */
73 #define CONFIG_NR_DRAM_BANKS		1
74 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_DDRCS
75 #define CONFIG_SYS_SDRAM_SIZE		0x10000000
76 
77 #define CONFIG_SYS_INIT_SP_ADDR \
78 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
79 
80 /* NAND flash */
81 #define CONFIG_CMD_NAND
82 
83 #ifdef CONFIG_CMD_NAND
84 #define CONFIG_NAND_ATMEL
85 #define CONFIG_SYS_MAX_NAND_DEVICE	1
86 #define CONFIG_SYS_NAND_BASE		ATMEL_BASE_CS3
87 /* our ALE is AD21 */
88 #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
89 /* our CLE is AD22 */
90 #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
91 #define CONFIG_SYS_NAND_ONFI_DETECTION
92 /* PMECC & PMERRLOC */
93 #define CONFIG_ATMEL_NAND_HWECC
94 #define CONFIG_ATMEL_NAND_HW_PMECC
95 #define CONFIG_PMECC_CAP		4
96 #define CONFIG_PMECC_SECTOR_SIZE	512
97 #define CONFIG_CMD_NAND_TRIMFFS
98 #define CONFIG_CMD_MTDPARTS
99 
100 #define CONFIG_MTD_DEVICE
101 #define CONFIG_MTD_PARTITIONS
102 #define CONFIG_RBTREE
103 #define CONFIG_LZO
104 #define CONFIG_CMD_UBI
105 #define CONFIG_CMD_UBIFS
106 #endif
107 
108 /* Ethernet Hardware */
109 #define CONFIG_MACB
110 #define CONFIG_RMII
111 #define CONFIG_NET_MULTI
112 #define CONFIG_NET_RETRY_COUNT		20
113 #define CONFIG_MACB_SEARCH_PHY
114 #define CONFIG_RGMII
115 #define CONFIG_CMD_MII
116 #define CONFIG_PHYLIB
117 
118 /* MMC */
119 #define CONFIG_CMD_MMC
120 
121 #ifdef CONFIG_CMD_MMC
122 #define CONFIG_MMC
123 #define CONFIG_GENERIC_MMC
124 #define CONFIG_GENERIC_ATMEL_MCI
125 #define CONFIG_ATMEL_MCI_8BIT
126 #endif
127 
128 /* USB */
129 #define CONFIG_CMD_USB
130 
131 #ifdef CONFIG_CMD_USB
132 #define CONFIG_USB_ATMEL
133 #define CONFIG_USB_ATMEL_CLK_SEL_UPLL
134 #define CONFIG_USB_OHCI_NEW
135 #define CONFIG_SYS_USB_OHCI_CPU_INIT
136 #define CONFIG_SYS_USB_OHCI_REGS_BASE		ATMEL_BASE_OHCI
137 #define CONFIG_SYS_USB_OHCI_SLOT_NAME		"SAMA5D3 Xplained"
138 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
139 #define CONFIG_DOS_PARTITION
140 #define CONFIG_USB_STORAGE
141 #endif
142 
143 #if defined(CONFIG_CMD_USB) || defined(CONFIG_CMD_MMC)
144 #define CONFIG_CMD_FAT
145 #define CONFIG_FAT_WRITE
146 #define CONFIG_CMD_EXT4
147 #define CONFIG_CMD_EXT4_WRITE
148 #endif
149 
150 #define CONFIG_SYS_LOAD_ADDR			0x22000000 /* load address */
151 
152 #if CONFIG_SYS_USE_NANDFLASH
153 /* bootstrap + u-boot + env in nandflash */
154 #define CONFIG_ENV_IS_IN_NAND
155 #define CONFIG_ENV_OFFSET		0xc0000
156 #define CONFIG_ENV_OFFSET_REDUND	0x100000
157 #define CONFIG_ENV_SIZE			0x20000
158 #define CONFIG_BOOTCOMMAND	"nand read 0x21000000 0x180000 0x80000;" \
159 				"nand read 0x22000000 0x200000 0x600000;" \
160 				"bootz 0x22000000 - 0x21000000"
161 #elif CONFIG_SYS_USE_MMC
162 /* bootstrap + u-boot + env in sd card */
163 #define CONFIG_ENV_IS_IN_MMC
164 #define CONFIG_ENV_OFFSET	0x2000
165 #define CONFIG_ENV_SIZE		0x1000
166 #define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d3_xplained.dtb; " \
167 				"fatload mmc 0:1 0x22000000 zImage; " \
168 				"bootz 0x22000000 - 0x21000000"
169 #define CONFIG_SYS_MMC_ENV_DEV	0
170 #else
171 #define CONFIG_ENV_IS_NOWHERE
172 #endif
173 
174 #ifdef CONFIG_SYS_USE_MMC
175 #define CONFIG_BOOTARGS							\
176 	"console=ttyS0,115200 earlyprintk "				\
177 	"root=/dev/mmcblk0p2 rw rootwait"
178 #else
179 #define CONFIG_BOOTARGS							\
180 	"console=ttyS0,115200 earlyprintk "				\
181 	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
182 	"256K(env),256k(evn_redundent),256k(spare),"			\
183 	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
184 	"rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
185 #endif
186 
187 #define CONFIG_BAUDRATE			115200
188 
189 #define CONFIG_SYS_PROMPT		"U-Boot> "
190 #define CONFIG_SYS_CBSIZE		256
191 #define CONFIG_SYS_MAXARGS		16
192 #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + \
193 					sizeof(CONFIG_SYS_PROMPT) + 16)
194 #define CONFIG_SYS_LONGHELP
195 #define CONFIG_CMDLINE_EDITING
196 #define CONFIG_AUTO_COMPLETE
197 #define CONFIG_SYS_HUSH_PARSER
198 
199 /* Size of malloc() pool */
200 #define CONFIG_SYS_MALLOC_LEN		(4 * 1024 * 1024)
201 
202 #endif
203