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