Skip to contentSkip to conversation

rockchip: resurrect rk3368 functionality and make lion bootable again

PATCH New Heiko Stuebner 1 participant 9 messages Feb 9, 2021

Subsystems (5)
lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

cover rockchip: resurrect rk3368 functionality and make lion bootable again

From: Heiko Stuebner <[email protected]>

With current u-boot (and probably for some time now) rk3368-lion can't boot anymore. As the patches indicate, that is partially on the lion support but also on general rk3368-support not fitting current expectations anymore.

So this series, adapts options to what other Rockchip SoCs do and makes lion also bootable again.

Heiko Stuebner (8):
rockchip: rk3368: adjust CONFIG_SYS_LOAD_ADDR
rockchip: rk3368: set CONFIG_SYS_BOOTM_LEN to 64MB
rockchip: rk3368: increase SYS_MALLOC_F_LEN to 0x4000
rockchip: rk3368: move STACK_R_ADDR address and into Kconfig
rockchip: rk3368: sync clock dt-binding header from Linux
rockchip: rk3368: sync main rk3368 dtsi from Linux
rockchip: rk3368: sync down rk3368-lion board devicetree from Linux
rockchip: lion: update board defconfig

 arch/arm/dts/Makefile                         |   2 +-
 arch/arm/dts/rk3368-geekbox-u-boot.dtsi       |   2 +
 ...ot.dtsi => rk3368-lion-haikou-u-boot.dtsi} |   6 +
 arch/arm/dts/rk3368-lion-haikou.dts           | 140 +++++
 .../dts/{rk3368-lion.dts => rk3368-lion.dtsi} | 271 ++++++--
 arch/arm/dts/rk3368-px5-evb-u-boot.dtsi       |   3 +
 arch/arm/dts/rk3368-sheep-u-boot.dtsi         |   2 +
 arch/arm/dts/rk3368-u-boot.dtsi               |  27 +
 arch/arm/dts/rk3368.dtsi                      | 578 +++++++++++-------
 arch/arm/mach-rockchip/rk3368/Kconfig         |   5 +-
 configs/lion-rk3368_defconfig                 |  19 +-
 include/configs/rk3368_common.h               |   4 +-
 include/dt-bindings/clock/rk3368-cru.h        |  31 +-
 13 files changed, 769 insertions(+), 321 deletions(-)
 rename arch/arm/dts/{rk3368-lion-u-boot.dtsi => rk3368-lion-haikou-u-boot.dtsi} (96%)
 create mode 100644 arch/arm/dts/rk3368-lion-haikou.dts
 rename arch/arm/dts/{rk3368-lion.dts => rk3368-lion.dtsi} (54%)
 create mode 100644 arch/arm/dts/rk3368-u-boot.dtsi
Signature · 1 line
2.29.2
author maintainer
#1 lore raw

PATCH 1/8 rockchip: rk3368: adjust CONFIG_SYS_LOAD_ADDR

From: Heiko Stuebner <[email protected]>

CONFIG_SYS_LOAD_ADDR currently is at 0x00280000 which is only 512KB behind the area where we load u-boot to, which depending on u-boot size may overlap at some point.

So for safety just pick the same value rk3399 has and set CONFIG_SYS_LOAD_ADDR to 0x00800800 on rk3368 as well.

---
 include/configs/rk3368_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/rk3368_common.h +1 -1
index f178a06945..86498b4c82 100644
@@ -24,7 +24,7 @@
 #define CONFIG_IRAM_BASE		0xff8c0000
 
 #define CONFIG_SYS_INIT_SP_ADDR		0x00300000
-#define CONFIG_SYS_LOAD_ADDR		0x00280000
+#define CONFIG_SYS_LOAD_ADDR		0x00800800
 
 #define CONFIG_SPL_MAX_SIZE             0x40000
 #define CONFIG_SPL_BSS_START_ADDR       0x400000
Signature · 1 line
2.29.2
author maintainer
#2 lore raw

PATCH 2/8 rockchip: rk3368: set CONFIG_SYS_BOOTM_LEN to 64MB

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Mimicing for example the rk3399, set the SYS_BOOTM_LEN to 64MB so that regular kernel images can get loaded without problems.

---
 include/configs/rk3368_common.h | 2 ++
 1 file changed, 2 insertions(+)
include/configs/rk3368_common.h +2 -0
index 86498b4c82..fbbb8cf267 100644
@@ -31,6 +31,8 @@
 #define CONFIG_SPL_BSS_MAX_SIZE         0x20000
 #define CONFIG_SPL_STACK                0x00188000
 
+#define CONFIG_SYS_BOOTM_LEN	(64 << 20)	/* 64M */
+
 #ifndef CONFIG_SPL_BUILD
 #define ENV_MEM_LAYOUT_SETTINGS \
 	"scriptaddr=0x00500000\0" \
