Skip to contentSkip to conversation

rockchip: rk3036: Add core Soc start-up code

PATCH New Simon Glass 1 participant 6 messages Nov 19, 2015

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

PATCH v8 19/23 rockchip: rk3036: Add core Soc start-up code

From: huang lin <[email protected]>

rk3036 only 4K size SRAM for SPL, so only support timer, uart, sdram driver in SPL stage, when finish initial sdram, back to bootrom.And in rk3036 sdmmc and debug uart use same iomux, so if you want to boot from sdmmc, you must disable debug uart.

Fixed build error for chromebook_jerry, firefly-rk3288:

---

Changes in v8:
- Fix build error for chromebook_jerry, firefly-rk3288

 arch/arm/mach-rockchip/Kconfig                  |  10 ++-
 arch/arm/mach-rockchip/Makefile                 |   4 +-
 arch/arm/mach-rockchip/board.c                  |   1 +
 arch/arm/mach-rockchip/rk3036-board-spl.c       |  55 +++++++++++++
 arch/arm/mach-rockchip/rk3036/Kconfig           |   3 +
 arch/arm/mach-rockchip/rk3036/Makefile          |   1 +
 arch/arm/mach-rockchip/rk3036/save_boot_param.S |  32 ++++++++
 include/configs/rk3036_common.h                 | 103 ++++++++++++++++++++++++
 8 files changed, 207 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk3036-board-spl.c
 create mode 100644 arch/arm/mach-rockchip/rk3036/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3036/save_boot_param.S
 create mode 100644 include/configs/rk3036_common.h
arch/arm/mach-rockchip/Kconfig +9 -1
index da665ef..6b608db 100644
@@ -9,6 +9,14 @@ config ROCKCHIP_RK3288
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART,s, SPI, I2C and PWMs.
 
+config ROCKCHIP_RK3036
+	bool "Support Rockchip RK3036"
+	help
+	  The Rockchip RK3036 is a ARM-based SoC with a dual-core Cortex-A7
+	  including NEON and GPU, Mali-400 graphics, several DDR3 options
+	  and video codec support. Peripherals include Gigabit Ethernet,
+	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
+
 config SYS_MALLOC_F
 	default y
 
@@ -34,5 +42,5 @@ config ROCKCHIP_SERIAL
 	default y
 
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
-
+source "arch/arm/mach-rockchip/rk3036/Kconfig"
 endif
arch/arm/mach-rockchip/Makefile +3 -1
index a29675d..b703c3c 100644
@@ -6,10 +6,12 @@
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o
+obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
 else
-obj-y += board.o
+obj-$(CONFIG_ROCKCHIP_RK3288) += board.o
 endif
 obj-y += rk_timer.o
 obj-y += rk_early_print.o
 obj-$(CONFIG_$(SPL_)ROCKCHIP_COMMON) += common.o
 obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/
+obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/
arch/arm/mach-rockchip/board.c +1 -0
index 688bc0f..f026abf 100644
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <ram.h>
+#include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
arch/arm/mach-rockchip/rk3036-board-spl.c new file +55 -0

55 lines not on this page · raw message

arch/arm/mach-rockchip/rk3036/Kconfig new file +3 -0
new file mode 100644
index 0000000..d76d5e1
@@ -0,0 +1,3 @@
+if ROCKCHIP_RK3036
+
+endif
arch/arm/mach-rockchip/rk3036/Makefile +1 -0
index 6095777..97d299d 100644
@@ -10,3 +10,4 @@ obj-y += syscon_rk3036.o
 endif
 
 obj-y += sdram_rk3036.o
