1 /*
2  * Copyright (C) 2012 Atmel Corporation
3  *
4  * Configuation settings for the AT91SAM9X5EK board.
5  *
6  * See file CREDITS for list of people who contributed to this
7  * project.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22  * MA 02111-1307 USA
23  */
24 
25 #ifndef __CONFIG_H__
26 #define __CONFIG_H__
27 
28 #include <asm/hardware.h>
29 
30 /* ARM asynchronous clock */
31 #define CONFIG_SYS_AT91_SLOW_CLOCK	32768
32 #define CONFIG_SYS_AT91_MAIN_CLOCK	12000000	/* 12 MHz crystal */
33 #define CONFIG_SYS_HZ			1000
34 
35 #define CONFIG_AT91SAM9X5EK
36 #define CONFIG_AT91FAMILY
37 
38 #define CONFIG_CMDLINE_TAG		/* enable passing of ATAGs */
39 #define CONFIG_SETUP_MEMORY_TAGS
40 #define CONFIG_INITRD_TAG
41 #define CONFIG_SKIP_LOWLEVEL_INIT
42 #define CONFIG_BOARD_EARLY_INIT_F
43 #define CONFIG_DISPLAY_CPUINFO
44 
45 #define CONFIG_CMD_BOOTZ
46 #define CONFIG_OF_LIBFDT
47 
48 /* general purpose I/O */
49 #define CONFIG_ATMEL_LEGACY		/* required until (g)pio is fixed */
50 #define CONFIG_AT91_GPIO
51 
52 /* serial console */
53 #define CONFIG_ATMEL_USART
54 #define CONFIG_USART_BASE	ATMEL_BASE_DBGU
55 #define CONFIG_USART_ID		ATMEL_ID_SYS
56 
57 /* LCD */
58 #define CONFIG_LCD
59 #define LCD_BPP			LCD_COLOR16
60 #define LCD_OUTPUT_BPP		24
61 #define CONFIG_LCD_LOGO
62 #undef LCD_TEST_PATTERN
63 #define CONFIG_LCD_INFO
64 #define CONFIG_LCD_INFO_BELOW_LOGO
65 #define CONFIG_SYS_WHITE_ON_BLACK
66 #define CONFIG_ATMEL_HLCD
67 #define CONFIG_ATMEL_LCD_RGB565
68 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
69 
70 #define CONFIG_BOOTDELAY	3
71 
72 /*
73  * BOOTP options
74  */
75 #define CONFIG_BOOTP_BOOTFILESIZE
76 #define CONFIG_BOOTP_BOOTPATH
77 #define CONFIG_BOOTP_GATEWAY
78 #define CONFIG_BOOTP_HOSTNAME
79 
80 /*
81  * Command line configuration.
82  */
83 #include <config_cmd_default.h>
84 #undef CONFIG_CMD_FPGA
85 #undef CONFIG_CMD_IMI
86 #undef CONFIG_CMD_IMLS
87 #undef CONFIG_CMD_LOADS
88 
89 #define CONFIG_CMD_PING
90 #define CONFIG_CMD_DHCP
91 #define CONFIG_CMD_NAND
92 #define CONFIG_CMD_SF
93 #define CONFIG_CMD_MMC
94 #define CONFIG_CMD_FAT
95 #define CONFIG_CMD_USB
96 
97 /*
98  * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0)
99  * NB: in this case, USB 1.1 devices won't be recognized.
100  */
101 
102 
103 /* SDRAM */
104 #define CONFIG_NR_DRAM_BANKS		1
105 #define CONFIG_SYS_SDRAM_BASE		0x20000000
106 #define CONFIG_SYS_SDRAM_SIZE		0x08000000	/* 128 megs */
107 
108 #define CONFIG_SYS_INIT_SP_ADDR \
109 	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
110 
111 /* DataFlash */
112 #ifdef CONFIG_CMD_SF
113 #define CONFIG_ATMEL_SPI
114 #define CONFIG_SPI_FLASH
115 #define CONFIG_SPI_FLASH_ATMEL
116 #define CONFIG_SF_DEFAULT_SPEED		30000000
117 #endif
118 
119 /* no NOR flash */
120 #define CONFIG_SYS_NO_FLASH
121 
122 /* NAND flash */
123 #ifdef CONFIG_CMD_NAND
124 #define CONFIG_NAND_ATMEL
125 #define CONFIG_SYS_MAX_NAND_DEVICE	1
126 #define CONFIG_SYS_NAND_BASE		0x40000000
127 #define CONFIG_SYS_NAND_DBW_8		1
128 /* our ALE is AD21 */
129 #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
130 /* our CLE is AD22 */
131 #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
132 #define CONFIG_SYS_NAND_ENABLE_PIN	AT91_PIN_PD4
133 #define CONFIG_SYS_NAND_READY_PIN	AT91_PIN_PD5
134 
135 /* PMECC & PMERRLOC */
136 #define CONFIG_ATMEL_NAND_HWECC		1
137 #define CONFIG_ATMEL_NAND_HW_PMECC	1
138 #define CONFIG_PMECC_CAP		2
139 #define CONFIG_PMECC_SECTOR_SIZE	512
140 #define CONFIG_PMECC_INDEX_TABLE_OFFSET	0x8000
141 
142 #define CONFIG_MTD_DEVICE
143 #define CONFIG_CMD_MTDPARTS
144 #define CONFIG_MTD_PARTITIONS
145 #define CONFIG_RBTREE
146 #define CONFIG_LZO
147 #define CONFIG_CMD_UBI
148 #define CONFIG_CMD_UBIFS
149 #endif
150 
151 /* MMC */
152 #ifdef CONFIG_CMD_MMC
153 #define CONFIG_MMC
154 #define CONFIG_GENERIC_MMC
155 #define CONFIG_GENERIC_ATMEL_MCI
156 #endif
157 
158 /* FAT */
159 #ifdef CONFIG_CMD_FAT
160 #define CONFIG_DOS_PARTITION
161 #endif
162 
163 /* Ethernet */
164 #define CONFIG_MACB
165 #define CONFIG_RMII
166 #define CONFIG_NET_RETRY_COUNT		20
167 #define CONFIG_MACB_SEARCH_PHY
168 
169 /* USB */
170 #ifdef CONFIG_CMD_USB
171 #ifdef CONFIG_USB_EHCI
172 #define CONFIG_USB_EHCI_ATMEL
173 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	2
174 #else
175 #define CONFIG_USB_OHCI_NEW
176 #define CONFIG_SYS_USB_OHCI_CPU_INIT
177 #define CONFIG_SYS_USB_OHCI_REGS_BASE		ATMEL_BASE_OHCI
178 #define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91sam9x5"
179 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	3
180 #endif
181 #define CONFIG_USB_ATMEL
182 #define CONFIG_USB_STORAGE
183 #endif
184 
185 #define CONFIG_SYS_LOAD_ADDR		0x22000000	/* load address */
186 
187 #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
188 #define CONFIG_SYS_MEMTEST_END		0x26e00000
189 
190 #ifdef CONFIG_SYS_USE_NANDFLASH
191 /* bootstrap + u-boot + env + linux in nandflash */
192 #define CONFIG_ENV_IS_IN_NAND
193 #define CONFIG_ENV_OFFSET		0xc0000
194 #define CONFIG_ENV_OFFSET_REDUND	0x100000
195 #define CONFIG_ENV_SIZE		0x20000		/* 1 sector = 128 kB */
196 #define CONFIG_BOOTCOMMAND	"nand read " \
197 				"0x22000000 0x200000 0x300000; " \
198 				"bootm 0x22000000"
199 #elif defined(CONFIG_SYS_USE_SPIFLASH)
200 /* bootstrap + u-boot + env + linux in spi flash */
201 #define CONFIG_ENV_IS_IN_SPI_FLASH
202 #define CONFIG_ENV_OFFSET	0x5000
203 #define CONFIG_ENV_SIZE		0x3000
204 #define CONFIG_ENV_SECT_SIZE	0x1000
205 #define CONFIG_ENV_SPI_MAX_HZ	30000000
206 #define CONFIG_BOOTCOMMAND	"sf probe 0; " \
207 				"sf read 0x22000000 0x100000 0x300000; " \
208 				"bootm 0x22000000"
209 #elif defined(CONFIG_SYS_USE_DATAFLASH)
210 /* bootstrap + u-boot + env + linux in data flash */
211 #define CONFIG_ENV_IS_IN_SPI_FLASH
212 #define CONFIG_ENV_OFFSET	0x4200
213 #define CONFIG_ENV_SIZE		0x4200
214 #define CONFIG_ENV_SECT_SIZE	0x210
215 #define CONFIG_ENV_SPI_MAX_HZ	30000000
216 #define CONFIG_BOOTCOMMAND	"sf probe 0; " \
217 				"sf read 0x22000000 0x84000 0x294000; " \
218 				"bootm 0x22000000"
219 #else /* CONFIG_SYS_USE_MMC */
220 /* bootstrap + u-boot + env + linux in mmc */
221 #define CONFIG_ENV_IS_IN_MMC
222 /* For FAT system, most cases it should be in the reserved sector */
223 #define CONFIG_ENV_OFFSET	0x2000
224 #define CONFIG_ENV_SIZE		0x1000
225 #define CONFIG_SYS_MMC_ENV_DEV	0
226 #endif
227 
228 #ifdef CONFIG_SYS_USE_MMC
229 #define CONFIG_BOOTARGS		"mem=128M console=ttyS0,115200 " \
230 				"mtdparts=atmel_nand:" \
231 				"8M(bootstrap/uboot/kernel)ro,-(rootfs) " \
232 				"root=/dev/mmcblk0p2 " \
233 				"rw rootfstype=ext4 rootwait"
234 #else
235 #define CONFIG_BOOTARGS							\
236 	"console=ttyS0,115200 earlyprintk "				\
237 	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
238 	"256k(env),256k(env_redundant),256k(spare),"			\
239 	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
240 	"rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs rw"
241 #endif
242 
243 #define CONFIG_BAUDRATE		115200
244 
245 #define CONFIG_SYS_PROMPT	"U-Boot> "
246 #define CONFIG_SYS_CBSIZE	256
247 #define CONFIG_SYS_MAXARGS	16
248 #define CONFIG_SYS_PBSIZE	(CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) \
249 					+ 16)
250 #define CONFIG_SYS_LONGHELP
251 #define CONFIG_CMDLINE_EDITING
252 #define CONFIG_AUTO_COMPLETE
253 #define CONFIG_SYS_HUSH_PARSER
254 
255 /*
256  * Size of malloc() pool
257  */
258 #define CONFIG_SYS_MALLOC_LEN		(512 * 1024 + 0x1000)
259 
260 #ifdef CONFIG_USE_IRQ
261 #error CONFIG_USE_IRQ not supported
262 #endif
263 
264 #endif
265