Skip to contentSkip to conversation

Support for the RK3576

PATCH Superseded Heiko Stuebner 2 participants 30 messages Apr 14, 2025 – Apr 15, 2025

Subsystems (9)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Heiko Stuebner

author maintainer
#0 lore raw

v2 cover Support for the RK3576

This adds support for the RK3576 SoC from Rockchip.

Currently supported (and tested) features are accessing and reading from sdhci and sdmmc devices as well as pxe-booting via the network interface.

As can be seen by the DONOTMERGE labels, this needs to wait a bit still.

The core RK3576 devicetrees will be part of 6.13-rc1, but the Firefly board I only submitted last week, so this would only appear in 6.14-rc1 .

If someone from Collabora could provide a board patch for the ArmSom board they are working with, this would speed things up a bit ;-) .

Checkpatch seems mostly happy too.

changes in v2:
- rebase on top of rockchip-for-next (including the rk3528 addition)
- drop patches now coming from mainline Linux
- cherry pick the now mainline comits for roc-rk3576-pc board and otp
- nitpicks in CFG_SYS_SDRAM_BASE handling (Quentin, Jonas)
- fold in Jonas' fixes for (roc-rk3576-pc board, dwc_eth, sdhci, pinctrl, clk, ram, rk3576-core), they all look nice and also match the review comments submitted.
- add received reviewed-bys for sdhci and mmc

It has been a while since v1, so I do hope I have caught all the review comments.

Detlev Casanova (1):
arm: rockchip: add RK3576-specific syscon ids

Elaine Zhang (2):
clk: rockchip: Add rk3576 clk support
reset: rockchip: implement rk3576 lookup table

Heiko Stuebner (10):
rockchip: sdram: honor CFG_SYS_SDRAM_BASE when defining ram regions
ram: rockchip: Add rk3576 ddr driver support
rockchip: otp: Add support for RK3576
mmc: rockchip_sdhci: Add support for RK3576
mmc: rockchip_dw_mmc: Add support for rk3576
net: dwc_eth_qos_rockchip: Add support for RK3576
arm64: dts: rockchip: add rk3576 otp node
dt-bindings: arm: rockchip: Add Firefly ROC-RK3576-PC binding
arm64: dts: rockchip: Add devicetree for the ROC-RK3576-PC
rockchip: rk3576: Add support for ROC-RK3576-PC board

Steven Liu (1):
pinctrl: rockchip: support rk3576 pinctrl

Xuhui Lin (2):
rockchip: mkimage: Add rk3576 support
arm: rockchip: Add RK3576 arch core support

 arch/arm/dts/rk3576-roc-pc-u-boot.dtsi        |   11 +
 arch/arm/dts/rk3576-u-boot.dtsi               |  131 +
 arch/arm/include/asm/arch-rk3576/boot0.h      |   11 +
 arch/arm/include/asm/arch-rk3576/gpio.h       |   11 +
 arch/arm/include/asm/arch-rockchip/clock.h    |   12 +
 .../include/asm/arch-rockchip/cru_rk3576.h    |  491 ++++
 arch/arm/mach-rockchip/Kconfig                |   51 +
 arch/arm/mach-rockchip/Makefile               |    1 +
 arch/arm/mach-rockchip/rk3576/Kconfig         |   23 +
 arch/arm/mach-rockchip/rk3576/Makefile        |    9 +
 arch/arm/mach-rockchip/rk3576/clk_rk3576.c    |   18 +
 arch/arm/mach-rockchip/rk3576/rk3576.c        |  155 +
 arch/arm/mach-rockchip/rk3576/syscon_rk3576.c |   22 +
 arch/arm/mach-rockchip/sdram.c                |   13 +-
 board/firefly/roc-pc-rk3576/Kconfig           |   12 +
 board/firefly/roc-pc-rk3576/MAINTAINERS       |    7 +
 configs/roc-pc-rk3576_defconfig               |   45 +
 doc/board/rockchip/rockchip.rst               |   12 +
 drivers/clk/rockchip/Makefile                 |    1 +
 drivers/clk/rockchip/clk_rk3576.c             | 2513 +++++++++++++++++
 drivers/misc/rockchip-otp.c                   |   11 +
 drivers/mmc/rockchip_dw_mmc.c                 |    1 +
 drivers/mmc/rockchip_sdhci.c                  |   15 +
 drivers/net/dwc_eth_qos.c                     |    4 +
 drivers/net/dwc_eth_qos_rockchip.c            |  154 +-
 drivers/pinctrl/rockchip/Makefile             |    1 +
 drivers/pinctrl/rockchip/pinctrl-rk3576.c     |  279 ++
 drivers/pinctrl/rockchip/pinctrl-rockchip.h   |    3 +
 drivers/ram/rockchip/Makefile                 |    1 +
 drivers/ram/rockchip/sdram_rk3576.c           |   35 +
 drivers/reset/Makefile                        |    2 +-
 drivers/reset/rst-rk3576.c                    |  647 +++++
 dts/upstream/Bindings/arm/rockchip.yaml       |    5 +
 .../src/arm64/rockchip/rk3576-roc-pc.dts      |  736 +++++
 dts/upstream/src/arm64/rockchip/rk3576.dtsi   |   39 +
 include/configs/rk3576_common.h               |   45 +
 include/configs/roc-pc-rk3576.h               |   15 +
 tools/rkcommon.c                              |    1 +
 38 files changed, 5535 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/dts/rk3576-roc-pc-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3576-u-boot.dtsi
 create mode 100644 arch/arm/include/asm/arch-rk3576/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3576/gpio.h
 create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3576.h
 create mode 100644 arch/arm/mach-rockchip/rk3576/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3576/Makefile
 create mode 100644 arch/arm/mach-rockchip/rk3576/clk_rk3576.c
 create mode 100644 arch/arm/mach-rockchip/rk3576/rk3576.c
 create mode 100644 arch/arm/mach-rockchip/rk3576/syscon_rk3576.c
 create mode 100644 board/firefly/roc-pc-rk3576/Kconfig
 create mode 100644 board/firefly/roc-pc-rk3576/MAINTAINERS
 create mode 100644 configs/roc-pc-rk3576_defconfig
 create mode 100644 drivers/clk/rockchip/clk_rk3576.c
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3576.c
 create mode 100644 drivers/ram/rockchip/sdram_rk3576.c
 create mode 100644 drivers/reset/rst-rk3576.c
 create mode 100644 dts/upstream/src/arm64/rockchip/rk3576-roc-pc.dts
 create mode 100644 include/configs/rk3576_common.h
 create mode 100644 include/configs/roc-pc-rk3576.h
Signature · 1 line
2.47.2
author maintainer
#1 lore raw

PATCH v2 1/16 rockchip: sdram: honor CFG_SYS_SDRAM_BASE when defining ram regions

Currently the sdram code for arm64 expects CFG_SYS_SDRAM_BASE to be 0. The ram being in front and the device-area behind it.

The upcoming RK3576 uses a different layout, with the device area in front the ram, which then also extends past the 4G mark.

Adapt both the generic zone definitions as well as the ATAG parser to be usable on devices where CFG_SYS_SDRAM_BASE is not 0.

---
 arch/arm/mach-rockchip/sdram.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-rockchip/sdram.c +6 -6
index aa3f47c3f20..f6d9c503bfd 100644
@@ -182,9 +182,9 @@ static int rockchip_dram_init_banksize(void)
 		 * BL31 (TF-A) reserves the first 2MB but DDR_MEM tag may not
 		 * have it, so force this space as reserved.
 		 */
