linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Add PCIe support to Sophgo SG2042 SoC
@ 2025-08-28  2:15 Chen Wang
  2025-08-28  2:16 ` [PATCH 1/5] dt-bindings: pci: Add Sophgo SG2042 PCIe host Chen Wang
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Chen Wang @ 2025-08-28  2:15 UTC (permalink / raw)
  To: kwilczynski, u.kleine-koenig, aou, alex, arnd, bwawrzyn, bhelgaas,
	unicorn_wang, conor+dt, 18255117159, inochiama, kishon, krzk+dt,
	lpieralisi, mani, palmer, paul.walmsley, robh, s-vadapalli, tglx,
	thomas.richard, sycamoremoon376, devicetree, linux-kernel,
	linux-pci, linux-riscv, sophgo, rabenda.cn, chao.wei,
	xiaoguang.xing, fengchun.li

From: Chen Wang <unicorn_wang@outlook.com>

Sophgo's SG2042 SoC uses Cadence PCIe core to implement RC mode.

This is a completely rewritten PCIe driver for SG2042. It inherits
some previously submitted patch codes (not merged into the upstream
mainline), but the biggest difference is that the support for
compatibility with old 32-bit PCIe devices has been removed in this
new version. This is because after discussing with community users,
we felt that there was not much demand for support for old devices,
so we made a new design based on the simplified design and practical
needs. If someone really needs to play with old devices, we can provide
them with some necessary hack patches in the downstream repository.

Since the new design is quite different from the old code, I will
release it as a new patch series. The old patch series can be found in
here [old-series].

Note, regarding [2/5] of this patchset, this fix is introduced because
the pcie->ops pointer is not filled in SG2042 PCIe driver. This is not
a must-have parameter, if we use it w/o checking will cause a null
pointer access error during runtime.

Link: https://lore.kernel.org/linux-riscv/cover.1736923025.git.unicorn_wang@outlook.com/ [old-series]

This patchset is based on v6.17-rc1.

Thanks,
Chen

---

Chen Wang (5):
  dt-bindings: pci: Add Sophgo SG2042 PCIe host
  PCI: cadence: Fix NULL pointer error for ops
  PCI: sg2042: Add Sophgo SG2042 PCIe driver
  riscv: sophgo: dts: add pcie controllers for SG2042
  riscv: sophgo: dts: enable pcie for PioneerBox

 .../bindings/pci/sophgo,sg2042-pcie-host.yaml |  66 +++++++++
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  |  12 ++
 arch/riscv/boot/dts/sophgo/sg2042.dtsi        |  66 +++++++++
 drivers/pci/controller/cadence/Kconfig        |  12 ++
 drivers/pci/controller/cadence/Makefile       |   1 +
 .../controller/cadence/pcie-cadence-host.c    |   2 +-
 drivers/pci/controller/cadence/pcie-cadence.c |   4 +-
 drivers/pci/controller/cadence/pcie-cadence.h |   6 +-
 drivers/pci/controller/cadence/pcie-sg2042.c  | 134 ++++++++++++++++++
 9 files changed, 297 insertions(+), 6 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml
 create mode 100644 drivers/pci/controller/cadence/pcie-sg2042.c


base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
-- 
2.34.1


^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH 0/5] Add PCIe support to Sophgo SG2042 SoC
@ 2024-11-11  5:59 Chen Wang
  0 siblings, 0 replies; 18+ messages in thread
From: Chen Wang @ 2024-11-11  5:59 UTC (permalink / raw)
  To: kw, u.kleine-koenig, aou, arnd, bhelgaas, unicorn_wang, conor+dt,
	guoren, inochiama, krzk+dt, lee, lpieralisi,
	manivannan.sadhasivam, palmer, paul.walmsley, pbrobinson, robh,
	devicetree, linux-kernel, linux-pci, linux-riscv, chao.wei,
	xiaoguang.xing, fengchun.li

From: Chen Wang <unicorn_wang@outlook.com>

Sophgo's SG2042 SoC uses Cadence PCIe core to implement RC mode.

SG2042 PCIe controller supports two ways to report MSI:

Method A, the PICe controller implements an MSI interrupt controller
inside, and connect to PLIC upward through one interrupt line. Provides
memory-mapped msi address, and by programming the upper 32 bits of the
address to zero, it can be compatible with old pcie devices that only
support 32-bit msi address.

Method B, the PICe controller connects to PLIC upward through an
independent MSI controller "sophgo,sg2042-msi" on the SOC. The MSI
controller provides multiple(up to 32) interrupt sources to PLIC.
Compared with the first method, the advantage is that the interrupt
source is expanded, but because for SG2042, the msi address provided
by the MSI controller is fixed and only supports 64-bit address(> 2^32),
it is not compatible with old pcie devices that only support 32-bit
msi address.

This patchset depends on another patchset for the SG2042 MSI controller[msi].
If you need to test the DTS part, you need to apply the corresponding
patchset.

Link: https://lore.kernel.org/linux-riscv/cover.1731296803.git.unicorn_wang@outlook.com/ [msi]

Thanks,
Chen

Chen Wang (5):
  dt-bindings: pci: Add Sophgo SG2042 PCIe host
  PCI: sg2042: Add Sophgo SG2042 PCIe driver
  dt-bindings: mfd: syscon: Add sg2042 pcie ctrl compatible
  riscv: sophgo: dts: add pcie controllers for SG2042
  riscv: sophgo: dts: enable pcie for PioneerBox

 .../devicetree/bindings/mfd/syscon.yaml       |   2 +
 .../bindings/pci/sophgo,sg2042-pcie-host.yaml |  88 +++
 .../boot/dts/sophgo/sg2042-milkv-pioneer.dts  |  12 +
 arch/riscv/boot/dts/sophgo/sg2042.dtsi        |  82 +++
 drivers/pci/controller/cadence/Kconfig        |  11 +
 drivers/pci/controller/cadence/Makefile       |   1 +
 drivers/pci/controller/cadence/pcie-sg2042.c  | 611 ++++++++++++++++++
 7 files changed, 807 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2042-pcie-host.yaml
 create mode 100644 drivers/pci/controller/cadence/pcie-sg2042.c


base-commit: 2d5404caa8c7bb5c4e0435f94b28834ae5456623
-- 
2.34.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-09-01  6:17 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28  2:15 [PATCH 0/5] Add PCIe support to Sophgo SG2042 SoC Chen Wang
2025-08-28  2:16 ` [PATCH 1/5] dt-bindings: pci: Add Sophgo SG2042 PCIe host Chen Wang
2025-08-29 17:13   ` Rob Herring (Arm)
2025-08-31  4:47   ` Manivannan Sadhasivam
2025-09-01  6:17     ` Chen Wang
2025-08-28  2:17 ` [PATCH 2/5] PCI: cadence: Fix NULL pointer error for ops Chen Wang
2025-08-28 21:43   ` Bjorn Helgaas
2025-08-29  0:16     ` Chen Wang
2025-08-28  2:17 ` [PATCH 3/5] PCI: sg2042: Add Sophgo SG2042 PCIe driver Chen Wang
2025-08-28 11:18   ` ALOK TIWARI
2025-08-29  0:12     ` Chen Wang
2025-08-29 17:09   ` Rob Herring
2025-08-30  1:42     ` Chen Wang
2025-08-31  4:45   ` Manivannan Sadhasivam
2025-09-01  6:00     ` Chen Wang
2025-08-28  2:18 ` [PATCH 4/5] riscv: sophgo: dts: add pcie controllers for SG2042 Chen Wang
2025-08-28  2:18 ` [PATCH 5/5] riscv: sophgo: dts: enable pcie for PioneerBox Chen Wang
  -- strict thread matches above, loose matches on Subject: below --
2024-11-11  5:59 [PATCH 0/5] Add PCIe support to Sophgo SG2042 SoC Chen Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).