[U-Boot] [RFC PATCH v1 3/6] dfu: spl: add generic spl-dfu function in common-spl

Ravi Babu ravibabu at ti.com
Tue Jun 14 13:02:21 CEST 2016


Add generic spl-dfu function in common-spl, specific
implemention for configuring dfu memory device is
done in platform board specific source file.

Signed-off-by: Ravi Babu <ravibabu at ti.com>
---
 common/spl/spl.c |    9 +++++++++
 include/spl.h    |    1 +
 2 files changed, 10 insertions(+)

diff --git a/common/spl/spl.c b/common/spl/spl.c
index 82e7f58..0726378 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -273,6 +273,11 @@ static void announce_boot_device(u32 boot_device)
 static inline void announce_boot_device(u32 boot_device) { }
 #endif
 
+__weak int spl_run_dfu(void)
+{
+	return 0;
+}
+
 static int spl_load_image(u32 boot_device)
 {
 	switch (boot_device) {
@@ -367,6 +372,9 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 	spl_board_init();
 #endif
 
+	if (spl_run_dfu())
+		goto os_boot;
+
 	board_boot_order(spl_boot_list);
 	for (i = 0; i < ARRAY_SIZE(spl_boot_list) &&
 			spl_boot_list[i] != BOOT_DEVICE_NONE; i++) {
@@ -381,6 +389,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 		hang();
 	}
 
+os_boot:
 	switch (spl_image.os) {
 	case IH_OS_U_BOOT:
 		debug("Jumping to U-Boot\n");
diff --git a/include/spl.h b/include/spl.h
index 8849678..f21a76a 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -149,4 +149,5 @@ bool spl_was_boot_source(void);
 int spl_dfu_mmc(int usb_index, int mmc_dev, char *dfu_alt_info);
 int spl_dfu_cmd(int usbctrl, char *dfu_alt_info, char *interface, char *devstr);
 int spl_dfu_ram_load_image(void);
+int spl_run_dfu(void);
 #endif
-- 
1.7.9.5



More information about the U-Boot mailing list