Skip to contentSkip to conversation

rockchip: rk3288: Change method of loading u-boot

PATCH Superseded Ziyuan Xu 1 participant 1 message Jun 27, 2016 2 messages not in the archive

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAPnjgZ2Z5PrQ=X4t0JvRbCXmLRbGD4ZKFU4OHpB3VeNyKqHLdw@mail.gmail.com

Ziyuan Xu

author
#2 lore raw

PATCH v2 1/1 rockchip: rk3288: Change method of loading u-boot

Quoted 27 lines · Simon Glass

Hi,

Quoted 23 lines · Ziyuan Xu

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

---

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(-)
Quoted 1 line

rename arch/arm/mach-rockchip/{rk3036 => }/save_boot_param.S (90%)

Quoted 4 lines

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.

Quoted 24 lines
Quoted 24 lines
arch/arm/mach-rockchip/Makefile +1 -0
index 55567cb..8e0c0ab 100644
@@ -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
arch/arm/mach-rockchip/board.c +3 -0
index 133d663..ebd396c 100644
@@ -9,12 +9,43 @@
  #include <dm.h>
  #include <ram.h>
  #include <asm/io.h>
+#include <asm/arch/periph.h>
+#include <asm/gpio.h>
+#include <dm/pinctrl.h>
 
Quoted 8 lines

arch/arm/mach-rockchip/board.c line 22

Quoted 7 lines
arch/arm/mach-rockchip/board.c +3 -0
  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.

Quoted 108 lines
Quoted 108 lines
arch/arm/mach-rockchip/board.c +25 -0
+       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)
arch/arm/mach-rockchip/rk3036/Makefile +0 -1
index 97d299d..6095777 100644
@@ -10,4 +10,3 @@ obj-y += syscon_rk3036.o
  endif
 
  obj-y += sdram_rk3036.o
-obj-y += save_boot_param.o
arch/arm/mach-rockchip/rk3288-board-spl.c +2 -1
index e133cca..40abc0e 100644
@@ -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)
arch/arm/mach-rockchip/save_boot_param.S renamed from arch/arm/mach-rockchip/rk3036/save_boot_param.S +1 -1
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
@@ -1,5 +1,5 @@
  /*
- * (C) Copyright 2015 Google, Inc
+ * (C) Copyright 2016 Rockchip Electronics Co., Ltd
   *
   * SPDX-License-Identifier:     GPL-2.0+
   */
include/configs/firefly-rk3288.h +0 -2
index a29f557..ee924c3 100644
@@ -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
include/configs/rk3288_common.h +1 -3
index 9d50d83..d80a427 100644
@@ -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"
 
Quoted 9 lines
Quoted 6 lines
include/configs/rk3288_common.h +0 -1
  #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.

Quoted 6 lines

Regards,
Simon