1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * (C) Copyright 2007-2010 Michal Simek
4  *
5  * Michal SIMEK <monstr@monstr.eu>
6  */
7 
8 #ifndef __CONFIG_H
9 #define __CONFIG_H
10 
11 /* Microblaze is microblaze_0 */
12 #define XILINX_FSL_NUMBER	3
13 
14 /* MicroBlaze CPU */
15 #define	MICROBLAZE_V5		1
16 
17 #define CONFIG_SYS_BOOTM_LEN	(64 * 1024 * 1024)
18 
19 /* uart */
20 /* The following table includes the supported baudrates */
21 # define CONFIG_SYS_BAUDRATE_TABLE \
22 	{300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400}
23 
24 /* setting reset address */
25 /*#define	CONFIG_SYS_RESET_ADDRESS	CONFIG_SYS_TEXT_BASE*/
26 
27 /* Stack location before relocation */
28 #define CONFIG_SYS_INIT_SP_OFFSET	(CONFIG_SYS_TEXT_BASE - \
29 					 CONFIG_SYS_MALLOC_F_LEN)
30 
31 #ifdef CONFIG_CFI_FLASH
32 /* ?empty sector */
33 # define CONFIG_SYS_FLASH_EMPTY_INFO	1
34 /* max number of memory banks */
35 # define CONFIG_SYS_MAX_FLASH_BANKS	1
36 /* max number of sectors on one chip */
37 # define CONFIG_SYS_MAX_FLASH_SECT	2048
38 #endif
39 
40 #define CONFIG_ICACHE
41 #define CONFIG_DCACHE
42 
43 #ifndef XILINX_DCACHE_BYTE_SIZE
44 #define XILINX_DCACHE_BYTE_SIZE	32768
45 #endif
46 
47 /*
48  * BOOTP options
49  */
50 #define CONFIG_BOOTP_BOOTFILESIZE
51 
52 /* size of console buffer */
53 #define	CONFIG_SYS_CBSIZE	512
54 /* max number of command args */
55 #define	CONFIG_SYS_MAXARGS	15
56 
57 #define	CONFIG_HOSTNAME		"microblaze-generic"
58 
59 /* architecture dependent code */
60 #define	CONFIG_SYS_USR_EXCEP	/* user exception */
61 
62 #if defined(CONFIG_CMD_PXE) && defined(CONFIG_CMD_DHCP)
63 #define BOOT_TARGET_DEVICES_PXE(func)	func(PXE, pxe, na)
64 #else
65 #define BOOT_TARGET_DEVICES_PXE(func)
66 #endif
67 
68 #if defined(CONFIG_CMD_DHCP)
69 #define BOOT_TARGET_DEVICES_DHCP(func)	func(DHCP, dhcp, na)
70 #else
71 #define BOOT_TARGET_DEVICES_DHCP(func)
72 #endif
73 
74 #if defined(CONFIG_SPI_FLASH)
75 # define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
76 #else
77 # define BOOT_TARGET_DEVICES_QSPI(func)
78 #endif
79 
80 #if defined(CONFIG_MTD_NOR_FLASH)
81 # define BOOT_TARGET_DEVICES_NOR(func)  func(NOR, nor, na)
82 #else
83 # define BOOT_TARGET_DEVICES_NOR(func)
84 #endif
85 
86 #define BOOTENV_DEV_NOR(devtypeu, devtypel, instance) \
87 	"bootcmd_nor=cp.b ${script_offset_nor} ${scriptaddr} ${script_size_f} && " \
88 		"echo NOR: Trying to boot script at ${scriptaddr} && " \
89 		"source ${scriptaddr}; echo NOR: SCRIPT FAILED: continuing...;\0"
90 
91 #define BOOTENV_DEV_NAME_NOR(devtypeu, devtypel, instance) \
92 	"nor "
93 
94 #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
95 	"bootcmd_qspi=sf probe 0 0 0 && " \
96 	"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
97 	"echo QSPI: Trying to boot script at ${scriptaddr} && " \
98 	"source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
99 
100 #define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
101 	"qspi "
102 
103 #define BOOT_TARGET_DEVICES_JTAG(func)	func(JTAG, jtag, na)
104 
105 #define BOOTENV_DEV_JTAG(devtypeu, devtypel, instance) \
106 	"bootcmd_jtag=echo JTAG: Trying to boot script at ${scriptaddr} && " \
107 		"source ${scriptaddr}; echo JTAG: SCRIPT FAILED: continuing...;\0"
108 
109 #define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \
110 	"jtag "
111 
112 #define BOOT_TARGET_DEVICES(func) \
113 	BOOT_TARGET_DEVICES_JTAG(func) \
114 	BOOT_TARGET_DEVICES_QSPI(func) \
115 	BOOT_TARGET_DEVICES_NOR(func) \
116 	BOOT_TARGET_DEVICES_DHCP(func) \
117 	BOOT_TARGET_DEVICES_PXE(func)
118 
119 #include <config_distro_bootcmd.h>
120 
121 #ifndef CONFIG_EXTRA_ENV_SETTINGS
122 #define CONFIG_EXTRA_ENV_SETTINGS \
123 	"unlock=yes\0"\
124 	"nor0=flash-0\0"\
125 	"mtdparts=mtdparts=flash-0:"\
126 	"256k(u-boot),256k(env),3m(kernel),"\
127 	"1m(romfs),1m(cramfs),-(jffs2)\0"\
128 	"nc=setenv stdout nc;"\
129 	"setenv stdin nc\0" \
130 	"serial=setenv stdout serial;"\
131 	"setenv stdin serial\0"\
132 	"script_size_f=0x40000\0"\
133 	BOOTENV
134 #endif
135 
136 #if defined(CONFIG_XILINX_AXIEMAC)
137 # define CONFIG_SYS_FAULT_ECHO_LINK_DOWN	1
138 #endif
139 
140 /* SPL part */
141 
142 #define CONFIG_SYS_UBOOT_BASE		CONFIG_SYS_TEXT_BASE
143 
144 /* for booting directly linux */
145 #define CONFIG_SYS_FDT_BASE		(CONFIG_SYS_TEXT_BASE + \
146 					0x40000)
147 
148 #define CONFIG_SYS_SPL_ARGS_ADDR	(CONFIG_SYS_TEXT_BASE + \
149 					 0x1000000)
150 
151 /* SP location before relocation, must use scratch RAM */
152 /* BRAM start */
153 #define CONFIG_SYS_INIT_RAM_ADDR	0x0
154 /* BRAM size - will be generated */
155 #define CONFIG_SYS_INIT_RAM_SIZE	0x100000
156 
157 # define CONFIG_SPL_STACK_ADDR		(CONFIG_SYS_INIT_RAM_ADDR + \
158 					 CONFIG_SYS_INIT_RAM_SIZE)
159 
160 /* Just for sure that there is a space for stack */
161 #define CONFIG_SPL_STACK_SIZE		0x100
162 
163 #define CONFIG_SPL_MAX_FOOTPRINT	(CONFIG_SYS_INIT_RAM_SIZE - \
164 					 CONFIG_SYS_INIT_RAM_ADDR - \
165 					 CONFIG_SYS_MALLOC_F_LEN - \
166 					 CONFIG_SPL_STACK_SIZE)
167 
168 #endif	/* __CONFIG_H */
169