All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode
@ 2017-08-09 10:18 Kever Yang
  2017-08-09 10:18 ` [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag Kever Yang
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Kever Yang @ 2017-08-09 10:18 UTC (permalink / raw)
  To: u-boot

U-Boot fastboot, kernel may reboot with parameter which require
bootloader to get into different boot mode, detect it and enter
proper mode.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 arch/arm/mach-rockchip/rk3399/Kconfig  |  1 +
 arch/arm/mach-rockchip/rk3399/rk3399.c | 42 +++++++++++++++++++++++++++++++++-
 2 files changed, 42 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-rockchip/rk3399/Kconfig b/arch/arm/mach-rockchip/rk3399/Kconfig
index 415466a..c4a6d46 100644
--- a/arch/arm/mach-rockchip/rk3399/Kconfig
+++ b/arch/arm/mach-rockchip/rk3399/Kconfig
@@ -5,6 +5,7 @@ choice
 
 config TARGET_EVB_RK3399
 	bool "RK3399 evaluation board"
+	select BOARD_LATE_INIT
 	help
 	  RK3399evb is a evaluation board for Rockchp rk3399,
 	  with full function and phisical connectors support like type-C ports,
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index 3484b28..d7a8aa6 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -5,9 +5,13 @@
  */
 
 #include <common.h>
+#include <syscon.h>
 #include <asm/armv8/mmu.h>
-#include <asm/io.h>
+#include <asm/arch/boot_mode.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/grf_rk3399.h>
 #include <asm/arch/hardware.h>
+#include <asm/io.h>
 
 #define GRF_EMMCCORE_CON11 0xff77f02c
 
@@ -53,3 +57,39 @@ int arch_cpu_init(void)
 
 	return 0;
 }
+
+static void setup_boot_mode(void)
+{
+	struct rk3399_pmugrf_regs *pmugrf;
+	int boot_mode;
+
+	pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
+	boot_mode = readl(&pmugrf->os_reg0);
+	debug("boot mode %x\n", boot_mode);
+
+	/* Clear boot mode */
+	writel(BOOT_NORMAL, &pmugrf->os_reg0);
+
+	switch (boot_mode) {
+	case BOOT_FASTBOOT:
+		printf("enter fastboot!\n");
+		setenv("preboot", "setenv preboot; fastboot usb0");
+		break;
+	case BOOT_UMS:
+		printf("enter UMS!\n");
+		setenv("preboot", "setenv preboot; if mmc dev 0;"
+		       "then ums mmc 0; else ums mmc 1;fi");
+		break;
+	case BOOT_LOADER:
+		printf("enter Rockusb!\n");
+		setenv("preboot", "setenv preboot; rockusb 0 mmc 0");
+		break;
+	}
+}
+
+int board_late_init(void)
+{
+	setup_boot_mode();
+
+	return 0;
+}
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag
  2017-08-09 10:18 [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Kever Yang
@ 2017-08-09 10:18 ` Kever Yang
  2017-08-13 21:36   ` Simon Glass
  2017-08-18 16:08   ` [U-Boot] [U-Boot, " Philipp Tomsich
  2017-08-09 10:18 ` [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect Kever Yang
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 9+ messages in thread
From: Kever Yang @ 2017-08-09 10:18 UTC (permalink / raw)
  To: u-boot

fastboot have a command "reboot-bootloader" which require the boot
loader to reboot and get into fastboot mode again.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 arch/arm/mach-rockchip/rk3399/rk3399.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index d7a8aa6..729e876 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -93,3 +93,17 @@ int board_late_init(void)
 
 	return 0;
 }
+
+#if defined(CONFIG_USB_FUNCTION_FASTBOOT)
+int fb_set_reboot_flag(void)
+{
+	struct rk3399_pmugrf_regs *pmugrf;
+
+	printf("Setting reboot to fastboot flag ...\n");
+	pmugrf = syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF);
+	/* Clear boot mode */
+	writel(BOOT_FASTBOOT, &pmugrf->os_reg0);
+
+	return 0;
+}
+#endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect
  2017-08-09 10:18 [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Kever Yang
  2017-08-09 10:18 ` [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag Kever Yang
@ 2017-08-09 10:18 ` Kever Yang
  2017-08-13 21:36   ` Simon Glass
  2017-08-18 16:08   ` [U-Boot] [U-Boot, " Philipp Tomsich
  2017-08-13 21:36 ` [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Simon Glass
  2017-08-18 16:08 ` [U-Boot] [U-Boot,1/3] " Philipp Tomsich
  3 siblings, 2 replies; 9+ messages in thread
From: Kever Yang @ 2017-08-09 10:18 UTC (permalink / raw)
  To: u-boot

We need to get into preboot once we detect that we are not
get into normal boot.

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---

 include/configs/rk3399_common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/rk3399_common.h b/include/configs/rk3399_common.h
index 1ef6b92..9a1690e 100644
--- a/include/configs/rk3399_common.h
+++ b/include/configs/rk3399_common.h
@@ -73,6 +73,8 @@
 
 #endif
 
+#define CONFIG_PREBOOT
+
 /* enable usb config for usb ether */
 #define CONFIG_USB_HOST_ETHER
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode
  2017-08-09 10:18 [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Kever Yang
  2017-08-09 10:18 ` [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag Kever Yang
  2017-08-09 10:18 ` [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect Kever Yang
@ 2017-08-13 21:36 ` Simon Glass
  2017-08-18 16:08 ` [U-Boot] [U-Boot,1/3] " Philipp Tomsich
  3 siblings, 0 replies; 9+ messages in thread
From: Simon Glass @ 2017-08-13 21:36 UTC (permalink / raw)
  To: u-boot

On 9 August 2017 at 04:18, Kever Yang <kever.yang@rock-chips.com> wrote:
> U-Boot fastboot, kernel may reboot with parameter which require
> bootloader to get into different boot mode, detect it and enter
> proper mode.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  arch/arm/mach-rockchip/rk3399/Kconfig  |  1 +
>  arch/arm/mach-rockchip/rk3399/rk3399.c | 42 +++++++++++++++++++++++++++++++++-
>  2 files changed, 42 insertions(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag
  2017-08-09 10:18 ` [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag Kever Yang
@ 2017-08-13 21:36   ` Simon Glass
  2017-08-18 16:08   ` [U-Boot] [U-Boot, " Philipp Tomsich
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2017-08-13 21:36 UTC (permalink / raw)
  To: u-boot

On 9 August 2017 at 04:18, Kever Yang <kever.yang@rock-chips.com> wrote:
> fastboot have a command "reboot-bootloader" which require the boot
> loader to reboot and get into fastboot mode again.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  arch/arm/mach-rockchip/rk3399/rk3399.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect
  2017-08-09 10:18 ` [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect Kever Yang
@ 2017-08-13 21:36   ` Simon Glass
  2017-08-18 16:08   ` [U-Boot] [U-Boot, " Philipp Tomsich
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2017-08-13 21:36 UTC (permalink / raw)
  To: u-boot

On 9 August 2017 at 04:18, Kever Yang <kever.yang@rock-chips.com> wrote:
> We need to get into preboot once we detect that we are not
> get into normal boot.
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
>  include/configs/rk3399_common.h | 2 ++
>  1 file changed, 2 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot,1/3] rockchip: rk3399: detect boot mode
  2017-08-09 10:18 [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Kever Yang
                   ` (2 preceding siblings ...)
  2017-08-13 21:36 ` [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Simon Glass
@ 2017-08-18 16:08 ` Philipp Tomsich
  3 siblings, 0 replies; 9+ messages in thread
From: Philipp Tomsich @ 2017-08-18 16:08 UTC (permalink / raw)
  To: u-boot

> U-Boot fastboot, kernel may reboot with parameter which require
> bootloader to get into different boot mode, detect it and enter
> proper mode.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/arm/mach-rockchip/rk3399/Kconfig  |  1 +
>  arch/arm/mach-rockchip/rk3399/rk3399.c | 42 +++++++++++++++++++++++++++++++++-
>  2 files changed, 42 insertions(+), 1 deletion(-)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, 2/3] rockchip: rk3399: enable fastboot to set boot mode tag
  2017-08-09 10:18 ` [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag Kever Yang
  2017-08-13 21:36   ` Simon Glass
@ 2017-08-18 16:08   ` Philipp Tomsich
  1 sibling, 0 replies; 9+ messages in thread
From: Philipp Tomsich @ 2017-08-18 16:08 UTC (permalink / raw)
  To: u-boot

> fastboot have a command "reboot-bootloader" which require the boot
> loader to reboot and get into fastboot mode again.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  arch/arm/mach-rockchip/rk3399/rk3399.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [U-Boot, 3/3] rockchip: rk3399: enable preboot for boot mode detect
  2017-08-09 10:18 ` [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect Kever Yang
  2017-08-13 21:36   ` Simon Glass
@ 2017-08-18 16:08   ` Philipp Tomsich
  1 sibling, 0 replies; 9+ messages in thread
From: Philipp Tomsich @ 2017-08-18 16:08 UTC (permalink / raw)
  To: u-boot

> We need to get into preboot once we detect that we are not
> get into normal boot.
> 
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  include/configs/rk3399_common.h | 2 ++
>  1 file changed, 2 insertions(+)
> 

Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-08-18 16:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-09 10:18 [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Kever Yang
2017-08-09 10:18 ` [U-Boot] [PATCH 2/3] rockchip: rk3399: enable fastboot to set boot mode tag Kever Yang
2017-08-13 21:36   ` Simon Glass
2017-08-18 16:08   ` [U-Boot] [U-Boot, " Philipp Tomsich
2017-08-09 10:18 ` [U-Boot] [PATCH 3/3] rockchip: rk3399: enable preboot for boot mode detect Kever Yang
2017-08-13 21:36   ` Simon Glass
2017-08-18 16:08   ` [U-Boot] [U-Boot, " Philipp Tomsich
2017-08-13 21:36 ` [U-Boot] [PATCH 1/3] rockchip: rk3399: detect boot mode Simon Glass
2017-08-18 16:08 ` [U-Boot] [U-Boot,1/3] " Philipp Tomsich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.