Skip to contentSkip to conversation

Add PCIe support in DTS for Sophgo SG2042 SoC

PATCH Applied Chen Wang 4 participants 10 messages Oct 20, 2025 – Nov 1, 2025

Subsystems (3)
lore
Share & tools
lore

Chen Wang

author
#0 lore raw

cover Add PCIe support in DTS for Sophgo SG2042 SoC

From: Chen Wang <[email protected]>

This new patch set is a continuation of the previous patchset "[PATCH v3 0/7] Add PCIe support to Sophgo SG2042 SoC" [1].

The drivers and bindings have already been merged into the kernel mainline, and this patchset will focus on submitting the remaining DTS changes into the mainline.

This patchset is based on v6.18-rc1 and the only changes since v3 is a fix to address the comments from Manivannan Sadhasivam to make sure PCI address of the I/O port to start from 0.

Chen Wang (4):
riscv: sophgo: dts: add PCIe controllers for SG2042
riscv: sophgo: dts: enable PCIe for PioneerBox
riscv: sophgo: dts: enable PCIe for SG2042_EVB_V1.X
riscv: sophgo: dts: enable PCIe for SG2042_EVB_V2.0

 arch/riscv/boot/dts/sophgo/sg2042-evb-v1.dts  | 12 +++
 arch/riscv/boot/dts/sophgo/sg2042-evb-v2.dts  | 12 +++
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  | 12 +++
 arch/riscv/boot/dts/sophgo/sg2042.dtsi        | 88 +++++++++++++++++++
 4 files changed, 124 insertions(+)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

Signature · 1 line
2.34.1
author
#1 lore raw

PATCH 1/4 riscv: sophgo: dts: add PCIe controllers for SG2042

From: Chen Wang <[email protected]>

Add PCIe controller nodes in DTS for Sophgo SG2042. Default they are disabled.

---
 arch/riscv/boot/dts/sophgo/sg2042.dtsi | 88 ++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042.dtsi +88 -0
index c5e49709b308..85d8b89cf9fc 100644
@@ -240,6 +240,94 @@ clkgen: clock-controller@7030012000 {
 			#clock-cells = <1>;
 		};
 
+		pcie_rc0: pcie@7060000000 {
+			compatible = "sophgo,sg2042-pcie-host";
+			device_type = "pci";
+			reg = <0x70 0x60000000  0x0 0x00800000>,
+			      <0x40 0x00000000  0x0 0x00001000>;
+			reg-names = "reg", "cfg";
+			linux,pci-domain = <0>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			ranges = <0x01000000 0x0  0x00000000  0x40 0xc0000000  0x0 0x00400000>,
+				 <0x42000000 0x0  0xd0000000  0x40 0xd0000000  0x0 0x10000000>,
+				 <0x02000000 0x0  0xe0000000  0x40 0xe0000000  0x0 0x20000000>,
+				 <0x43000000 0x42 0x00000000  0x42 0x00000000  0x2 0x00000000>,
+				 <0x03000000 0x41 0x00000000  0x41 0x00000000  0x1 0x00000000>;
+			bus-range = <0x0 0xff>;
+			vendor-id = <0x1f1c>;
+			device-id = <0x2042>;
+			cdns,no-bar-match-nbits = <48>;
+			msi-parent = <&msi>;
+			status = "disabled";
+		};
+
+		pcie_rc1: pcie@7060800000 {
+			compatible = "sophgo,sg2042-pcie-host";
+			device_type = "pci";
+			reg = <0x70 0x60800000  0x0 0x00800000>,
+			      <0x44 0x00000000  0x0 0x00001000>;
+			reg-names = "reg", "cfg";
+			linux,pci-domain = <1>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			ranges = <0x01000000 0x0  0x00000000  0x44 0xc0400000  0x0 0x00400000>,
+				 <0x42000000 0x0  0xd0000000  0x44 0xd0000000  0x0 0x10000000>,
+				 <0x02000000 0x0  0xe0000000  0x44 0xe0000000  0x0 0x20000000>,
+				 <0x43000000 0x46 0x00000000  0x46 0x00000000  0x2 0x00000000>,
+				 <0x03000000 0x45 0x00000000  0x45 0x00000000  0x1 0x00000000>;
+			bus-range = <0x0 0xff>;
+			vendor-id = <0x1f1c>;
+			device-id = <0x2042>;
+			cdns,no-bar-match-nbits = <48>;
+			msi-parent = <&msi>;
+			status = "disabled";
+		};
+
+		pcie_rc2: pcie@7062000000 {
+			compatible = "sophgo,sg2042-pcie-host";
+			device_type = "pci";
+			reg = <0x70 0x62000000  0x0 0x00800000>,
+			      <0x48 0x00000000  0x0 0x00001000>;
+			reg-names = "reg", "cfg";
+			linux,pci-domain = <2>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			ranges = <0x01000000 0x0  0x00000000  0x48 0xc0800000  0x0 0x00400000>,
+				 <0x42000000 0x0  0xd0000000  0x48 0xd0000000  0x0 0x10000000>,
+				 <0x02000000 0x0  0xe0000000  0x48 0xe0000000  0x0 0x20000000>,
+				 <0x03000000 0x49 0x00000000  0x49 0x00000000  0x1 0x00000000>,
+				 <0x43000000 0x4a 0x00000000  0x4a 0x00000000  0x2 0x00000000>;
+			bus-range = <0x0 0xff>;
+			vendor-id = <0x1f1c>;
+			device-id = <0x2042>;
+			cdns,no-bar-match-nbits = <48>;
+			msi-parent = <&msi>;
+			status = "disabled";
+		};
+
+		pcie_rc3: pcie@7062800000 {
+			compatible = "sophgo,sg2042-pcie-host";
+			device_type = "pci";
+			reg = <0x70 0x62800000  0x0 0x00800000>,
+			      <0x4c 0x00000000  0x0 0x00001000>;
+			reg-names = "reg", "cfg";
+			linux,pci-domain = <3>;
+			#address-cells = <3>;
+			#size-cells = <2>;
+			ranges = <0x01000000 0x0  0x00000000  0x4c 0xc0c00000  0x0 0x00400000>,
+				 <0x42000000 0x0  0xf8000000  0x4c 0xf8000000  0x0 0x04000000>,
+				 <0x02000000 0x0  0xfc000000  0x4c 0xfc000000  0x0 0x04000000>,
+				 <0x43000000 0x4e 0x00000000  0x4e 0x00000000  0x2 0x00000000>,
+				 <0x03000000 0x4d 0x00000000  0x4d 0x00000000  0x1 0x00000000>;
+			bus-range = <0x0 0xff>;
+			vendor-id = <0x1f1c>;
+			device-id = <0x2042>;
+			cdns,no-bar-match-nbits = <48>;
+			msi-parent = <&msi>;
+			status = "disabled";
+		};
+
 		clint_mswi: interrupt-controller@7094000000 {
 			compatible = "sophgo,sg2042-aclint-mswi", "thead,c900-aclint-mswi";
 			reg = <0x00000070 0x94000000 0x00000000 0x00004000>;
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH 2/4 riscv: sophgo: dts: enable PCIe for PioneerBox

In reply to Chen Wang

From: Chen Wang <[email protected]>

Enable PCIe controllers for PioneerBox, which uses SG2042 SoC.

---
 arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts +12 -0
index ef3a602172b1..c4d5f8d7d4ad 100644
@@ -128,6 +128,18 @@ uart0-rx-pins {
 	};
 };
 
