Skip to contentSkip to conversation

rockchip: Print a message when returning to the bootrom

PATCH New Simon Glass 2 participants 4 messages Apr 5, 2017 – Apr 6, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rockchip: Print a message when returning to the bootrom

At present if the return to bootrom fails (e.g. because you are not using the Rockchip's bootrom's pointer table in MMC) then the board prints SPL message and hangs. Print a message first if we can, to help in understanding what happened when it hangs.

---

 arch/arm/include/asm/arch-rockchip/bootrom.h |  9 +++++++--
 arch/arm/mach-rockchip/Makefile              |  2 ++
 arch/arm/mach-rockchip/bootrom.c             | 16 ++++++++++++++++
 arch/arm/mach-rockchip/save_boot_param.S     |  6 +++---
 configs/firefly-rk3288_defconfig             |  2 +-
 5 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/bootrom.c
arch/arm/include/asm/arch-rockchip/bootrom.h +7 -2
index 79fb1a07ac..92eb8783a3 100644
@@ -13,10 +13,15 @@
  */
 extern u32 SAVE_SP_ADDR;
 
-/*
+/**
  * Hand control back to the bootrom to load another
  * boot stage.
  */
-extern void back_to_bootrom(void);
+void back_to_bootrom(void);
+
+/**
+ * Assembler component for the above (do not call this directly)
+ */
+void _back_to_bootrom_s(void);
 
 #endif
arch/arm/mach-rockchip/Makefile +2 -0
index 6b251c7e7e..5caecfb2c0 100644
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-y += bootrom.o
+
 ifdef CONFIG_TPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o
arch/arm/mach-rockchip/bootrom.c new file +16 -0
new file mode 100644
index 0000000000..65f058460e
@@ -0,0 +1,16 @@
+/**
+ * Copyright (c) 2017 Google, Inc
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/bootrom.h>
+
+void back_to_bootrom(void)
+{
+#ifdef SPL_LIBGENERIC_SUPPORT
+	printf("Returning to boot ROM...");
+#endif
+	_back_to_bootrom_s();
+}
arch/arm/mach-rockchip/save_boot_param.S +3 -3
index 85b407b4d3..5e6c8dba13 100644
@@ -23,10 +23,10 @@ ENTRY(save_boot_params)
 ENDPROC(save_boot_params)
 
 
-.globl back_to_bootrom
-ENTRY(back_to_bootrom)
+.globl _back_to_bootrom_s
+ENTRY(_back_to_bootrom_s)
 	ldr	r0, =SAVE_SP_ADDR
 	ldr	sp, [r0]
 	mov	r0, #0
 	pop	{r1-r12, pc}
-ENDPROC(back_to_bootrom)
+ENDPROC(_back_to_bootrom_s)
configs/firefly-rk3288_defconfig +1 -1
index b0741d7bd9..f2e079a378 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ROCKCHIP_RK3288=y
-CONFIG_ROCKCHIP_SPL_BACK_TO_BROM=y
 CONFIG_TARGET_FIREFLY_RK3288=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="rk3288-firefly"
@@ -74,3 +73,4 @@ CONFIG_CONSOLE_SCROLL_LINES=10
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
+CONFIG_SPL_OF_PLATDATA=y
Signature · 1 line
2.12.2.715.g7642488e1d-goog
#1 lore raw

PATCH 1/1 rockchip: Print a message when returning to the bootrom

Hi,

Quoted 7 lines · Simon Glass

At present if the return to bootrom fails (e.g. because you are not using the Rockchip's bootrom's pointer table in MMC) then the board prints SPL message and hangs. Print a message first if we can, to help in understanding what happened when it hangs.

---

This is supposed to be an RFC, sorry. Please ignore the firefly change. I tend to get his with this problem a lot so am thinking some indication would be useful.

Quoted 102 lines
 arch/arm/include/asm/arch-rockchip/bootrom.h |  9 +++++++--
 arch/arm/mach-rockchip/Makefile              |  2 ++
 arch/arm/mach-rockchip/bootrom.c             | 16 ++++++++++++++++
 arch/arm/mach-rockchip/save_boot_param.S     |  6 +++---
 configs/firefly-rk3288_defconfig             |  2 +-
 5 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/bootrom.c
arch/arm/include/asm/arch-rockchip/bootrom.h +7 -2
index 79fb1a07ac..92eb8783a3 100644
@@ -13,10 +13,15 @@
  */
 extern u32 SAVE_SP_ADDR;
 
-/*
+/**
  * Hand control back to the bootrom to load another
  * boot stage.
  */
-extern void back_to_bootrom(void);
+void back_to_bootrom(void);
+
+/**
+ * Assembler component for the above (do not call this directly)
+ */
+void _back_to_bootrom_s(void);
 
 #endif
arch/arm/mach-rockchip/Makefile +2 -0
index 6b251c7e7e..5caecfb2c0 100644
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier:     GPL-2.0+
 #
 
+obj-y += bootrom.o
+
 ifdef CONFIG_TPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o
