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