+obj-y += save_boot_param.o
arch/arm/mach-rockchip/rk3036/save_boot_param.S new file +32 -0
new file mode 100644
index 0000000..778ec83
@@ -0,0 +1,32 @@
+/*
+ * (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)
include/configs/rk3036_common.h new file +103 -0

103 lines not on this page · raw message

Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#1 lore raw

PATCH v8 19/23 rockchip: rk3036: Add core Soc start-up code

Quoted 18 lines · Simon Glass

From: huang lin <[email protected]>

rk3036 only 4K size SRAM for SPL, so only support timer, uart, sdram driver in SPL stage, when finish initial sdram, back to bootrom.And in rk3036 sdmmc and debug uart use same iomux, so if you want to boot from sdmmc, you must disable debug uart.

Fixed build error for chromebook_jerry, firefly-rk3288:

---

Changes in v8:
- Fix build error for chromebook_jerry, firefly-rk3288

Quoted 13 lines
 arch/arm/mach-rockchip/Kconfig                  |  10 ++-
 arch/arm/mach-rockchip/Makefile                 |   4 +-
 arch/arm/mach-rockchip/board.c                  |   1 +
 arch/arm/mach-rockchip/rk3036-board-spl.c       |  55 +++++++++++++
 arch/arm/mach-rockchip/rk3036/Kconfig           |   3 +
 arch/arm/mach-rockchip/rk3036/Makefile          |   1 +
 arch/arm/mach-rockchip/rk3036/save_boot_param.S |  32 ++++++++
 include/configs/rk3036_common.h                 | 103 ++++++++++++++++++++++++
 8 files changed, 207 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk3036-board-spl.c
 create mode 100644 arch/arm/mach-rockchip/rk3036/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3036/save_boot_param.S
 create mode 100644 include/configs/rk3036_common.h

Applied to u-boot-rockchip, thanks!

#2 lore raw

PATCH v8 20/23 rockchip: Add basic support for evb-rk3036 board

In reply to Simon Glass

From: huang lin <[email protected]>

This add some basic files required to allow the board to dispaly serial message and can run command(mmc info etc)

Moved board Kconfig fragment from previous patch into this one to fix build error:

---

Changes in v8:
- moved board Kconfig fragment from previous patch into this one

 arch/arm/dts/Makefile                    |  3 +-
 arch/arm/dts/rk3036-sdk.dts              | 46 ++++++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3036/Kconfig    | 14 +++++++++
 board/evb_rk3036/evb_rk3036/Kconfig      | 15 ++++++++++
 board/evb_rk3036/evb_rk3036/MAINTAINERS  |  0
 board/evb_rk3036/evb_rk3036/Makefile     |  7 +++++
 board/evb_rk3036/evb_rk3036/evb_rk3036.c | 49 ++++++++++++++++++++++++++++++++
 configs/evb-rk3036_defconfig             | 26 +++++++++++++++++
 include/configs/evb_rk3036.h             | 12 ++++++++
 9 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3036-sdk.dts
 create mode 100644 board/evb_rk3036/evb_rk3036/Kconfig
 create mode 100644 board/evb_rk3036/evb_rk3036/MAINTAINERS
 create mode 100644 board/evb_rk3036/evb_rk3036/Makefile
 create mode 100644 board/evb_rk3036/evb_rk3036/evb_rk3036.c
 create mode 100644 configs/evb-rk3036_defconfig
 create mode 100644 include/configs/evb_rk3036.h
arch/arm/dts/Makefile +2 -1
index 9542fff..b383500 100644
@@ -21,7 +21,8 @@ dtb-$(CONFIG_EXYNOS5) += exynos5250-arndale.dtb \
 	exynos5422-odroidxu3.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rk3288-firefly.dtb \
-	rk3288-jerry.dtb
+	rk3288-jerry.dtb \
+	rk3036-sdk.dtb
 dtb-$(CONFIG_TEGRA) += tegra20-harmony.dtb \
 	tegra20-medcom-wide.dtb \
 	tegra20-paz00.dtb \
arch/arm/dts/rk3036-sdk.dts new file +46 -0

46 lines not on this page · raw message

arch/arm/mach-rockchip/rk3036/Kconfig +14 -0
index d76d5e1..0fbc58e 100644
@@ -1,3 +1,17 @@
 if ROCKCHIP_RK3036
 
+config TARGET_EVB_RK3036
+	bool "EVB_RK3036"
+
+config SYS_SOC
+	default "rockchip"
+
+config SYS_MALLOC_F_LEN
+	default 0x400
+
+config ROCKCHIP_COMMON
+	bool "Support rk common fuction"
+
+source "board/evb_rk3036/evb_rk3036/Kconfig"
+
 endif
board/evb_rk3036/evb_rk3036/Kconfig new file +15 -0
new file mode 100644
index 0000000..ae2a9eb
@@ -0,0 +1,15 @@
+if TARGET_EVB_RK3036
+
+config SYS_BOARD
+	default "evb_rk3036"
+
+config SYS_VENDOR
+	default "evb_rk3036"
+
+config SYS_CONFIG_NAME
+	default "evb_rk3036"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
board/evb_rk3036/evb_rk3036/MAINTAINERS new file +0 -0
new file mode 100644
index 0000000..e69de29
board/evb_rk3036/evb_rk3036/Makefile new file +7 -0
new file mode 100644
index 0000000..0403836
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2015 Google, Inc
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y	+= evb_rk3036.o
board/evb_rk3036/evb_rk3036/evb_rk3036.c new file +49 -0

49 lines not on this page · raw message

configs/evb-rk3036_defconfig new file +26 -0
new file mode 100644
index 0000000..2e915ff
@@ -0,0 +1,26 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_ROCKCHIP_RK3036=y
+CONFIG_TARGET_EVB_RK3036=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3036-sdk"
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_ADDR=0x80000
+# CONFIG_CMD_IMLS is not set
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_PMIC=y
+CONFIG_CMD_REGULATOR=y
+CONFIG_CLK=y
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_RESET=y
+CONFIG_LED=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_PINCTRL=y
+CONFIG_ROCKCHIP_DWMMC=y
+CONFIG_ROCKCHIP_3036_PINCTRL=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_RAM=y
+CONFIG_DM_MMC=y
+CONFIG_USE_PRIVATE_LIBGCC=y
+CONFIG_CMD_DHRYSTONE=y
+CONFIG_ERRNO_STR=y
include/configs/evb_rk3036.h new file +12 -0
new file mode 100644
index 0000000..aa07889
@@ -0,0 +1,12 @@
+/*
+ * (C) Copyright 2015 Rockchip Electronics Co., Ltd
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <configs/rk3036_common.h>
+
+#endif
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#3 lore raw

PATCH v8 20/23 rockchip: Add basic support for evb-rk3036 board

Quoted 25 lines · Simon Glass

From: huang lin <[email protected]>

This add some basic files required to allow the board to dispaly serial message and can run command(mmc info etc)

Moved board Kconfig fragment from previous patch into this one to fix build error:

---

Changes in v8:
- moved board Kconfig fragment from previous patch into this one

 arch/arm/dts/Makefile                    |  3 +-
 arch/arm/dts/rk3036-sdk.dts              | 46 ++++++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3036/Kconfig    | 14 +++++++++
 board/evb_rk3036/evb_rk3036/Kconfig      | 15 ++++++++++
 board/evb_rk3036/evb_rk3036/MAINTAINERS  |  0
 board/evb_rk3036/evb_rk3036/Makefile     |  7 +++++
 board/evb_rk3036/evb_rk3036/evb_rk3036.c | 49 ++++++++++++++++++++++++++++++++
 configs/evb-rk3036_defconfig             | 26 +++++++++++++++++
 include/configs/evb_rk3036.h             | 12 ++++++++
Quoted 8 lines
 9 files changed, 171 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/dts/rk3036-sdk.dts
 create mode 100644 board/evb_rk3036/evb_rk3036/Kconfig
 create mode 100644 board/evb_rk3036/evb_rk3036/MAINTAINERS
 create mode 100644 board/evb_rk3036/evb_rk3036/Makefile
 create mode 100644 board/evb_rk3036/evb_rk3036/evb_rk3036.c
 create mode 100644 configs/evb-rk3036_defconfig
 create mode 100644 include/configs/evb_rk3036.h

Applied to u-boot-rockchip, thanks!

#4 lore raw

PATCH v8 21/23 rockchip: Add max spl size & spl header configs

In reply to Simon Glass

From: Jeffy Chen <[email protected]>

Our chips may have different max spl size and spl header, so we need to add configs for that.

Dropped CONFIG_ROCKCHIP_MAX_SPL_SIZE from rk3288_common.h, Added $(if...) to tools/Makefile to fix widespread build breakage

---

Changes in v8:
- Drop CONFIG_ROCKCHIP_MAX_SPL_SIZE from rk3288_common.h,
- Add $(if...) to tools/Makefile to fix widespread build breakage

 arch/arm/mach-rockchip/Kconfig        | 15 +++++++++++++++
 arch/arm/mach-rockchip/rk3036/Kconfig |  6 ++++++
 arch/arm/mach-rockchip/rk3288/Kconfig |  6 ++++++
 tools/Makefile                        |  8 +++++++-
 tools/rkcommon.c                      |  2 +-
 tools/rkcommon.h                      |  1 -
 tools/rkimage.c                       |  2 +-
 tools/rksd.c                          |  4 ++--
 tools/rkspi.c                         |  4 ++--
 9 files changed, 40 insertions(+), 8 deletions(-)
arch/arm/mach-rockchip/Kconfig +15 -0
index 6b608db..4848018 100644
@@ -17,6 +17,21 @@ config ROCKCHIP_RK3036
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
 
+config ROCKCHIP_SPL_HDR
+	string "Header of rockchip's spl loader"
+	help
+	  Rockchip's bootrom requires the spl loader to start with a 4-bytes
+	  header. The content of this header depends on the chip type.
+
+config ROCKCHIP_MAX_SPL_SIZE
+	hex "Max size of rockchip's spl loader"
+	help
+	  Different chip may have different sram size. And if we want to jump
+	  back to the bootrom after spl, we may need to reserve some sram space
+	  for the bootrom.
+	  The max spl loader size should be sram size minus reserved
+	  size(if needed)
+
 config SYS_MALLOC_F
 	default y
 
arch/arm/mach-rockchip/rk3036/Kconfig +6 -0
index 0fbc58e..95fb2b9 100644
@@ -9,6 +9,12 @@ config SYS_SOC
 config SYS_MALLOC_F_LEN
 	default 0x400
 
+config ROCKCHIP_SPL_HDR
+        default "RK30"
+
+config ROCKCHIP_MAX_SPL_SIZE
+        default 0x1000
+
 config ROCKCHIP_COMMON
 	bool "Support rk common fuction"
 
arch/arm/mach-rockchip/rk3288/Kconfig +6 -0
index d0a7276..3de3878 100644
@@ -16,6 +16,12 @@ config TARGET_CHROMEBOOK_JERRY
 	  WiFi. It includes a Chrome OS EC (Cortex-M3) to provide access to
 	  the keyboard and battery functions.
 
+config ROCKCHIP_SPL_HDR
+	default "RK32"
+
+config ROCKCHIP_MAX_SPL_SIZE
+	default 0x8000
+
 config SYS_SOC
 	default "rockchip"
 
tools/Makefile +7 -1
index 9082bda..117b07e 100644
@@ -64,7 +64,7 @@ RSA_OBJS-$(CONFIG_FIT_SIGNATURE) := $(addprefix lib/rsa/, \
 					rsa-sign.o rsa-verify.o rsa-checksum.o \
 					rsa-mod-exp.o)
 
-ROCKCHIP_OBS = lib/rc4.o rkcommon.o rkimage.o rksd.o
+ROCKCHIP_OBS = $(if $(CONFIG_ARCH_ROCKCHIP),lib/rc4.o rkcommon.o rkimage.o rksd.o,)
 
 # common objs for dumpimage and mkimage
 dumpimage-mkimage-objs := aisimage.o \
@@ -108,6 +108,12 @@ fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
 
 # TODO(sjg at chromium.org): Is this correct on Mac OS?
 
+ifneq ($(CONFIG_ARCH_ROCKCHIP),)
+HOST_EXTRACFLAGS += \
+		-DCONFIG_ROCKCHIP_MAX_SPL_SIZE=$(CONFIG_ROCKCHIP_MAX_SPL_SIZE) \
+		-DCONFIG_ROCKCHIP_SPL_HDR="\"$(CONFIG_ROCKCHIP_SPL_HDR)\""
+endif
+
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)
 # Add CONFIG_MXS into host CFLAGS, so we can check whether or not register
 # the mxsimage support within tools/mxsimage.c .
tools/rkcommon.c +1 -1
index 4389622..18778aa 100644
@@ -50,7 +50,7 @@ int rkcommon_set_header(void *buf, uint file_size)
 {
 	struct header0_info *hdr;
 
-	if (file_size > RK_MAX_CODE1_SIZE)
+	if (file_size > CONFIG_ROCKCHIP_MAX_SPL_SIZE)
 		return -ENOSPC;
 
 	memset(buf,  '\0', RK_CODE1_OFFSET * RK_BLK_SIZE);
tools/rkcommon.h +0 -1
index 57fd726..39b1d52 100644
@@ -11,7 +11,6 @@
 enum {
 	RK_BLK_SIZE		= 512,
 	RK_CODE1_OFFSET		= 4,
-	RK_MAX_CODE1_SIZE	= 32 << 10,
 };
 
 /**
tools/rkimage.c +1 -1
index 7b292f4..73634e3 100644
@@ -30,7 +30,7 @@ static void rkimage_print_header(const void *buf)
 static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
 			       struct image_tool_params *params)
 {
-	memcpy(buf, "RK32", 4);
+	memcpy(buf, CONFIG_ROCKCHIP_SPL_HDR, 4);
 }
 
 static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
tools/rksd.c +2 -2
index a8dbe98..30b149d 100644
@@ -50,7 +50,7 @@ static void rksd_set_header(void *buf,  struct stat *sbuf,  int ifd,
 		       size);
 	}
 
-	memcpy(buf + RKSD_SPL_HDR_START, "RK32", 4);
+	memcpy(buf + RKSD_SPL_HDR_START, CONFIG_ROCKCHIP_SPL_HDR, 4);
 }
 
 static int rksd_extract_subimage(void *buf,  struct image_tool_params *params)
@@ -72,7 +72,7 @@ static int rksd_vrec_header(struct image_tool_params *params,
 {
 	int pad_size;
 
-	pad_size = RKSD_SPL_HDR_START + RK_MAX_CODE1_SIZE;
+	pad_size = RKSD_SPL_HDR_START + CONFIG_ROCKCHIP_MAX_SPL_SIZE;
 	debug("pad_size %x\n", pad_size);
 
 	return pad_size - params->file_size;
tools/rkspi.c +2 -2
index a3c4c73..13cc593 100644
@@ -53,7 +53,7 @@ static void rkspi_set_header(void *buf, struct stat *sbuf, int ifd,
 		       size);
 	}
 
-	memcpy(buf + RKSPI_SPL_HDR_START, "RK32", 4);
+	memcpy(buf + RKSPI_SPL_HDR_START, CONFIG_ROCKCHIP_SPL_HDR, 4);
 
 	/*
 	 * Spread the image out so we only use the first 2KB of each 4KB
@@ -89,7 +89,7 @@ static int rkspi_vrec_header(struct image_tool_params *params,
 {
 	int pad_size;
 
-	pad_size = (RK_MAX_CODE1_SIZE + 0x7ff) / 0x800 * 0x800;
+	pad_size = (CONFIG_ROCKCHIP_MAX_SPL_SIZE + 0x7ff) / 0x800 * 0x800;
 	params->orig_file_size = pad_size;
 
 	/* We will double the image size due to the SPI format */
