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 
48 /* Extras */
49 #define CONFIG_CMD_MEMTEST
50 #undef CONFIG_SYS_MEMTEST_START
51 #define CONFIG_SYS_MEMTEST_START	0
52 #undef CONFIG_SYS_MEMTEST_END
53 #define CONFIG_SYS_MEMTEST_END	0x18000000
54 
55 /* Faster flash, ours may run at 108 MHz */
56 #undef CONFIG_SF_DEFAULT_SPEED
57 #define CONFIG_SF_DEFAULT_SPEED	108000000
58 #define CONFIG_SF_DEFAULT_MODE SPI_MODE_0
59 #define CONFIG_ENV_SPI_MAX_HZ CONFIG_SF_DEFAULT_SPEED
60 #undef CONFIG_SPI_FLASH_WINBOND
61 #undef CONFIG_SPI_FLASH_ISSI
62 
63 /* Setup proper boot sequences for Miami boards */
64 
65 #if defined(CONFIG_USB)
66 # define EXTRA_ENV_USB \
67 	"usbreset=i2c dev 1 && i2c mw 41 1 ff && i2c mw 41 3 fe && "\
68 		"i2c mw 41 1 fe && i2c mw 41 1 ff\0" \
69 	"usbboot=run usbreset && if usb start; then " \
70 		"echo Booting from USB... && " \
71 		"if load usb 0 0x1900000 ${bootscript}; then "\
72 		"source 0x1900000; fi; " \
73 		"load usb 0 ${kernel_addr} ${kernel_image} && " \
74 		"load usb 0 ${devicetree_addr} ${devicetree_image} && " \
75 		"load usb 0 ${ramdisk_load_address} ${ramdisk_image} && " \
76 		"bootm ${kernel_addr} ${ramdisk_load_address} "\
77 			"${devicetree_addr}; " \
78 	"fi\0"
79   /* Note that addresses here should match the addresses in the env */
80 # undef DFU_ALT_INFO
81 # define DFU_ALT_INFO \
82 	"dfu_alt_info=" \
83 	"uImage ram 0x2080000 0x500000;" \
84 	"devicetree.dtb ram 0x2000000 0x20000;" \
85 	"uramdisk.image.gz ram 0x4000000 0x10000000\0" \
86 	"dfu_ram=run usbreset && dfu 0 ram 0\0" \
87 	"thor_ram=run usbreset && thordown 0 ram 0\0"
88 #else
89 # define EXTRA_ENV_USB
90 #endif
91 
92 #undef CONFIG_PREBOOT
93 
94 #undef CONFIG_EXTRA_ENV_SETTINGS
95 #define CONFIG_EXTRA_ENV_SETTINGS	\
96 	"kernel_image=uImage\0"	\
97 	"kernel_addr=0x2080000\0" \
98 	"ramdisk_image=uramdisk.image.gz\0"	\
99 	"ramdisk_load_address=0x4000000\0"	\
100 	"devicetree_image=devicetree.dtb\0"	\
101 	"devicetree_addr=0x2000000\0"	\
102 	"bitstream_image=fpga.bin\0"	\
103 	"bootscript=autorun.scr\0" \
104 	"loadbit_addr=0x100000\0"	\
105 	"loadbootenv_addr=0x2000000\0" \
106 	"kernel_size=0x440000\0"	\
107 	"devicetree_size=0x10000\0"	\
108 	"boot_size=0xF00000\0"	\
109 	"fdt_high=0x20000000\0"	\
110 	"initrd_high=0x20000000\0"	\
111 	"mmc_loadbit=echo Loading bitstream from SD/MMC/eMMC to RAM.. && " \
112 		"mmcinfo && " \
113 		"load mmc 0 ${loadbit_addr} ${bitstream_image} && " \
114 		"fpga load 0 ${loadbit_addr} ${filesize}\0" \
115 	"qspiboot=echo Booting from QSPI flash... && " \
116 		"sf probe && " \
117 		"sf read ${devicetree_addr} 0xA0000 ${devicetree_size} && " \
118 		"sf read ${kernel_addr} 0xC0000 ${kernel_size} && " \
119 		"bootm ${kernel_addr} - ${devicetree_addr}\0" \
120 	"sdboot=if mmcinfo; then " \
121 			"setenv bootargs console=ttyPS0,115200 " \
122 				"root=/dev/mmcblk0p2 rw rootfstype=ext4 " \
123 				"rootwait quiet ; " \
124 			"load mmc 0 ${kernel_addr} ${kernel_image}&& " \
125 			"load mmc 0 ${devicetree_addr} ${devicetree_image}&& " \
126 			"bootm ${kernel_addr} - ${devicetree_addr}; " \
127 		"fi\0" \
128 	EXTRA_ENV_USB \
129 	DFU_ALT_INFO
130 
131 #undef CONFIG_BOOTCOMMAND
132 #define CONFIG_BOOTCOMMAND	"if mmcinfo; then " \
133 	"if fatload mmc 0 0x1900000 ${bootscript}; then source 0x1900000; " \
134 	"fi; fi; run $modeboot"
135 #undef CONFIG_DISPLAY_BOARDINFO
136 
137 /* Further tweaks to reduce image size */
138 #undef CONFIG_CMD_BOOTZ
139 #undef CONFIG_CMD_NET
140 
141 #endif /* __CONFIG_TOPIC_MIAMI_H */
142