[U-Boot] [RESEND] rockchip: rk3288: Change method of loading u-boot

Ziyuan Xu xzy.xu at rock-chips.com
Sun Jun 12 08:34:13 CEST 2016


If we would like to boot from SD card, we have to implement mmc driver
in SPL stage, and get a slightly large spl binrary. RK3288's bootrom code
has the ability to load spl and u-boot. This patch tasks bootrom to load
u-boot.

Loading sequence after rework:
bootrom ==> spl ==> bootrom ==> u-boot

Signed-off-by: Ziyuan Xu <xzy.xu at rock-chips.com>
---
 arch/arm/mach-rockchip/Makefile                 |  1 +
 arch/arm/mach-rockchip/rk3036/Makefile          |  1 -
 arch/arm/mach-rockchip/rk3036/save_boot_param.S | 32 -------------------------
 arch/arm/mach-rockchip/rk3288-board-spl.c       |  3 ++-
 arch/arm/mach-rockchip/save_boot_param.S        | 32 +++++++++++++++++++++++++
 include/configs/firefly-rk3288.h                |  2 --
 include/configs/rk3288_common.h                 |  4 +---
 7 files changed, 36 insertions(+), 39 deletions(-)
 delete mode 100644 arch/arm/mach-rockchip/rk3036/save_boot_param.S
 create mode 100644 arch/arm/mach-rockchip/save_boot_param.S

diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 55567cb..8e0c0ab 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -7,6 +7,7 @@
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o
 obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
+obj-y += save_boot_param.o
 else
 obj-$(CONFIG_ROCKCHIP_RK3288) += board.o
 endif
diff --git a/arch/arm/mach-rockchip/rk3036/Makefile b/arch/arm/mach-rockchip/rk3036/Makefile
index 97d299d..6095777 100644
--- a/arch/arm/mach-rockchip/rk3036/Makefile
+++ b/arch/arm/mach-rockchip/rk3036/Makefile
@@ -10,4 +10,3 @@ obj-y += syscon_rk3036.o
 endif
 
 obj-y += sdram_rk3036.o
-obj-y += save_boot_param.o
diff --git a/arch/arm/mach-rockchip/rk3036/save_boot_param.S b/arch/arm/mach-rockchip/rk3036/save_boot_param.S
deleted file mode 100644
index 778ec83..0000000
--- a/arch/arm/mach-rockchip/rk3036/save_boot_param.S
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * (C) Copyright 2015 Google, Inc
- *
- * SPDX-License-Identifier:     GPL-2.0+
- */
-
-#include <linux/linkage.h>
-
-.globl	SAVE_SP_ADDR
-SAVE_SP_ADDR:
-	.word 0
-
-/*
- * void save_boot_params
- *
- * Save sp, lr, r1~r12
- */
-ENTRY(save_boot_params)
-	push	{r1-r12, lr}
-	ldr	r0, =SAVE_SP_ADDR
-	str	sp, [r0]
-	b	save_boot_params_ret		@ back to my caller
-ENDPROC(save_boot_params)
-
-
-.globl back_to_bootrom
-ENTRY(back_to_bootrom)
-	ldr	r0, =SAVE_SP_ADDR
-	ldr	sp, [r0]
-	mov	r0, #0
-	pop	{r1-r12, pc}
-ENDPROC(back_to_bootrom)
diff --git a/arch/arm/mach-rockchip/rk3288-board-spl.c b/arch/arm/mach-rockchip/rk3288-board-spl.c
index e133cca..40abc0e 100644
--- a/arch/arm/mach-rockchip/rk3288-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3288-board-spl.c
@@ -149,7 +149,7 @@ static int configure_emmc(struct udevice *pinctrl)
 	return 0;
 }
 #endif
-
+extern void back_to_bootrom(void);
 void board_init_f(ulong dummy)
 {
 	struct udevice *pinctrl;
@@ -204,6 +204,7 @@ void board_init_f(ulong dummy)
 		debug("DRAM init failed: %d\n", ret);
 		return;
 	}
+	back_to_bootrom();
 }
 
 static int setup_led(void)
diff --git a/arch/arm/mach-rockchip/save_boot_param.S b/arch/arm/mach-rockchip/save_boot_param.S
new file mode 100644
index 0000000..85b407b
--- /dev/null
+++ b/arch/arm/mach-rockchip/save_boot_param.S
@@ -0,0 +1,32 @@
+/*
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <linux/linkage.h>
+
+.globl	SAVE_SP_ADDR
+SAVE_SP_ADDR:
+	.word 0
+
+/*
+ * void save_boot_params
+ *
+ * Save sp, lr, r1~r12
+ */
+ENTRY(save_boot_params)
+	push	{r1-r12, lr}
+	ldr	r0, =SAVE_SP_ADDR
+	str	sp, [r0]
+	b	save_boot_params_ret		@ back to my caller
+ENDPROC(save_boot_params)
+
+
+.globl back_to_bootrom
+ENTRY(back_to_bootrom)
+	ldr	r0, =SAVE_SP_ADDR
+	ldr	sp, [r0]
+	mov	r0, #0
+	pop	{r1-r12, pc}
+ENDPROC(back_to_bootrom)
diff --git a/include/configs/firefly-rk3288.h b/include/configs/firefly-rk3288.h
index a29f557..ee924c3 100644
--- a/include/configs/firefly-rk3288.h
+++ b/include/configs/firefly-rk3288.h
@@ -14,8 +14,6 @@
 
 #include <configs/rk3288_common.h>
 
-#define CONFIG_SPL_MMC_SUPPORT
-
 #define CONFIG_ENV_IS_IN_MMC
 #define CONFIG_SYS_MMC_ENV_DEV 0
 /* SPL @ 32k for ~36k
diff --git a/include/configs/rk3288_common.h b/include/configs/rk3288_common.h
index 9d50d83..d80a427 100644
--- a/include/configs/rk3288_common.h
+++ b/include/configs/rk3288_common.h
@@ -31,9 +31,8 @@
 #define CONFIG_SPL_LIBGENERIC_SUPPORT
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SYS_NS16550_MEM32
-#define CONFIG_SPL_BOARD_INIT
 
-#define CONFIG_SYS_TEXT_BASE		0x00100000
+#define CONFIG_SYS_TEXT_BASE		0x00000000
 #define CONFIG_SYS_INIT_SP_ADDR		0x00100000
 #define CONFIG_SYS_LOAD_ADDR		0x00800800
 #define CONFIG_SPL_STACK		0xff718000
@@ -66,7 +65,6 @@
 
 /* FAT sd card locations. */
 #define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION	1
-#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME		"u-boot.img"
 
 #define CONFIG_SPL_PINCTRL_SUPPORT
 #define CONFIG_SPL_RAM_SUPPORT
-- 
1.9.1




More information about the U-Boot mailing list