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