-		if (start_addr < SZ_2M) {
-			size -= SZ_2M - start_addr;
-			start_addr = SZ_2M;
+		if (start_addr < SZ_2M + CFG_SYS_SDRAM_BASE) {
+			size -= CFG_SYS_SDRAM_BASE + SZ_2M - start_addr;
+			start_addr = CFG_SYS_SDRAM_BASE + SZ_2M;
 		}
 
 		/*
@@ -229,7 +229,7 @@ static int rockchip_dram_init_banksize(void)
 					return -EINVAL;
 				}
 
-				size -= rsrv_end - start_addr;
+				size -= rsrv_end - (start_addr - CFG_SYS_SDRAM_BASE);
 				start_addr = rsrv_end;
 				break;
 			}
@@ -302,8 +302,8 @@ int dram_init_banksize(void)
 	debug("Couldn't use ATAG (%d) to detect DDR layout, falling back...\n",
 	      ret);
 
-	/* Reserve 0x200000 for ATF bl31 */
-	gd->bd->bi_dram[0].start = 0x200000;
+	/* Reserve 2M for ATF bl31 */
+	gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE + SZ_2M;
 	gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
 
 	/* Add usable memory beyond the blob of space for peripheral near 4GB */
Signature · 1 line
2.47.2
#2 lore raw

Re: [PATCH v2 01/16] rockchip: sdram: honor CFG_SYS_SDRAM_BASE when defining ram regions

Hi Heiko,

Quoted 21 lines · Heiko Stuebner

Currently the sdram code for arm64 expects CFG_SYS_SDRAM_BASE to be 0. The ram being in front and the device-area behind it.

The upcoming RK3576 uses a different layout, with the device area in front the ram, which then also extends past the 4G mark.

Adapt both the generic zone definitions as well as the ATAG parser to be usable on devices where CFG_SYS_SDRAM_BASE is not 0.

---
 arch/arm/mach-rockchip/sdram.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm/mach-rockchip/sdram.c +0 -0
index aa3f47c3f20..f6d9c503bfd 100644

arch/arm/mach-rockchip/sdram.c static int rockchip_dram_init_banksize(void) · line 185

Quoted 7 lines
arch/arm/mach-rockchip/sdram.c +1 -3
@@ -182,9 +182,9 @@ static int rockchip_dram_init_banksize(void)
 		 * BL31 (TF-A) reserves the first 2MB but DDR_MEM tag may not
 		 * have it, so force this space as reserved.
 		 */
-		if (start_addr < SZ_2M) {
-			size -= SZ_2M - start_addr;
-			start_addr = SZ_2M;
+		if (start_addr < SZ_2M + CFG_SYS_SDRAM_BASE) {

A small nitpick for consistency:

	if (start_addr < CFG_SYS_SDRAM_BASE + SZ_2M) {

That would result in 4x grep-able "CFG_SYS_SDRAM_BASE + SZ_2M" in this file.

Regards,
Jonas

Quoted 25 lines
arch/arm/mach-rockchip/sdram.c +5 -3
+			size -= CFG_SYS_SDRAM_BASE + SZ_2M - start_addr;
+			start_addr = CFG_SYS_SDRAM_BASE + SZ_2M;
 		}
 
 		/*
@@ -229,7 +229,7 @@ static int rockchip_dram_init_banksize(void)
 					return -EINVAL;
 				}
 
-				size -= rsrv_end - start_addr;
+				size -= rsrv_end - (start_addr - CFG_SYS_SDRAM_BASE);
 				start_addr = rsrv_end;
 				break;
 			}
@@ -302,8 +302,8 @@ int dram_init_banksize(void)
 	debug("Couldn't use ATAG (%d) to detect DDR layout, falling back...\n",
 	      ret);
 
-	/* Reserve 0x200000 for ATF bl31 */
-	gd->bd->bi_dram[0].start = 0x200000;
+	/* Reserve 2M for ATF bl31 */
+	gd->bd->bi_dram[0].start = CFG_SYS_SDRAM_BASE + SZ_2M;
 	gd->bd->bi_dram[0].size = top - gd->bd->bi_dram[0].start;
 
 	/* Add usable memory beyond the blob of space for peripheral near 4GB */
author maintainer
#3 lore raw

PATCH v2 2/16 rockchip: mkimage: Add rk3576 support

In reply to Heiko Stuebner

From: Xuhui Lin <[email protected]>

Add support for rk3576 package header in mkimage tool.

---
 tools/rkcommon.c | 1 +
 1 file changed, 1 insertion(+)
tools/rkcommon.c +1 -0
index f158d156228..a0caa029cc0 100644
@@ -136,6 +136,7 @@ static struct spl_info spl_infos[] = {
 	{ "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
 	{ "rk3528", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
 	{ "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
+	{ "rk3576", "RK35", 0x80000 - 0x1000, false, RK_HEADER_V2 },
 	{ "rk3588", "RK35", 0x100000 - 0x1000, false, RK_HEADER_V2 },
 };
 
Signature · 1 line
2.47.2
Reviewed-by on v2 2/16
#4 lore raw

Re: [PATCH v2 02/16] rockchip: mkimage: Add rk3576 support

Quoted 14 lines · Heiko Stuebner

From: Xuhui Lin <[email protected]>

Add support for rk3576 package header in mkimage tool.

---
 tools/rkcommon.c | 1 +
 1 file changed, 1 insertion(+)
tools/rkcommon.c +0 -0
index f158d156228..a0caa029cc0 100644

tools/rkcommon.c static struct spl_info spl_infos[] = { · line 139

Quoted 4 lines
tools/rkcommon.c +1 -0
@@ -136,6 +136,7 @@ static struct spl_info spl_infos[] = {
 	{ "rv1126", "110B", 0x10000 - 0x1000, false, RK_HEADER_V1 },
 	{ "rk3528", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
 	{ "rk3568", "RK35", 0x10000 - 0x1000, false, RK_HEADER_V2 },
+	{ "rk3576", "RK35", 0x80000 - 0x1000, false, RK_HEADER_V2 },

Works and matches size of SYS_SRAM (512kB) in datasheet.

Regards,
Jonas

Quoted 3 lines
tools/rkcommon.c +0 -0
 	{ "rk3588", "RK35", 0x100000 - 0x1000, false, RK_HEADER_V2 },
 };
 
author maintainer
#5 lore raw

PATCH v2 3/16 arm: rockchip: add RK3576-specific syscon ids

In reply to Heiko Stuebner

From: Detlev Casanova <[email protected]>

The rk3576 defines some more different syscons, namely the IOC-syscon holding io-controller registers and sdgmac holding settings for the gmac controller.

---
 arch/arm/include/asm/arch-rockchip/clock.h | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/include/asm/arch-rockchip/clock.h +2 -0
index a9921fbb6e4..533f8bd89eb 100644
@@ -39,6 +39,8 @@ enum {
 	ROCKCHIP_SYSCON_PIPE_PHY2_GRF,
 	ROCKCHIP_SYSCON_VOP_GRF,
 	ROCKCHIP_SYSCON_VO_GRF,
+	ROCKCHIP_SYSCON_IOC,
+	ROCKCHIP_SYSCON_SDGMAC,
 };
 
 /* Standard Rockchip clock numbers */
Signature · 1 line
2.47.2
#6 lore raw

Re: [PATCH v2 03/16] arm: rockchip: add RK3576-specific syscon ids

Hi Heiko,

Quoted 18 lines · Heiko Stuebner

From: Detlev Casanova <[email protected]>

The rk3576 defines some more different syscons, namely the IOC-syscon holding io-controller registers and sdgmac holding settings for the gmac controller.

---
 arch/arm/include/asm/arch-rockchip/clock.h | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/include/asm/arch-rockchip/clock.h +0 -0
index a9921fbb6e4..533f8bd89eb 100644

arch/arm/include/asm/arch-rockchip/clock.h enum { · line 43

Quoted 5 lines
arch/arm/include/asm/arch-rockchip/clock.h +2 -0
@@ -39,6 +39,8 @@ enum {
 	ROCKCHIP_SYSCON_PIPE_PHY2_GRF,
 	ROCKCHIP_SYSCON_VOP_GRF,
 	ROCKCHIP_SYSCON_VO_GRF,
+	ROCKCHIP_SYSCON_IOC,
+	ROCKCHIP_SYSCON_SDGMAC,

These are not really needed, the gmac and pinctrl drivers get these syscon/regmap using the phandle from rockchip,grf/php-grf props.

I also have a very slow going work-in-progress series that eventually hopefully will drop most if not all of these syscon ids, see [1].

So please drop this patch.

[1] https://source.denx.de/u-boot/contributors/kwiboo/u-boot/-/commits/optimize

Regards,
Jonas

Quoted 3 lines
arch/arm/include/asm/arch-rockchip/clock.h +0 -0
 };
 
 /* Standard Rockchip clock numbers */
author maintainer
#7 lore raw

PATCH v2 4/16 arm: rockchip: Add RK3576 arch core support

In reply to Heiko Stuebner

From: Xuhui Lin <[email protected]>

The Rockchip RK3576 is a ARM-based SoC with quad-core Cortex-A72 and quad-core Cortex-A53 including 6TOPS NPU, Mali-G52 MC3, HDMI Out, DP, eDP, MIPI DSI, MIPI CSI2, LPDDR4/4X/5, eMMC5.1, SD3.0/MMC4.5, UFS, USB OTG 3.0, Type-C, USB 2.0, PCIe 2.1, SATA 3, Ethernet, SDIO3.0, I2C, UART, SPI, GPIO and PWM.

Add arch core support for it.

[adapted for mainline u-boot]
---
 arch/arm/dts/rk3576-u-boot.dtsi               | 131 +++++++++++++++
 arch/arm/include/asm/arch-rk3576/boot0.h      |  11 ++
 arch/arm/include/asm/arch-rk3576/gpio.h       |  11 ++
 arch/arm/mach-rockchip/Kconfig                |  51 ++++++
 arch/arm/mach-rockchip/Makefile               |   1 +
 arch/arm/mach-rockchip/rk3576/Kconfig         |  15 ++
 arch/arm/mach-rockchip/rk3576/Makefile        |   9 +
 arch/arm/mach-rockchip/rk3576/clk_rk3576.c    |  18 ++
 arch/arm/mach-rockchip/rk3576/rk3576.c        | 155 ++++++++++++++++++
 arch/arm/mach-rockchip/rk3576/syscon_rk3576.c |  22 +++
 arch/arm/mach-rockchip/sdram.c                |   1 +
 doc/board/rockchip/rockchip.rst               |   9 +
 include/configs/rk3576_common.h               |  45 +++++
 13 files changed, 479 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-u-boot.dtsi
 create mode 100644 arch/arm/include/asm/arch-rk3576/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3576/gpio.h
 create mode 100644 arch/arm/mach-rockchip/rk3576/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3576/Makefile
 create mode 100644 arch/arm/mach-rockchip/rk3576/clk_rk3576.c
 create mode 100644 arch/arm/mach-rockchip/rk3576/rk3576.c
 create mode 100644 arch/arm/mach-rockchip/rk3576/syscon_rk3576.c
 create mode 100644 include/configs/rk3576_common.h
arch/arm/dts/rk3576-u-boot.dtsi new file +131 -0
new file mode 100644
index 00000000000..be99a48a630
@@ -0,0 +1,131 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * (C) Copyright 2025 Rockchip Electronics Co., Ltd
+ */
+
+#include "rockchip-u-boot.dtsi"
+
+/ {
+	chosen {
+		u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
+	};
+
+	dmc {
+		compatible = "rockchip,rk3576-dmc";
+		bootph-all;
+	};
+};
+
+&cru {
+	bootph-all;
+};
+
+&emmc_bus8 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&emmc_clk {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&emmc_cmd {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&emmc_rstnout {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&emmc_strb {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&ioc_grf {
+	bootph-all;
+};
+
+&pcfg_pull_none {
+	bootph-all;
+};
+
+&pcfg_pull_up {
+	bootph-all;
+};
+
+&pcfg_pull_up_drv_level_2 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&pcfg_pull_up_drv_level_3 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&pinctrl {
+	bootph-all;
+};
+
+&pmu1_grf {
+	bootph-all;
+};
+
+&sdhci {
+	bootph-pre-ram;
+	bootph-some-ram;
+	u-boot,spl-fifo-mode;
+};
+
+&sdmmc {
+	bootph-pre-ram;
+	bootph-some-ram;
+	u-boot,spl-fifo-mode;
+};
+
+&sdmmc0_bus4 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&sdmmc0_clk {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&sdmmc0_cmd {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&sdmmc0_det {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&sdmmc0_pwren {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&sys_grf {
+	bootph-all;
+};
+
+&uart0 {
+	bootph-all;
+	clock-frequency = <24000000>;
+};
+
+&uart0m0_xfer {
+	bootph-pre-sram;
+	bootph-pre-ram;
+};
+
+&xin24m {
+	bootph-all;
+};
arch/arm/include/asm/arch-rk3576/boot0.h new file +11 -0
new file mode 100644
index 00000000000..dea2b20252d
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2021 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_BOOT0_H__
+#define __ASM_ARCH_BOOT0_H__
+
+#include <asm/arch-rockchip/boot0.h>
+
+#endif
arch/arm/include/asm/arch-rk3576/gpio.h new file +11 -0
new file mode 100644
index 00000000000..b48c0a5cf84
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2021 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __ASM_ARCH_GPIO_H__
+#define __ASM_ARCH_GPIO_H__
+
+#include <asm/arch-rockchip/gpio.h>
+
+#endif
arch/arm/mach-rockchip/Kconfig +51 -0

63 lines not on this page · raw message

arch/arm/mach-rockchip/Makefile +1 -0
index 5a7dd5b5940..ae15a9f8a2d 100644
@@ -44,6 +44,7 @@ obj-$(CONFIG_ROCKCHIP_RK3368) += rk3368/
 obj-$(CONFIG_ROCKCHIP_RK3399) += rk3399/
 obj-$(CONFIG_ROCKCHIP_RK3528) += rk3528/
 obj-$(CONFIG_ROCKCHIP_RK3568) += rk3568/
+obj-$(CONFIG_ROCKCHIP_RK3576) += rk3576/
 obj-$(CONFIG_ROCKCHIP_RK3588) += rk3588/
 obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108/
 obj-$(CONFIG_ROCKCHIP_RV1126) += rv1126/
arch/arm/mach-rockchip/rk3576/Kconfig new file +15 -0
new file mode 100644
index 00000000000..a94dc6706f0
@@ -0,0 +1,15 @@
+if ROCKCHIP_RK3576
+
+config ROCKCHIP_BOOT_MODE_REG
+	default 0x26024040
+
+config ROCKCHIP_STIMER_BASE
+	default 0x27400000
+
+config SYS_SOC
+	default "rk3576"
+
+config SYS_CONFIG_NAME
+	default "rk3576_common"
+
+endif
arch/arm/mach-rockchip/rk3576/Makefile new file +9 -0
new file mode 100644
index 00000000000..cbc58257deb
@@ -0,0 +1,9 @@
+#
+# (C) Copyright 2023 Rockchip Electronics Co., Ltd
+#
+# SPDX-License-Identifier:     GPL-2.0+
+#
+
+obj-y += rk3576.o
+obj-y += clk_rk3576.o
+obj-y += syscon_rk3576.o
arch/arm/mach-rockchip/rk3576/clk_rk3576.c new file +18 -0
new file mode 100644
index 00000000000..edda1afd0bd
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * (C) Copyright 2020 Rockchip Electronics Co., Ltd.
+ */
+
+#include <dm.h>
+#include <asm/arch-rockchip/cru_rk3576.h>
+
+int rockchip_get_clk(struct udevice **devp)
+{
+	return uclass_get_device_by_driver(UCLASS_CLK,
+				DM_DRIVER_GET(rockchip_rk3576_cru), devp);
+}
+
+void *rockchip_get_cru(void)
+{
+	return (void *)RK3576_CRU_BASE;
+}
arch/arm/mach-rockchip/rk3576/rk3576.c new file +155 -0

155 lines not on this page · raw message

arch/arm/mach-rockchip/rk3576/syscon_rk3576.c new file +22 -0
new file mode 100644
index 00000000000..0dbf8f8d9c0
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * (C) Copyright 2023 Rockchip Electronics Co., Ltd
+ */
+
+#include <dm.h>
+#include <asm/arch-rockchip/clock.h>
+
+static const struct udevice_id rk3576_syscon_ids[] = {
+	{ .compatible = "rockchip,rk3576-sys-grf", .data = ROCKCHIP_SYSCON_GRF },
+	{ .compatible = "rockchip,rk3576-pmu1-grf",  .data = ROCKCHIP_SYSCON_PMUGRF },
+	{ }
+};
+
+U_BOOT_DRIVER(rockchip_rk3576_syscon) = {
+	.name = "rockchip_rk3576_syscon",
+	.id = UCLASS_SYSCON,
+	.of_match = rk3576_syscon_ids,
+#if CONFIG_IS_ENABLED(OF_REAL)
+	.bind = dm_scan_fdt_dev,
+#endif
+};
arch/arm/mach-rockchip/sdram.c +1 -0
index f6d9c503bfd..1330ff14a29 100644
@@ -110,6 +110,7 @@ static int rockchip_dram_init_banksize(void)
 	u8 i, j;
 
 	if (!IS_ENABLED(CONFIG_ROCKCHIP_RK3588) &&
+	    !IS_ENABLED(CONFIG_ROCKCHIP_RK3576) &&
 	    !IS_ENABLED(CONFIG_ROCKCHIP_RK3568) &&
 	    !IS_ENABLED(CONFIG_ROCKCHIP_RK3528))
 		return -ENOTSUPP;
doc/board/rockchip/rockchip.rst +9 -0
index b992e6c8b6c..1058a1ce990 100644
@@ -281,6 +281,15 @@ To build rk3568 boards:
         make evb-rk3568_defconfig
         make CROSS_COMPILE=aarch64-linux-gnu-
 
+To build rk3576 boards:
+
+.. code-block:: bash
+
+        export BL31=../rkbin/bin/rk35/rk3576_bl31_v1.04.elf
+        export ROCKCHIP_TPL=../rkbin/bin/rk35/rk3576_ddr_lp4_2112MHz_lp5_2736MHz_v1.03.bin
+        make roc-pc-rk3576_defconfig
+        make CROSS_COMPILE=aarch64-linux-gnu-
+
 To build rk3588 boards:
 
 .. code-block:: bash
include/configs/rk3576_common.h new file +45 -0

45 lines not on this page · raw message

Signature · 1 line
2.47.2
Reviewed-by on v2 4/16
#8 lore raw

Re: [PATCH v2 04/16] arm: rockchip: Add RK3576 arch core support

Hi Heiko,

Quoted 38 lines · Heiko Stuebner

From: Xuhui Lin <[email protected]>

The Rockchip RK3576 is a ARM-based SoC with quad-core Cortex-A72 and quad-core Cortex-A53 including 6TOPS NPU, Mali-G52 MC3, HDMI Out, DP, eDP, MIPI DSI, MIPI CSI2, LPDDR4/4X/5, eMMC5.1, SD3.0/MMC4.5, UFS, USB OTG 3.0, Type-C, USB 2.0, PCIe 2.1, SATA 3, Ethernet, SDIO3.0, I2C, UART, SPI, GPIO and PWM.

Add arch core support for it.

[adapted for mainline u-boot]
---
 arch/arm/dts/rk3576-u-boot.dtsi               | 131 +++++++++++++++
 arch/arm/include/asm/arch-rk3576/boot0.h      |  11 ++
 arch/arm/include/asm/arch-rk3576/gpio.h       |  11 ++
 arch/arm/mach-rockchip/Kconfig                |  51 ++++++
 arch/arm/mach-rockchip/Makefile               |   1 +
 arch/arm/mach-rockchip/rk3576/Kconfig         |  15 ++
 arch/arm/mach-rockchip/rk3576/Makefile        |   9 +
 arch/arm/mach-rockchip/rk3576/clk_rk3576.c    |  18 ++
 arch/arm/mach-rockchip/rk3576/rk3576.c        | 155 ++++++++++++++++++
 arch/arm/mach-rockchip/rk3576/syscon_rk3576.c |  22 +++
 arch/arm/mach-rockchip/sdram.c                |   1 +
 doc/board/rockchip/rockchip.rst               |   9 +
 include/configs/rk3576_common.h               |  45 +++++
 13 files changed, 479 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-u-boot.dtsi
 create mode 100644 arch/arm/include/asm/arch-rk3576/boot0.h
 create mode 100644 arch/arm/include/asm/arch-rk3576/gpio.h
 create mode 100644 arch/arm/mach-rockchip/rk3576/Kconfig
 create mode 100644 arch/arm/mach-rockchip/rk3576/Makefile
 create mode 100644 arch/arm/mach-rockchip/rk3576/clk_rk3576.c
 create mode 100644 arch/arm/mach-rockchip/rk3576/rk3576.c
 create mode 100644 arch/arm/mach-rockchip/rk3576/syscon_rk3576.c
 create mode 100644 include/configs/rk3576_common.h

[snip]

Quoted 15 lines
include/configs/rk3576_common.h new file +9 -0
new file mode 100644
index 00000000000..90ea62cb9ca
@@ -0,0 +1,45 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2024 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __CONFIG_RK3576_COMMON_H
+#define __CONFIG_RK3576_COMMON_H
+
+#define CFG_CPUID_OFFSET	0xa

include/configs/rk3576_common.h line 19

Quoted 10 lines
include/configs/rk3576_common.h new file +10 -0
+
+#include "rockchip-common.h"
+
+#define CFG_IRAM_BASE			0x3ff80000
+
+#define CFG_SYS_SDRAM_BASE		0x40000000
+/* Used by board_get_usable_ram_top(), space below the 4G address boundary */
+#define SDRAM_MAX_SIZE			(SZ_4G - CFG_SYS_SDRAM_BASE)
+
+#ifndef CONFIG_XPL_BUILD

I know that I probably suggested adding this XPL_BUILD condition in v1, however after seeing similar wrapper being dropped in FUKAUMI Naoki's "rockchip: Add boot from USB OTG port" series [1] I am no longer sure it should be here and I ended up dropping it for RK3528.

Regardless, this is:

[1] https://patchwork.ozlabs.org/cover/2045428/

Regards,
Jonas

Quoted 26 lines
include/configs/rk3576_common.h new file +26 -0
+
+#ifndef ROCKCHIP_DEVICE_SETTINGS
+#define ROCKCHIP_DEVICE_SETTINGS
+#endif
+
+#define ENV_MEM_LAYOUT_SETTINGS		\
+	"scriptaddr=0x40c00000\0" \
+	"script_offset_f=0xffe000\0"	\
+	"script_size_f=0x2000\0"	\
+	"pxefile_addr_r=0x40e00000\0" \
+	"kernel_addr_r=0x42000000\0" \
+	"kernel_comp_addr_r=0x4a000000\0"	\
+	"fdt_addr_r=0x52000000\0"	\
+	"fdtoverlay_addr_r=0x52100000\0"	\
+	"ramdisk_addr_r=0x52180000\0"	\
+	"kernel_comp_size=0x8000000\0"
+
+#define CFG_EXTRA_ENV_SETTINGS		\
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0"	\
+	ENV_MEM_LAYOUT_SETTINGS		\
+	ROCKCHIP_DEVICE_SETTINGS	\
+	"boot_targets=" BOOT_TARGETS "\0"
+
+#endif /* CONFIG_XPL_BUILD */
+
+#endif /* __CONFIG_RK3576_COMMON_H */
author maintainer
#9 lore raw

PATCH v2 5/16 pinctrl: rockchip: support rk3576 pinctrl

In reply to Heiko Stuebner

From: Steven Liu <[email protected]>

Add support for the rk3576 variant of pinctrl.

[adapted to mainline u-boot]
---
 drivers/pinctrl/rockchip/Makefile           |   1 +
 drivers/pinctrl/rockchip/pinctrl-rk3576.c   | 279 ++++++++++++++++++++
 drivers/pinctrl/rockchip/pinctrl-rockchip.h |   3 +
 3 files changed, 283 insertions(+)
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3576.c
drivers/pinctrl/rockchip/Makefile +1 -0
index df6c97d6234..e17415e1ca6 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_ROCKCHIP_RK3368) += pinctrl-rk3368.o
 obj-$(CONFIG_ROCKCHIP_RK3399) += pinctrl-rk3399.o
 obj-$(CONFIG_ROCKCHIP_RK3528) += pinctrl-rk3528.o
 obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o
+obj-$(CONFIG_ROCKCHIP_RK3576) += pinctrl-rk3576.o
 obj-$(CONFIG_ROCKCHIP_RK3588) += pinctrl-rk3588.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
drivers/pinctrl/rockchip/pinctrl-rk3576.c new file +279 -0

279 lines not on this page · raw message

drivers/pinctrl/rockchip/pinctrl-rockchip.h +3 -0
index df7bc684d29..5e3c9c90760 100644
@@ -458,6 +458,9 @@ struct rockchip_pin_bank {
 #define MR_PMUGRF(ID, PIN, FUNC, REG, VAL)	\
 	PIN_BANK_MUX_ROUTE_FLAGS(ID, PIN, FUNC, REG, VAL, ROUTE_TYPE_PMUGRF)
 
+#define RK3576_PIN_BANK_FLAGS(ID, PIN, LABEL, M, O1, O2, O3, O4)	\
+	PIN_BANK_IOMUX_FLAGS_OFFSET(ID, PIN, LABEL, M, M, M, M, O1, O2, O3, O4)
+
 #define RK3588_PIN_BANK_FLAGS(ID, PIN, LABEL, M, P)			\
 	PIN_BANK_IOMUX_FLAGS_PULL_FLAGS(ID, PIN, LABEL, M, M, M, M, P, P, P, P)
 
Signature · 1 line
2.47.2
Reviewed-by on v2 5/16
#10 lore raw

Re: [PATCH v2 05/16] pinctrl: rockchip: support rk3576 pinctrl

Hi Heiko,

Quoted 31 lines · Heiko Stuebner

From: Steven Liu <[email protected]>

Add support for the rk3576 variant of pinctrl.

[adapted to mainline u-boot]
---
 drivers/pinctrl/rockchip/Makefile           |   1 +
 drivers/pinctrl/rockchip/pinctrl-rk3576.c   | 279 ++++++++++++++++++++
 drivers/pinctrl/rockchip/pinctrl-rockchip.h |   3 +
 3 files changed, 283 insertions(+)
 create mode 100644 drivers/pinctrl/rockchip/pinctrl-rk3576.c
drivers/pinctrl/rockchip/Makefile +1 -0
index df6c97d6234..e17415e1ca6 100644
@@ -16,6 +16,7 @@ obj-$(CONFIG_ROCKCHIP_RK3368) += pinctrl-rk3368.o
 obj-$(CONFIG_ROCKCHIP_RK3399) += pinctrl-rk3399.o
 obj-$(CONFIG_ROCKCHIP_RK3528) += pinctrl-rk3528.o
 obj-$(CONFIG_ROCKCHIP_RK3568) += pinctrl-rk3568.o
+obj-$(CONFIG_ROCKCHIP_RK3576) += pinctrl-rk3576.o
 obj-$(CONFIG_ROCKCHIP_RK3588) += pinctrl-rk3588.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += pinctrl-rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += pinctrl-rv1126.o
drivers/pinctrl/rockchip/pinctrl-rk3576.c new file +0 -0
new file mode 100644
index 00000000000..589a9b8491c

[snip]

drivers/pinctrl/rockchip/pinctrl-rk3576.c line 253

Quoted 4 lines
drivers/pinctrl/rockchip/pinctrl-rk3576.c new file +4 -0
+static const struct rockchip_pin_ctrl rk3576_pin_ctrl = {
+	.pin_banks		= rk3576_pin_banks,
+	.nr_banks		= ARRAY_SIZE(rk3576_pin_banks),
+	.nr_pins		= 160,

This property is removed in Quentin Schulz "pinctrl: rockchip: fix editing const struct + constify rockchip_pin_ctrl" series [1].

Suggest you drop this property to ease merging of both these series.

With that fixes this is:

[1] https://patchwork.ozlabs.org/cover/2040824/

Regards,
Jonas

Quoted 6 lines
drivers/pinctrl/rockchip/pinctrl-rk3576.c new file +6 -0
+	.grf_mux_offset		= 0x0,
+	.set_mux		= rk3576_set_mux,
+	.set_pull		= rk3576_set_pull,
+	.set_drive		= rk3576_set_drive,
+	.set_schmitt		= rk3576_set_schmitt,
+};

[snip]

author maintainer
#11 lore raw

PATCH v2 6/16 clk: rockchip: Add rk3576 clk support

In reply to Heiko Stuebner

From: Elaine Zhang <[email protected]>

Add clock driver support for Rockchip RK3576 SoC.

[adapted to mainline u-boot]
---
 .../include/asm/arch-rockchip/cru_rk3576.h    |  491 ++++
 drivers/clk/rockchip/Makefile                 |    1 +
 drivers/clk/rockchip/clk_rk3576.c             | 2513 +++++++++++++++++
 3 files changed, 3005 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3576.h
 create mode 100644 drivers/clk/rockchip/clk_rk3576.c
arch/arm/include/asm/arch-rockchip/cru_rk3576.h new file +491 -0
new file mode 100644
index 00000000000..c51750beff2
@@ -0,0 +1,491 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2020 Rockchip Electronics Co. Ltd.
+ * Author: Elaine Zhang <[email protected]>
+ */
+
+#ifndef _ASM_ARCH_CRU_RK3576_H
+#define _ASM_ARCH_CRU_RK3576_H
+
+#define MHz		1000000
+#define KHz		1000
+#define OSC_HZ		(24 * MHz)
+
+#define CPU_PVTPLL_HZ	(1008 * MHz)
+#define LPLL_HZ		(816 * MHz)
+#define GPLL_HZ		(1188 * MHz)
+#define CPLL_HZ		(1000 * MHz)
+#define PPLL_HZ		(1100 * MHz)
+#define GMAC0_PTP_REFCLK_IN	(24 * MHz)
+#define GMAC1_PTP_REFCLK_IN	(24 * MHz)
+
+/* RK3576 pll id */
+enum rk3576_pll_id {
+	BPLL,
+	LPLL,
+	DPLL,
+	CPLL,
+	GPLL,
+	VPLL,
+	AUPLL,
+	SPLL,
+	PPLL,
+	PLL_COUNT,
+};
+
+struct rk3576_clk_priv {
+	struct rk3576_cru *cru;
+	ulong ppll_hz;
+	ulong gpll_hz;
+	ulong cpll_hz;
+	ulong vpll_hz;
+	ulong aupll_hz;
+	ulong spll_hz;
+	ulong lpll_hz;
+	ulong bpll_hz;
+	ulong armclk_hz;
+	ulong armclk_enter_hz;
+	ulong armclk_init_hz;
+	bool sync_kernel;
+	bool set_armclk_rate;
+};
+
+struct rk3576_pll {
+	unsigned int con0;
+	unsigned int con1;
+	unsigned int con2;
+	unsigned int con3;
+	unsigned int con4;
+	unsigned int reserved0[3];
+};
+
+struct rk3576_cru {
+	struct rk3576_pll pll[18];
+	unsigned int reserved0[16];/* Address Offset: 0x0240 */
+	unsigned int mode_con00;/* Address Offset: 0x0280 */
+	unsigned int reserved1[31];/* Address Offset: 0x0284 */
+	unsigned int clksel_con[181]; /* Address Offset: 0x0300 */
+	unsigned int reserved2[139];/* Address Offset: 0x05d4 */
+	unsigned int clkgate_con[80];/* Address Offset: 0x0800 */
+	unsigned int reserved3[48];/* Address Offset: 0x0938 */
+	unsigned int softrst_con[80];/* Address Offset: 0x0400 */
+	unsigned int reserved4[48];/* Address Offset: 0x0b38 */
+	unsigned int glb_cnt_th;/* Address Offset: 0x0c00 */
+	unsigned int glb_rst_st;/* Address Offset: 0x0c04 */
+	unsigned int glb_srst_fst;/* Address Offset: 0x0c08 */
+	unsigned int glb_srsr_snd; /* Address Offset: 0x0c0c */
+	unsigned int glb_rst_con;/* Address Offset: 0x0c10 */
+	unsigned int reserved5[43];/* Address Offset: 0x0c14 */
+	unsigned int smoth_divfree_con[3];/* Address Offset: 0x0cc0 */
+	unsigned int fracdiv_high_con[4];/* Address Offset: 0x0ccc */
+	unsigned int reserved8[32137];/* Address Offset: 0x0c38 */
+	unsigned int pmuclksel_con[22]; /* Address Offset: 0x20300 */
+	unsigned int reserved9[298];/* Address Offset: 0x20358 */
+	unsigned int pmuclkgate_con[8]; /* Address Offset: 0x20800 */
+	unsigned int reserved10[32440];/* Address Offset: 0x20820 */
+	unsigned int litclksel_con[4]; /* Address Offset: 0x40300 */
+};
+
+check_member(rk3576_cru, mode_con00, 0x280);
+check_member(rk3576_cru, pmuclksel_con[1], 0x20304);
+
+struct pll_rate_table {
+	unsigned long rate;
+	unsigned int m;
+	unsigned int p;
+	unsigned int s;
+	unsigned int k;
+};
+
+#define RK3576_PHP_CRU_BASE		0x8000
+#define RK3576_PMU_CRU_BASE		0x20000
+#define RK3576_BIGCORE_CRU_BASE		0x38000
+#define RK3576_LITCORE_CRU_BASE		0x40000
+#define RK3576_CCI_CRU_BASE		0x48000
+#define RK3576_CRU_BASE			0x27200000
+#define RK3576_SCRU_BASE		0x27214000
+
+#define RK3576_BIGCORE_GRF_BASE		0x2600C000
+#define RK3576_LITCORE_GRF_BASE		0x2600E000
+#define RK3576_CCI_GRF_BASE		0x26010000
+
+#define RK3576_PLL_CON(x)		((x) * 0x4)
+#define RK3576_MODE_CON0		0x280
+#define RK3576_BPLL_MODE_CON0		(RK3576_BIGCORE_CRU_BASE + 0x280)
+#define RK3576_LPLL_MODE_CON0		(RK3576_LITCORE_CRU_BASE + 0x280)
+#define RK3576_PPLL_MODE_CON0		(RK3576_PHP_CRU_BASE + 0x280)
+#define RK3576_CLKSEL_CON(x)		((x) * 0x4 + 0x300)
+#define RK3576_CLKGATE_CON(x)		((x) * 0x4 + 0x800)
+#define RK3576_SOFTRST_CON(x)		((x) * 0x4 + 0xa00)
+#define RK3576_GLB_CNT_TH		0xc00
+#define RK3576_GLB_SRST_FST		0xc08
+#define RK3576_GLB_SRST_SND		0xc0c
+#define RK3576_GLB_RST_CON		0xc10
+#define RK3576_GLB_RST_ST		0xc04
+#define RK3576_SDIO_CON0		0xC24
+#define RK3576_SDIO_CON1		0xC28
+#define RK3576_SDMMC_CON0		0xC30
+#define RK3576_SDMMC_CON1		0xC34
+
+#define RK3576_PHP_CLKSEL_CON(x)	((x) * 0x4 + RK3576_PHP_CRU_BASE + 0x300)
+#define RK3576_PHP_CLKGATE_CON(x)	((x) * 0x4 + RK3576_PHP_CRU_BASE + 0x800)
+#define RK3576_PHP_SOFTRST_CON(x)	((x) * 0x4 + RK3576_PHP_CRU_BASE + 0xa00)
+
+#define RK3576_PMU_PLL_CON(x)		((x) * 0x4 + RK3576_PHP_CRU_BASE)
+#define RK3576_PMU_CLKSEL_CON(x)	((x) * 0x4 + RK3576_PMU_CRU_BASE + 0x300)
+#define RK3576_PMU_CLKGATE_CON(x)	((x) * 0x4 + RK3576_PMU_CRU_BASE + 0x800)
+#define RK3576_PMU_SOFTRST_CON(x)	((x) * 0x4 + RK3576_PMU_CRU_BASE + 0xa00)
+
+#define RK3576_CCI_CLKSEL_CON(x)	((x) * 0x4 + RK3576_CCI_CRU_BASE + 0x300)
+#define RK3576_CCI_CLKGATE_CON(x)	((x) * 0x4 + RK3576_CCI_CRU_BASE + 0x800)
+#define RK3576_CCI_SOFTRST_CON(x)	((x) * 0x4 + RK3576_CCI_CRU_BASE + 0xa00)
+
+#define RK3576_BPLL_CON(x)		((x) * 0x4 + RK3576_BIGCORE_CRU_BASE)
+#define RK3576_BIGCORE_CLKSEL_CON(x)	((x) * 0x4 + RK3576_BIGCORE_CRU_BASE + 0x300)
+#define RK3576_BIGCORE_CLKGATE_CON(x)	((x) * 0x4 + RK3576_BIGCORE_CRU_BASE + 0x800)
+#define RK3576_BIGCORE_SOFTRST_CON(x)	((x) * 0x4 + RK3576_BIGCORE_CRU_BASE + 0xa00)
+#define RK3576_LPLL_CON(x)		((x) * 0x4 + RK3576_CCI_CRU_BASE)
+#define RK3576_LITCORE_CLKSEL_CON(x)	((x) * 0x4 + RK3576_LITCORE_CRU_BASE + 0x300)
+#define RK3576_LITCORE_CLKGATE_CON(x)	((x) * 0x4 + RK3576_LITCORE_CRU_BASE + 0x800)
+#define RK3576_LITCORE_SOFTRST_CON(x)	((x) * 0x4 + RK3576_LITCORE_CRU_BASE + 0xa00)
+
+enum {
+	/* CRU_CLK_SEL8_CON */
+	PCLK_TOP_SEL_SHIFT		= 7,
+	PCLK_TOP_SEL_MASK		= 3 << PCLK_TOP_SEL_SHIFT,
+	PCLK_TOP_SEL_100M		= 0,
+	PCLK_TOP_SEL_50M,
+	PCLK_TOP_SEL_OSC,
+
+	/* CRU_CLK_SEL9_CON */
+	ACLK_TOP_SEL_SHIFT		= 5,
+	ACLK_TOP_SEL_MASK		= 3 << ACLK_TOP_SEL_SHIFT,
+	ACLK_TOP_SEL_GPLL		= 0,
+	ACLK_TOP_SEL_CPLL,
+	ACLK_TOP_SEL_AUPLL,
+	ACLK_TOP_DIV_SHIFT		= 0,
+	ACLK_TOP_DIV_MASK		= 0x1f << ACLK_TOP_DIV_SHIFT,
+
+	/* CRU_CLK_SEL10_CON */
+	ACLK_TOP_MID_SEL_SHIFT		= 5,
+	ACLK_TOP_MID_SEL_MASK		= 1 << ACLK_TOP_MID_SEL_SHIFT,
+	ACLK_TOP_MID_SEL_GPLL		= 0,
+	ACLK_TOP_MID_SEL_CPLL,
+	ACLK_TOP_MID_DIV_SHIFT		= 0,
+	ACLK_TOP_MID_DIV_MASK		= 0x1f << ACLK_TOP_MID_DIV_SHIFT,
+
+	/* CRU_CLK_SEL19_CON */
+	HCLK_TOP_SEL_SHIFT		= 2,
+	HCLK_TOP_SEL_MASK		= 3 << HCLK_TOP_SEL_SHIFT,
+	HCLK_TOP_SEL_200M		= 0,
+	HCLK_TOP_SEL_100M,
+	HCLK_TOP_SEL_50M,
+	HCLK_TOP_SEL_OSC,
+
+	/* CRU_CLK_SEL25_CON */
+	CLK_UART_FRAC_NUMERATOR_SHIFT	= 16,
+	CLK_UART_FRAC_NUMERATOR_MASK	= 0xffff << 16,
+	CLK_UART_FRAC_DENOMINATOR_SHIFT	= 0,
+	CLK_UART_FRAC_DENOMINATOR_MASK	= 0xffff,
+
+	/* CRU_CLK_SEL26_CON */
+	CLK_UART_SRC_SEL_SHIFT		= 0,
+	CLK_UART_SRC_SEL_MASK		= 0x3 << CLK_UART_SRC_SEL_SHIFT,
+	CLK_UART_SRC_SEL_GPLL		= 0,
+	CLK_UART_SRC_SEL_CPLL,
+	CLK_UART_SRC_S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+	CLK_I2C_SEL_OSC,
+
+	/* CRU_CLK_SEL58_CON */
+	CLK_SARADC_SEL_SHIFT		= 12,
+	CLK_SARADC_SEL_MASK		= 0x1 << CLK_SARADC_SEL_SHIFT,
+	CLK_SARADC_SEL_GPLL		= 0,
+	CLK_SARADC_SEL_OSC,
+	CLK_SARADC_DIV_SHIFT		= 4,
+	CLK_SARADC_DIV_MASK		= 0xff << CLK_SARADC_DIV_SHIFT,
+	CLK_I2C9_SEL_SHIFT		= 0,
+	CLK_I2C9_SEL_MASK		= 3 << CLK_I2C9_SEL_SHIFT,
+
+	/* CRU_CLK_SEL59_CON */
+	CLK_TSADC_DIV_SHIFT		= 0,
+	CLK_TSADC_DIV_MASK		= 0xff << CLK_TSADC_DIV_SHIFT,
+
+	/* CRU_CLK_SEL60_CON */
+	CLK_UART_SEL_SHIFT		= 8,
+	CLK_UART_SEL_MASK		= 7 << CLK_UART_SEL_SHIFT,
+	CLK_UART_SEL_GPLL		= 0,
+	CLK_UART_SEL_CPLL,
+	CLK_UART_SEL_AUPLL,
+	CLK_UART_SEL_OSC,
+	CLK_UART_SEL_FRAC0,
+	CLK_UART_SEL_FRAC1,
+	CLK_UART_SEL_FRAC2,
+	CLK_UART_DIV_SHIFT		= 0,
+	CLK_UART_DIV_MASK		= 0xff << CLK_UART_DIV_SHIFT,
+
+	/* CRU_CLK_SEL70_CON */
+	CLK_SPI0_SEL_SHIFT		= 13,
+	CLK_SPI0_SEL_MASK		= 3 << CLK_SPI0_SEL_SHIFT,
+	CLK_SPI_SEL_200M		= 0,
+	CLK_SPI_SEL_100M,
+	CLK_SPI_SEL_50M,
+	CLK_SPI_SEL_OSC,
+
+	/* CRU_CLK_SEL71_CON */
+	CLK_PWM1_SEL_SHIFT		= 8,
+	CLK_PWM1_SEL_MASK		= 3 << CLK_PWM1_SEL_SHIFT,
+	CLK_SPI4_SEL_SHIFT		= 6,
+	CLK_SPI4_SEL_MASK		= 3 << CLK_SPI4_SEL_SHIFT,
+	CLK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IFT		= 12,
+	CLK_LITCORE_SEL_MASK		= 3 << CLK_LITCORE_SEL_SHIFT,
+	CLK_LITCORE_SEL_LPLL		= 0,
+	CLK_LITCORE_SEL_GPLL,
+	CLK_LITCORE_SEL_PVTPLL,
+	CLK_LITCORE_DIV_SHIFT		= 7,
+	CLK_LITCORE_DIV_MASK		= 0x1f << CLK_LITCORE_DIV_SHIFT,
+
+};
+#endif
drivers/clk/rockchip/Makefile +1 -0
index 70be03164e8..34b63d4df34 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_ROCKCHIP_RK3368) += clk_rk3368.o
 obj-$(CONFIG_ROCKCHIP_RK3399) += clk_rk3399.o
 obj-$(CONFIG_ROCKCHIP_RK3528) += clk_rk3528.o
 obj-$(CONFIG_ROCKCHIP_RK3568) += clk_rk3568.o
+obj-$(CONFIG_ROCKCHIP_RK3576) += clk_rk3576.o
 obj-$(CONFIG_ROCKCHIP_RK3588) += clk_rk3588.o
 obj-$(CONFIG_ROCKCHIP_RV1108) += clk_rv1108.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += clk_rv1126.o
drivers/clk/rockchip/clk_rk3576.c new file +2513 -0

2,502 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.47.2

Part of the diff is not shown here. View the raw message.

Reviewed-by on v2 6/16
#12 lore raw

Re: [PATCH v2 06/16] clk: rockchip: Add rk3576 clk support

Quoted 7 lines · Heiko Stuebner

From: Elaine Zhang <[email protected]>

Add clock driver support for Rockchip RK3576 SoC.

[adapted to mainline u-boot]

Regards,
Jonas

Quoted 7 lines
---
 .../include/asm/arch-rockchip/cru_rk3576.h    |  491 ++++
 drivers/clk/rockchip/Makefile                 |    1 +
 drivers/clk/rockchip/clk_rk3576.c             | 2513 +++++++++++++++++
 3 files changed, 3005 insertions(+)
 create mode 100644 arch/arm/include/asm/arch-rockchip/cru_rk3576.h
 create mode 100644 drivers/clk/rockchip/clk_rk3576.c

[snip]

author maintainer
#13 lore raw

PATCH v2 7/16 reset: rockchip: implement rk3576 lookup table

In reply to Heiko Stuebner

From: Elaine Zhang <[email protected]>

The current DT bindings for the rk3576 clock use a different ID than the one that is supposed to be written to the hardware registers. Thus, we cannot use directly the id provided in the phandle, but rather use a lookup table to correctly setup the hardware.

This follows the implementation done in the Linux-Kernel and also how the rk3588 does this both in the Linux-Kernel as well as U-Boot.

[adapted from mainline Linux code for u-boot]
---
 arch/arm/include/asm/arch-rockchip/clock.h |  10 +
 drivers/reset/Makefile                     |   2 +-
 drivers/reset/rst-rk3576.c                 | 647 +++++++++++++++++++++
 3 files changed, 658 insertions(+), 1 deletion(-)
 create mode 100644 drivers/reset/rst-rk3576.c
arch/arm/include/asm/arch-rockchip/clock.h +10 -0
index 533f8bd89eb..2d2ca616331 100644
@@ -226,6 +226,16 @@ int rockchip_reset_bind_lut(struct udevice *pdev, const int *lookup_table,
  * Return: 0 success, or error value
  */
 int rk3528_reset_bind_lut(struct udevice *pdev, u32 reg_offset, u32 reg_number);
+/*
+ * rk3576_reset_bind_lut() - Bind soft reset device as child of clock device
+ *			     using dedicated RK3576 lookup table
+ *
+ * @pdev: clock udevice
+ * @reg_offset: the first offset in cru for softreset registers
+ * @reg_number: the reg numbers of softreset registers
+ * Return: 0 success, or error value
+ */
+int rk3576_reset_bind_lut(struct udevice *pdev, u32 reg_offset, u32 reg_number);
 /*
  * rk3588_reset_bind_lut() - Bind soft reset device as child of clock device
  *			     using dedicated RK3588 lookup table
drivers/reset/Makefile +1 -1
index 53e7d373065..1dd3cd99a14 100644
@@ -17,7 +17,7 @@ obj-$(CONFIG_RESET_BCM6345) += reset-bcm6345.o
 obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
 obj-$(CONFIG_RESET_AST2500) += reset-ast2500.o
 obj-$(CONFIG_RESET_AST2600) += reset-ast2600.o
-obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o rst-rk3528.o rst-rk3588.o
+obj-$(CONFIG_RESET_ROCKCHIP) += reset-rockchip.o rst-rk3528.o rst-rk3576.o rst-rk3588.o
 obj-$(CONFIG_RESET_MESON) += reset-meson.o
 obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_RESET_MEDIATEK) += reset-mediatek.o
drivers/reset/rst-rk3576.c new file +647 -0

647 lines not on this page · raw message

Signature · 1 line
2.47.2
Reviewed-by on v2 7/16
#14 lore raw

Re: [PATCH v2 07/16] reset: rockchip: implement rk3576 lookup table

Hi Heiko,

Quoted 19 lines · Heiko Stuebner

From: Elaine Zhang <[email protected]>

The current DT bindings for the rk3576 clock use a different ID than the one that is supposed to be written to the hardware registers. Thus, we cannot use directly the id provided in the phandle, but rather use a lookup table to correctly setup the hardware.

This follows the implementation done in the Linux-Kernel and also how the rk3588 does this both in the Linux-Kernel as well as U-Boot.

[adapted from mainline Linux code for u-boot]
---
 arch/arm/include/asm/arch-rockchip/clock.h |  10 +
 drivers/reset/Makefile                     |   2 +-
 drivers/reset/rst-rk3576.c                 | 647 +++++++++++++++++++++
 3 files changed, 658 insertions(+), 1 deletion(-)
 create mode 100644 drivers/reset/rst-rk3576.c

[snip]

drivers/reset/rst-rk3576.c line 6

Quoted 12 lines
drivers/reset/rst-rk3576.c new file +6 -0
new file mode 100644
index 00000000000..e64e27c1987
@@ -0,0 +1,647 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2024 Collabora Ltd.
+ * Author: Detlev Casanova <[email protected]>
+ * Based on Sebastien Reichel's implementation for RK3588

nitpick: s/Sebastien/Sebastian/ ?

Regardless, this is:

Regards,
Jonas

Quoted 2 lines
drivers/reset/rst-rk3576.c new file +2 -0
+ */
+
author maintainer
#15 lore raw

PATCH v2 8/16 ram: rockchip: Add rk3576 ddr driver support

In reply to Heiko Stuebner

Add ddr driver for rk3576 to get the ram capacity.

---
 drivers/ram/rockchip/Makefile       |  1 +
 drivers/ram/rockchip/sdram_rk3576.c | 35 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 drivers/ram/rockchip/sdram_rk3576.c
drivers/ram/rockchip/Makefile +1 -0
index f222cc99f1e..fd94aad0cd4 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_ROCKCHIP_RK3328) = sdram_rk3328.o sdram_pctl_px30.o sdram_phy_px30.
 obj-$(CONFIG_ROCKCHIP_RK3399) += sdram_rk3399.o
 obj-$(CONFIG_ROCKCHIP_RK3528) += sdram_rk3528.o
 obj-$(CONFIG_ROCKCHIP_RK3568) += sdram_rk3568.o
+obj-$(CONFIG_ROCKCHIP_RK3576) += sdram_rk3576.o
 obj-$(CONFIG_ROCKCHIP_RK3588) += sdram_rk3588.o
 obj-$(CONFIG_ROCKCHIP_RV1126) += sdram_rv1126.o sdram_pctl_px30.o
 obj-$(CONFIG_ROCKCHIP_SDRAM_COMMON) += sdram_common.o
drivers/ram/rockchip/sdram_rk3576.c new file +35 -0
new file mode 100644
index 00000000000..5a66032ef8f
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2024 Rockchip Electronics Co., Ltd.
+ */
+
+#include <dm.h>
+#include <ram.h>
+#include <asm/arch-rockchip/sdram.h>
+
+#define PMU1GRF_BASE			0x26026000
+#define OS_REG2_REG			0x208
+
+static int rk3576_dmc_get_info(struct udevice *dev, struct ram_info *info)
+{
+	info->base = CFG_SYS_SDRAM_BASE;
+	info->size = rockchip_sdram_size(PMU1GRF_BASE + OS_REG2_REG);
+
+	return 0;
+}
+
+static struct ram_ops rk3576_dmc_ops = {
+	.get_info = rk3576_dmc_get_info,
+};
+
+static const struct udevice_id rk3576_dmc_ids[] = {
+	{ .compatible = "rockchip,rk3576-dmc" },
+	{ }
+};
+
+U_BOOT_DRIVER(rockchip_rk3576_dmc) = {
+	.name = "rockchip_rk3576_dmc",
+	.id = UCLASS_RAM,
+	.of_match = rk3576_dmc_ids,
+	.ops = &rk3576_dmc_ops,
+};
Signature · 1 line
2.47.2
Reviewed-by on v2 8/16
#16 lore raw

Re: [PATCH v2 08/16] ram: rockchip: Add rk3576 ddr driver support

Quoted 3 lines · Heiko Stuebner

Add ddr driver for rk3576 to get the ram capacity.

Correct DRAM amount is reported on my boards.

Regards,
Jonas

Quoted 5 lines
---
 drivers/ram/rockchip/Makefile       |  1 +
 drivers/ram/rockchip/sdram_rk3576.c | 35 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 drivers/ram/rockchip/sdram_rk3576.c

[snip]

author maintainer
#17 lore raw

PATCH v2 9/16 rockchip: otp: Add support for RK3576

In reply to Heiko Stuebner

Add support for RK3576 compatible.
The RK3576 OTP uses the same read mechanism as the RK3588, just with different values for offset and size.

---
 drivers/misc/rockchip-otp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/misc/rockchip-otp.c +11 -0
index b5597de39ac..46820425a84 100644
@@ -361,6 +361,13 @@ static const struct rockchip_otp_data rk3568_data = {
 	.block_size = 2,
 };
 
+static const struct rockchip_otp_data rk3576_data = {
+	.read = rockchip_rk3588_otp_read,
+	.offset = 0x700,
+	.size = 0x100,
+	.block_size = 4,
+};
+
 static const struct rockchip_otp_data rk3588_data = {
 	.read = rockchip_rk3588_otp_read,
 	.offset = 0xC00,
@@ -391,6 +398,10 @@ static const struct udevice_id rockchip_otp_ids[] = {
 		.compatible = "rockchip,rk3568-otp",
 		.data = (ulong)&rk3568_data,
 	},
+	{
+		.compatible = "rockchip,rk3576-otp",
+		.data = (ulong)&rk3576_data,
+	},
 	{
 		.compatible = "rockchip,rk3588-otp",
 		.data = (ulong)&rk3588_data,
Signature · 1 line
2.47.2
Reviewed-by on v2 9/16
#18 lore raw

Re: [PATCH v2 09/16] rockchip: otp: Add support for RK3576

Quoted 5 lines · Heiko Stuebner

Add support for RK3576 compatible.
The RK3576 OTP uses the same read mechanism as the RK3588, just with different values for offset and size.

I can read correct data from OTP on my boards.

Regards,
Jonas

Quoted 3 lines
---
 drivers/misc/rockchip-otp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

[snip]

author maintainer
#19 lore raw

PATCH v2 10/16 mmc: rockchip_sdhci: Add support for RK3576

In reply to Heiko Stuebner

Add support for RK3576 to the rockchip sdhci driver.

It's pretty similar to its cousins found in the RK3568 and RK3588 and the specific hs400-tx-tap number was taken from the vendor-u-boot.

---
 drivers/mmc/rockchip_sdhci.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/mmc/rockchip_sdhci.c +15 -0
index c0f98678436..761e3619329 100644
@@ -682,6 +682,17 @@ static const struct sdhci_data rk3568_data = {
 	.ddr50_strbin_delay_num = DLL_STRBIN_DELAY_NUM_DEFAULT,
 };
 
+static const struct sdhci_data rk3576_data = {
+	.set_ios_post = rk3568_sdhci_set_ios_post,
+	.set_clock = rk3568_sdhci_set_clock,
+	.config_dll = rk3568_sdhci_config_dll,
+	.hs200_txclk_tapnum = DLL_TXCLK_TAPNUM_DEFAULT,
+	.hs400_txclk_tapnum = 0x7,
+	.hs400_cmdout_tapnum = 0x7,
+	.hs400_strbin_tapnum = 0x5,
+	.ddr50_strbin_delay_num = 0xa,
+};
+
 static const struct sdhci_data rk3588_data = {
 	.set_ios_post = rk3568_sdhci_set_ios_post,
 	.set_clock = rk3568_sdhci_set_clock,
@@ -706,6 +717,10 @@ static const struct udevice_id sdhci_ids[] = {
 		.compatible = "rockchip,rk3568-dwcmshc",
 		.data = (ulong)&rk3568_data,
 	},
+	{
+		.compatible = "rockchip,rk3576-dwcmshc",
+		.data = (ulong)&rk3576_data,
+	},
 	{
 		.compatible = "rockchip,rk3588-dwcmshc",
 		.data = (ulong)&rk3588_data,
Signature · 1 line
2.47.2
Reviewed-by on v2 10/16
#20 lore raw

Re: [PATCH v2 10/16] mmc: rockchip_sdhci: Add support for RK3576

Quoted 7 lines · Heiko Stuebner

Add support for RK3576 to the rockchip sdhci driver.

It's pretty similar to its cousins found in the RK3568 and RK3588 and the specific hs400-tx-tap number was taken from the vendor-u-boot.

HS200 mode work by default on my boards.

Regards,
Jonas

Quoted 3 lines
---
 drivers/mmc/rockchip_sdhci.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

[snip]

author maintainer
#21 lore raw

PATCH v2 11/16 mmc: rockchip_dw_mmc: Add support for rk3576

In reply to Heiko Stuebner

The rk3576 uses a different base-compatible, as starting with this generation, the clock phase tuning is done via registers inside the mmc controller and not from inside the CRU.

In U-Boot we do not tune at all, so no other code changes are necessary.

---
 drivers/mmc/rockchip_dw_mmc.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mmc/rockchip_dw_mmc.c +1 -0
index 422b8f7e4c8..7a72abaa38a 100644
@@ -171,6 +171,7 @@ static int rockchip_dwmmc_bind(struct udevice *dev)
 static const struct udevice_id rockchip_dwmmc_ids[] = {
 	{ .compatible = "rockchip,rk2928-dw-mshc" },
 	{ .compatible = "rockchip,rk3288-dw-mshc" },
+	{ .compatible = "rockchip,rk3576-dw-mshc" },
 	{ }
 };
 
Signature · 1 line
2.47.2
Reviewed-by on v2 11/16
#22 lore raw

Re: [PATCH v2 11/16] mmc: rockchip_dw_mmc: Add support for rk3576

Quoted 9 lines · Heiko Stuebner

The rk3576 uses a different base-compatible, as starting with this generation, the clock phase tuning is done via registers inside the mmc controller and not from inside the CRU.

In U-Boot we do not tune at all, so no other code changes are necessary.

Reading and writing data from/to SD-card work on my boards.

Regards,
Jonas

Quoted 3 lines
---
 drivers/mmc/rockchip_dw_mmc.c | 1 +
 1 file changed, 1 insertion(+)

[snip]

author maintainer
#23 lore raw

PATCH v2 12/16 net: dwc_eth_qos_rockchip: Add support for RK3576

In reply to Heiko Stuebner

Add rk_gmac_ops and other special handling that is needed for GMAC to work on RK3576.

---
 drivers/net/dwc_eth_qos.c          |   4 +
 drivers/net/dwc_eth_qos_rockchip.c | 154 ++++++++++++++++++++++++++++-
 2 files changed, 157 insertions(+), 1 deletion(-)
drivers/net/dwc_eth_qos.c +4 -0
index d4561784a6e..b1bc422f791 100644
@@ -1619,6 +1619,10 @@ static const struct udevice_id eqos_ids[] = {
 		.compatible = "rockchip,rk3568-gmac",
 		.data = (ulong)&eqos_rockchip_config
 	},
+	{
+		.compatible = "rockchip,rk3576-gmac",
+		.data = (ulong)&eqos_rockchip_config
+	},
 	{
 		.compatible = "rockchip,rk3588-gmac",
 		.data = (ulong)&eqos_rockchip_config
drivers/net/dwc_eth_qos_rockchip.c +153 -1

172 lines not on this page · raw message

Signature · 1 line
2.47.2
Reviewed-by on v2 12/16
#24 lore raw

Re: [PATCH v2 12/16] net: dwc_eth_qos_rockchip: Add support for RK3576

Quoted 4 lines · Heiko Stuebner

Add rk_gmac_ops and other special handling that is needed for GMAC to work on RK3576.

Ethernet works on my boards, using normal dhcp cmd, and also wget + dns using NET_LWIP=y.

Regards,
Jonas

Quoted 4 lines
---
 drivers/net/dwc_eth_qos.c          |   4 +
 drivers/net/dwc_eth_qos_rockchip.c | 154 ++++++++++++++++++++++++++++-
 2 files changed, 157 insertions(+), 1 deletion(-)

[snip]

author maintainer
#25 lore raw

PATCH v2 13/16 arm64: dts: rockchip: add rk3576 otp node

In reply to Heiko Stuebner

This adds the otp node to the rk3576 soc devicetree including the individual fields we know about.

[ upstream commit: 8715d2eeb062f6859c252bb6c87b363230b66e9f ]

(cherry picked from commit d67cf6de8aacb4abcdfb516eeb8a511a4a657bc1)

---
 dts/upstream/src/arm64/rockchip/rk3576.dtsi | 39 +++++++++++++++++++++
 1 file changed, 39 insertions(+)
dts/upstream/src/arm64/rockchip/rk3576.dtsi +39 -0
index 4dde954043e..29b47799849 100644
@@ -1260,6 +1260,45 @@
 			status = "disabled";
 		};
 
+		otp: otp@2a580000 {
+			compatible = "rockchip,rk3576-otp";
+			reg = <0x0 0x2a580000 0x0 0x400>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			clocks = <&cru CLK_OTPC_NS>, <&cru PCLK_OTPC_NS>,
+				 <&cru CLK_OTP_PHY_G>;
+			clock-names = "otp", "apb_pclk", "phy";
+			resets = <&cru SRST_OTPC_NS>, <&cru SRST_P_OTPC_NS>;
+			reset-names = "otp", "apb";
+
+			/* Data cells */
+			cpu_code: cpu-code@2 {
+				reg = <0x02 0x2>;
+			};
+			otp_cpu_version: cpu-version@5 {
+				reg = <0x05 0x1>;
+				bits = <3 3>;
+			};
+			otp_id: id@a {
+				reg = <0x0a 0x10>;
+			};
+			cpub_leakage: cpub-leakage@1e {
+				reg = <0x1e 0x1>;
+			};
+			cpul_leakage: cpul-leakage@1f {
+				reg = <0x1f 0x1>;
+			};
+			npu_leakage: npu-leakage@20 {
+				reg = <0x20 0x1>;
+			};
+			gpu_leakage: gpu-leakage@21 {
+				reg = <0x21 0x1>;
+			};
+			log_leakage: log-leakage@22 {
+				reg = <0x22 0x1>;
+			};
+		};
+
 		gic: interrupt-controller@2a701000 {
 			compatible = "arm,gic-400";
 			reg = <0x0 0x2a701000 0 0x10000>,
Signature · 1 line
2.47.2
author maintainer
#26 lore raw

PATCH v2 14/16 dt-bindings: arm: rockchip: Add Firefly ROC-RK3576-PC binding

In reply to Heiko Stuebner

Add devicetree binding for the ROC-RK3576-PC SBC.

The board is based on the RK3576 SoC (4*Cortex-A72 + 4*Cortex-A53).

[ upstream commit: 2be4a4171401761cb5fb02225d8b18351f6807c0 ]

(cherry picked from commit 89026942ddd0475d78b11b019285fff0c1d47266)

---
 dts/upstream/Bindings/arm/rockchip.yaml | 5 +++++
 1 file changed, 5 insertions(+)
dts/upstream/Bindings/arm/rockchip.yaml +5 -0
index 522a6f0450e..0f4ca08d9ae 100644
@@ -236,6 +236,11 @@ properties:
               - firefly,roc-rk3399-pc-plus
           - const: rockchip,rk3399
 
+      - description: Firefly ROC-RK3576-PC
+        items:
+          - const: firefly,roc-rk3576-pc
+          - const: rockchip,rk3576
+
       - description: Firefly Station M2
         items:
           - const: firefly,rk3566-roc-pc
Signature · 1 line
2.47.2
author maintainer
#27 lore raw

PATCH v2 15/16 arm64: dts: rockchip: Add devicetree for the ROC-RK3576-PC

In reply to Heiko Stuebner

As the name implies, it is built around the RK3576 SoC with 4x Cortex-A72 cores, four Cortex-A53 cores and Mali-G52 MC3 GPU.

Storage options are EMMC, SD-Card, a 2242 M.2 slot and the possibility to use UFS 2.0 storage.

Video Output options are a HDMI port, a DSI connector as well as Display- Port via the TypeC connector (all of them not yet supported).

Networking options are a Low-profile Gigabit Ethernet RJ45 port with Motorcomm YT8531 PHY as well as WiFi via an AMPAK AP6256 module.

USB ports on the board are 1x USB 3.0 port, 1x USB 2.0 port, 1x USB Type-C and it comes with 40-pin GPIO header

[ upstream commit: 887ff17cdd8f088a52e2b61e71f2b6c9b9678de6 ]

(cherry picked from commit 388e7272d092bd20e414cd408bac39d8fd02d765)

---
 .../src/arm64/rockchip/rk3576-roc-pc.dts      | 736 ++++++++++++++++++
 1 file changed, 736 insertions(+)
 create mode 100644 dts/upstream/src/arm64/rockchip/rk3576-roc-pc.dts
dts/upstream/src/arm64/rockchip/rk3576-roc-pc.dts new file +736 -0
new file mode 100644
index 00000000000..612b7bb0b74
@@ -0,0 +1,736 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2024 Firefly Technology Co. Ltd
+ * Copyright (c) 2024 Heiko Stuebner <[email protected]>
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/pwm/pwm.h>
+#include <dt-bindings/usb/pd.h>
+#include "rk3576.dtsi"
+
+/ {
+	model = "Firefly ROC-RK3576-PC";
+	compatible = "firefly,roc-rk3576-pc", "rockchip,rk3576";
+
+	aliases {
+		mmc0 = &sdhci;
+		mmc1 = &sdmmc;
+	};
+
+	chosen {
+		stdout-path = "serial0:1500000n8";
+	};
+
+	adc-keys-0 {
+		compatible = "adc-keys";
+		io-channels = <&saradc 0>;
+		io-channel-names = "buttons";
+		keyup-threshold-microvolt = <1800000>;
+		poll-interval = <100>;
+
+		button-maskrom {
+			label = "Maskrom";
+			linux,code = <KEY_SETUP>;
+			press-threshold-microvolt = <17000>;
+		};
+	};
+
+	adc-keys-1 {
+		compatible = "adc-keys";
+		io-channels = <&saradc 1>;
+		io-channel-names = "buttons";
+		keyup-threshold-microvolt = <1800000>;
+		poll-interval = <100>;
+
+		button-recovery {
+			label = "Recovery";
+			linux,code = <KEY_VENDOR>;
+			press-threshold-microvolt = <17000>;
+		};
+	};
+
+	vbus5v0_typec: regulator-vbus5v0-typec {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio0 RK_PD1 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb_otg0_pwren_h>;
+		regulator-name = "vbus5v0_typec";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc5v0_device_s0>;
+	};
+
+	vcc12v_dcin: regulator-vcc12v-dcin {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc12v_dcin";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <12000000>;
+		regulator-max-microvolt = <12000000>;
+	};
+
+	vcc1v2_ufs_vccq_s0: regulator-vcc1v2-ufs-vccq-s0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc1v2_ufs_vccq_s0";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <1200000>;
+		regulator-max-microvolt = <1200000>;
+		vin-supply = <&vcc5v0_sys_s5>;
+	};
+
+	vcc1v8_ufs_vccq2_s0: regulator-vcc1v8-ufs-vccq2-s0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc1v8_ufs_vccq2_s0";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_1v8_s3>;
+	};
+
+	vcc3v3_pcie: regulator-vcc3v3-pcie {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio2 RK_PB3 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pcie_pwren_h>;
+		regulator-name = "vcc3v3_pcie";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		startup-delay-us = <5000>;
+		vin-supply = <&vcc12v_dcin>;
+	};
+
+	vcc3v3_rtc_s5: regulator-vcc3v3-rtc-s5 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc3v3_rtc_s5";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc5v0_sys_s5>;
+	};
+
+	vcc5v0_device_s0: regulator-vcc5v0-device-s0 {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&vcc5vd_en>;
+		regulator-name = "vcc5v0_device";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc12v_dcin>;
+	};
+
+	vcc5v0_sys_s5: regulator-vcc5v0-sys-s5 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_sys";
+		regulator-always-on;
+		regulator-boot-on;
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc12v_dcin>;
+	};
+
+	vcc5v0_usb20_host1: regulator-vcc5v0-usb20-host1 {
+		compatible = "regulator-fixed";
+		enable-active-high;
+		gpio = <&gpio0 RK_PC7 GPIO_ACTIVE_HIGH>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&usb3_host_pwren_h>;
+		regulator-name = "vcc5v0_host1";
+		regulator-min-microvolt = <5000000>;
+		regulator-max-microvolt = <5000000>;
+		vin-supply = <&vcc5v0_device_s0>;
+	};
+
+	vcc_1v1_nldo_s3: regulator-vcc-1v1-nldo-s3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_1v1_nldo_s3";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <1100000>;
+		regulator-max-microvolt = <1100000>;
+		vin-supply = <&vcc5v0_sys_s5>;
+	};
+
+	vcc_1v8_s0: regulator-vcc-1v8-s0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_1v8_s0";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		vin-supply = <&vcc_1v8_s3>;
+	};
+
+	vcc_2v0_pldo_s3: regulator-vcc-2v0-pldo-s3 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_2v0_pldo_s3";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <2000000>;
+		regulator-max-microvolt = <2000000>;
+		vin-supply = <&vcc5v0_sys_s5>;
+	};
+
+	vcc_3v3_s0: regulator-vcc-3v3-s0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_3v3_s0";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc_3v3_s3>;
+	};
+
+	vcc_ufs_s0: regulator-vcc-ufs-s0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_ufs_s0";
+		regulator-boot-on;
+		regulator-always-on;
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		vin-supply = <&vcc5v0_sys_s5>;
+	};
+};
+
+&cpu_l0 {
+	cpu-supply = <&vdd_cpu_lit_s0>;
+};
+
+&cpu_l1 {
+	cpu-supply = <&vdd_cpu_lit_s0>;
+};
+
+&cpu_l2 {
+	cpu-supply = <&vdd_cpu_lit_s0>;
+};
+
+&cpu_l3 {
+	cpu-supply = <&vdd_cpu_lit_s0>;
+};
+
+&cpu_b0 {
+	cpu-supply = <&vdd_cpu_big_s0>;
+};
+
+&cpu_b1 {
+	cpu-supply = <&vdd_cpu_big_s0>;
+};
+
+&cpu_b2 {
+	cpu-supply = <&vdd_cpu_big_s0>;
+};
+
+&cpu_b3 {
+	cpu-supply = <&vdd_cpu_big_s0>;
+};
+
+&gpu {
+	mali-supply = <&vdd_gpu_s0>;
+	status = "okay";
+};
+
+&gmac0 {
+	clock_in_out = "output";
+	pinctrl-names = "default";
+	pinctrl-0 = <&eth0m0_miim
+		     &eth0m0_tx_bus2
+		     &eth0m0_rx_bus2
+		     &eth0m0_rgmii_clk
+		     &eth0m0_rgmii_bus
+		     &ethm0_clk0_25m_out>;
+	/* Use rgmii-rxid mode to disable rx delay inside Soc */
+	phy-mode = "rgmii-rxid";
+	phy-handle = <&rgmii_phy0>;
+	tx_delay = <0x21>;
+	status = "okay";
+};
+
+&mdio0 {
+	status = "okay";
+
+	rgmii_phy0: phy@1 {
+		compatible = "ethernet-phy-ieee802.3-c22";
+		reg = <0x1>;
+		clocks = <&cru REFCLKO25M_GMAC0_OUT>;
+		/* Reset time is 20ms, 100ms for rtl8211f */
+		reset-delay-us = <20000>;
+		reset-gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
+		reset-post-delay-us = <100000>;
+	};
+};
+
+&i2c1 {
+	status = "okay";
+
+	pmic@23 {
+		compatible = "rockchip,rk806";
+		reg = <0x23>;
+		interrupt-parent = <&gpio0>;
+		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&pmic_pins>, <&rk806_dvs1_null>,
+			    <&rk806_dvs2_null>, <&rk806_dvs3_null>;
+		system-power-controller;
+
+		vcc1-supply = <&vcc5v0_sys_s5>;
+		vcc2-supply = <&vcc5v0_sys_s5>;
+		vcc3-supply = <&vcc5v0_sys_s5>;
+		vcc4-supply = <&vcc5v0_sys_s5>;
+		vcc5-supply = <&vcc5v0_sys_s5>;
+		vcc6-supply = <&vcc5v0_sys_s5>;
+		vcc7-supply = <&vcc5v0_sys_s5>;
+		vcc8-supply = <&vcc5v0_sys_s5>;
+		vcc9-supply = <&vcc5v0_sys_s5>;
+		vcc10-supply = <&vcc5v0_sys_s5>;
+		vcc11-supply = <&vcc_2v0_pldo_s3>;
+		vcc12-supply = <&vcc5v0_sys_s5>;
+		vcc13-supply = <&vcc_1v1_nldo_s3>;
+		vcc14-supply = <&vcc_1v1_nldo_s3>;
+		vcca-supply = <&vcc5v0_sys_s5>;
+
+		rk806_dvs1_null: dvs1-null-pins {
+			pins = "gpio_pwrctrl1";
+			function = "pin_fun0";
+		};
+
+		rk806_dvs2_null: dvs2-null-pins {
+			pins = "gpio_pwrctrl2";
+			function = "pin_fun0";
+		};
+
+		rk806_dvs3_null: dvs3-null-pins {
+			pins = "gpio_pwrctrl3";
+			function = "pin_fun0";
+		};
+
+		rk806_dvs1_slp: dvs1-slp-pins {
+			pins = "gpio_pwrctrl1";
+			function = "pin_fun1";
+		};
+
+		rk806_dvs1_pwrdn: dvs1-pwrdn-pins {
+			pins = "gpio_pwrctrl1";
+			function = "pin_fun2";
+		};
+
+		rk806_dvs1_rst: dvs1-rst-pins {
+			pins = "gpio_pwrctrl1";
+			function = "pin_fun3";
+		};
+
+		rk806_dvs2_slp: dvs2-slp-pins {
+			pins = "gpio_pwrctrl2";
+			function = "pin_fun1";
+		};
+
+		rk806_dvs2_pwrdn: dvs2-pwrdn-pins {
+			pins = "gpio_pwrctrl2";
+			function = "pin_fun2";
+		};
+
+		rk806_dvs2_rst: dvs2-rst-pins {
+			pins = "gpio_pwrctrl2";
+			function = "pin_fun3";
+		};
+
+		rk806_dvs2_dvs: dvs2-dvs-pins {
+			pins = "gpio_pwrctrl2";
+			function = "pin_fun4";
+		};
+
+		rk806_dvs2_gpio: dvs2-gpio-pins {
+			pins = "gpio_pwrctrl2";
+			function = "pin_fun5";
+		};
+
+		rk806_dvs3_slp: dvs3-slp-pins {
+			pins = "gpio_pwrctrl3";
+			function = "pin_fun1";
+		};
+
+		rk806_dvs3_pwrdn: dvs3-pwrdn-pins {
+			pins = "gpio_pwrctrl3";
+			function = "pin_fun2";
+		};
+
+		rk806_dvs3_rst: dvs3-rst-pins {
+			pins = "gpio_pwrctrl3";
+			function = "pin_fun3";
+		};
+
+		rk806_dvs3_dvs: dvs3-dvs-pins {
+			pins = "gpio_pwrctrl3";
+			function = "pin_fun4";
+		};
+
+		rk806_dvs3_gpio: dvs3-gpio-pins {
+			pins = "gpio_pwrctrl3";
+			function = "pin_fun5";
+		};
+
+		regulators {
+			vdd_cpu_big_s0: dcdc-reg1 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <950000>;
+				regulator-ramp-delay = <12500>;
+				regulator-name = "vdd_cpu_big_s0";
+				regulator-enable-ramp-delay = <400>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdd_npu_s0: dcdc-reg2 {
+				regulator-boot-on;
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <950000>;
+				regulator-ramp-delay = <12500>;
+				regulator-name = "vdd_npu_s0";
+				regulator-enable-ramp-delay = <400>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdd_cpu_lit_s0: dcdc-reg3 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <950000>;
+				regulator-ramp-delay = <12500>;
+				regulator-name = "vdd_cpu_lit_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+					regulator-suspend-microvolt = <750000>;
+				};
+			};
+
+			vcc_3v3_s3: dcdc-reg4 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vcc_3v3_s3";
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <3300000>;
+				};
+			};
+
+			vdd_gpu_s0: dcdc-reg5 {
+				regulator-boot-on;
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <900000>;
+				regulator-ramp-delay = <12500>;
+				regulator-name = "vdd_gpu_s0";
+				regulator-enable-ramp-delay = <400>;
+				regulator-state-mem {
+					regulator-off-in-suspend;
+					regulator-suspend-microvolt = <850000>;
+				};
+			};
+
+			vddq_ddr_s0: dcdc-reg6 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-name = "vddq_ddr_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdd_logic_s0: dcdc-reg7 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <800000>;
+				regulator-name = "vdd_logic_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcc_1v8_s3: dcdc-reg8 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-name = "vcc_1v8_s3";
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <1800000>;
+				};
+			};
+
+			vdd2_ddr_s3: dcdc-reg9 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-name = "vdd2_ddr_s3";
+				regulator-state-mem {
+					regulator-on-in-suspend;
+				};
+			};
+
+			vdd_ddr_s0: dcdc-reg10 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <550000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-name = "vdd_ddr_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcca_1v8_s0: pldo-reg1 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-name = "vcca_1v8_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcca1v8_pldo2_s0: pldo-reg2 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-name = "vcca1v8_pldo2_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdda_1v2_s0: pldo-reg3 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1200000>;
+				regulator-max-microvolt = <1200000>;
+				regulator-name = "vdda_1v2_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcca_3v3_s0: pldo-reg4 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <3300000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vcca_3v3_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vccio_sd_s0: pldo-reg5 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				regulator-name = "vccio_sd_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vcca1v8_pldo6_s3: pldo-reg6 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <1800000>;
+				regulator-name = "vcca1v8_pldo6_s3";
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <1800000>;
+				};
+			};
+
+			vdd_0v75_s3: nldo-reg1 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <750000>;
+				regulator-name = "vdd_0v75_s3";
+				regulator-state-mem {
+					regulator-on-in-suspend;
+					regulator-suspend-microvolt = <750000>;
+				};
+			};
+
+			vdda_ddr_pll_s0: nldo-reg2 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <850000>;
+				regulator-max-microvolt = <850000>;
+				regulator-name = "vdda_ddr_pll_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdda0v75_hdmi_s0: nldo-reg3 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <837500>;
+				regulator-max-microvolt = <837500>;
+				regulator-name = "vdda0v75_hdmi_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdda_0v85_s0: nldo-reg4 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <850000>;
+				regulator-max-microvolt = <850000>;
+				regulator-name = "vdda_0v85_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+
+			vdda_0v75_s0: nldo-reg5 {
+				regulator-always-on;
+				regulator-boot-on;
+				regulator-min-microvolt = <750000>;
+				regulator-max-microvolt = <750000>;
+				regulator-name = "vdda_0v75_s0";
+				regulator-state-mem {
+					regulator-off-in-suspend;
+				};
+			};
+		};
+	};
+};
+
+&i2c2 {
+	status = "okay";
+
+	/* pc9202 watchdog@3c with enable-gpio gpio0-c3 */
+
+	/* hnyetek,husb311 typec-portc@4e */
+
+	hym8563: rtc@51 {
+		compatible = "haoyu,hym8563";
+		reg = <0x51>;
+		#clock-cells = <0>;
+		clock-output-names = "hym8563";
+		pinctrl-names = "default";
+		pinctrl-0 = <&rtc_int_l>;
+		interrupt-parent = <&gpio0>;
+		interrupts = <RK_PA0 IRQ_TYPE_LEVEL_LOW>;
+		wakeup-source;
+	};
+};
+
+&saradc {
+	vref-supply = <&vcca_1v8_s0>;
+	status = "okay";
+};
+
+&sdhci {
+	bus-width = <8>;
+	no-sdio;
+	no-sd;
+	non-removable;
+	max-frequency = <200000000>;
+	mmc-hs400-1_8v;
+	mmc-hs400-enhanced-strobe;
+	full-pwr-cycle-in-suspend;
+	status = "okay";
+};
+
+&sdmmc {
+	max-frequency = <200000000>;
+	no-sdio;
+	no-mmc;
+	bus-width = <4>;
+	cap-mmc-highspeed;
+	cap-sd-highspeed;
+	disable-wp;
+	sd-uhs-sdr104;
+	vqmmc-supply = <&vccio_sd_s0>;
+	status = "okay";
+};
+
+&pinctrl {
+	hym8563 {
+		rtc_int_l: rtc-int-l {
+			rockchip,pins = <0 RK_PA0 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+	};
+
+	power {
+		vcc5vd_en: vcc5vd-en {
+			rockchip,pins = <2 RK_PC0 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		pcie_pwren_h: pcie-pwren-h {
+			rockchip,pins = <2 RK_PB3 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+
+	usb {
+		hub_reset_h: hub-reset-h {
+			rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		usb3_host_pwren_h: usb3-host-pwren-h {
+			rockchip,pins = <0 RK_PC7 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		usb_otg0_pwren_h: usb-otg0-pwren-h {
+			rockchip,pins = <0 RK_PD1 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+
+		usbc0_int_l: usbc0-int-l {
+			rockchip,pins = <0 RK_PA5 RK_FUNC_GPIO &pcfg_pull_up>;
+		};
+	};
+
+	watchdog {
+		wd_en: wd-en {
+			rockchip,pins = <0 RK_PC3 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+};
+
+&uart0 {
+	pinctrl-0 = <&uart0m0_xfer>;
+	status = "okay";
+};
+
+&uart4 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart4m1_xfer &uart4m1_ctsn>;
+	status = "okay";
+};
+
+/* On the extension pin header */
+&uart6 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart6m3_xfer>;
+	status = "okay";
+};
Signature · 1 line
2.47.2
author maintainer
#28 lore raw

PATCH v2 16/16 rockchip: rk3576: Add support for ROC-RK3576-PC board

In reply to Heiko Stuebner

The ROC-RK3576-PC is a SBC made by Firefly, designed around the RK3576 SoC. This adds the needed board infrastructure and config for it.

---
 arch/arm/dts/rk3576-roc-pc-u-boot.dtsi  | 11 ++++++
 arch/arm/mach-rockchip/rk3576/Kconfig   |  8 +++++
 board/firefly/roc-pc-rk3576/Kconfig     | 12 +++++++
 board/firefly/roc-pc-rk3576/MAINTAINERS |  7 ++++
 configs/roc-pc-rk3576_defconfig         | 45 +++++++++++++++++++++++++
 doc/board/rockchip/rockchip.rst         |  3 ++
 include/configs/roc-pc-rk3576.h         | 15 +++++++++
 7 files changed, 101 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-roc-pc-u-boot.dtsi
 create mode 100644 board/firefly/roc-pc-rk3576/Kconfig
 create mode 100644 board/firefly/roc-pc-rk3576/MAINTAINERS
 create mode 100644 configs/roc-pc-rk3576_defconfig
 create mode 100644 include/configs/roc-pc-rk3576.h
arch/arm/dts/rk3576-roc-pc-u-boot.dtsi new file +11 -0
new file mode 100644
index 00000000000..97240345ed4
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Joshua Riek <[email protected]>
+ *
+ */
+
+#include "rk3576-u-boot.dtsi"
+
+&sdhci {
+	cap-mmc-highspeed;
+};
arch/arm/mach-rockchip/rk3576/Kconfig +8 -0
index a94dc6706f0..83d41f7a100 100644
@@ -1,5 +1,11 @@
 if ROCKCHIP_RK3576
 
+config TARGET_ROC_PC_RK3576
+	bool "Firefly ROC-RK3576-PC"
+	help
+	  ROC-RK3576-PC is a single board computer from Firefly
+	  using the Rockchip RK3576.
+
 config ROCKCHIP_BOOT_MODE_REG
 	default 0x26024040
 
@@ -12,4 +18,6 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "rk3576_common"
 
+source board/firefly/roc-pc-rk3576/Kconfig
+
 endif
board/firefly/roc-pc-rk3576/Kconfig new file +12 -0
new file mode 100644
index 00000000000..2fc0f913c37
@@ -0,0 +1,12 @@
+if TARGET_ROC_PC_RK3576
+
+config SYS_BOARD
+	default "roc-pc-rk3576"
+
+config SYS_VENDOR
+	default "firefly"
+
+config SYS_CONFIG_NAME
+	default "roc-pc-rk3576"
+
+endif
board/firefly/roc-pc-rk3576/MAINTAINERS new file +7 -0
new file mode 100644
index 00000000000..aa8897c16fc
@@ -0,0 +1,7 @@
+ROC-RK3576-PC
+M:	Heiko Stuebner <[email protected]>
+S:	Maintained
+F:	board/firefly/roc-pc-rk3576
+F:	include/configs/roc-pc-rk3576.h
+F:	configs/roc-pc-rk3576_defconfig
+F:	arch/arm/dts/rk3576-roc-pc*
configs/roc-pc-rk3576_defconfig new file +45 -0

45 lines not on this page · raw message

doc/board/rockchip/rockchip.rst +3 -0
index 1058a1ce990..8d7c2591e25 100644
@@ -130,6 +130,9 @@ List of mainline supported Rockchip boards:
      - Radxa ROCK 3A (rock-3a-rk3568)
      - Radxa ROCK 3B (rock-3b-rk3568)
 
+* rk3576
+     - Firefly ROC-RK3576-PC (roc-pc-rk3576)
+
 * rk3588
      - ArmSoM Sige7 (sige7-rk3588)
      - Rockchip EVB (evb-rk3588)
include/configs/roc-pc-rk3576.h new file +15 -0
new file mode 100644
index 00000000000..77c95f0c560
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
+ */
+
+#ifndef __ROC_PC_RK3576_H
+#define __ROC_PC_RK3576_H
+
+#define ROCKCHIP_DEVICE_SETTINGS \
+		"stdout=serial,vidconsole\0" \
+		"stderr=serial,vidconsole\0"
+
+#include <configs/rk3576_common.h>
+
+#endif
Signature · 1 line
2.47.2
Reviewed-by on v2 16/16
#29 lore raw

Re: [PATCH v2 16/16] rockchip: rk3576: Add support for ROC-RK3576-PC board

Hi Heiko,

Quoted 53 lines · Heiko Stuebner

The ROC-RK3576-PC is a SBC made by Firefly, designed around the RK3576 SoC. This adds the needed board infrastructure and config for it.

---
 arch/arm/dts/rk3576-roc-pc-u-boot.dtsi  | 11 ++++++
 arch/arm/mach-rockchip/rk3576/Kconfig   |  8 +++++
 board/firefly/roc-pc-rk3576/Kconfig     | 12 +++++++
 board/firefly/roc-pc-rk3576/MAINTAINERS |  7 ++++
 configs/roc-pc-rk3576_defconfig         | 45 +++++++++++++++++++++++++
 doc/board/rockchip/rockchip.rst         |  3 ++
 include/configs/roc-pc-rk3576.h         | 15 +++++++++
 7 files changed, 101 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-roc-pc-u-boot.dtsi
 create mode 100644 board/firefly/roc-pc-rk3576/Kconfig
 create mode 100644 board/firefly/roc-pc-rk3576/MAINTAINERS
 create mode 100644 configs/roc-pc-rk3576_defconfig
 create mode 100644 include/configs/roc-pc-rk3576.h
arch/arm/dts/rk3576-roc-pc-u-boot.dtsi new file +11 -0
new file mode 100644
index 00000000000..97240345ed4
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 Joshua Riek <[email protected]>
+ *
+ */
+
+#include "rk3576-u-boot.dtsi"
+
+&sdhci {
+	cap-mmc-highspeed;
+};
arch/arm/mach-rockchip/rk3576/Kconfig +6 -0
index a94dc6706f0..83d41f7a100 100644
@@ -1,5 +1,11 @@
 if ROCKCHIP_RK3576
 
+config TARGET_ROC_PC_RK3576
+	bool "Firefly ROC-RK3576-PC"
+	help
+	  ROC-RK3576-PC is a single board computer from Firefly
+	  using the Rockchip RK3576.
+
 config ROCKCHIP_BOOT_MODE_REG
 	default 0x26024040
 

arch/arm/mach-rockchip/rk3576/Kconfig config SYS_SOC · line 21

Quoted 4 lines
arch/arm/mach-rockchip/rk3576/Kconfig +1 -0
@@ -12,4 +18,6 @@ config SYS_SOC
 config SYS_CONFIG_NAME
 	default "rk3576_common"
 
+source board/firefly/roc-pc-rk3576/Kconfig

This line should be added before the "config SYS_CONFIG_NAME" above, else the default SYS_CONFIG_NAME defined in the board Kconfig does not take effect and rk3576_common.h will be included instead of roc-pc-rk3576.h.

With that fixed this is:

Regards,
Jonas

Quoted 20 lines
arch/arm/mach-rockchip/rk3576/Kconfig +1 -0
+
 endif
board/firefly/roc-pc-rk3576/Kconfig new file +12 -0
new file mode 100644
index 00000000000..2fc0f913c37
@@ -0,0 +1,12 @@
+if TARGET_ROC_PC_RK3576
+
+config SYS_BOARD
+	default "roc-pc-rk3576"
+
+config SYS_VENDOR
+	default "firefly"
+
+config SYS_CONFIG_NAME
+	default "roc-pc-rk3576"
+
+endif

[snip]