From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ziyuan Xu Date: Mon, 27 Jun 2016 13:44:55 +0800 Subject: [U-Boot] [PATCH v2] rockchip: rk3288: Change method of loading u-boot In-Reply-To: References: <1465717194-32396-1-git-send-email-xzy.xu@rock-chips.com> Message-ID: <5770BD57.8080608@rock-chips.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2016?06?17? 11:50, Simon Glass wrote: > Hi, > > On 12 June 2016 at 01:39, Ziyuan Xu wrote: >> 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 >> --- >> >> Changes in v2: >> - Add sdcard iomux initlization in board_init() to fix sdmmc CMD0 >> timeout issue when booting from eMMC. >> >> arch/arm/mach-rockchip/Makefile | 1 + >> arch/arm/mach-rockchip/board.c | 31 ++++++++++++++++++++++ >> arch/arm/mach-rockchip/rk3036/Makefile | 1 - >> arch/arm/mach-rockchip/rk3288-board-spl.c | 3 ++- >> .../mach-rockchip/{rk3036 => }/save_boot_param.S | 2 +- >> include/configs/firefly-rk3288.h | 2 -- >> include/configs/rk3288_common.h | 4 +-- >> 7 files changed, 36 insertions(+), 8 deletions(-) >> rename arch/arm/mach-rockchip/{rk3036 => }/save_boot_param.S (90%) > Can you please update README.rockchip with instructions on how to use > this - i.e. how to build an image and make it work this way? > > For me it is not clear. Done, update more detailed instructions in v3. >> 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/board.c b/arch/arm/mach-rockchip/board.c >> index 133d663..ebd396c 100644 >> --- a/arch/arm/mach-rockchip/board.c >> +++ b/arch/arm/mach-rockchip/board.c >> @@ -9,12 +9,43 @@ >> #include >> #include >> #include >> +#include >> +#include >> +#include >> >> DECLARE_GLOBAL_DATA_PTR; >> >> int board_init(void) >> { >> + struct udevice *pinctrl; >> + int ret; >> + > Please add a comment as to why this is needed (from your v2 change log). Okay. > >> + ret = uclass_get_device(UCLASS_PINCTRL, 0, &pinctrl); >> + if (ret) { >> + debug("%s: Cannot find pinctrl device\n", __func__); >> + goto err; >> + } >> + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_SDCARD); >> + if (ret) { >> + debug("%s: Failed to set up SD card\n", __func__); >> + goto err; >> + } >> + >> + /* Enable debug UART */ >> + ret = pinctrl_request_noflags(pinctrl, PERIPH_ID_UART_DBG); >> + if (ret) { >> + debug("%s: Failed to set up console UART\n", __func__); >> + goto err; >> + } >> + >> return 0; >> +err: >> + printf("board_init: Error %d\n", ret); >> + >> + /* No way to report error here */ >> + hang(); >> + >> + return -1; >> } >> >> int dram_init(void) >> 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/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/rk3036/save_boot_param.S b/arch/arm/mach-rockchip/save_boot_param.S >> similarity index 90% >> rename from arch/arm/mach-rockchip/rk3036/save_boot_param.S >> rename to arch/arm/mach-rockchip/save_boot_param.S >> index 778ec83..85b407b 100644 >> --- a/arch/arm/mach-rockchip/rk3036/save_boot_param.S >> +++ b/arch/arm/mach-rockchip/save_boot_param.S >> @@ -1,5 +1,5 @@ >> /* >> - * (C) Copyright 2015 Google, Inc >> + * (C) Copyright 2016 Rockchip Electronics Co., Ltd >> * >> * SPDX-License-Identifier: GPL-2.0+ >> */ >> 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 >> >> -#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 >> >> > Does this change U-Boot on rk3288 to use the bootrom? If so I think > this should be a new Kconfig option. It seems like a useful feature > which should be enabled by default for some boards. It makes sense to me. I have tested this feature on firefly-rk3288 and evb-rk3288, and I will enable it via a macro. See in V3. Thanks. > > Regards, > Simon > > >