Skip to contentSkip to conversation

ARM: rockchip: add new ARCH_ROCKCHIP_{V7,V8} symbols

PATCH In review Ahmad Fatoum 3 participants 5 messages Jan 14, 2022

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

PATCH 1/3 ARM: rockchip: add new ARCH_ROCKCHIP_{V7,V8} symbols

In preparation for adding rk3399 support, which is another SoC with ARMv8 CPUs, add new ARCH_ROCKCHIP_{V7,V8} symbols for the common functionality.

---
 arch/arm/mach-rockchip/Kconfig  | 18 ++++++++++++------
 arch/arm/mach-rockchip/Makefile |  5 +++--
 2 files changed, 15 insertions(+), 8 deletions(-)
arch/arm/mach-rockchip/Kconfig +12 -6
index 2e855714f7da..596de663f9e3 100644
@@ -12,24 +12,30 @@ config RK_TIMER
 	hex
 	default 1
 
-config ARCH_RK3188
+config ARCH_ROCKCHIP_V7
 	bool
 	select CPU_V7
 	select ARM_SMP_TWD
 	select ARCH_HAS_L2X0
 
+config ARCH_RK3188
+	bool
+	select ARCH_ROCKCHIP_V7
+
 config ARCH_RK3288
 	bool
-	select CPU_V7
-	select ARM_SMP_TWD
-	select ARCH_HAS_L2X0
+	select ARCH_ROCKCHIP_V7
 	select CLOCKSOURCE_ROCKCHIP
 
-config ARCH_RK3568
+config ARCH_ROCKCHIP_V8
 	bool
 	select CPU_V8
-	select ARM_ATF
 	select SYS_SUPPORTS_64BIT_KERNEL
+	select ARM_ATF
+
+config ARCH_RK3568
+	bool
+	select ARCH_ROCKCHIP_V8
 
 comment "select Rockchip boards:"
 
arch/arm/mach-rockchip/Makefile +3 -2
index 72bf77c1e124..474b8629d13f 100644
@@ -1,9 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-y += rockchip.o
-pbl-$(CONFIG_ARCH_RK3568) += atf.o
+pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
 obj-$(CONFIG_ARCH_RK3188) += rk3188.o
 obj-$(CONFIG_ARCH_RK3288) += rk3288.o
+obj-pbl-$(CONFIG_ARCH_RK3399) += rk3399.o
 obj-pbl-$(CONFIG_ARCH_RK3568) += rk3568.o
-obj-$(CONFIG_ARCH_RK3568) += bootm.o
+obj-$(CONFIG_ARCH_ROCKCHIP_V8) += bootm.o
 obj-$(CONFIG_BAREBOX_UPDATE) += bbu.o
Signature · 7 lines
2.33.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH 2/3 ARM64: rockchip: add config symbol for ARMv8-based rk3399 SoC

As preperation for adding support for the RK3399-based Radxa Rock Pi N10, define the ARCH_RK3399 config symbol and associated boilerplate.

---
 arch/arm/mach-rockchip/Kconfig                 | 18 +++++++++++++++++-
 arch/arm/mach-rockchip/atf.c                   |  4 ++++
 arch/arm/mach-rockchip/include/mach/atf.h      |  6 ++++++
 arch/arm/mach-rockchip/include/mach/debug_ll.h |  6 ++++++
 .../mach-rockchip/include/mach/rk3399-regs.h   | 16 ++++++++++++++++
 common/Kconfig                                 | 10 +++++++++-
 firmware/Makefile                              |  2 ++
 7 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/include/mach/rk3399-regs.h
arch/arm/mach-rockchip/Kconfig +17 -1
index 596de663f9e3..98ef35769ffd 100644
@@ -6,7 +6,7 @@ menu "Rockchip Features"
 config ARCH_TEXT_BASE
 	hex
 	default 0x68000000 if ARCH_RK3188
-	default 0x0 if ARCH_RK3288
+	default 0x0
 
 config RK_TIMER
 	hex
@@ -32,6 +32,15 @@ config ARCH_ROCKCHIP_V8
 	select CPU_V8
 	select SYS_SUPPORTS_64BIT_KERNEL
 	select ARM_ATF
+	select RELOCATABLE
+
+config ARCH_RK3399
+	bool
+	select ARCH_ROCKCHIP_V8
+
+config ARCH_RK3399PRO
+	bool
+	select ARCH_RK3399
 
 config ARCH_RK3568
 	bool