arch/arm/mach-rockchip/bootrom.c new file +16 -0
new file mode 100644
index 0000000000..65f058460e
@@ -0,0 +1,16 @@
+/**
+ * Copyright (c) 2017 Google, Inc
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/bootrom.h>
+
+void back_to_bootrom(void)
+{
+#ifdef SPL_LIBGENERIC_SUPPORT
+       printf("Returning to boot ROM...");
+#endif
+       _back_to_bootrom_s();
+}
arch/arm/mach-rockchip/save_boot_param.S +3 -3
index 85b407b4d3..5e6c8dba13 100644
@@ -23,10 +23,10 @@ ENTRY(save_boot_params)
 ENDPROC(save_boot_params)
 
 
-.globl back_to_bootrom
-ENTRY(back_to_bootrom)
+.globl _back_to_bootrom_s
+ENTRY(_back_to_bootrom_s)
        ldr     r0, =SAVE_SP_ADDR
        ldr     sp, [r0]
        mov     r0, #0
        pop     {r1-r12, pc}
-ENDPROC(back_to_bootrom)
+ENDPROC(_back_to_bootrom_s)
configs/firefly-rk3288_defconfig +1 -2
index b0741d7bd9..f2e079a378 100644
@@ -2,7 +2,6 @@ CONFIG_ARM=y
 CONFIG_ARCH_ROCKCHIP=y
 CONFIG_SYS_MALLOC_F_LEN=0x2000
 CONFIG_ROCKCHIP_RK3288=y
-CONFIG_ROCKCHIP_SPL_BACK_TO_BROM=y
 CONFIG_TARGET_FIREFLY_RK3288=y
 CONFIG_SPL_STACK_R_ADDR=0x80000
 CONFIG_DEFAULT_DEVICE_TREE="rk3288-firefly"
@@ -74,3 +73,4 @@ CONFIG_CONSOLE_SCROLL_LINES=10
 CONFIG_USE_TINY_PRINTF=y
 CONFIG_CMD_DHRYSTONE=y
 CONFIG_ERRNO_STR=y
+CONFIG_SPL_OF_PLATDATA=y
--
Quoted 2 lines

2.12.2.715.g7642488e1d-goog

Regards,
Simon

maintainer
#2 lore raw

PATCH 1/1 rockchip: Print a message when returning to the bootrom

In reply to Simon Glass

Am Dienstag, 4. April 2017, 20:02:40 CEST schrieb Simon Glass:

Quoted 59 lines

At present if the return to bootrom fails (e.g. because you are not using the Rockchip's bootrom's pointer table in MMC) then the board prints SPL message and hangs. Print a message first if we can, to help in understanding what happened when it hangs.

---

 arch/arm/include/asm/arch-rockchip/bootrom.h |  9 +++++++--
 arch/arm/mach-rockchip/Makefile              |  2 ++
 arch/arm/mach-rockchip/bootrom.c             | 16 ++++++++++++++++
 arch/arm/mach-rockchip/save_boot_param.S     |  6 +++---
 configs/firefly-rk3288_defconfig             |  2 +-
 5 files changed, 29 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/bootrom.c
arch/arm/include/asm/arch-rockchip/bootrom.h +7 -2
index 79fb1a07ac..92eb8783a3 100644
@@ -13,10 +13,15 @@
  */
 extern u32 SAVE_SP_ADDR;
 
-/*
+/**
  * Hand control back to the bootrom to load another
  * boot stage.
  */
-extern void back_to_bootrom(void);
+void back_to_bootrom(void);
+
+/**
+ * Assembler component for the above (do not call this directly)
+ */
+void _back_to_bootrom_s(void);
 
 #endif
arch/arm/mach-rockchip/Makefile +2 -0
index 6b251c7e7e..5caecfb2c0 100644
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-y += bootrom.o
+
 ifdef CONFIG_TPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o
arch/arm/mach-rockchip/bootrom.c new file +2 -0
new file mode 100644
index 0000000000..65f058460e
@@ -0,0 +1,16 @@
+/**
+ * Copyright (c) 2017 Google, Inc

arch/arm/mach-rockchip/bootrom.c line 12

Quoted 10 lines
arch/arm/mach-rockchip/bootrom.c new file +10 -0
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/bootrom.h>
+
+void back_to_bootrom(void)
+{
+#ifdef SPL_LIBGENERIC_SUPPORT

you might want something like

	#if defined(CONFIG_SPL_LIBGENERIC_SUPPORT) && \
	    !defined(CONFIG_TPL_BUILD)

instead. For one to test for the correct option and secondly we most likely don't want it in any TPL for size reasons.

Apart from that, it does what it is supposed to do, so

And I do like uboot telling a bit more what it is doing on Rockchip platforms - or which stage it did reach, so also

Heiko

maintainer
#3 lore raw

PATCH 1/1 rockchip: Print a message when returning to the bootrom

In reply to Simon Glass

Am Dienstag, 4. April 2017, 20:02:40 CEST schrieb Simon Glass:

Quoted 6 lines

At present if the return to bootrom fails (e.g. because you are not using the Rockchip's bootrom's pointer table in MMC) then the board prints SPL message and hangs. Print a message first if we can, to help in understanding what happened when it hangs.

[...]

arch/arm/mach-rockchip/Makefile line 8

Quoted 10 lines
arch/arm/mach-rockchip/Makefile +2 -0
index 6b251c7e7e..5caecfb2c0 100644
@@ -4,6 +4,8 @@
 # SPDX-License-Identifier:	GPL-2.0+
 #
 
+obj-y += bootrom.o
+

you also probably want
obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o

Quoted 3 lines
arch/arm/mach-rockchip/Makefile +0 -0
 ifdef CONFIG_TPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-tpl.o
 obj-$(CONFIG_ROCKCHIP_BROM_HELPER) += save_boot_param.o