Skip to contentSkip to conversation

rockchip: rk3576: Add rng, checkboard() and generic board

PATCH In review Jonas Karlman 2 participants 16 messages Aug 1, 2025 – Aug 30, 2025

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

v3 cover rockchip: rk3576: Add rng, checkboard() and generic board

This is a follow-up series on top of the original "Support for the RK3576" series, merged in v2025.07. It adds support for RNG, USB, a generic board and printing of the running SoC variant.

Changes in v3:
- Add USB glue and USB PHY related patches
- Drop use of USBDP PHY for generic board
- Drop device tree patches merged with the v6.16-dts sync
- Collect r-b tag

Changes in v2:
- Add RNG node by picking a commit from devicetree-rebasing
- Add compatible for RK3576 to RNG driver
- Add default USB_GADGET_PRODUCT_NUM for RK3576
- Add USB OTG nodes to the minimal generic RK3576 board
- Split the checkboard() patch in two
- Split out the ArmSoM Sige5 patch into a separate series

It is recommended to also apply "rockchip: Fix misc USB PHY related issues" [1] to ensure USB can work reliable.

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

Frank Wang (2):
phy: rockchip-inno-usb2: Add support for RK3576
phy: rockchip: usbdp: Add support for RK3576

Jonas Karlman (6):
rng: rockchip_rng: Add compatible for RK3576
rockchip: Add default USB_GADGET_PRODUCT_NUM for RK3576
board: rockchip: Add minimal generic RK3576 board
rockchip: rk3576: Implement checkboard() to print SoC variant
arm: dts: rockchip: Include OTP in U-Boot pre-reloc phase for RK3576
usb: dwc3-generic: Use combined glue and ctrl node for RK3576

 arch/arm/dts/rk3576-generic-u-boot.dtsi       |  3 +
 arch/arm/dts/rk3576-generic.dts               | 63 +++++++++++++++++++
 arch/arm/dts/rk3576-u-boot.dtsi               |  4 ++
 arch/arm/mach-rockchip/rk3576/MAINTAINERS     |  5 ++
 arch/arm/mach-rockchip/rk3576/rk3576.c        | 48 ++++++++++++++
 configs/generic-rk3576_defconfig              | 50 +++++++++++++++
 doc/board/rockchip/rockchip.rst               |  1 +
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 26 ++++++++
 drivers/phy/rockchip/phy-rockchip-usbdp.c     | 26 ++++++++
 drivers/rng/rockchip_rng.c                    |  4 ++
 drivers/usb/dwc3/dwc3-generic.c               |  1 +
 drivers/usb/gadget/Kconfig                    |  1 +
 12 files changed, 232 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3576-generic.dts
 create mode 100644 arch/arm/mach-rockchip/rk3576/MAINTAINERS
 create mode 100644 configs/generic-rk3576_defconfig
Signature · 1 line
2.50.1
#1 lore raw

PATCH v3 1/8 rng: rockchip_rng: Add compatible for RK3576

The RK3576 SoC contains a RKRNG block that can be used to generate random numbers using the rockchip_rng driver.

Add compatible for RK3576 to support random numbers:

=> rng list
RNG #0 - rng@2a410000

=> rng

  00000000: 36 dd ab 98 ec fb fe d1 cf 36 b3 e1 9b 3d 00 90  6........6...=..
  00000010: f5 84 de 75 6b 27 48 9e 13 62 12 6c 50 ca 47 1a  ...uk'H..b.lP.G.
  00000020: b3 4d fc 43 c5 b5 2d be 07 27 03 26 bb 69 61 2a  .M.C..-..'.&.ia*
  00000030: 6f 70 01 83 4e ce 91 7a 5a 6c 7c 00 43 87 3e c5  op..N..zZl|.C.>.

---
v3: No change
v2: New patch

---
 drivers/rng/rockchip_rng.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/rng/rockchip_rng.c +4 -0
index d854ea900442..8cf750e043cf 100644
@@ -393,6 +393,10 @@ static const struct udevice_id rockchip_rng_match[] = {
 		.compatible = "rockchip,rk3588-rng",
 		.data = (ulong)&rk_trngv1_soc_data,
 	},
