diff mbox

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

Message ID 1471995532-18649-2-git-send-email-steve.rae@raedomain.com
State Changes Requested
Delegated to: Lukasz Majewski
Headers show

Commit Message

Steve Rae Aug. 23, 2016, 11:38 p.m. UTC
on bcm235xx and bcm281xx boards

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

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

Comments

Steve Rae Sept. 25, 2016, 1:01 a.m. UTC | #1
On Aug 23, 2016 16:39, "Steve Rae" <steve.rae@raedomain.com> wrote:
>
> on bcm235xx and bcm281xx boards
>
> Signed-off-by: Steve Rae <steve.rae@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
>

ping...
diff mbox

Patch

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);
+	}
+}