add uboot-oxnas
[openwrt/staging/yousong.git] / package / boot / uboot-oxnas / files / include / configs / ox820.h
1 #ifndef __CONFIG_H
2 #define __CONFIG_H
3
4 /* High Level Configuration Options */
5 #define CONFIG_ARM1136
6 #define CONFIG_OX820
7
8 #include <asm/arch/cpu.h> /* get chip and board defs */
9
10 /* make cmd_ide.c quiet when compile */
11 #define __io
12
13 /*#define CONFIG_ARCH_CPU_INIT*/
14 /*#define CONFIG_DISPLAY_CPUINFO*/
15 /*#define CONFIG_DISPLAY_BOARDINFO*/
16 /*#define CONFIG_BOARD_EARLY_INIT_F*/
17 /*#define CONFIG_SKIP_LOWLEVEL_INIT*/
18
19 /* mem */
20 #define CONFIG_SYS_SDRAM_BASE 0x60000000
21 #define CONFIG_NR_DRAM_BANKS 1
22 #define CONFIG_MIN_SDRAM_SIZE (128 * 1024 * 1024) /* 128 MB */
23 #define CONFIG_MAX_SDRAM_SIZE (512 * 1024 * 1024) /* 512 MB */
24 #define CONFIG_SRAM_BASE 0x50000000
25 #define CONFIG_SRAM_SIZE (64 * 1024)
26
27 /* need do dma so better keep dcache off */
28 #define CONFIG_SYS_DCACHE_OFF
29
30 /* clock */
31 #define CONFIG_PLLA_FREQ_MHZ 800
32 #define CONFIG_RPSCLK 6250000
33 #define CONFIG_SYS_HZ 1000
34 #define CONFIG_SYS_CLK_FREQ CONFIG_RPSCLK
35 #define CONFIG_SYS_TIMERBASE TIMER1_BASE
36 #define CONFIG_TIMER_PRESCALE TIMER_PRESCALE_16
37
38 /* serial */
39 #define CONFIG_SYS_NS16550
40 #define CONFIG_SYS_NS16550_SERIAL
41 #define CONFIG_SYS_NS16550_CLK CONFIG_RPSCLK
42 #define CONFIG_SYS_NS16550_REG_SIZE 1
43 #define CONFIG_BAUDRATE 115200
44 #define CONFIG_SYS_NS16550_COM1 UART_1_BASE
45 #define CONFIG_CONS_INDEX 1
46
47 /* ide */
48 #define CONFIG_SYS_ATA_BASE_ADDR 0
49 #define CONFIG_SYS_ATA_DATA_OFFSET 0
50 #define CONFIG_SYS_ATA_REG_OFFSET 0
51 #define CONFIG_SYS_ATA_ALT_OFFSET 0
52 #define CONFIG_IDE_PLX
53 #define CONFIG_SYS_IDE_MAXDEVICE 1
54 #define CONFIG_SYS_IDE_MAXBUS 1
55 #define CONFIG_IDE_PREINIT
56 #define CONFIG_LBA48
57
58 /* nand */
59 #define CONFIG_NAND
60 #define CONFIG_SYS_MAX_NAND_DEVICE 1
61 #define CONFIG_SYS_NAND_BASE STATIC_CS0_BASE
62 #define NAND_CLE_ADDR_PIN 19
63 #define NAND_ALE_ADDR_PIN 18
64 #define MTDPARTS_DEFAULT "mtdparts=41000000.nand:" \
65 "14m(boot)," \
66 "-(ubi)"
67 #define MTDIDS_DEFAULT "nand0=41000000.nand"
68 #define UBIPART_DEFAULT "ubi"
69
70 /* net */
71 #define CONFIG_DESIGNWARE_ETH
72 #define CONFIG_DW_ALTDESCRIPTOR
73 #define CONFIG_MII
74 #define CONFIG_CMD_MII
75 #define CONFIG_PHYLIB
76 #define CONFIG_PHY_REALTEK
77
78 /* spl */
79 #ifdef CONFIG_SPL_BUILD
80 #define USE_DL_PREFIX /* rename malloc free etc, so we can override them */
81 #endif
82
83 #if defined(CONFIG_BOOT_FROM_NAND) || defined(CONFIG_BOOT_FROM_SATA)
84 #define CONFIG_SPL
85 #define CONFIG_SPL_FRAMEWORK
86 #define CONFIG_SPL_LIBCOMMON_SUPPORT
87 #define CONFIG_SPL_SERIAL_SUPPORT
88 #define CONFIG_SPL_LIBGENERIC_SUPPORT
89 #define CONFIG_SPL_TEXT_BASE 0x50000000
90 #define CONFIG_SPL_STACK (CONFIG_SRAM_BASE + (48 * 1024))
91 #define CONFIG_SPL_DISPLAY_PRINT
92 #define CONFIG_SPL_BSS_DRAM_START 0x65000000
93 #define CONFIG_SPL_BSS_DRAM_SIZE 0x01000000
94 #define CONFIG_SPL_MALLOC_START 0x66000000
95 #endif
96
97 #if defined(CONFIG_BOOT_FROM_NAND)
98 #define CONFIG_SPL_NAND_SUPPORT
99 #define BOOT_DEVICE_TYPE "NAND"
100 #define BOOT_DEVICE_NAND 0xfeedbacc
101 #define CONFIG_SPL_BOOT_DEVICE BOOT_DEVICE_NAND
102 #define CONFIG_SPL_NAND_SIMPLE
103 #define CONFIG_SPL_NAND_ECC
104 #define CONFIG_SPL_NAND_SOFTECC
105 #define CONFIG_SYS_NAND_ECCSIZE 512
106 #define CONFIG_SYS_NAND_ECCBYTES 6
107 #define CONFIG_SYS_NAND_ECCPOS {40, 41, 42, 43, 44, 45, 46, 47, \
108 48, 49, 50, 51, 52, 53, 54, 55, \
109 56, 57, 58, 59, 60, 61, 62, 63}
110 #define CONFIG_SYS_NAND_PAGE_SIZE 2048
111 #define CONFIG_SYS_NAND_OOBSIZE 64
112 #define CONFIG_SYS_NAND_BLOCK_SIZE (128 * 1024)
113 #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0
114 /* pages per erase block */
115 #define CONFIG_SYS_NAND_PAGE_COUNT (CONFIG_SYS_NAND_BLOCK_SIZE / CONFIG_SYS_NAND_PAGE_SIZE)
116 /* nand spl use 1 erase block, and use bit to byte encode for reliability */
117 #define CONFIG_SPL_MAX_SIZE (128 * 1024 / 8)
118 #define CONFIG_SYS_NAND_U_BOOT_OFFS 0x00040000
119 /* spl kernel load is not enabled */
120 #define CONFIG_SYS_NAND_SPL_KERNEL_OFFS 0x00200000
121 #define CONFIG_CMD_SPL_NAND_OFS 0
122 #define CONFIG_CMD_SPL_WRITE_SIZE 1024
123 #define CONFIG_SYS_SPL_ARGS_ADDR (CONFIG_SYS_SDRAM_BASE + 0x100)
124 /* CONFIG_BOOT_FROM_NAND end */
125
126 #elif defined(CONFIG_BOOT_FROM_SATA)
127 #define CONFIG_SPL_BLOCK_SUPPORT
128 #define BOOT_DEVICE_TYPE "SATA"
129 #define BOOT_DEVICE_BLOCK 860202
130 #define CONFIG_SPL_BOOT_DEVICE BOOT_DEVICE_BLOCK
131 #define CONFIG_SPL_MAX_SIZE (36 * 1024)
132 #define CONFIG_SPL_LIBDISK_SUPPORT
133 #define CONFIG_SPL_BLOCKDEV_INTERFACE "ide"
134 #define CONFIG_SPL_BLOCKDEV_ID 0
135
136 #ifdef CONFIG_BOOT_FROM_FAT /* u-boot in fat partition */
137
138 #define CONFIG_SPL_FAT_SUPPORT
139
140 #define CONFIG_BLOCKDEV_FAT_BOOT_PARTITION 1 /* first partition */
141 #define CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME "u-boot.img" /* u-boot file name */
142 /* enable U-Boot Falcon Mode */
143 #define CONFIG_CMD_SPL
144 #define CONFIG_SPL_OS_BOOT
145 #define CONFIG_SPL_FAT_LOAD_ARGS_NAME "bootargs.bin" /* boot parameters */
146 #define CONFIG_SPL_FAT_LOAD_KERNEL_NAME "falcon.img" /* kernel */
147 #define CONFIG_SYS_SPL_ARGS_ADDR (CONFIG_SYS_SDRAM_BASE + 0x100)
148
149 #elif CONFIG_BOOT_FROM_EXT4
150
151 #define CONFIG_SPL_EXT4_SUPPORT
152 #define CONFIG_BLOCKDEV_EXT4_BOOT_PARTITION 1 /* first partition */
153 #define CONFIG_SPL_EXT4_LOAD_PAYLOAD_NAME "/boot/u-boot.img" /* u-boot file name */
154 /* enable U-Boot Falcon Mode */
155 #define CONFIG_CMD_SPL
156 #define CONFIG_SPL_OS_BOOT
157 #define CONFIG_SPL_EXT4_LOAD_ARGS_NAME "/boot/bootargs.bin" /* boot parameters */
158 #define CONFIG_SPL_EXT4_LOAD_KERNEL_NAME "/boot/falcon.img" /* kernel */
159 #define CONFIG_SYS_SPL_ARGS_ADDR (CONFIG_SYS_SDRAM_BASE + 0x100)
160
161 #else /* u-boot in raw sectors */
162
163 #define CONFIG_SYS_BLOCK_RAW_MODE_U_BOOT_SECTOR 1024
164 /* spl kernel load is not enabled */
165 #define CONFIG_SYS_BLOCK_RAW_MODE_KERNEL_SECTOR 4096
166 #define CONFIG_SYS_BLOCK_RAW_MODE_ARGS_SECTOR 0
167 #define CONFIG_SYS_BLOCK_RAW_MODE_ARGS_SECTORS (1024 / 512)
168 #define CONFIG_SYS_SPL_ARGS_ADDR (CONFIG_SYS_SDRAM_BASE + 0x100)
169
170 #endif /* CONFIG_BOOT_FROM_FAT */
171 /* CONFIG_BOOT_FROM_SATA end */
172
173 #else
174 /* generic, no spl support */
175 #endif
176
177 /* boot */
178 #define CONFIG_IDENT_STRING " for OXNAS"
179 #define CONFIG_MACH_TYPE MACH_TYPE_OXNAS
180 #ifndef CONFIG_SPL_BUILD
181 /* Enable devicetree support */
182 #define CONFIG_OF_LIBFDT
183 #endif
184 #define CONFIG_SETUP_MEMORY_TAGS
185 #define CONFIG_CMDLINE_TAG
186 #define CONFIG_INITRD_TAG
187 #define CONFIG_BOOTDELAY 1
188 #define CONFIG_ZERO_BOOTDELAY_CHECK
189 #define CONFIG_DEFAULT_CONSOLE_PARM "console=ttyS0,115200n8 earlyprintk=serial"
190 /* Boot Argument Buffer Size */
191 #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE
192 /* memtest works on */
193 #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE)
194 #define CONFIG_SYS_AUTOLOAD "no"
195
196 #define CONFIG_DEFAULT_CONSOLE CONFIG_DEFAULT_CONSOLE_PARM "\0"
197 #define CONFIG_BOOTARGS CONFIG_DEFAULT_CONSOLE_PARM
198 #define CONFIG_BOOTCOMMAND "run nandboot"
199 #define CONFIG_BOOT_RETRY_TIME -1
200 #define CONFIG_RESET_TO_RETRY 60
201
202 #define CONFIG_NETCONSOLE
203 #define CONFIG_IPADDR 192.168.50.100
204 #define CONFIG_SERVERIP 192.168.50.59
205
206 /* A sane default configuration...
207 * When booting without a valid environment in ubi, first to loading and booting
208 * the kernel image directly above U-Boot, maybe both were loaded there by
209 * another bootloader.
210 * Also use that same offset (0x90000) to load the rescue image later on (by
211 * adding it onto the flash address where U-Boot is supposed to be stored by
212 * the legacy loader, 0x440000, resulting in offset 0x4d0000 on the flash).
213 * When coming up with a valid environment in ubi, first try to load the
214 * kernel from a ubi volume kernel, if that fails, fallback to the rescue
215 * image stored in boot partition. As a last resort try booting via
216 * DHCP/TFTP.
217 * In case there is no valid environment, first probe for a uimage in ram left
218 * behind by the first bootloader on a tftp boot.
219 * If that fails, switch to normal boot order and save environment.
220 * The loader is supposed to be written to flash at offset 0x440000 and loaded to
221 * RAM at 0x64000000
222 */
223 #define CONFIG_EXTRA_ENV_SETTINGS \
224 "load_kernel_ubi=ubi readvol 0x62000000 kernel;\0" \
225 "load_kernel_rescue=nand read 0x62000000 0x4e0000 0x400000;\0" \
226 "load_kernel_dhcp=dhcp 0x62000000 oxnas-rescue.bin;\0" \
227 "boot_kernel=bootm 0x62000000;\0" \
228 "boot_ubi=run load_kernel_ubi && run boot_kernel;\0" \
229 "boot_rescue=run load_kernel_rescue && run boot_kernel;\0" \
230 "boot_dhcp=run load_kernel_dhcp && run boot_kernel;\0" \
231 "normalboot=run boot_ubi; run boot_rescue; run boot_dhcp;\0" \
232 "firstboot=bootm 0x640a0000; setenv bootcmd run normalboot; " \
233 "setenv firstboot; saveenv; run bootcmd; \0" \
234 "bootcmd=run firstboot; \0" \
235 "console=" CONFIG_DEFAULT_CONSOLE \
236 "bootargs=" CONFIG_BOOTARGS "\0" \
237 "mtdids=" MTDIDS_DEFAULT "\0" \
238 "mtdparts=" MTDPARTS_DEFAULT "\0" \
239
240 /* env */
241 #if defined(CONFIG_BOOT_FROM_NAND)
242 #define CONFIG_ENV_IS_IN_NAND
243 #define CONFIG_ENV_OFFSET 0x000C0000
244 #define CONFIG_ENV_SIZE 0x00020000
245 #define CONFIG_ENV_OFFSET_REDUND 0x00100000
246 #define CONFIG_ENV_SIZE_REDUND 0x00020000
247 #define CONFIG_ENV_RANGE (CONFIG_ENV_SIZE * 2)
248 /* CONFIG_BOOT_FROM_NAND end */
249
250 #elif defined(CONFIG_BOOT_FROM_SATA)
251 #ifdef CONFIG_BOOT_FROM_EXT4
252 #define CONFIG_ENV_IS_IN_EXT4
253 #define CONFIG_START_IDE
254 #define EXT4_ENV_INTERFACE "ide"
255 #define EXT4_ENV_DEVICE 0
256 #define EXT4_ENV_PART 1
257 #define EXT4_ENV_FILE "/boot/u-boot.env"
258 #define CONFIG_ENV_SIZE (16 * 1024)
259 #else
260 #define CONFIG_ENV_IS_IN_FAT
261 #define CONFIG_START_IDE
262 #define FAT_ENV_INTERFACE "ide"
263 #define FAT_ENV_DEVICE 0
264 #define FAT_ENV_PART 1
265 #define FAT_ENV_FILE "u-boot.env"
266 #define CONFIG_ENV_SIZE (16 * 1024)
267 #endif
268 /* CONFIG_BOOT_FROM_SATA end */
269 #elif defined(CONFIG_BOOT_FROM_SATA)
270
271 #else
272 /* generic */
273 #define CONFIG_ENV_IS_IN_UBI 1
274 #define CONFIG_ENV_UBI_PART UBIPART_DEFAULT
275 #define CONFIG_ENV_UBI_VOLUME "ubootenv"
276 #define CONFIG_ENV_UBI_VOLUME_REDUND "ubootenv2"
277 #define CONFIG_ENV_SIZE (16 * 1024)
278 #endif
279
280 /* allow to overwrite serial and ethaddr */
281 #define CONFIG_ENV_OVERWRITE
282
283 #define CONFIG_SYS_MONITOR_LEN (512 * 1024)
284 #define CONFIG_SYS_TEXT_BASE 0x64000000
285 #define CONFIG_SYS_INIT_SP_ADDR 0x65000000
286 /* Size of malloc() pool */
287 #define CONFIG_SYS_MALLOC_LEN (1 * 1024 * 1024)
288
289 /* Miscellaneous configurable options */
290 #define CONFIG_SYS_LONGHELP /* undef to save memory */
291 #define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
292 #define CONFIG_SYS_PROMPT "OX820 # "
293 #define CONFIG_SYS_CBSIZE 1024 /* Console I/O Buffer Size*/
294 #define CONFIG_SYS_PBSIZE 1024 /* Print Buffer Size */
295 #define CONFIG_SYS_MAXARGS 32 /* max number of command args */
296 #define CONFIG_CMDLINE_EDITING
297 #define CONFIG_AUTO_COMPLETE
298
299 /* usb */
300 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
301 #define CONFIG_USB_EHCI
302 #define CONFIG_EHCI_IS_TDI
303 /* #define CONFIG_USB_EHCI_TXFIFO_THRESH 0x3F */
304 #define CONFIG_USB_PLLB_CLK
305 #define CONFIG_USB_EHCI_OXNAS
306 #ifndef CONFIG_SPL_BUILD
307 #define CONFIG_USB_STORAGE
308 #endif
309 #define CONFIG_CMD_USB
310
311 /* cmds */
312 #define CONFIG_SYS_NO_FLASH
313 #include <config_cmd_default.h>
314
315 #define CONFIG_CMD_SAVEENV
316 #define CONFIG_CMD_ASKENV
317 #define CONFIG_CMD_GREPENV
318 #define CONFIG_CMD_ENV_FLAGS
319
320 #define CONFIG_CMD_NET
321 #define CONFIG_CMD_DHCP
322 #define CONFIG_CMD_NFS
323 #define CONFIG_CMD_PING
324 #define CONFIG_CMD_PXE
325
326 #define CONFIG_CMD_NAND
327 #define CONFIG_CMD_MTDPARTS
328 #define CONFIG_CMD_UBI
329 #define CONFIG_CMD_UBIFS
330
331 #define CONFIG_CMD_IDE
332 #define CONFIG_CMD_FAT
333 #define CONFIG_FAT_WRITE
334 #define CONFIG_CMD_EXT2
335 #define CONFIG_CMD_EXT4
336 #ifndef CONFIG_SPL_BUILD
337 #define CONFIG_CMD_EXT4_WRITE
338 #endif
339
340 #define CONFIG_CMD_ZIP
341 #define CONFIG_CMD_UNZIP
342 #define CONFIG_CMD_TIME
343 #define CONFIG_CMD_TERMINAL
344 #define CONFIG_CMD_SETEXPR
345 #define CONFIG_CMD_MD5SUM
346 #define CONFIG_CMD_HASH
347 #define CONFIG_CMD_INI
348 #define CONFIG_CMD_GETTIME
349 #define CONFIG_CMD_BOOTMENU
350 #define CONFIG_CMD_ELF
351
352 #define CONFIG_DOS_PARTITION
353 #define CONFIG_EFI_PARTITION
354
355 /* for CONFIG_CMD_MTDPARTS */
356 #define CONFIG_MTD_DEVICE
357 /* for CONFIG_CMD_UBI */
358 #define CONFIG_MTD_PARTITIONS
359 /* for CONFIG_CMD_UBI */
360 #define CONFIG_RBTREE
361
362 /* optional, for CONFIG_CMD_BOOTM & required by CONFIG_CMD_UBIFS */
363 #define CONFIG_LZO
364 #define CONFIG_LZMA
365 #define CONFIG_BZIP2
366
367 /* for CONFIG_CMD_ZIP */
368 #define CONFIG_GZIP_COMPRESSED
369 /* for CONFIG_CMD_MD5SUM */
370 #define CONFIG_MD5
371 #define CONFIG_MD5SUM_VERIFY
372 /* enable CONFIG_CMD_HASH's verification feature */
373 #define CONFIG_HASH_VERIFY
374 #define CONFIG_REGEX
375 /* for CONFIG_CMD_BOOTMENU & CONFIG_CMD_PXE */
376 #define CONFIG_MENU
377
378 /* for new FIT uImage format generated in OpenWrt */
379 #define CONFIG_FIT
380
381 #endif /* __CONFIG_H */