Signature · 1 line
2.6.0.rc2.230.g3dd15c0
#5 lore raw

PATCH v8 21/23 rockchip: Add max spl size & spl header configs

Quoted 17 lines · Simon Glass

From: Jeffy Chen <[email protected]>

Our chips may have different max spl size and spl header, so we need to add configs for that.

Dropped CONFIG_ROCKCHIP_MAX_SPL_SIZE from rk3288_common.h, Added $(if...) to tools/Makefile to fix widespread build breakage

---

Changes in v8:
- Drop CONFIG_ROCKCHIP_MAX_SPL_SIZE from rk3288_common.h,
- Add $(if...) to tools/Makefile to fix widespread build breakage

Quoted 10 lines
 arch/arm/mach-rockchip/Kconfig        | 15 +++++++++++++++
 arch/arm/mach-rockchip/rk3036/Kconfig |  6 ++++++
 arch/arm/mach-rockchip/rk3288/Kconfig |  6 ++++++
 tools/Makefile                        |  8 +++++++-
 tools/rkcommon.c                      |  2 +-
 tools/rkcommon.h                      |  1 -
 tools/rkimage.c                       |  2 +-
 tools/rksd.c                          |  4 ++--
 tools/rkspi.c                         |  4 ++--
 9 files changed, 40 insertions(+), 8 deletions(-)

Applied to u-boot-rockchip, thanks!

This will need to be done a different way - I only just realised this. I'll reply on the cover letter.

- Simon