[U-Boot] [PATCH 2/2] ARM64: rockchip: Add initial support for RK3368 based GeekBox

Andreas Färber afaerber at suse.de
Mon Jul 18 03:06:07 CEST 2016


The RK3368 is an octa-core Cortex-A53 SoC from Rockchip.

The GeekBox is a TV box from GeekBuying, based on an MXM3 module.
The module can be used with base boards such as the GeekBox Landingship.

This adds basic support to chain-load U-Boot from Rockchip's miniloader.

  $ ./lollipop_u-boot/tools/loaderimage --pack u-boot.bin u-boot.img
  # ./utils/upgrade_tool di uboot u-boot.img

Implemented is the serial console, but no boot media drivers yet.

Note that flashing the resulting U-Boot will not allow you to enter the
rockusb mode any more via "Update" button. Instead, you will need to
short two pins on the bottom of the module to enter MaskRom mode and
re-flash the loader:

  # ./utils/upgrade_tool ul ./lollipop_u-boot/RK3368MiniLoaderAll_V2.40.bin
  # ./utils/upgrade_tool di uboot u-boot.img

Signed-off-by: Andreas Färber <afaerber at suse.de>
---
 arch/arm/Kconfig                       |  4 ---
 arch/arm/dts/rk3368.dtsi               |  1 +
 arch/arm/mach-rockchip/Kconfig         | 14 ++++++++++
 arch/arm/mach-rockchip/Makefile        |  1 +
 arch/arm/mach-rockchip/rk3368/Kconfig  | 14 ++++++++++
 arch/arm/mach-rockchip/rk3368/Makefile |  7 +++++
 arch/arm/mach-rockchip/rk3368/rk3368.c | 28 ++++++++++++++++++++
 board/geekbuying/geekbox/Kconfig       | 15 +++++++++++
 board/geekbuying/geekbox/Makefile      |  7 +++++
 board/geekbuying/geekbox/geekbox.c     | 26 +++++++++++++++++++
 configs/geekbox_defconfig              | 20 +++++++++++++++
 include/configs/geekbox.h              | 19 ++++++++++++++
 include/configs/rk3368_common.h        | 47 ++++++++++++++++++++++++++++++++++
 13 files changed, 199 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk3368/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3368/Makefile
 create mode 100644 arch/arm/mach-rockchip/rk3368/rk3368.c
 create mode 100644 board/geekbuying/geekbox/Kconfig
 create mode 100644 board/geekbuying/geekbox/Makefile
 create mode 100644 board/geekbuying/geekbox/geekbox.c
 create mode 100644 configs/geekbox_defconfig
 create mode 100644 include/configs/geekbox.h
 create mode 100644 include/configs/rk3368_common.h

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f9fddad..4ff1a26 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -838,14 +838,10 @@ config STM32
 
 config ARCH_ROCKCHIP
 	bool "Support Rockchip SoCs"
-	select SUPPORT_SPL
-	select SPL
 	select OF_CONTROL
 	select BLK
 	select DM
-	select SPL_DM
 	select SYS_MALLOC_F
-	select SPL_SYS_MALLOC_SIMPLE
 	select DM_GPIO
 	select DM_I2C
 	select DM_MMC
