1 /*
2  * (C) Copyright 2014 Topic Embedded Products
3  *
4  * Configuration for Zynq Evaluation and Development Board - Miami
5  * See zynq-common.h for Zynq common configs
6  *
7  * SPDX-License-Identifier:	GPL-2.0+
8  */
9 
10 #ifndef __CONFIG_TOPIC_MIAMI_H
11 #define __CONFIG_TOPIC_MIAMI_H
12 
13 #define CONFIG_ZYNQ_I2C0
14 #define CONFIG_ZYNQ_I2C1
15 
16 /* Speed up boot time by ignoring the environment which we never used */
17 #define CONFIG_ENV_IS_NOWHERE
18 
19 #include "zynq-common.h"
20 
21 /* Fixup settings */
22 #undef CONFIG_ENV_SIZE
23 #define CONFIG_ENV_SIZE			0x8000
24 #undef CONFIG_ENV_OFFSET
25 #define CONFIG_ENV_OFFSET		0x80000
26 
27 /* SPL settings */
28 #undef CONFIG_SPL_ETH_SUPPORT
29 #undef CONFIG_SYS_SPI_U_BOOT_OFFS
30 #define CONFIG_SYS_SPI_U_BOOT_OFFS	0x20000
31 #undef CONFIG_SPL_MAX_FOOTPRINT
32 #define CONFIG_SPL_MAX_FOOTPRINT	CONFIG_SYS_SPI_U_BOOT_OFFS
33 #define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME     "u-boot.img"
34 
35 /* sspi command isn't useful */
36 #undef CONFIG_CMD_SPI
37 
38 /* No useful gpio */
39 #undef CONFIG_ZYNQ_GPIO
40 #undef CONFIG_CMD_GPIO
41 
42 /* No falcon support */
43 #undef CONFIG_SPL_OS_BOOT
44 #undef CONFIG_SPL_FPGA_SUPPORT
45 
46 /* FPGA commands that we don't use */
47 #undef CONFIG_CMD_FPGA_LOADMK
48 #undef CONFIG_CMD_FPGA_LOADP
49 #undef CONFIG_CMD_FPGA_LOADBP
50 #undef CONFIG_CMD_FPGA_LOADFS
51 
52 /* Extras */
53 #define CONFIG_CMD_MEMTEST
54 #undef CONFIG_SYS_MEMTEST_START
55 #define CONFIG_SYS_MEMTEST_START	0
56 #undef CONFIG_SYS_MEMTEST_END
57 #define CONFIG_SYS_MEMTEST_END	0x18000000
58 
59 /* Faster flash, ours may run at 108 MHz */
60 #undef CONFIG_SF_DEFAULT_SPEED
61 #define CONFIG_SF_DEFAULT_SPEED	108000000
62 #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
63 #undef CONFIG_SF_DUAL_FLASH
64 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
65 #undef CONFIG_SPI_FLASH_WINBOND
66 #undef CONFIG_SPI_FLASH_ISSI
67 
68 /* Setup proper boot sequences for Miami boards */
69 
70 #if defined(CONFIG_USB)
71 # define EXTRA_ENV_USB \
72 	"usbreset=i2c dev 1 && i2c mw 41 1 ff && i2c mw 41 3 fe && "\
73 		"i2c mw 41 1 fe && i2c mw 41 1 ff\0" \
74 	"usbboot=run usbreset && if usb start; then " \
75 		"echo Booting from USB... && " \
76 		"if load usb 0 0x1900000 ${bootscript}; then "\
77 		"source 0x1900000; fi; " \
78 		"load usb 0 ${kernel_addr} ${kernel_image} && " \
79 		"load usb 0 ${devicetree_addr} ${devicetree_image} && " \
80 		"load usb 0 ${ramdisk_load_address} ${ramdisk_image} && " \
81 		"bootm ${kernel_addr} ${ramdisk_load_address} "\
82 			"${devicetree_addr}; " \
83 	"fi\0"
84   /* Note that addresses here should match the addresses in the env */
85 # undef DFU_ALT_INFO
86 # define DFU_ALT_INFO \
87 	"dfu_alt_info=" \
88 	"uImage ram 0x2080000 0x500000;" \
89 	"devicetree.dtb ram 0x2000000 0x20000;" \
90 	"uramdisk.image.gz ram 0x4000000 0x10000000\0" \
91 	"dfu_ram=run usbreset && dfu 0 ram 0\0" \
92 	"thor_ram=run usbreset && thordown 0 ram 0\0"
93 #else
94 # define EXTRA_ENV_USB
95 #endif
96 
97 #undef CONFIG_PREBOOT
98 
99 #undef CONFIG_EXTRA_ENV_SETTINGS
100 #define CONFIG_EXTRA_ENV_SETTINGS	\
101 	"kernel_image=uImage\0"	\
102 	"kernel_addr=0x2080000\0" \
103 	"ramdisk_image=uramdisk.image.gz\0"	\
104 	"ramdisk_load_address=0x4000000\0"	\
105 	"devicetree_image=devicetree.dtb\0"	\
106 	"devicetree_addr=0x2000000\0"	\
107 	"bitstream_image=fpga.bin\0"	\
108 	"bootscript=autorun.scr\0" \
109 	"loadbit_addr=0x100000\0"	\
110 	"loadbootenv_addr=0x2000000\0" \
111 	"kernel_size=0x440000\0"	\
112 	"devicetree_size=0x10000\0"	\
113 	"boot_size=0xF00000\0"	\
114 	"fdt_high=0x20000000\0"	\
115 	"initrd_high=0x20000000\0"	\
116 	"mmc_loadbit=echo Loading bitstream from SD/MMC/eMMC to RAM.. && " \
117 		"mmcinfo && " \
118 		"load mmc 0 ${loadbit_addr} ${bitstream_image} && " \
119 		"fpga load 0 ${loadbit_addr} ${filesize}\0" \
120 	"qspiboot=echo Booting from QSPI flash... && " \
121 		"sf probe && " \
122 		"sf read ${devicetree_addr} 0xA0000 ${devicetree_size} && " \
123 		"sf read ${kernel_addr} 0xC0000 ${kernel_size} && " \
124 		"bootm ${kernel_addr} - ${devicetree_addr}\0" \
125 	"sdboot=if mmcinfo; then " \
126 			"setenv bootargs console=ttyPS0,115200 " \
127 				"root=/dev/mmcblk0p2 rw rootfstype=ext4 " \
128 				"rootwait quiet ; " \
129 			"load mmc 0 ${kernel_addr} ${kernel_image}&& " \
130 			"load mmc 0 ${devicetree_addr} ${devicetree_image}&& " \
131 			"bootm ${kernel_addr} - ${devicetree_addr}; " \
132 		"fi\0" \
133 	EXTRA_ENV_USB \
134 	DFU_ALT_INFO
135 
136 #undef CONFIG_BOOTCOMMAND
137 #define CONFIG_BOOTCOMMAND	"if mmcinfo; then " \
138 	"if fatload mmc 0 0x1900000 ${bootscript}; then source 0x1900000; " \
139 	"fi; fi; run $modeboot"
140 #undef CONFIG_DISPLAY_BOARDINFO
141 
142 /* Further tweaks to reduce image size */
143 #undef CONFIG_CMD_BOOTZ
144 #undef CONFIG_CMD_NET
145 #undef CONFIG_CMD_AES
146 
147 #endif /* __CONFIG_TOPIC_MIAMI_H */
148