[U-Boot] [PATCH 2/2] bcm: fastboot: implement 'reboot-bootloader'

Steve Rae steve.rae at raedomain.com
Wed Aug 24 01:38:52 CEST 2016


on bcm235xx and bcm281xx boards

Signed-off-by: Steve Rae <steve.rae at raedomain.com>
---

 board/broadcom/bcm23550_w1d/bcm23550_w1d.c | 30 ++++++++++++++++++++++++++++++
 board/broadcom/bcm28155_ap/bcm28155_ap.c   | 30 ++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
index 0cb059f..ec0956c 100644
--- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
+++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
@@ -26,6 +26,9 @@
 #define CONFIG_USB_SERIALNO "1234567890"
 #endif
 
+#define FB_REBOOT_FLAG_BITS		0x05
+#define FB_REBOOT_FLAG_LOCATION		0x34051f80
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -118,3 +121,30 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 	return 0;
 }
 #endif
+
+int fb_set_reboot_flag(void)
+{
+	/* set 'reboot-bootloader' bits */
+	writel(readl(FB_REBOOT_FLAG_LOCATION) | FB_REBOOT_FLAG_BITS,
+	       FB_REBOOT_FLAG_LOCATION);
+	printf("%s: 0x%08x @ 0x%08x\n", __func__,
+	       readl(FB_REBOOT_FLAG_LOCATION), FB_REBOOT_FLAG_LOCATION);
+	return 0;
+}
+
+void fb_handle_reboot_flag(void)
+{
+	int run_fastboot = (readl(FB_REBOOT_FLAG_LOCATION) &
+			    FB_REBOOT_FLAG_BITS ? 1 : 0);
+
+	if (run_fastboot) {
+		printf("\n%s: performing: 'fastboot 0'\n", __func__);
+
+		/* clear 'reboot-bootloader' bits */
+		writel(readl(FB_REBOOT_FLAG_LOCATION) & ~(FB_REBOOT_FLAG_BITS),
+		       FB_REBOOT_FLAG_LOCATION);
+
+		/* process 'reboot-bootloader' request */
+		run_command("fastboot 0", 0);
+	}
+}
diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
index b3a4a41..5ac9569 100644
--- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -26,6 +26,9 @@
 #define CONFIG_USB_SERIALNO "1234567890"
 #endif
 
+#define FB_REBOOT_FLAG_BITS		0x05
+#define FB_REBOOT_FLAG_LOCATION		0x34053f98
+
 DECLARE_GLOBAL_DATA_PTR;
 
 /*
@@ -125,3 +128,30 @@ int board_usb_cleanup(int index, enum usb_init_type init)
 	return 0;
 }
 #endif
+
+int fb_set_reboot_flag(void)
+{
+	/* set 'reboot-bootloader' bits */
+	writel(readl(FB_REBOOT_FLAG_LOCATION) | FB_REBOOT_FLAG_BITS,
+	       FB_REBOOT_FLAG_LOCATION);
+	printf("%s: 0x%08x @ 0x%08x\n", __func__,
+	       readl(FB_REBOOT_FLAG_LOCATION), FB_REBOOT_FLAG_LOCATION);
+	return 0;
+}
+
+void fb_handle_reboot_flag(void)
+{
+	int run_fastboot = (readl(FB_REBOOT_FLAG_LOCATION) &
+			    FB_REBOOT_FLAG_BITS ? 1 : 0);
+
+	if (run_fastboot) {
+		printf("\n%s: performing: 'fastboot 0'\n", __func__);
+
+		/* clear 'reboot-bootloader' bits */
+		writel(readl(FB_REBOOT_FLAG_LOCATION) & ~(FB_REBOOT_FLAG_BITS),
+		       FB_REBOOT_FLAG_LOCATION);
+
+		/* process 'reboot-bootloader' request */
+		run_command("fastboot 0", 0);
+	}
+}
-- 
1.8.5



More information about the U-Boot mailing list