diff --git a/arch/arm/dts/rk3368.dtsi b/arch/arm/dts/rk3368.dtsi
index 8b4a7c9..3ab7edc 100644
--- a/arch/arm/dts/rk3368.dtsi
+++ b/arch/arm/dts/rk3368.dtsi
@@ -609,6 +609,7 @@
 	uart2: serial at ff690000 {
 		compatible = "rockchip,rk3368-uart", "snps,dw-apb-uart";
 		reg = <0x0 0xff690000 0x0 0x100>;
+		clock-frequency = <24000000>;
 		clocks = <&cru SCLK_UART2>, <&cru PCLK_UART2>;
 		clock-names = "baudclk", "apb_pclk";
 		interrupts = <GIC_SPI 57 IRQ_TYPE_LEVEL_HIGH>;
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 86b77f8..597f043 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -3,6 +3,10 @@ if ARCH_ROCKCHIP
 config ROCKCHIP_RK3288
 	bool "Support Rockchip RK3288"
 	select CPU_V7
+	select SUPPORT_SPL
+	select SPL
+	select SPL_DM
+	select SPL_SYS_MALLOC_SIMPLE
 	help
 	  The Rockchip RK3288 is a ARM-based SoC with a quad-core Cortex-A17
 	  including NEON and GPU, 1MB L2 cache, Mali-T7 graphics, two
@@ -13,12 +17,21 @@ config ROCKCHIP_RK3288
 config ROCKCHIP_RK3036
 	bool "Support Rockchip RK3036"
 	select CPU_V7
+	select SUPPORT_SPL
+	select SPL
+	select SPL_DM
+	select SPL_SYS_MALLOC_SIMPLE
 	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 ROCKCHIP_RK3368
+	bool "Support Rockchip RK3368"
+	select ARM64
+	select SYS_NS16550
+
 config ROCKCHIP_SPL_BACK_TO_BROM
 	bool "SPL returns to bootrom"
 	default y if ROCKCHIP_RK3036
@@ -29,4 +42,5 @@ config ROCKCHIP_SPL_BACK_TO_BROM
 
 source "arch/arm/mach-rockchip/rk3288/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
+source "arch/arm/mach-rockchip/rk3368/Kconfig"
 endif
diff --git a/arch/arm/mach-rockchip/Makefile b/arch/arm/mach-rockchip/Makefile
index 6763af4..48e78c1 100644
--- a/arch/arm/mach-rockchip/Makefile
+++ b/arch/arm/mach-rockchip/Makefile
@@ -16,3 +16,4 @@ obj-y += rk_timer.o
 endif
 obj-$(CONFIG_ROCKCHIP_RK3288) += rk3288/
 obj-$(CONFIG_ROCKCHIP_RK3036) += rk3036/
+obj-$(CONFIG_ROCKCHIP_RK3368) += rk3368/
diff --git a/arch/arm/mach-rockchip/rk3368/Kconfig b/arch/arm/mach-rockchip/rk3368/Kconfig
new file mode 100644
index 0000000..5f2cd53
--- /dev/null
+++ b/arch/arm/mach-rockchip/rk3368/Kconfig
@@ -0,0 +1,14 @@
+if ROCKCHIP_RK3368
+
+config TARGET_GEEKBOX
+	bool "GeekBox"
+
+config SYS_SOC
+	default "rockchip"
+
+config SYS_MALLOC_F_LEN
+	default 0x0800
+
+source "board/geekbuying/geekbox/Kconfig"
+
+endif
diff --git a/arch/arm/mach-rockchip/rk3368/Makefile b/arch/arm/mach-rockchip/rk3368/Makefile
new file mode 100644
index 0000000..3e20498
--- /dev/null
+++ b/arch/arm/mach-rockchip/rk3368/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2016 Andreas Färber
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y		+= rk3368.o
diff --git a/arch/arm/mach-rockchip/rk3368/rk3368.c b/arch/arm/mach-rockchip/rk3368/rk3368.c
new file mode 100644
index 0000000..dd34fed
--- /dev/null
+++ b/arch/arm/mach-rockchip/rk3368/rk3368.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 Andreas Färber
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/armv8/mmu.h>
+
+static struct mm_region rk3368_mem_map[] = {
+	{
+		.base = 0x0UL,
+		.size = 0x80000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
+			 PTE_BLOCK_INNER_SHARE
+	}, {
+		.base = 0xf0000000UL,
+		.size = 0x10000000UL,
+		.attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
+			 PTE_BLOCK_NON_SHARE |
+			 PTE_BLOCK_PXN | PTE_BLOCK_UXN
+	}, {
+		/* List terminator */
+		0,
+	}
+};
+
+struct mm_region *mem_map = rk3368_mem_map;
diff --git a/board/geekbuying/geekbox/Kconfig b/board/geekbuying/geekbox/Kconfig
new file mode 100644
index 0000000..41aa8fb
--- /dev/null
+++ b/board/geekbuying/geekbox/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_GEEKBOX
+
+config SYS_BOARD
+	default "geekbox"
+
+config SYS_VENDOR
+	default "geekbuying"
+
+config SYS_CONFIG_NAME
+	default "geekbox"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
diff --git a/board/geekbuying/geekbox/Makefile b/board/geekbuying/geekbox/Makefile
new file mode 100644
index 0000000..5c1d66c
--- /dev/null
+++ b/board/geekbuying/geekbox/Makefile
@@ -0,0 +1,7 @@
+#
+# Copyright (c) 2016 Andreas Färber
+#
+# SPDX-License-Identifier:	GPL-2.0+
+#
+
+obj-y	+= geekbox.o
diff --git a/board/geekbuying/geekbox/geekbox.c b/board/geekbuying/geekbox/geekbox.c
new file mode 100644
index 0000000..4a9c4ff
--- /dev/null
+++ b/board/geekbuying/geekbox/geekbox.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2016 Andreas Färber
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#include <common.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+int board_init(void)
+{
+	return 0;
+}
+
+int dram_init(void)
+{
+	gd->ram_size = 0x80000000;
+	return 0;
+}
+
+void dram_init_banksize(void)
+{
+	gd->bd->bi_dram[0].start = 0;
+	gd->bd->bi_dram[0].size = 0x80000000;
+}
diff --git a/configs/geekbox_defconfig b/configs/geekbox_defconfig
new file mode 100644
index 0000000..6e82c22
--- /dev/null
+++ b/configs/geekbox_defconfig
@@ -0,0 +1,20 @@
+CONFIG_ARM=y
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_ROCKCHIP_RK3368=y
+CONFIG_TARGET_GEEKBOX=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3368-geekbox"
+CONFIG_HUSH_PARSER=y
+# CONFIG_CMD_IMLS is not set
+CONFIG_REGMAP=y
+CONFIG_SYSCON=y
+CONFIG_CLK=y
+CONFIG_SYSRESET=y
+CONFIG_PINCTRL=y
+CONFIG_RAM=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_BASE=0xFF690000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_DEBUG_UART_ANNOUNCE=y
+CONFIG_DEBUG_UART_SKIP_INIT=y
+CONFIG_ERRNO_STR=y
diff --git a/include/configs/geekbox.h b/include/configs/geekbox.h
new file mode 100644
index 0000000..47490f1
--- /dev/null
+++ b/include/configs/geekbox.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2016 Andreas Färber
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIGS_GEEKBOX_H
+#define __CONFIGS_GEEKBOX_H
+
+#include <configs/rk3368_common.h>
+
+#define CONFIG_ENV_IS_NOWHERE
+#define CONFIG_ENV_SIZE			0x2000
+#define CONFIG_SYS_NO_FLASH
+
+#define CONFIG_SYS_WHITE_ON_BLACK
+#define CONFIG_CONSOLE_SCROLL_LINES		10
+
+#endif
diff --git a/include/configs/rk3368_common.h b/include/configs/rk3368_common.h
new file mode 100644
index 0000000..27ff1b9
--- /dev/null
+++ b/include/configs/rk3368_common.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2016 Andreas Färber
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef __CONFIG_RK3368_COMMON_H
+#define __CONFIG_RK3368_COMMON_H
+
+#define CONFIG_SYS_CACHELINE_SIZE	64
+
+#include <asm/arch/hardware.h>
+#include <linux/sizes.h>
+
+#define CONFIG_NR_DRAM_BANKS		1
+#define CONFIG_SYS_MAXARGS		16
+#define CONFIG_BAUDRATE			115200
+#define CONFIG_SYS_MALLOC_LEN		(32 << 20)
+#define CONFIG_SYS_CBSIZE		1024
+#define CONFIG_SKIP_LOWLEVEL_INIT
+#define CONFIG_DISPLAY_BOARDINFO
+
+//#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_MEM32
+
+#ifdef CONFIG_SPL_BUILD
+#define CONFIG_SYS_TEXT_BASE		0x00000000
+#else
+#define CONFIG_SYS_TEXT_BASE		0x00200000
+#endif
+#define CONFIG_SYS_INIT_SP_ADDR		0x00300000
+#define CONFIG_SYS_LOAD_ADDR		0x00800800
+
+#ifndef CONFIG_SPL_BUILD
+
+#include <config_distro_defaults.h>
+
+#define BOOT_TARGET_DEVICES(func)
+
+#include <config_distro_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	BOOTENV
+
+#endif
+
+#endif
-- 
2.6.6



More information about the U-Boot mailing list