[U-Boot] [PATCH] sunxi: add spi flash bootcmd

Oskari Lemmela oskari at lemmela.net
Sat Jan 5 18:03:46 UTC 2019


Enable SPI bootcmd if CONFIG_DM_SPI_FLASH is defined.

Signed-off-by: Oskari Lemmela <oskari at lemmela.net>
---
 include/configs/sunxi-common.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 9819d9980c..b2443ef678 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -401,6 +401,21 @@ extern int soft_i2c_gpio_scl;
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
 
+#ifdef CONFIG_DM_SPI_FLASH
+#define BOOT_TARGET_DEVICES_SPI(func) func(SPI, spi, 0)
+#define BOOTENV_DEV_SPI(devtypeu, devtypel, instance) \
+	"image_addr=0x100000\0" \
+	"image_size=0x700000\0" \
+	"bootcmd_" #devtypel #instance "=" \
+		"if sf probe " #instance "; then " \
+			"sf read ${ramdisk_addr_r} ${image_addr} ${image_size}; " \
+			"bootm ${ramdisk_addr_r}; " \
+		"fi\0"
+#define BOOTENV_DEV_NAME_SPI(devtypeu, devtypel, instance) \
+	#devtypel #instance " "
+#else
+#define BOOT_TARGET_DEVICES_SPI(func)
+#endif
 /* FEL boot support, auto-execute boot.scr if a script address was provided */
 #define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
 	"bootcmd_fel=" \
@@ -416,6 +431,7 @@ extern int soft_i2c_gpio_scl;
 	BOOT_TARGET_DEVICES_MMC(func) \
 	BOOT_TARGET_DEVICES_SCSI(func) \
 	BOOT_TARGET_DEVICES_USB(func) \
+	BOOT_TARGET_DEVICES_SPI(func) \
 	func(PXE, pxe, na) \
 	func(DHCP, dhcp, na)
 
-- 
2.17.1



More information about the U-Boot mailing list