Signature · 1 line
2.29.2
author maintainer
#3 lore raw

PATCH 3/8 rockchip: rk3368: increase SYS_MALLOC_F_LEN to 0x4000

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

To prevent running out of memory, increase SYS_MALLOC_F_LEN to 0x4000 similar to what rk3399 uses.

---
 arch/arm/mach-rockchip/rk3368/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3368/Kconfig +1 -1
index d6ca5f1d24..c31915e7dc 100644
@@ -49,7 +49,7 @@ config SYS_SOC
 	default "rk3368"
 
 config SYS_MALLOC_F_LEN
-	default 0x2000
+	default 0x4000
 
 config SPL_LIBCOMMON_SUPPORT
 	default y
Signature · 1 line
2.29.2
author maintainer
#4 lore raw

PATCH 4/8 rockchip: rk3368: move STACK_R_ADDR address and into Kconfig

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

With the STACK_R_ADDR at 0x600000 (6MB) we're competing with with the loading address of either u-boot or atf parts, so move that away to 0x4000000 (64MB) similar to rk3399.

Only lion currently sets that at all but not sheep the second rk3368 board, so just move that to the Kconfig for rk3368 similar to rk3399 as well.

---
 arch/arm/mach-rockchip/rk3368/Kconfig | 3 +++
 configs/lion-rk3368_defconfig         | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
arch/arm/mach-rockchip/rk3368/Kconfig +3 -0
index c31915e7dc..78eb96df3d 100644
@@ -65,6 +65,9 @@ source "board/rockchip/evb_px5/Kconfig"
 config SPL_LDSCRIPT
 	default "arch/arm/cpu/armv8/u-boot-spl.lds"
 
+config SPL_STACK_R_ADDR
+	default 0x04000000
+
 config TPL_MAX_SIZE
         default 28672
 
configs/lion-rk3368_defconfig +0 -1
index 583dd44da3..b409715060 100644
@@ -9,7 +9,6 @@ CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_TPL_LIBCOMMON_SUPPORT=y
 CONFIG_TPL_LIBGENERIC_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
-CONFIG_SPL_STACK_R_ADDR=0x600000
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0xFF180000
 CONFIG_DEBUG_UART_CLOCK=24000000
Signature · 1 line
2.29.2
author maintainer
#5 lore raw

PATCH 5/8 rockchip: rk3368: sync clock dt-binding header from Linux

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This is the state as of v5.10 in Linux.

---
 include/dt-bindings/clock/rk3368-cru.h | 31 ++++++++++++--------------
 1 file changed, 14 insertions(+), 17 deletions(-)
include/dt-bindings/clock/rk3368-cru.h +14 -17
index 9c5dd9ba2f..0a06c5f514 100644
@@ -1,15 +1,6 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  * Copyright (c) 2015 Heiko Stuebner <[email protected]>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #ifndef _DT_BINDINGS_CLK_ROCKCHIP_RK3368_H
@@ -44,13 +35,12 @@
 #define SCLK_I2S_8CH		82
 #define SCLK_SPDIF_8CH		83
 #define SCLK_I2S_2CH		84
-#define SCLK_TIMER0		85
-#define SCLK_TIMER1		86
-#define SCLK_TIMER2		87
-#define SCLK_TIMER3		88
-#define SCLK_TIMER4		89
-#define SCLK_TIMER5		90
-#define SCLK_TIMER6		91
+#define SCLK_TIMER00		85
+#define SCLK_TIMER01		86
+#define SCLK_TIMER02		87
+#define SCLK_TIMER03		88
+#define SCLK_TIMER04		89
+#define SCLK_TIMER05		90
 #define SCLK_OTGPHY0		93
 #define SCLK_OTG_ADP		96
 #define SCLK_HSICPHY480M	97
@@ -82,6 +72,12 @@
 #define SCLK_SFC		126
 #define SCLK_MAC		127
 #define SCLK_MACREF_OUT		128
+#define SCLK_TIMER10		133
+#define SCLK_TIMER11		134
+#define SCLK_TIMER12		135
+#define SCLK_TIMER13		136
+#define SCLK_TIMER14		137
+#define SCLK_TIMER15		138
 
 #define DCLK_VOP		190
 #define MCLK_CRYPTO		191
@@ -151,6 +147,7 @@
 #define PCLK_ISP		366
 #define PCLK_VIP		367
 #define PCLK_WDT		368
+#define PCLK_EFUSE256		369
 
 /* hclk gates */
 #define HCLK_SFC		448
Signature · 1 line
2.29.2
author maintainer
#6 lore raw

