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