+&pcie_rc0 {
+	status = "okay";
+};
+
+&pcie_rc2 {
+	status = "okay";
+};
+
+&pcie_rc3 {
+	status = "okay";
+};
+
 &sd {
 	pinctrl-0 = <&sd_cfg>;
 	pinctrl-names = "default";
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/4 riscv: sophgo: dts: enable PCIe for SG2042_EVB_V1.X

In reply to Chen Wang

From: Chen Wang <[email protected]>

Enable PCIe controllers for Sophgo SG2042_EVB_V1.X board, which uses SG2042 SoC.

---
 arch/riscv/boot/dts/sophgo/sg2042-evb-v1.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-evb-v1.dts +12 -0
index 3320bc1dd2c6..a186d036cf36 100644
@@ -164,6 +164,18 @@ phy0: phy@0 {
 	};
 };
 
+&pcie_rc0 {
+	status = "okay";
+};
+
+&pcie_rc1 {
+	status = "okay";
+};
+
+&pcie_rc2 {
+	status = "okay";
+};
+
 &pinctrl {
 	emmc_cfg: sdhci-emmc-cfg {
 		sdhci-emmc-wp-pins {
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 4/4 riscv: sophgo: dts: enable PCIe for SG2042_EVB_V2.0

In reply to Chen Wang

From: Chen Wang <[email protected]>

Enable PCIe controllers for Sophgo SG2042_EVB_V2.0 board, which uses SG2042 SoC.

---
 arch/riscv/boot/dts/sophgo/sg2042-evb-v2.dts | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/riscv/boot/dts/sophgo/sg2042-evb-v2.dts +12 -0
index 46980e41b886..0cd0dc0f537c 100644
@@ -152,6 +152,18 @@ phy0: phy@0 {
 	};
 };
 
+&pcie_rc0 {
+	status = "okay";
+};
+
+&pcie_rc1 {
+	status = "okay";
+};
+
+&pcie_rc2 {
+	status = "okay";
+};
+
 &pinctrl {
 	emmc_cfg: sdhci-emmc-cfg {
 		sdhci-emmc-wp-pins {
Signature · 1 line
2.34.1
#5 lore raw
In reply to Chen Wang

hi, Han Gao,

Please help test this out on EVB, I don't have those boards and just tested with my pinoeerbox.

Thanks,

Chen

Quoted 29 lines · Chen Wang

From: Chen Wang <[email protected]>

This new patch set is a continuation of the previous patchset "[PATCH v3 0/7] Add PCIe support to Sophgo SG2042 SoC" [1].

The drivers and bindings have already been merged into the kernel mainline, and this patchset will focus on submitting the remaining DTS changes into the mainline.

This patchset is based on v6.18-rc1 and the only changes since v3 is a fix to address the comments from Manivannan Sadhasivam to make sure PCI address of the I/O port to start from 0.

Chen Wang (4):
riscv: sophgo: dts: add PCIe controllers for SG2042
riscv: sophgo: dts: enable PCIe for PioneerBox
riscv: sophgo: dts: enable PCIe for SG2042_EVB_V1.X
riscv: sophgo: dts: enable PCIe for SG2042_EVB_V2.0

  arch/riscv/boot/dts/sophgo/sg2042-evb-v1.dts  | 12 +++
  arch/riscv/boot/dts/sophgo/sg2042-evb-v2.dts  | 12 +++
  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  | 12 +++
  arch/riscv/boot/dts/sophgo/sg2042.dtsi        | 88 +++++++++++++++++++
  4 files changed, 124 insertions(+)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

#6 lore raw
Quoted 40 lines · Chen Wang

hi, Han Gao,

Please help test this out on EVB, I don't have those boards and just tested with my pinoeerbox.

Thanks,

Chen

Quoted 29 lines · Chen Wang

From: Chen Wang <[email protected]>

This new patch set is a continuation of the previous patchset "[PATCH v3 0/7] Add PCIe support to Sophgo SG2042 SoC" [1].

The drivers and bindings have already been merged into the kernel mainline, and this patchset will focus on submitting the remaining DTS changes into the mainline.

This patchset is based on v6.18-rc1 and the only changes since v3 is a fix to address the comments from Manivannan Sadhasivam to make sure PCI address of the I/O port to start from 0.

Chen Wang (4):
riscv: sophgo: dts: add PCIe controllers for SG2042
riscv: sophgo: dts: enable PCIe for PioneerBox
riscv: sophgo: dts: enable PCIe for SG2042_EVB_V1.X
riscv: sophgo: dts: enable PCIe for SG2042_EVB_V2.0

  arch/riscv/boot/dts/sophgo/sg2042-evb-v1.dts  | 12 +++
  arch/riscv/boot/dts/sophgo/sg2042-evb-v2.dts  | 12 +++
  .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  | 12 +++
  arch/riscv/boot/dts/sophgo/sg2042.dtsi        | 88 +++++++++++++++++++
  4 files changed, 124 insertions(+)

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

EVB1.X/2.0 can be started normally.

#7 lore raw

On 10/25/2025 7:58 PM, Han Gao wrote:
[......]

Quoted 2 lines
Quoted 1 line
Quoted 1 line

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

EVB1.X/2.0 can be started normally.

Thank you, Han.

Inochi, please add "Tested-by: Han Gao <[email protected]>" when you pick this patchset for next.

Regards,

Chen

maintainer Tested-by Han Gao
#8 lore raw
Quoted 11 lines · Chen Wang

On 10/25/2025 7:58 PM, Han Gao wrote:
[......]

Quoted 2 lines
Quoted 1 line
Quoted 1 line

base-commit: 3a8660878839faadb4f1a6dd72c3179c1df56787

EVB1.X/2.0 can be started normally.

Thank you, Han.

Inochi, please add "Tested-by: Han Gao <[email protected]>" when you pick this patchset for next.

Just add the tag is fine and no quote, I can collect the tag with b4.

Like this.

Regards,
Inochi

maintainer Applied
#9 lore raw
In reply to Chen Wang
Quoted 10 lines · Chen Wang

From: Chen Wang <[email protected]>

This new patch set is a continuation of the previous patchset "[PATCH v3 0/7] Add PCIe support to Sophgo SG2042 SoC" [1].

The drivers and bindings have already been merged into the kernel mainline, and this patchset will focus on submitting the remaining DTS changes into the mainline.

[...]

Applied to dt/riscv, thanks!

[1/4] riscv: sophgo: dts: add PCIe controllers for SG2042

      https://github.com/sophgo/linux/commit/4e27aca4881ace1e9a812fc2c88b33dd84e29993
[2/4] riscv: sophgo: dts: enable PCIe for PioneerBox
      https://github.com/sophgo/linux/commit/b85ad0d06a19de95d41f91162389a1bbb461a405
[3/4] riscv: sophgo: dts: enable PCIe for SG2042_EVB_V1.X
      https://github.com/sophgo/linux/commit/c6c215099e89b1eb71ed6592163ae5b530f4538e
[4/4] riscv: sophgo: dts: enable PCIe for SG2042_EVB_V2.0
      https://github.com/sophgo/linux/commit/579d6526aa43a155c8685a88ef8350a8c29afa47

Thanks,
Inochi