PATCH 6/8 rockchip: rk3368: sync main rk3368 dtsi from Linux

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This is the state as of v5.10 + the recently added timer0 phandle targetted at the 5.12 merge window.

With this the non-mainline nodes like the dmc move to a separate rk3368-u-boot.dtsi that is included from the board-specific -u-boot.dtsi files, similar to how rk3399 does this.

---
 arch/arm/dts/rk3368-geekbox-u-boot.dtsi |   2 +
 arch/arm/dts/rk3368-lion-u-boot.dtsi    |   2 +
 arch/arm/dts/rk3368-px5-evb-u-boot.dtsi |   3 +
 arch/arm/dts/rk3368-sheep-u-boot.dtsi   |   2 +
 arch/arm/dts/rk3368-u-boot.dtsi         |  27 ++
 arch/arm/dts/rk3368.dtsi                | 578 ++++++++++++++----------
 6 files changed, 383 insertions(+), 231 deletions(-)
 create mode 100644 arch/arm/dts/rk3368-u-boot.dtsi
arch/arm/dts/rk3368-geekbox-u-boot.dtsi +2 -0
index 30ea9e433a..0b724fa45f 100644
@@ -3,6 +3,8 @@
  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  */
 
+#include "rk3368-u-boot.dtsi"
+
 &pinctrl {
 	u-boot,dm-pre-reloc;
 };
arch/arm/dts/rk3368-lion-u-boot.dtsi +2 -0
index 6d54214de9..9bd6352755 100644
@@ -3,6 +3,8 @@
  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  */
 
+#include "rk3368-u-boot.dtsi"
+
 / {
 	config {
 		u-boot,spl-payload-offset = <0x40000>; /* @ 256KB */
arch/arm/dts/rk3368-px5-evb-u-boot.dtsi +3 -0
index 936ce55727..264fb7adf0 100644
@@ -2,6 +2,9 @@
 /*
  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  */
+
+#include "rk3368-u-boot.dtsi"
+
 / {
 	chosen {
 		u-boot,spl-boot-order = &emmc;
arch/arm/dts/rk3368-sheep-u-boot.dtsi +2 -0
index 30ea9e433a..0b724fa45f 100644
@@ -3,6 +3,8 @@
  * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
  */
 
+#include "rk3368-u-boot.dtsi"
+
 &pinctrl {
 	u-boot,dm-pre-reloc;
 };
arch/arm/dts/rk3368-u-boot.dtsi new file +27 -0
new file mode 100644
index 0000000000..2767c2678d
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2020 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include <dt-bindings/memory/rk3368-dmc.h>
+
+/ {
+	dmc: dmc at ff610000 {
+		compatible = "rockchip,rk3368-dmc", "syscon";
+		rockchip,cru = <&cru>;
+		rockchip,grf = <&grf>;
+		rockchip,msch = <&service_msch>;
+		reg = <0 0xff610000 0 0x400
+		       0 0xff620000 0 0x400>;
+	};
+
+	service_msch: syscon at ffac0000 {
+		compatible = "rockchip,rk3368-msch", "syscon";
+		reg = <0x0 0xffac0000 0x0 0x2000>;
+	};
+
+	sgrf: syscon at ff740000 {
+		compatible = "rockchip,rk3368-sgrf", "syscon";
+		reg = <0x0 0xff740000 0x0 0x1000>;
+	};
+};
arch/arm/dts/rk3368.dtsi +347 -231

1,017 lines not on this page · raw message

Signature · 1 line
2.29.2
author maintainer
#7 lore raw

PATCH 7/8 rockchip: rk3368: sync down rk3368-lion board devicetree from Linux

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

This brings the actual rk3368-lion devicetree files from Linux 5.10 instead of using something separate.

---
 arch/arm/dts/Makefile                         |   2 +-
 ...ot.dtsi => rk3368-lion-haikou-u-boot.dtsi} |   4 +
 arch/arm/dts/rk3368-lion-haikou.dts           | 140 +++++++++
 .../dts/{rk3368-lion.dts => rk3368-lion.dtsi} | 271 +++++++++++++-----
 configs/lion-rk3368_defconfig                 |   2 +
 5 files changed, 351 insertions(+), 68 deletions(-)
 rename arch/arm/dts/{rk3368-lion-u-boot.dtsi => rk3368-lion-haikou-u-boot.dtsi} (98%)
 create mode 100644 arch/arm/dts/rk3368-lion-haikou.dts
 rename arch/arm/dts/{rk3368-lion.dts => rk3368-lion.dtsi} (54%)
arch/arm/dts/Makefile +1 -1
index fd47e408f8..fa2e8b5ef7 100644
@@ -115,7 +115,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3328) += \
 	rk3328-rock-pi-e.dtb
 
 dtb-$(CONFIG_ROCKCHIP_RK3368) += \
-	rk3368-lion.dtb \
+	rk3368-lion-haikou.dtb \
 	rk3368-sheep.dtb \
 	rk3368-geekbox.dtb \
 	rk3368-px5-evb.dtb \
arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi renamed from arch/arm/dts/rk3368-lion-u-boot.dtsi +4 -0
similarity index 98%
rename from arch/arm/dts/rk3368-lion-u-boot.dtsi
rename to arch/arm/dts/rk3368-lion-haikou-u-boot.dtsi
index 9bd6352755..7826d1e70b 100644
@@ -38,6 +38,10 @@
 	};
 };
 
