riscv: sophgo Add PCIe support to Sophgo SG2044 SoC
Subsystems (5)
Inochi Amaoto
maintainerv3 cover riscv: sophgo Add PCIe support to Sophgo SG2044 SoC
Sophgo's SG2044 SoC uses Synopsys Designware PCIe core to implement RC mode.
For legacy interrupt, the PCIe controller on SG2044 implement its own legacy interrupt controller. For MSI/MSI-X, it use an external interrupt controller to handle.
The external MSI interrupt controller patch can be found on [1]. As SG2044 needs a mirror change to support the way to send MSI message and different irq number.
[1] https://lore.kernel.org/all/[email protected]
Changed from v2:
- https://lore.kernel.org/all/[email protected]
1. patch 1: remove "|+" for description
2. patch 1: apply Rob's tag
3. patch 2: remove empty irq_eoi and use handle_level_irq as the right irq handle function.
Changed from v1:
- https://lore.kernel.org/all/[email protected]
1. patch 1: remove dma-coherent property
2. patch 2: remove unused reset
3. patch 2: fix Kconfig menu title and reorder the entry
4. patch 2: use FIELD_GET/FIELD_PREP to simplify the code.
5. patch 2: rename the irq handle function to match the irq_chip name
Inochi Amaoto (2):
dt-bindings: pci: Add Sophgo SG2044 PCIe host
PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver
.../bindings/pci/sophgo,sg2044-pcie.yaml | 122 +++++++++ drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-dw-sophgo.c | 258 ++++++++++++++++++ 4 files changed, 391 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c
--
2.49.0
Inochi Amaoto
maintainerPATCH v3 1/2 dt-bindings: pci: Add Sophgo SG2044 PCIe host
The pcie controller on the SG2044 is designware based with custom app registers.
Add binding document for SG2044 PCIe host controller.
--- .../bindings/pci/sophgo,sg2044-pcie.yaml | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +122 -0
@@ -0,0 +1,122 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/sophgo,sg2044-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: DesignWare based PCIe Root Complex controller on Sophgo SoCs + +maintainers: + - Inochi Amaoto <[email protected]> + +description: + SG2044 SoC PCIe Root Complex controller is based on the Synopsys DesignWare + PCIe IP and thus inherits all the common properties defined in + snps,dw-pcie.yaml. + +allOf: + - $ref: /schemas/pci/pci-host-bridge.yaml# + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: sophgo,sg2044-pcie + + reg: + items: + - description: Data Bus Interface (DBI) registers + - description: iATU registers + - description: Config registers + - description: Sophgo designed configuration registers + + reg-names: + items: + - const: dbi + - const: atu + - const: config + - const: app + + clocks: + items: + - description: core clk + + clock-names: + items: + - const: core + + interrupt-controller: + description: Interrupt controller node for handling legacy PCI interrupts. + type: object + + properties: + "#address-cells": + const: 0 + + "#interrupt-cells": + const: 1 + + interrupt-controller: true + + interrupts: + items: + - description: combined legacy interrupt + + required: + - "#address-cells" + - "#interrupt-cells" + - interrupt-controller + - interrupts + + additionalProperties: false + + msi-parent: true + + ranges: + maxItems: 5 + +required: + - compatible + - reg + - clocks + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + pcie@6c00400000 { + compatible = "sophgo,sg2044-pcie"; + reg = <0x6c 0x00400000 0x0 0x00001000>, + <0x6c 0x00700000 0x0 0x00004000>, + <0x40 0x00000000 0x0 0x00001000>, + <0x6c 0x00780c00 0x0 0x00000400>; + reg-names = "dbi", "atu", "config", "app"; + #address-cells = <3>; + #size-cells = <2>; + bus-range = <0x00 0xff>; + clocks = <&clk 0>; + clock-names = "core"; + device_type = "pci"; + linux,pci-domain = <0>; + msi-parent = <&msi>; + ranges = <0x01000000 0x0 0x00000000 0x40 0x10000000 0x0 0x00200000>, + <0x42000000 0x0 0x00000000 0x0 0x00000000 0x0 0x04000000>, + <0x02000000 0x0 0x04000000 0x0 0x04000000 0x0 0x04000000>, + <0x43000000 0x42 0x00000000 0x42 0x00000000 0x2 0x00000000>, + <0x03000000 0x41 0x00000000 0x41 0x00000000 0x1 0x00000000>; + + interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + interrupt-parent = <&intc>; + interrupts = <64 IRQ_TYPE_LEVEL_HIGH>; + }; + }; + }; +...
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerPATCH v3 2/2 PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver
In reply to Inochi AmaotoAdd support for DesignWare-based PCIe controller in SG2044 SoC.
--- drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-dw-sophgo.c | 258 ++++++++++++++++++++ 3 files changed, 269 insertions(+) create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c
drivers/pci/controller/dwc/Kconfig +10 -0
@@ -402,6 +402,16 @@ config PCIE_UNIPHIER_EP Say Y here if you want PCIe endpoint controller support on UniPhier SoCs. This driver supports Pro5 SoC. +config PCIE_SOPHGO_DW + bool "Sophgo DesignWare PCIe controller" + depends on ARCH_SOPHGO || COMPILE_TEST + depends on PCI_MSI + depends on OF + select PCIE_DW_HOST + help + Enables support for the DesignWare PCIe controller in the + Sophgo SoC. + config PCIE_SPEAR13XX bool "STMicroelectronics SPEAr PCIe controller" depends on ARCH_SPEAR13XX || COMPILE_TEST
drivers/pci/controller/dwc/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_PCIE_QCOM_EP) += pcie-qcom-ep.o obj-$(CONFIG_PCIE_ARMADA_8K) += pcie-armada8k.o obj-$(CONFIG_PCIE_ARTPEC6) += pcie-artpec6.o obj-$(CONFIG_PCIE_ROCKCHIP_DW) += pcie-dw-rockchip.o +obj-$(CONFIG_PCIE_SOPHGO_DW) += pcie-dw-sophgo.o obj-$(CONFIG_PCIE_INTEL_GW) += pcie-intel-gw.o obj-$(CONFIG_PCIE_KEEMBAY) += pcie-keembay.o obj-$(CONFIG_PCIE_KIRIN) += pcie-kirin.o
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +258 -0
258 lines not on this page · raw message
Signature · 1 line
2.49.0
Inochi Amaoto
maintainerQuoted 40 lines · Inochi Amaoto
Sophgo's SG2044 SoC uses Synopsys Designware PCIe core to implement RC mode.
For legacy interrupt, the PCIe controller on SG2044 implement its own legacy interrupt controller. For MSI/MSI-X, it use an external interrupt controller to handle.
The external MSI interrupt controller patch can be found on [1]. As SG2044 needs a mirror change to support the way to send MSI message and different irq number.
[1] https://lore.kernel.org/all/[email protected]
Changed from v2:
- https://lore.kernel.org/all/[email protected]
1. patch 1: remove "|+" for description
2. patch 1: apply Rob's tag
3. patch 2: remove emptyirq_eoiand usehandle_level_irqas the right irq handle function.Changed from v1:
- https://lore.kernel.org/all/[email protected]
1. patch 1: remove dma-coherent property
2. patch 2: remove unused reset
3. patch 2: fixKconfigmenu title and reorder the entry
4. patch 2: use FIELD_GET/FIELD_PREP to simplify the code.
5. patch 2: rename the irq handle function to match theirq_chipnameInochi Amaoto (2):
dt-bindings: pci: Add Sophgo SG2044 PCIe host
PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver.../bindings/pci/sophgo,sg2044-pcie.yaml | 122 +++++++++ drivers/pci/controller/dwc/Kconfig | 10 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-dw-sophgo.c | 258 ++++++++++++++++++ 4 files changed, 391 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c
Quoted 3 lines
--
2.49.0
It is a long time for this series without any comment, I wonder that this patch could be picked for 6.16?
Regard,
Inochi
Quoted 8 lines · Inochi Amaoto
Sophgo's SG2044 SoC uses Synopsys Designware PCIe core to implement RC mode.
For legacy interrupt, the PCIe controller on SG2044 implement its own legacy interrupt controller. For MSI/MSI-X, it use an external interrupt controller to handle.
[...]
Applied, thanks!
[1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host
commit: a202f09e3e30622fdcae7d740dbf87fb0f032dd5
[2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver
commit: 74ab255bab3082fa6bd2a925a986526e093d615bBest regards,
Signature · 1 line
Manivannan Sadhasivam <[email protected]>