+	{
+		.compatible = "rockchip,rk3576-rng",
+		.data = (ulong)&rkrng_soc_data,
+	},
 	{
 		.compatible = "rockchip,rkrng",
 		.data = (ulong)&rkrng_soc_data,
Signature · 1 line
2.50.1
Reviewed-by on v3 1/8
#2 lore raw

Re: [PATCH v3 1/8] rng: rockchip_rng: Add compatible for RK3576

Quoted 14 lines · Jonas Karlman

The RK3576 SoC contains a RKRNG block that can be used to generate random numbers using the rockchip_rng driver.

Add compatible for RK3576 to support random numbers:

   => rng list
   RNG #0 - rng@2a410000

   => rng
   00000000: 36 dd ab 98 ec fb fe d1 cf 36 b3 e1 9b 3d 00 90  6........6...=..
   00000010: f5 84 de 75 6b 27 48 9e 13 62 12 6c 50 ca 47 1a  ...uk'H..b.lP.G.
   00000020: b3 4d fc 43 c5 b5 2d be 07 27 03 26 bb 69 61 2a  .M.C..-..'.&.ia*
   00000030: 6f 70 01 83 4e ce 91 7a 5a 6c 7c 00 43 87 3e c5  op..N..zZl|.C.>.
Quoted 1 line

Thanks,
- Kever

Quoted 22 lines

---
v3: No change
v2: New patch

---
  drivers/rng/rockchip_rng.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/rng/rockchip_rng.c +4 -0
index d854ea900442..8cf750e043cf 100644
@@ -393,6 +393,10 @@ static const struct udevice_id rockchip_rng_match[] = {
  		.compatible = "rockchip,rk3588-rng",
  		.data = (ulong)&rk_trngv1_soc_data,
  	},
+	{
+		.compatible = "rockchip,rk3576-rng",
+		.data = (ulong)&rkrng_soc_data,
+	},
  	{
  		.compatible = "rockchip,rkrng",
  		.data = (ulong)&rkrng_soc_data,
#3 lore raw

PATCH v3 2/8 rockchip: Add default USB_GADGET_PRODUCT_NUM for RK3576

In reply to Jonas Karlman

Use 0x350e as the default USB Product ID for Rockchip RK3576, same PID being used by the BootROM when the device is in MASKROM mode.

---
v3: Collect r-b tag
v2: New patch

---
 drivers/usb/gadget/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/gadget/Kconfig +1 -0
index 46a83141481f..bab88567ea62 100644
@@ -86,6 +86,7 @@ config USB_GADGET_PRODUCT_NUM
 	default 0x350a if ROCKCHIP_RK3568
 	default 0x350b if ROCKCHIP_RK3588
 	default 0x350c if ROCKCHIP_RK3528
+	default 0x350e if ROCKCHIP_RK3576
 	default 0x0
 	help
 	  Product ID of the USB device emulated, reported to the host device.
Signature · 1 line
2.50.1
Reviewed-by on v3 2/8
#4 lore raw

Re: [PATCH v3 2/8] rockchip: Add default USB_GADGET_PRODUCT_NUM for RK3576

Quoted 5 lines · Jonas Karlman

Use 0x350e as the default USB Product ID for Rockchip RK3576, same PID being used by the BootROM when the device is in MASKROM mode.

Thanks,
- Kever

Quoted 19 lines

---
v3: Collect r-b tag
v2: New patch

---
  drivers/usb/gadget/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/usb/gadget/Kconfig +1 -0
index 46a83141481f..bab88567ea62 100644
@@ -86,6 +86,7 @@ config USB_GADGET_PRODUCT_NUM
  	default 0x350a if ROCKCHIP_RK3568
  	default 0x350b if ROCKCHIP_RK3588
  	default 0x350c if ROCKCHIP_RK3528
+	default 0x350e if ROCKCHIP_RK3576
  	default 0x0
  	help
  	  Product ID of the USB device emulated, reported to the host device.
#5 lore raw

PATCH v3 3/8 board: rockchip: Add minimal generic RK3576 board

In reply to Jonas Karlman

Add a minimal generic RK3576 board that only have eMMC, SDMMC and USB OTG enabled. This defconfig can be used to boot from eMMC or SD-card on most RK3576 boards that follow reference board design.

eMMC and SD-card boot tested on:
- ArmSoM CM5
- ArmSoM Sige5
- FriendlyElec NanoPi M5
- Luckfox Omni3576
- Toybrick TB-RK3576D

---
v3: Drop use of USBDP PHY
v2: Add nodes and Kconfig options for USB OTG

---
 arch/arm/dts/rk3576-generic-u-boot.dtsi   |  3 ++
 arch/arm/dts/rk3576-generic.dts           | 63 +++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3576/MAINTAINERS |  5 ++
 configs/generic-rk3576_defconfig          | 50 ++++++++++++++++++
 doc/board/rockchip/rockchip.rst           |  1 +
 5 files changed, 122 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-generic-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3576-generic.dts
 create mode 100644 arch/arm/mach-rockchip/rk3576/MAINTAINERS
 create mode 100644 configs/generic-rk3576_defconfig
arch/arm/dts/rk3576-generic-u-boot.dtsi new file +3 -0
new file mode 100644
index 000000000000..632fabb6af56
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3576-u-boot.dtsi"
arch/arm/dts/rk3576-generic.dts new file +63 -0

63 lines not on this page · raw message

arch/arm/mach-rockchip/rk3576/MAINTAINERS new file +5 -0
new file mode 100644
index 000000000000..b5190c818468
@@ -0,0 +1,5 @@
+GENERIC-RK3576
+M:	Jonas Karlman <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/rk3576-generic*
+F:	configs/generic-rk3576_defconfig
configs/generic-rk3576_defconfig new file +50 -0

50 lines not on this page · raw message

doc/board/rockchip/rockchip.rst +1 -0
index 7a1385789c20..42fdeafec28b 100644
@@ -135,6 +135,7 @@ List of mainline supported Rockchip boards:
 
 * rk3576
      - Firefly ROC-RK3576-PC (roc-pc-rk3576)
+     - Generic RK3576 (generic-rk3576)
 
 * rk3588
      - ArmSoM Sige7 (sige7-rk3588)
Signature · 1 line
2.50.1
#6 lore raw

PATCH v3 4/8 rockchip: rk3576: Implement checkboard() to print SoC variant

In reply to Jonas Karlman

Implement checkboard() to print current SoC model used by a board when U-Boot proper is running.

U-Boot 2025.04 (Apr 22 2025 - 20:43:17 +0000)

Model: Generic RK3576
SoC: RK3576
DRAM: 8 GiB

Information about the SoC model and variant is read from OTP.

---
v3: No change

---
 arch/arm/mach-rockchip/rk3576/rk3576.c | 48 ++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
arch/arm/mach-rockchip/rk3576/rk3576.c +48 -0
index dc53941ab2f5..a6c2fbdc4840 100644
@@ -3,6 +3,10 @@
  * Copyright (c) 2024 Rockchip Electronics Co., Ltd
  */
 
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <dm.h>
+#include <misc.h>
 #include <asm/armv8/mmu.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/hardware.h>
@@ -159,3 +163,47 @@ int arch_cpu_init(void)
 
 	return 0;
 }
+
+#define RK3576_OTP_CPU_CODE_OFFSET		0x02
+#define RK3576_OTP_SPECIFICATION_OFFSET		0x08
+
+int checkboard(void)
+{
+	u8 cpu_code[2], specification;
+	struct udevice *dev;
+	char suffix[2];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+		return 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(rockchip_otp), &dev);
+	if (ret) {
+		log_debug("Could not find otp device, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* cpu-code: SoC model, e.g. 0x35 0x76 */
+	ret = misc_read(dev, RK3576_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+	if (ret < 0) {
+		log_debug("Could not read cpu-code, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* specification: SoC variant, e.g. 0xA for RK3576J */
+	ret = misc_read(dev, RK3576_OTP_SPECIFICATION_OFFSET, &specification, 1);
+	if (ret < 0) {
+		log_debug("Could not read specification, ret=%d\n", ret);
+		return 0;
+	}
+	specification &= 0x1f;
+
+	/* for RK3576J i.e. '@' + 0xA = 'J' */
+	suffix[0] = specification > 1 ? '@' + specification : '\0';
+	suffix[1] = '\0';
+
+	printf("SoC:   RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
+	return 0;
+}
Signature · 1 line
2.50.1
Reviewed-by on v3 4/8
#7 lore raw

Re: [PATCH v3 4/8] rockchip: rk3576: Implement checkboard() to print SoC variant

Quoted 5 lines · Jonas Karlman

Implement checkboard() to print current SoC model used by a board when U-Boot proper is running.

U-Boot 2025.04 (Apr 22 2025 - 20:43:17 +0000)

Quoted 7 lines

Model: Generic RK3576
SoC: RK3576
DRAM: 8 GiB

Information about the SoC model and variant is read from OTP.

Thanks,
- Kever

Quoted 69 lines

---
v3: No change

---
  arch/arm/mach-rockchip/rk3576/rk3576.c | 48 ++++++++++++++++++++++++++
  1 file changed, 48 insertions(+)
arch/arm/mach-rockchip/rk3576/rk3576.c +48 -0
index dc53941ab2f5..a6c2fbdc4840 100644
@@ -3,6 +3,10 @@
   * Copyright (c) 2024 Rockchip Electronics Co., Ltd
   */
 
+#define LOG_CATEGORY LOGC_ARCH
+
+#include <dm.h>
+#include <misc.h>
  #include <asm/armv8/mmu.h>
  #include <asm/arch-rockchip/bootrom.h>
  #include <asm/arch-rockchip/hardware.h>
@@ -159,3 +163,47 @@ int arch_cpu_init(void)
 
  	return 0;
  }
+
+#define RK3576_OTP_CPU_CODE_OFFSET		0x02
+#define RK3576_OTP_SPECIFICATION_OFFSET		0x08
+
+int checkboard(void)
+{
+	u8 cpu_code[2], specification;
+	struct udevice *dev;
+	char suffix[2];
+	int ret;
+
+	if (!IS_ENABLED(CONFIG_ROCKCHIP_OTP) || !CONFIG_IS_ENABLED(MISC))
+		return 0;
+
+	ret = uclass_get_device_by_driver(UCLASS_MISC,
+					  DM_DRIVER_GET(rockchip_otp), &dev);
+	if (ret) {
+		log_debug("Could not find otp device, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* cpu-code: SoC model, e.g. 0x35 0x76 */
+	ret = misc_read(dev, RK3576_OTP_CPU_CODE_OFFSET, cpu_code, 2);
+	if (ret < 0) {
+		log_debug("Could not read cpu-code, ret=%d\n", ret);
+		return 0;
+	}
+
+	/* specification: SoC variant, e.g. 0xA for RK3576J */
+	ret = misc_read(dev, RK3576_OTP_SPECIFICATION_OFFSET, &specification, 1);
+	if (ret < 0) {
+		log_debug("Could not read specification, ret=%d\n", ret);
+		return 0;
+	}
+	specification &= 0x1f;
+
+	/* for RK3576J i.e. '@' + 0xA = 'J' */
+	suffix[0] = specification > 1 ? '@' + specification : '\0';
+	suffix[1] = '\0';
+
+	printf("SoC:   RK%02x%02x%s\n", cpu_code[0], cpu_code[1], suffix);
+
+	return 0;
+}
#8 lore raw

PATCH v3 5/8 arm: dts: rockchip: Include OTP in U-Boot pre-reloc phase for RK3576

In reply to Jonas Karlman

Update rk3576-u-boot.dtsi to include OTP in U-Boot pre-reloc phase for checkboard() to be able to read information about the running SoC model and variant from OTP and print it during boot:

U-Boot 2025.04 (Apr 22 2025 - 20:43:17 +0000)

Model: Generic RK3576
SoC: RK3576
DRAM: 8 GiB

---
v3: No change

---
 arch/arm/dts/rk3576-u-boot.dtsi | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/dts/rk3576-u-boot.dtsi +4 -0
index be99a48a630f..fb5a107f47d9 100644
@@ -49,6 +49,10 @@
 	bootph-all;
 };
 
+&otp {
+	bootph-some-ram;
+};
+
 &pcfg_pull_none {
 	bootph-all;
 };
Signature · 1 line
2.50.1
Reviewed-by on v3 5/8
#9 lore raw

Re: [PATCH v3 5/8] arm: dts: rockchip: Include OTP in U-Boot pre-reloc phase for RK3576

Quoted 11 lines · Jonas Karlman

Update rk3576-u-boot.dtsi to include OTP in U-Boot pre-reloc phase for checkboard() to be able to read information about the running SoC model and variant from OTP and print it during boot:

U-Boot 2025.04 (Apr 22 2025 - 20:43:17 +0000)

Model: Generic RK3576
SoC: RK3576
DRAM: 8 GiB

Thanks,
- Kever

Quoted 21 lines

---
v3: No change

---
  arch/arm/dts/rk3576-u-boot.dtsi | 4 ++++
  1 file changed, 4 insertions(+)
arch/arm/dts/rk3576-u-boot.dtsi +4 -0
index be99a48a630f..fb5a107f47d9 100644
@@ -49,6 +49,10 @@
  	bootph-all;
  };
 
+&otp {
+	bootph-some-ram;
+};
+
  &pcfg_pull_none {
  	bootph-all;
  };
#10 lore raw

PATCH v3 6/8 usb: dwc3-generic: Use combined glue and ctrl node for RK3576

In reply to Jonas Karlman

Like Rockchip RK3328, RK3568 and RK3588, the RK3576 also have a single node to represent the glue and ctrl for USB 3.0.

Use rk_ops as driver data to select correct ctrl node for RK3576 DWC3.

---
v3: New patch

---
 drivers/usb/dwc3/dwc3-generic.c | 1 +
 1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-generic.c +1 -0
index 3cda2b74b7e3..cdb997ea6e48 100644
@@ -699,6 +699,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
 	{ .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops },
 	{ .compatible = "rockchip,rk3399-dwc3" },
 	{ .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops },
+	{ .compatible = "rockchip,rk3576-dwc3", .data = (ulong)&rk_ops },
 	{ .compatible = "rockchip,rk3588-dwc3", .data = (ulong)&rk_ops },
 	{ .compatible = "qcom,dwc3", .data = (ulong)&qcom_ops },
 	{ .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops },
Signature · 1 line
2.50.1
Reviewed-by on v3 6/8
#11 lore raw

Re: [PATCH v3 6/8] usb: dwc3-generic: Use combined glue and ctrl node for RK3576

Quoted 6 lines · Jonas Karlman

Like Rockchip RK3328, RK3568 and RK3588, the RK3576 also have a single node to represent the glue and ctrl for USB 3.0.

Use rk_ops as driver data to select correct ctrl node for RK3576 DWC3.

Thanks,
- Kever

Quoted 18 lines

---
v3: New patch

---
  drivers/usb/dwc3/dwc3-generic.c | 1 +
  1 file changed, 1 insertion(+)
drivers/usb/dwc3/dwc3-generic.c +1 -0
index 3cda2b74b7e3..cdb997ea6e48 100644
@@ -699,6 +699,7 @@ static const struct udevice_id dwc3_glue_ids[] = {
  	{ .compatible = "rockchip,rk3328-dwc3", .data = (ulong)&rk_ops },
  	{ .compatible = "rockchip,rk3399-dwc3" },
  	{ .compatible = "rockchip,rk3568-dwc3", .data = (ulong)&rk_ops },
+	{ .compatible = "rockchip,rk3576-dwc3", .data = (ulong)&rk_ops },
  	{ .compatible = "rockchip,rk3588-dwc3", .data = (ulong)&rk_ops },
  	{ .compatible = "qcom,dwc3", .data = (ulong)&qcom_ops },
  	{ .compatible = "fsl,imx8mp-dwc3", .data = (ulong)&imx8mp_ops },
#12 lore raw

PATCH v3 7/8 phy: rockchip-inno-usb2: Add support for RK3576

In reply to Jonas Karlman

From: Frank Wang <[email protected]>

Add support for the USB2.0 PHYs used in the RK3576 SoC.

Config values are taken from vendor U-Boot linux-6.1-stan-rkr5 tag.

---
v3: New patch

---
 drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +26 -0
index a3222138b9d0..4ea6600ce7f5 100644
@@ -465,6 +465,28 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
 	{ /* sentinel */ }
 };
 
+static const struct rockchip_usb2phy_cfg rk3576_phy_cfgs[] = {
+	{
+		.reg		= 0x0000,
+		.clkout_ctl	= { 0x0008, 0, 0, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x0000, 1, 0, 2, 1 },
+			}
+		},
+	},
+	{
+		.reg		= 0x2000,
+		.clkout_ctl	= { 0x2008, 0, 0, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x2000, 1, 0, 2, 1 },
+			}
+		},
+	},
+	{ /* sentinel */ }
+};
+
 static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = {
 	{
 		.reg		= 0x0000,
@@ -526,6 +548,10 @@ static const struct udevice_id rockchip_usb2phy_ids[] = {
 		.compatible = "rockchip,rk3568-usb2phy",
 		.data = (ulong)&rk3568_phy_cfgs,
 	},
+	{
+		.compatible = "rockchip,rk3576-usb2phy",
+		.data = (ulong)&rk3576_phy_cfgs,
+	},
 	{
 		.compatible = "rockchip,rk3588-usb2phy",
 		.data = (ulong)&rk3588_phy_cfgs,
Signature · 1 line
2.50.1
Reviewed-by on v3 7/8
#13 lore raw

Re: [PATCH v3 7/8] phy: rockchip-inno-usb2: Add support for RK3576

Quoted 8 lines · Jonas Karlman

From: Frank Wang <[email protected]>

Add support for the USB2.0 PHYs used in the RK3576 SoC.

Config values are taken from vendor U-Boot linux-6.1-stan-rkr5 tag.

Thanks,
- Kever

Quoted 50 lines

---
v3: New patch

---
  drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 26 +++++++++++++++++++
  1 file changed, 26 insertions(+)
drivers/phy/rockchip/phy-rockchip-inno-usb2.c +26 -0
index a3222138b9d0..4ea6600ce7f5 100644
@@ -465,6 +465,28 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = {
  	{ /* sentinel */ }
  };
 
+static const struct rockchip_usb2phy_cfg rk3576_phy_cfgs[] = {
+	{
+		.reg		= 0x0000,
+		.clkout_ctl	= { 0x0008, 0, 0, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x0000, 1, 0, 2, 1 },
+			}
+		},
+	},
+	{
+		.reg		= 0x2000,
+		.clkout_ctl	= { 0x2008, 0, 0, 1, 0 },
+		.port_cfgs	= {
+			[USB2PHY_PORT_OTG] = {
+				.phy_sus	= { 0x2000, 1, 0, 2, 1 },
+			}
+		},
+	},
+	{ /* sentinel */ }
+};
+
  static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = {
  	{
  		.reg		= 0x0000,
@@ -526,6 +548,10 @@ static const struct udevice_id rockchip_usb2phy_ids[] = {
  		.compatible = "rockchip,rk3568-usb2phy",
  		.data = (ulong)&rk3568_phy_cfgs,
  	},
+	{
+		.compatible = "rockchip,rk3576-usb2phy",
+		.data = (ulong)&rk3576_phy_cfgs,
+	},
  	{
  		.compatible = "rockchip,rk3588-usb2phy",
  		.data = (ulong)&rk3588_phy_cfgs,
#14 lore raw

PATCH v3 8/8 phy: rockchip: usbdp: Add support for RK3576

In reply to Jonas Karlman

From: Frank Wang <[email protected]>

Add support for the USB3.0+DP PHY used in the RK3576 SoC.

Config values are taken from vendor U-Boot linux-6.1-stan-rkr5 tag.

---
v3: New patch

---
 drivers/phy/rockchip/phy-rockchip-usbdp.c | 26 +++++++++++++++++++++++
 1 file changed, 26 insertions(+)
drivers/phy/rockchip/phy-rockchip-usbdp.c +26 -0
index 6cfbef02b4ac..cca67dd3611d 100644
@@ -762,6 +762,28 @@ static const char * const rk3588_udphy_rst_l[] = {
 	"init", "cmn", "lane", "pcs_apb", "pma_apb"
 };
 
+static const struct rockchip_udphy_cfg rk3576_udphy_cfgs = {
+	.num_phys = 1,
+	.phy_ids = {
+		0x2b010000,
+	},
+	.num_rsts = ARRAY_SIZE(rk3588_udphy_rst_l),
+	.rst_list = rk3588_udphy_rst_l,
+	.grfcfg	= {
+		/* u2phy-grf */
+		.bvalid_phy_con		= { 0x0010, 1, 0, 0x2, 0x3 },
+		.bvalid_grf_con		= { 0x0000, 15, 14, 0x1, 0x3 },
+
+		/* usb-grf */
+		.usb3otg0_cfg		= { 0x0030, 15, 0, 0x1100, 0x0188 },
+
+		/* usbdpphy-grf */
+		.low_pwrn		= { 0x0004, 13, 13, 0, 1 },
+		.rx_lfps		= { 0x0004, 14, 14, 0, 1 },
+	},
+	.combophy_init = rk3588_udphy_init,
+};
+
 static const struct rockchip_udphy_cfg rk3588_udphy_cfgs = {
 	.num_phys = 2,
 	.phy_ids = {
@@ -787,6 +809,10 @@ static const struct rockchip_udphy_cfg rk3588_udphy_cfgs = {
 };
 
 static const struct udevice_id rockchip_udphy_dt_match[] = {
+	{
+		.compatible = "rockchip,rk3576-usbdp-phy",
+		.data = (ulong)&rk3576_udphy_cfgs
+	},
 	{
 		.compatible = "rockchip,rk3588-usbdp-phy",
 		.data = (ulong)&rk3588_udphy_cfgs
Signature · 1 line
2.50.1
Reviewed-by on v3 8/8
#15 lore raw

Re: [PATCH v3 8/8] phy: rockchip: usbdp: Add support for RK3576

Quoted 8 lines · Jonas Karlman

From: Frank Wang <[email protected]>

Add support for the USB3.0+DP PHY used in the RK3576 SoC.

Config values are taken from vendor U-Boot linux-6.1-stan-rkr5 tag.

Thanks,
- Kever

Quoted 50 lines

---
v3: New patch

---
  drivers/phy/rockchip/phy-rockchip-usbdp.c | 26 +++++++++++++++++++++++
  1 file changed, 26 insertions(+)
drivers/phy/rockchip/phy-rockchip-usbdp.c +26 -0
index 6cfbef02b4ac..cca67dd3611d 100644
@@ -762,6 +762,28 @@ static const char * const rk3588_udphy_rst_l[] = {
  	"init", "cmn", "lane", "pcs_apb", "pma_apb"
  };
 
+static const struct rockchip_udphy_cfg rk3576_udphy_cfgs = {
+	.num_phys = 1,
+	.phy_ids = {
+		0x2b010000,
+	},
+	.num_rsts = ARRAY_SIZE(rk3588_udphy_rst_l),
+	.rst_list = rk3588_udphy_rst_l,
+	.grfcfg	= {
+		/* u2phy-grf */
+		.bvalid_phy_con		= { 0x0010, 1, 0, 0x2, 0x3 },
+		.bvalid_grf_con		= { 0x0000, 15, 14, 0x1, 0x3 },
+
+		/* usb-grf */
+		.usb3otg0_cfg		= { 0x0030, 15, 0, 0x1100, 0x0188 },
+
+		/* usbdpphy-grf */
+		.low_pwrn		= { 0x0004, 13, 13, 0, 1 },
+		.rx_lfps		= { 0x0004, 14, 14, 0, 1 },
+	},
+	.combophy_init = rk3588_udphy_init,
+};
+
  static const struct rockchip_udphy_cfg rk3588_udphy_cfgs = {
  	.num_phys = 2,
  	.phy_ids = {
@@ -787,6 +809,10 @@ static const struct rockchip_udphy_cfg rk3588_udphy_cfgs = {
  };
 
  static const struct udevice_id rockchip_udphy_dt_match[] = {
+	{
+		.compatible = "rockchip,rk3576-usbdp-phy",
+		.data = (ulong)&rk3576_udphy_cfgs
+	},
  	{
  		.compatible = "rockchip,rk3588-usbdp-phy",
  		.data = (ulong)&rk3588_udphy_cfgs