+&gpio2 {
+	u-boot,dm-pre-reloc;
+};
+
 &pinctrl {
 	u-boot,dm-pre-reloc;
 };
arch/arm/dts/rk3368-lion-haikou.dts new file +140 -0

140 lines not on this page · raw message

arch/arm/dts/rk3368-lion.dtsi renamed from arch/arm/dts/rk3368-lion.dts +204 -67

382 lines not on this page · raw message

configs/lion-rk3368_defconfig +2 -0
index b409715060..f547875dee 100644
@@ -32,6 +32,7 @@ CONFIG_SPL_BOOTROM_SUPPORT=y
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 CONFIG_TPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000
 CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
 CONFIG_SPL_ATF=y
 CONFIG_TPL=y
@@ -44,6 +45,7 @@ CONFIG_CMD_MTDPARTS=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_TPL_OF_CONTROL=y
 CONFIG_OF_LIVE=y
+CONFIG_DEFAULT_DEVICE_TREE="rk3368-lion-haikou"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent"
 CONFIG_TPL_OF_PLATDATA=y
 CONFIG_ENV_IS_IN_MMC=y
Signature · 1 line
2.29.2
author maintainer
#8 lore raw

PATCH 8/8 rockchip: lion: update board defconfig

In reply to Heiko Stuebner

From: Heiko Stuebner <[email protected]>

Adds the needed target option and drivers needed for correct bringup.

---
 configs/lion-rk3368_defconfig | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
configs/lion-rk3368_defconfig +14 -2
index f547875dee..6d6b73d977 100644
@@ -9,6 +9,7 @@ CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_TPL_LIBCOMMON_SUPPORT=y
 CONFIG_TPL_LIBGENERIC_SUPPORT=y
 CONFIG_SPL_DRIVERS_MISC_SUPPORT=y
+CONFIG_TARGET_LION_RK3368=y
 CONFIG_SPL=y
 CONFIG_DEBUG_UART_BASE=0xFF180000
 CONFIG_DEBUG_UART_CLOCK=24000000
@@ -39,6 +40,8 @@ CONFIG_TPL=y
 CONFIG_TPL_DRIVERS_MISC_SUPPORT=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_MMC=y
+CONFIG_CMD_SPI=y
+CONFIG_CMD_USB=y
 CONFIG_CMD_BOOTSTAGE=y
 CONFIG_CMD_REGULATOR=y
 CONFIG_CMD_MTDPARTS=y
@@ -62,14 +65,15 @@ CONFIG_CLK=y
 CONFIG_SPL_CLK=y
 CONFIG_TPL_CLK=y
 CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MTD=y
 CONFIG_SPI_FLASH_MACRONIX=y
 CONFIG_SPI_FLASH_WINBOND=y
-CONFIG_PHY_MICREL=y
-CONFIG_PHY_MICREL_KSZ90X1=y
+CONFIG_PHY_MSCC=y
 CONFIG_DM_ETH=y
+CONFIG_DM_ETH_PHY=y
 CONFIG_ETH_DESIGNWARE=y
 CONFIG_RGMII=y
 CONFIG_GMAC_ROCKCHIP=y
@@ -78,6 +82,7 @@ CONFIG_SPL_PINCTRL=y
 CONFIG_DM_PMIC=y
 CONFIG_PMIC_RK8XX=y
 CONFIG_DM_REGULATOR_FIXED=y
+CONFIG_REGULATOR_RK8XX=y
 CONFIG_RAM=y
 CONFIG_SPL_RAM=y
 CONFIG_TPL_RAM=y
@@ -88,6 +93,13 @@ CONFIG_ROCKCHIP_SPI=y
 CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SMBIOS=y
 CONFIG_SYSRESET=y
+CONFIG_USB=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_DWC2=y
+CONFIG_ROCKCHIP_USB2_PHY=y
+CONFIG_USB_GADGET=y
+CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_SPL_TINY_MEMSET=y
 CONFIG_LZO=y
 CONFIG_ERRNO_STR=y
Signature · 1 line
2.29.2