@@ -66,6 +75,13 @@ config MACH_PINE64_QUARTZ64
 
 comment "select board features:"
 
+config ARCH_RK3399_OPTEE
+	bool "Build rk3399 OP-TEE binary into barebox"
+	depends on ARCH_RK3399
+	help
+	  With this option enabled the RK3399 OP-TEE binary is compiled
+	  into barebox and started along with the BL31 trusted firmware.
+
 config ARCH_RK3568_OPTEE
 	bool "Build rk3568 OP-TEE binary into barebox"
 	depends on ARCH_RK3568
arch/arm/mach-rockchip/atf.c +4 -0
index de22784489b5..0512ff99f456 100644
@@ -60,6 +60,10 @@ static unsigned long load_elf64_image_phdr(const void *elf)
 		   SOC##_BAREBOX_LOAD_ADDRESS, (uintptr_t)fdt);                 \
 } while (0)                                                                     \
 
+void rk3399_atf_load_bl31(void *fdt)
+{
+	rockchip_atf_load_bl31(RK3399, rk3399_bl31_bin, rk3399_op_tee_bin, fdt);
+}
 
 void rk3568_atf_load_bl31(void *fdt)
 {
arch/arm/mach-rockchip/include/mach/atf.h +6 -0
index ab328cc8d20a..d1bae5a7714f 100644
@@ -4,17 +4,23 @@
 #define __MACH_ATF_H
 
 /* First usable DRAM address. Lower mem is used for ATF and OP-TEE */
+#define RK3399_DRAM_BOTTOM		0xa00000
 #define RK3568_DRAM_BOTTOM		0xa00000
 
 /* OP-TEE expects to be loaded here */
+#define RK3399_OPTEE_LOAD_ADDRESS	0x200000
 #define RK3568_OPTEE_LOAD_ADDRESS	0x200000
 
 /*
  * board lowlevel code should relocate barebox here. This is where
  * OP-TEE jumps to after initialization.
  */
+#define RK3399_BAREBOX_LOAD_ADDRESS	(RK3399_DRAM_BOTTOM + 1024*1024)
 #define RK3568_BAREBOX_LOAD_ADDRESS	(RK3568_DRAM_BOTTOM + 1024*1024)
 
+#ifndef __ASSEMBLY__
+void rk3399_atf_load_bl31(void *fdt);
 void rk3568_atf_load_bl31(void *fdt);
+#endif
 
 #endif /* __MACH_ATF_H */
arch/arm/mach-rockchip/include/mach/debug_ll.h +6 -0
index 73fc5b5db2ff..42e35188a20a 100644
@@ -8,6 +8,7 @@
 #include <mach/rk3188-regs.h>
 #include <mach/rk3288-regs.h>
 #include <mach/rk3568-regs.h>
+#include <mach/rk3399-regs.h>
 
 #ifdef CONFIG_DEBUG_LL
 
@@ -29,6 +30,11 @@
 
 #define UART_CLOCK		24000000
 #define RK_DEBUG_SOC		RK3568
+
+#elif defined CONFIG_DEBUG_ROCKCHIP_RK3399_UART
+
+#define UART_CLOCK		24000000
+#define RK_DEBUG_SOC		RK3399
 #define serial_out(a, v)	writel(v, a)
 #define serial_in(a)		readl(a)
 
arch/arm/mach-rockchip/include/mach/rk3399-regs.h new file +16 -0
new file mode 100644
index 000000000000..57033b651085
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef __MACH_RK3399_REGS_H
+#define __MACH_RK3399_REGS_H
+
+/* UART */
+#define RK3399_UART0_BASE	0xff180000
+#define RK3399_UART1_BASE	0xff190000
+#define RK3399_UART2_BASE	0xff1a0000
+#define RK3399_UART3_BASE	0xff1b0000
+#define RK3399_UART4_BASE	0xff370000
+
+#define RK3399_IRAM_BASE	0xff8c0000
+#define RK3399_STIMER_BASE	0xff8680a0
+
+#endif
common/Kconfig +9 -1
index 482faea933a6..1843a81b3d97 100644
@@ -1358,6 +1358,13 @@ config DEBUG_ROCKCHIP_RK3568_UART
 	  Say Y here if you want kernel low-level debugging support
 	  on RK3568.
 
+config DEBUG_ROCKCHIP_RK3399_UART
+	bool "RK3399 Debug UART"
+	depends on ARCH_RK3399
+	help
+	  Say Y here if you want kernel low-level debugging support
+	  on RK3399.
+
 config DEBUG_SOCFPGA_UART0
 	bool "Use SOCFPGA UART0 for low-level debug"
 	depends on ARCH_SOCFPGA
@@ -1474,7 +1481,8 @@ config DEBUG_OMAP_UART_PORT
 config DEBUG_ROCKCHIP_UART_PORT
 	int "RK3xxx UART debug port" if DEBUG_ROCKCHIP_RK3188_UART || \
 				DEBUG_ROCKCHIP_RK3288_UART || \
-				DEBUG_ROCKCHIP_RK3568_UART
+				DEBUG_ROCKCHIP_RK3568_UART || \
+				DEBUG_ROCKCHIP_RK3399_UART
 	default 2
 	depends on ARCH_ROCKCHIP
 	help
firmware/Makefile +2 -0
index 8873f5178d33..87bd033f6e5c 100644
@@ -18,6 +18,8 @@ firmware-$(CONFIG_FIRMWARE_IMX8MP_ATF) += imx8mp-bl31.bin
 firmware-$(CONFIG_FIRMWARE_IMX8MQ_ATF) += imx8mq-bl31.bin
 firmware-$(CONFIG_ARCH_RK3568) += rk3568-bl31.bin
 firmware-$(CONFIG_ARCH_RK3568_OPTEE) += rk3568-op-tee.bin
+firmware-$(CONFIG_ARCH_RK3399) += rk3399-bl31.bin
+firmware-$(CONFIG_ARCH_RK3399_OPTEE) += rk3399-op-tee.bin
 firmware-$(CONFIG_DRIVER_NET_FSL_FMAN) += fsl_fman_ucode_ls1046_r1.0_106_4_18.bin
 
 firmware-$(CONFIG_ARCH_LAYERSCAPE_PPA) += ppa-ls1046a.bin
Signature · 7 lines
2.33.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 3/3 clk: rockchip: extend for rk3399 support

In reply to Ahmad Fatoum

This is a very straight-forward port of Linux' clock driver for the SoC facilitated with the very convenient changes done to synchronize barebox clock framework with Linux'.

It adds support for clock tree, restart handler and a reset controller.

---
 arch/arm/mach-rockchip/Kconfig    |    1 +
 drivers/clk/rockchip/Makefile     |    1 +
 drivers/clk/rockchip/clk-rk3399.c | 1653 +++++++++++++++++++++++++++++
 3 files changed, 1655 insertions(+)
 create mode 100644 drivers/clk/rockchip/clk-rk3399.c
arch/arm/mach-rockchip/Kconfig +1 -0
index 98ef35769ffd..3c6b3dd9b531 100644
@@ -37,6 +37,7 @@ config ARCH_ROCKCHIP_V8
 config ARCH_RK3399
 	bool
 	select ARCH_ROCKCHIP_V8
+	select ARCH_HAS_RESET_CONTROLLER
 
 config ARCH_RK3399PRO
 	bool
drivers/clk/rockchip/Makefile +1 -0
index a2461d16c10d..7adbaf266f0b 100644
@@ -3,4 +3,5 @@ obj-y += clk-cpu.o clk-pll.o clk.o clk-muxgrf.o clk-mmc-phase.o clk-inverter.o
 obj-$(CONFIG_RESET_CONTROLLER) += softrst.o
 obj-$(CONFIG_ARCH_RK3188) += clk-rk3188.o
 obj-$(CONFIG_ARCH_RK3288) += clk-rk3288.o
+obj-$(CONFIG_ARCH_RK3399) += clk-rk3399.o
 obj-$(CONFIG_ARCH_RK3568) += clk-rk3568.o
drivers/clk/rockchip/clk-rk3399.c new file +1653 -0

1,653 lines not on this page · raw message

Signature · 7 lines
2.33.0


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
In reply to Ahmad Fatoum
Quoted 56 lines · Ahmad Fatoum

In preparation for adding rk3399 support, which is another SoC with ARMv8 CPUs, add new ARCH_ROCKCHIP_{V7,V8} symbols for the common functionality.

---
 arch/arm/mach-rockchip/Kconfig  | 18 ++++++++++++------
 arch/arm/mach-rockchip/Makefile |  5 +++--
 2 files changed, 15 insertions(+), 8 deletions(-)
arch/arm/mach-rockchip/Kconfig +12 -6
index 2e855714f7da..596de663f9e3 100644
@@ -12,24 +12,30 @@ config RK_TIMER
 	hex
 	default 1
 
-config ARCH_RK3188
+config ARCH_ROCKCHIP_V7
 	bool
 	select CPU_V7
 	select ARM_SMP_TWD
 	select ARCH_HAS_L2X0
 
+config ARCH_RK3188
+	bool
+	select ARCH_ROCKCHIP_V7
+
 config ARCH_RK3288
 	bool
-	select CPU_V7
-	select ARM_SMP_TWD
-	select ARCH_HAS_L2X0
+	select ARCH_ROCKCHIP_V7
 	select CLOCKSOURCE_ROCKCHIP
 
-config ARCH_RK3568
+config ARCH_ROCKCHIP_V8
 	bool
 	select CPU_V8
-	select ARM_ATF
 	select SYS_SUPPORTS_64BIT_KERNEL
+	select ARM_ATF
+
+config ARCH_RK3568
+	bool
+	select ARCH_ROCKCHIP_V8
 
 comment "select Rockchip boards:"
 
arch/arm/mach-rockchip/Makefile +0 -0
index 72bf77c1e124..474b8629d13f 100644

arch/arm/mach-rockchip/Makefile line 7

Quoted 8 lines
arch/arm/mach-rockchip/Makefile +2 -1
@@ -1,9 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
 obj-y += rockchip.o
-pbl-$(CONFIG_ARCH_RK3568) += atf.o
+pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
 obj-$(CONFIG_ARCH_RK3188) += rk3188.o
 obj-$(CONFIG_ARCH_RK3288) += rk3288.o
+obj-pbl-$(CONFIG_ARCH_RK3399) += rk3399.o

We don't have this yet, removed this hunk while applying.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw
Quoted 59 lines · Sascha Hauer
Quoted 58 lines · Ahmad Fatoum

In preparation for adding rk3399 support, which is another SoC with ARMv8 CPUs, add new ARCH_ROCKCHIP_{V7,V8} symbols for the common functionality.

---
 arch/arm/mach-rockchip/Kconfig  | 18 ++++++++++++------
 arch/arm/mach-rockchip/Makefile |  5 +++--
 2 files changed, 15 insertions(+), 8 deletions(-)
arch/arm/mach-rockchip/Kconfig +12 -6
index 2e855714f7da..596de663f9e3 100644
@@ -12,24 +12,30 @@ config RK_TIMER
 	hex
 	default 1
 
-config ARCH_RK3188
+config ARCH_ROCKCHIP_V7
 	bool
 	select CPU_V7
 	select ARM_SMP_TWD
 	select ARCH_HAS_L2X0
 
+config ARCH_RK3188
+	bool
+	select ARCH_ROCKCHIP_V7
+
 config ARCH_RK3288
 	bool
-	select CPU_V7
-	select ARM_SMP_TWD
-	select ARCH_HAS_L2X0
+	select ARCH_ROCKCHIP_V7
 	select CLOCKSOURCE_ROCKCHIP
 
-config ARCH_RK3568
+config ARCH_ROCKCHIP_V8
 	bool
 	select CPU_V8
-	select ARM_ATF
 	select SYS_SUPPORTS_64BIT_KERNEL
+	select ARM_ATF
+
+config ARCH_RK3568
+	bool
+	select ARCH_ROCKCHIP_V8
 
 comment "select Rockchip boards:"
 
arch/arm/mach-rockchip/Makefile +0 -0
index 72bf77c1e124..474b8629d13f 100644
@@ -1,9 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
Quoted 8 lines

arch/arm/mach-rockchip/Makefile line 7

Quoted 6 lines
arch/arm/mach-rockchip/Makefile +2 -1
 obj-y += rockchip.o
-pbl-$(CONFIG_ARCH_RK3568) += atf.o
+pbl-$(CONFIG_ARCH_ROCKCHIP_V8) += atf.o
 obj-$(CONFIG_ARCH_RK3188) += rk3188.o
 obj-$(CONFIG_ARCH_RK3288) += rk3288.o
+obj-pbl-$(CONFIG_ARCH_RK3399) += rk3399.o

We don't have this yet, removed this hunk while applying.

Thanks, missed that during the rebase. I want to polish that a bit before sending out in the following weeks.

Thanks,
Ahmad

Quoted 3 lines

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox