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