Skip to contentSkip to conversation

riscv: sophgo Add PCIe support to Sophgo SG2044 SoC

PATCH In review Inochi Amaoto 4 participants 21 messages Feb 21, 2025 – Mar 5, 2025

Subsystems (5)
lore
Share & tools
lore

Inochi Amaoto

author maintainer
#0 lore raw

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]/

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      | 125 ++++++++
 drivers/pci/controller/dwc/Kconfig            |  10 +
 drivers/pci/controller/dwc/Makefile           |   1 +
 drivers/pci/controller/dwc/pcie-dw-sophgo.c   | 282 ++++++++++++++++++
 4 files changed, 418 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
 create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c

--
2.48.1

author maintainer
#1 lore raw

PATCH 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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +125 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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
+
+  dma-coherent: true
+
+  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";
+        dma-coherent;
+        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.48.1
#2 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Cheers,
Conor.

Quoted 81 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +78 -0
+
+  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";
+        dma-coherent;
+        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.48.1
author maintainer
#3 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 69 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 3 lines

Cheers,
Conor.

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent. So I add dma-coherent to the binding. I wonder whether dma-coherent is necessary even in this case?

Regards,
Inochi

#4 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 70 lines · Inochi Amaoto
Quoted 60 lines · Conor Dooley
Quoted 59 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +42 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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
+
Quoted 8 lines

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 5 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +5 -0
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent? IMO, that should not be done if there are devices on it that are coherent.

Quoted 2 lines

So I add dma-coherent to the binding. I
wonder whether dma-coherent is necessary even in this case?

author maintainer
#5 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Regards,
Inochi

#6 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 81 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 6 lines
Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices. That said, Is the PCIe controller actually on the same bus as the other devices? (Not talking about the same DT node, the actual bus in the device)

author maintainer
#7 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 82 lines · Conor Dooley
Quoted 81 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices.

I think this is OK for me.

Quoted 3 lines

That said, Is the PCIe controller actually on the same bus as the other devices? (Not talking about the same DT node, the actual bus in the device)

It share the same bus with other device, but on a different master interface.

Regards,
Inochi

author maintainer
#8 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 86 lines · Inochi Amaoto
Quoted 85 lines · Conor Dooley
Quoted 84 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices.

I think this is OK for me.

In technical, I wonder a better way to "handle dma-noncoherent". In the binding check, all devices with this property complains

"Unevaluated properties are not allowed ('dma-noncoherent' was unexpected)"

It is a pain as at least 10 devices' binding need to be modified. So I wonder whether there is a way to simplify this.

Regars,
Inochi

author maintainer
#9 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 96 lines · Inochi Amaoto
Quoted 86 lines · Inochi Amaoto
Quoted 85 lines · Conor Dooley
Quoted 84 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices.

I think this is OK for me.

Quoted 9 lines

In technical, I wonder a better way to "handle dma-noncoherent". In the binding check, all devices with this property complains

"Unevaluated properties are not allowed ('dma-noncoherent' was unexpected)"

It is a pain as at least 10 devices' binding need to be modified. So I wonder whether there is a way to simplify this.

Ignore this, I misunderstood the dma device. it seems like only dmac and eth needs it.

Regards,
Inochi

#10 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 103 lines · Inochi Amaoto
Quoted 101 lines · Inochi Amaoto
Quoted 86 lines · Inochi Amaoto
Quoted 85 lines · Conor Dooley
Quoted 84 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices.

I think this is OK for me.

In technical, I wonder a better way to "handle dma-noncoherent". In the binding check, all devices with this property complains

"Unevaluated properties are not allowed ('dma-noncoherent' was unexpected)"

Quoted 6 lines
Quoted 3 lines

It is a pain as at least 10 devices' binding need to be modified. So I wonder whether there is a way to simplify this.

Ignore this, I misunderstood the dma device. it seems like only dmac and eth needs it.

Nah, not gonna ignore it ;) You do make a valid point about it being painful, but given you mention a different master for the pci device, having two different soc@<foo> nodes sounds like it might make sense. One marked dma-noncoherent w/ the existing devices and one that is unmarked (since that's default) to represent the master than pci is on?

author maintainer
#11 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 108 lines · Conor Dooley
Quoted 107 lines · Inochi Amaoto
Quoted 105 lines · Inochi Amaoto
Quoted 86 lines · Inochi Amaoto
Quoted 85 lines · Conor Dooley
Quoted 84 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices.

I think this is OK for me.

In technical, I wonder a better way to "handle dma-noncoherent". In the binding check, all devices with this property complains

"Unevaluated properties are not allowed ('dma-noncoherent' was unexpected)"

It is a pain as at least 10 devices' binding need to be modified. So I wonder whether there is a way to simplify this.

Quoted 8 lines
Quoted 2 lines

Ignore this, I misunderstood the dma device. it seems like only dmac and eth needs it.

Nah, not gonna ignore it ;) You do make a valid point about it being painful, but given you mention a different master for the pci device, having two different soc@<foo> nodes sounds like it might make sense. One marked dma-noncoherent w/ the existing devices and one that is unmarked (since that's default) to represent the master than pci is on?

Yeah, That make sense. I think it serves as a better way for SG2044.

Regards,
Inochi

author maintainer
#12 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

In reply to Conor Dooley
Quoted 108 lines · Conor Dooley
Quoted 107 lines · Inochi Amaoto
Quoted 105 lines · Inochi Amaoto
Quoted 86 lines · Inochi Amaoto
Quoted 85 lines · Conor Dooley
Quoted 84 lines · Inochi Amaoto
Quoted 71 lines · Conor Dooley
Quoted 70 lines · Inochi Amaoto
Quoted 68 lines · Conor Dooley
Quoted 54 lines · Inochi Amaoto

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      | 125 ++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +37 -0
new file mode 100644
index 000000000000..040dabe905e0
@@ -0,0 +1,125 @@
+# 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

Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml line 47

Quoted 10 lines
Documentation/devicetree/bindings/pci/sophgo,sg2044-pcie.yaml new file +10 -0
+
+  clocks:
+    items:
+      - description: core clk
+
+  clock-names:
+    items:
+      - const: core
+
+  dma-coherent: true

Why's this here? RISC-V is dma-coherent by default, with dma-noncoherent used to indicate systems/devices that are not.

Quoted 5 lines
Quoted 2 lines

The PCIe is dma coherent, but the SoC itself is marked as dma-noncoherent.

By "the SoC itself", do you mean that the bus that this device is on is marked as dma-noncoherent?

Yeah, I was told only PCIe device on SG2044 is dma coherent. The others are not.

Quoted 2 lines

IMO, that should not be done if there are devices on it that are coherent.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

It is OK for me. But I wonder how to handle the non coherent device in DT? Just Mark the bus coherent and mark all devices except the PCIe device non coherent?

Don't mark the bus anything (default is coherent) and mark the devices.

I think this is OK for me.

In technical, I wonder a better way to "handle dma-noncoherent". In the binding check, all devices with this property complains

"Unevaluated properties are not allowed ('dma-noncoherent' was unexpected)"

It is a pain as at least 10 devices' binding need to be modified. So I wonder whether there is a way to simplify this.

Quoted 8 lines
Quoted 2 lines

Ignore this, I misunderstood the dma device. it seems like only dmac and eth needs it.

Nah, not gonna ignore it ;) You do make a valid point about it being painful, but given you mention a different master for the pci device, having two different soc@<foo> nodes sounds like it might make sense. One marked dma-noncoherent w/ the existing devices and one that is unmarked (since that's default) to represent the master than pci is on?

Hi, Conor,

After some testing. It has some new problems. As the pcie register area and ranges mapping are not isolated. It is a disaster to figure the right mapping. If writing this with soc ranges, the thing may look like the following:

/* this is for pcie */

soc@6c00000000 {
		 /* pcie ip register area */
	ranges = <0x6c 0x00000000 0x6c 0x00000000 0x0  0xc0000000>,
		 /* pcie vendor registes area and other mapping */
		 <0x40 0x00000000 0x40 0x00000000 0x28 0x00000000>,
		 /* for 32 bit memory */
		 <0x0  0x00000000 0x0  0x00000000 0x0  0x70000000>;
};

/* this is for others */

soc@6800000000 {
		 /* clint and some peripherals */
	ranges = <0x68 0x00000000 0x68 0x00000000 0x4  0x0000000>,
		 /* other peripherals */
		 <0x6d 0x00000000 0x6d 0x00000000 0x13 0x00000040>,
		 /* this one is for the external msi controller */
		 <0x0  0x7ee00000 0x0  0x7ee00000 0x0  0x00000040>;
	dma-noncoherent;
};

It is complete a mess. I think it is more clear to just make the dmac and eth device as noncoherent, and use one soc bus for all. Do you have any suggestions on it?

Regards,
Inochi

#13 lore raw

Re: [PATCH 1/2] dt-bindings: pci: Add Sophgo SG2044 PCIe host

Quoted 3 lines · Inochi Amaoto

It is complete a mess. I think it is more clear to just make the dmac and eth device as noncoherent, and use one soc bus for all. Do you have any suggestions on it?

If splitting is worse for read/usability, then yes, keep it as one bus.

author maintainer
#14 lore raw

PATCH 2/2 PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

In reply to Inochi Amaoto

Add 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 | 282 ++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c
drivers/pci/controller/dwc/Kconfig +10 -0
index b6d6778b0698..202014acf260 100644
@@ -341,6 +341,16 @@ config PCIE_ROCKCHIP_DW_EP
 	  Enables support for the DesignWare PCIe controller in the
 	  Rockchip SoC (except RK3399) to work in endpoint mode.
 
+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 PCI_EXYNOS
 	tristate "Samsung Exynos PCIe controller"
 	depends on ARCH_EXYNOS || COMPILE_TEST
drivers/pci/controller/dwc/Makefile +1 -0
index a8308d9ea986..193150056dd3 100644
@@ -18,6 +18,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 +282 -0

282 lines not on this page · raw message

Signature · 1 line
2.48.1
#15 lore raw

Re: [PATCH 2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

Quoted 10 lines · Inochi Amaoto

Add 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 | 282 ++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c

[...]

Quoted 13 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +7 -0
new file mode 100644
index 000000000000..a4ca4f1e26e0
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PCIe host controller driver for Sophgo SoCs.
+ *
+ */
+
+#include <linux/clk.h>

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 17

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+#include <linux/gpio/consumer.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/phy/phy.h>
+#include <linux/property.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>

Drop this ...

Quoted 14 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +14 -0
+
+#include "pcie-designware.h"
+
+#define to_sophgo_pcie(x)		dev_get_drvdata((x)->dev)
+
+#define PCIE_INT_SIGNAL			0xc48
+#define PCIE_INT_EN			0xca0
+
+#define PCIE_SIGNAL_INTX_SHIFT		5
+
+#define PCIE_INT_EN_INTX_SHIFT		1
+#define PCIE_INT_EN_INT_SII		BIT(0)
+#define PCIE_INT_EN_INT_INTA		BIT(1)
+#define PCIE_INT_EN_INT_INTB		BIT(2)

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 41

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+#define PCIE_INT_EN_INT_INTC		BIT(3)
+#define PCIE_INT_EN_INT_INTD		BIT(4)
+#define PCIE_INT_EN_INT_MSI		BIT(5)
+
+struct sophgo_pcie {
+	struct dw_pcie pci;
+	void __iomem *app_base;
+	struct clk_bulk_data *clks;
+	unsigned int clk_cnt;
+	struct reset_control *rst;

... and this. It is unused.

regards
Philipp

author maintainer
#16 lore raw

Re: [PATCH 2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

Quoted 66 lines · Philipp Zabel
Quoted 10 lines · Inochi Amaoto

Add 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 | 282 ++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 drivers/pci/controller/dwc/pcie-dw-sophgo.c

[...]

Quoted 13 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +7 -0
new file mode 100644
index 000000000000..a4ca4f1e26e0
@@ -0,0 +1,282 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PCIe host controller driver for Sophgo SoCs.
+ *
+ */
+
+#include <linux/clk.h>

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 17

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+#include <linux/gpio/consumer.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/phy/phy.h>
+#include <linux/property.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>

Drop this ...

Quoted 14 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +14 -0
+
+#include "pcie-designware.h"
+
+#define to_sophgo_pcie(x)		dev_get_drvdata((x)->dev)
+
+#define PCIE_INT_SIGNAL			0xc48
+#define PCIE_INT_EN			0xca0
+
+#define PCIE_SIGNAL_INTX_SHIFT		5
+
+#define PCIE_INT_EN_INTX_SHIFT		1
+#define PCIE_INT_EN_INT_SII		BIT(0)
+#define PCIE_INT_EN_INT_INTA		BIT(1)
+#define PCIE_INT_EN_INT_INTB		BIT(2)

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 41

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+#define PCIE_INT_EN_INT_INTC		BIT(3)
+#define PCIE_INT_EN_INT_INTD		BIT(4)
+#define PCIE_INT_EN_INT_MSI		BIT(5)
+
+struct sophgo_pcie {
+	struct dw_pcie pci;
+	void __iomem *app_base;
+	struct clk_bulk_data *clks;
+	unsigned int clk_cnt;
+	struct reset_control *rst;

... and this. It is unused.

Quoted 2 lines

regards
Philipp

Thanks, I will remove this.

Regards,
Inochi

#17 lore raw

Re: [PATCH 2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

In reply to Inochi Amaoto

drivers/pci/controller/dwc/Kconfig config PCIE_ROCKCHIP_DW_EP · line 345

Quoted 8 lines · Inochi Amaoto

Add support for DesignWare-based PCIe controller in SG2044 SoC.

drivers/pci/controller/dwc/Kconfig +2 -0
@@ -341,6 +341,16 @@ config PCIE_ROCKCHIP_DW_EP
 	  Enables support for the DesignWare PCIe controller in the
 	  Rockchip SoC (except RK3399) to work in endpoint mode.
 
+config PCIE_SOPHGO_DW
+	bool "SOPHGO DesignWare PCIe controller"

What's the canonical styling of "SOPHGO"? I see "Sophgo" in the subject line and in Chen Wang's SG2042 series. Pick the official styling and use it consistently.

Reorder this so the menuconfig menu items remain alphabetically sorted.

Quoted 5 lines
drivers/pci/controller/dwc/Kconfig +5 -0
+	depends on ARCH_SOPHGO || COMPILE_TEST
+	depends on PCI_MSI
+	depends on OF
+	select PCIE_DW_HOST
+	help

drivers/pci/controller/dwc/Kconfig config PCIE_ROCKCHIP_DW_EP

Quoted 10 lines
drivers/pci/controller/dwc/Kconfig +6 -0
+	  Enables support for the DesignWare PCIe controller in the
+	  SOPHGO SoC.
+
 config PCI_EXYNOS
 	tristate "Samsung Exynos PCIe controller"
 	depends on ARCH_EXYNOS || COMPILE_TEST
 
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PCIe host controller driver for Sophgo SoCs.

Looks too generic, since Chen Wang's series says Sophgo SG2042 SoC is Cadence-based, so this driver apparently doesn't cover all Sophgo SoCs.

Quoted 1 line

+ *

Spurious blank line.

Quoted 13 lines

+ */

drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +12 -0
+
+#include <linux/clk.h>
+#include <linux/gpio/consumer.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/phy/phy.h>
+#include <linux/property.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 28

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+
+#include "pcie-designware.h"
+
+#define to_sophgo_pcie(x)		dev_get_drvdata((x)->dev)
+
+#define PCIE_INT_SIGNAL			0xc48
+#define PCIE_INT_EN			0xca0
+
+#define PCIE_SIGNAL_INTX_SHIFT		5
+#define PCIE_INT_EN_INTX_SHIFT		1

Define masks with GENMASK() and get rid of the _SHIFT #defines.

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 33

Quoted 5 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +5 -0
+#define PCIE_INT_EN_INT_SII		BIT(0)
+#define PCIE_INT_EN_INT_INTA		BIT(1)
+#define PCIE_INT_EN_INT_INTB		BIT(2)
+#define PCIE_INT_EN_INT_INTC		BIT(3)
+#define PCIE_INT_EN_INT_INTD		BIT(4)

These are unused, drop them.

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 42

Quoted 9 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +9 -0
+#define PCIE_INT_EN_INT_MSI		BIT(5)
+
+struct sophgo_pcie {
+	struct dw_pcie pci;
+	void __iomem *app_base;
+	struct clk_bulk_data *clks;
+	unsigned int clk_cnt;
+	struct reset_control *rst;
+	struct irq_domain *irq_domain;

Indent the member names to align vertically as most other drivers do.

Quoted 16 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +16 -0
+};
+
+static int sophgo_pcie_readl_app(struct sophgo_pcie *sophgo, u32 reg)
+{
+	return readl_relaxed(sophgo->app_base + reg);
+}
+
+static void sophgo_pcie_writel_app(struct sophgo_pcie *sophgo, u32 val, u32 reg)
+{
+	writel_relaxed(val, sophgo->app_base + reg);
+}
+
+static void sophgo_pcie_intx_handler(struct irq_desc *desc)
+{
+	struct dw_pcie_rp *pp = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 68

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sophgo_pcie *sophgo = to_sophgo_pcie(pci);
+	unsigned long hwirq = PCIE_SIGNAL_INTX_SHIFT;
+	unsigned long reg;
+
+	chained_irq_enter(chip, desc);
+
+	reg = sophgo_pcie_readl_app(sophgo, PCIE_INT_SIGNAL);
+
+	for_each_set_bit_from(hwirq, &reg, PCI_NUM_INTX + PCIE_SIGNAL_INTX_SHIFT)

Use FIELD_GET() here and iterate through PCI_NUM_INTX. Then you don't need for_each_set_bit_from() and shouldn't need PCIE_SIGNAL_INTX_SHIFT here and below.

Quoted 8 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +8 -0
+		generic_handle_domain_irq(sophgo->irq_domain,
+					  hwirq - PCIE_SIGNAL_INTX_SHIFT);
+
+	chained_irq_exit(chip, desc);
+}
+
+static void sophgo_intx_mask(struct irq_data *d)
+{

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 86

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+	struct dw_pcie_rp *pp = irq_data_get_irq_chip_data(d);
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sophgo_pcie *sophgo = to_sophgo_pcie(pci);
+	unsigned long flags;
+	u32 val;
+
+	raw_spin_lock_irqsave(&pp->lock, flags);
+
+	val = sophgo_pcie_readl_app(sophgo, PCIE_INT_EN);
+	val &= ~BIT(d->hwirq + PCIE_INT_EN_INTX_SHIFT);

FIELD_PREP().

Quoted 7 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +7 -0
+	sophgo_pcie_writel_app(sophgo, val, PCIE_INT_EN);
+
+	raw_spin_unlock_irqrestore(&pp->lock, flags);
+};
+
+static void sophgo_intx_unmask(struct irq_data *d)
+{

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 103

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+	struct dw_pcie_rp *pp = irq_data_get_irq_chip_data(d);
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sophgo_pcie *sophgo = to_sophgo_pcie(pci);
+	unsigned long flags;
+	u32 val;
+
+	raw_spin_lock_irqsave(&pp->lock, flags);
+
+	val = sophgo_pcie_readl_app(sophgo, PCIE_INT_EN);
+	val |= BIT(d->hwirq + PCIE_INT_EN_INTX_SHIFT);

Ditto.

Quoted 4 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +4 -0
+	sophgo_pcie_writel_app(sophgo, val, PCIE_INT_EN);
+
+	raw_spin_unlock_irqrestore(&pp->lock, flags);
+};

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 117

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+
+static void sophgo_intx_eoi(struct irq_data *d)
+{
+}
+
+static struct irq_chip sophgo_intx_irq_chip = {
+	.name			= "INTx",
+	.irq_mask		= sophgo_intx_mask,
+	.irq_unmask		= sophgo_intx_unmask,
+	.irq_eoi		= sophgo_intx_eoi,

Name these ending with the irq_chip field names, e.g., sophgo_intx_irq_mask(), to make them easier to find with grep.

Bjorn

author maintainer
#18 lore raw

Re: [PATCH 2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Inochi Amaoto

Add support for DesignWare-based PCIe controller in SG2044 SoC.

drivers/pci/controller/dwc/Kconfig +0 -0
@@ -341,6 +341,16 @@ config PCIE_ROCKCHIP_DW_EP
 	  Enables support for the DesignWare PCIe controller in the
 	  Rockchip SoC (except RK3399) to work in endpoint mode.
 
Quoted 7 lines

drivers/pci/controller/dwc/Kconfig config PCIE_ROCKCHIP_DW_EP · line 345

Quoted 2 lines
drivers/pci/controller/dwc/Kconfig +2 -0
+config PCIE_SOPHGO_DW
+	bool "SOPHGO DesignWare PCIe controller"

What's the canonical styling of "SOPHGO"? I see "Sophgo" in the subject line and in Chen Wang's SG2042 series. Pick the official styling and use it consistently.

This is my mistake. It should be "Sophgo", I will change it.

Quoted 3 lines

Reorder this so the menuconfig menu items remain alphabetically sorted.

I think this order is applied to the entry title in menuconfig, and is not the config key? If so, I will change it.

Quoted 12 lines
Quoted 11 lines
drivers/pci/controller/dwc/Kconfig +8 -0
+	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 PCI_EXYNOS
 	tristate "Samsung Exynos PCIe controller"
 	depends on ARCH_EXYNOS || COMPILE_TEST
Quoted 8 lines

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 3

Quoted 3 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +3 -0
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * PCIe host controller driver for Sophgo SoCs.

Looks too generic, since Chen Wang's series says Sophgo SG2042 SoC is Cadence-based, so this driver apparently doesn't cover all Sophgo SoCs.

OK, I will change the description to point it only cover the controller based on the DesignWare core.

Quoted 72 lines
Quoted 1 line

+ *

Spurious blank line.

Quoted 13 lines

+ */

drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +12 -0
+
+#include <linux/clk.h>
+#include <linux/gpio/consumer.h>
+#include <linux/irqchip/chained_irq.h>
+#include <linux/irqdomain.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/phy/phy.h>
+#include <linux/property.h>
+#include <linux/platform_device.h>
+#include <linux/regmap.h>
+#include <linux/reset.h>

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 28

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+
+#include "pcie-designware.h"
+
+#define to_sophgo_pcie(x)		dev_get_drvdata((x)->dev)
+
+#define PCIE_INT_SIGNAL			0xc48
+#define PCIE_INT_EN			0xca0
+
+#define PCIE_SIGNAL_INTX_SHIFT		5
+#define PCIE_INT_EN_INTX_SHIFT		1

Define masks with GENMASK() and get rid of the _SHIFT #defines.

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 33

Quoted 5 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +5 -0
+#define PCIE_INT_EN_INT_SII		BIT(0)
+#define PCIE_INT_EN_INT_INTA		BIT(1)
+#define PCIE_INT_EN_INT_INTB		BIT(2)
+#define PCIE_INT_EN_INT_INTC		BIT(3)
+#define PCIE_INT_EN_INT_INTD		BIT(4)

These are unused, drop them.

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 42

Quoted 9 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +9 -0
+#define PCIE_INT_EN_INT_MSI		BIT(5)
+
+struct sophgo_pcie {
+	struct dw_pcie pci;
+	void __iomem *app_base;
+	struct clk_bulk_data *clks;
+	unsigned int clk_cnt;
+	struct reset_control *rst;
+	struct irq_domain *irq_domain;

Indent the member names to align vertically as most other drivers do.

Quoted 22 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +22 -0
+};
+
+static int sophgo_pcie_readl_app(struct sophgo_pcie *sophgo, u32 reg)
+{
+	return readl_relaxed(sophgo->app_base + reg);
+}
+
+static void sophgo_pcie_writel_app(struct sophgo_pcie *sophgo, u32 val, u32 reg)
+{
+	writel_relaxed(val, sophgo->app_base + reg);
+}
+
+static void sophgo_pcie_intx_handler(struct irq_desc *desc)
+{
+	struct dw_pcie_rp *pp = irq_desc_get_handler_data(desc);
+	struct irq_chip *chip = irq_desc_get_chip(desc);
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sophgo_pcie *sophgo = to_sophgo_pcie(pci);
+	unsigned long hwirq = PCIE_SIGNAL_INTX_SHIFT;
+	unsigned long reg;
+
+	chained_irq_enter(chip, desc);
Quoted 9 lines

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 68

Quoted 4 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +4 -0
+
+	reg = sophgo_pcie_readl_app(sophgo, PCIE_INT_SIGNAL);
+
+	for_each_set_bit_from(hwirq, &reg, PCI_NUM_INTX + PCIE_SIGNAL_INTX_SHIFT)

Use FIELD_GET() here and iterate through PCI_NUM_INTX. Then you don't need for_each_set_bit_from() and shouldn't need PCIE_SIGNAL_INTX_SHIFT here and below.

OK, I will change it

Quoted 59 lines
Quoted 8 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +8 -0
+		generic_handle_domain_irq(sophgo->irq_domain,
+					  hwirq - PCIE_SIGNAL_INTX_SHIFT);
+
+	chained_irq_exit(chip, desc);
+}
+
+static void sophgo_intx_mask(struct irq_data *d)
+{

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 86

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+	struct dw_pcie_rp *pp = irq_data_get_irq_chip_data(d);
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sophgo_pcie *sophgo = to_sophgo_pcie(pci);
+	unsigned long flags;
+	u32 val;
+
+	raw_spin_lock_irqsave(&pp->lock, flags);
+
+	val = sophgo_pcie_readl_app(sophgo, PCIE_INT_EN);
+	val &= ~BIT(d->hwirq + PCIE_INT_EN_INTX_SHIFT);

FIELD_PREP().

Quoted 7 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +7 -0
+	sophgo_pcie_writel_app(sophgo, val, PCIE_INT_EN);
+
+	raw_spin_unlock_irqrestore(&pp->lock, flags);
+};
+
+static void sophgo_intx_unmask(struct irq_data *d)
+{

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 103

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+	struct dw_pcie_rp *pp = irq_data_get_irq_chip_data(d);
+	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
+	struct sophgo_pcie *sophgo = to_sophgo_pcie(pci);
+	unsigned long flags;
+	u32 val;
+
+	raw_spin_lock_irqsave(&pp->lock, flags);
+
+	val = sophgo_pcie_readl_app(sophgo, PCIE_INT_EN);
+	val |= BIT(d->hwirq + PCIE_INT_EN_INTX_SHIFT);

Ditto.

Quoted 4 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +4 -0
+	sophgo_pcie_writel_app(sophgo, val, PCIE_INT_EN);
+
+	raw_spin_unlock_irqrestore(&pp->lock, flags);
+};

drivers/pci/controller/dwc/pcie-dw-sophgo.c line 117

Quoted 10 lines
drivers/pci/controller/dwc/pcie-dw-sophgo.c new file +10 -0
+
+static void sophgo_intx_eoi(struct irq_data *d)
+{
+}
+
+static struct irq_chip sophgo_intx_irq_chip = {
+	.name			= "INTx",
+	.irq_mask		= sophgo_intx_mask,
+	.irq_unmask		= sophgo_intx_unmask,
+	.irq_eoi		= sophgo_intx_eoi,

Name these ending with the irq_chip field names, e.g., sophgo_intx_irq_mask(), to make them easier to find with grep.

Quoted 1 line

Bjorn

Thanks, I will take all the comments and improve the driver.

Regards,
Inochi

#19 lore raw

Re: [PATCH 2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

Quoted 15 lines · Inochi Amaoto
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Inochi Amaoto

Add support for DesignWare-based PCIe controller in SG2044 SoC.

drivers/pci/controller/dwc/Kconfig +0 -0
@@ -341,6 +341,16 @@ config PCIE_ROCKCHIP_DW_EP
 	  Enables support for the DesignWare PCIe controller in the
 	  Rockchip SoC (except RK3399) to work in endpoint mode.
 
Quoted 6 lines

drivers/pci/controller/dwc/Kconfig config PCIE_ROCKCHIP_DW_EP · line 345

Quoted 2 lines
drivers/pci/controller/dwc/Kconfig +2 -0
+config PCIE_SOPHGO_DW
+	bool "SOPHGO DesignWare PCIe controller"

What's the canonical styling of "SOPHGO"? I see "Sophgo" in the subject line and in Chen Wang's SG2042 series. Pick the official styling and use it consistently.

Quoted 7 lines

This is my mistake. It should be "Sophgo", I will change it.

Quoted 2 lines

Reorder this so the menuconfig menu items remain alphabetically sorted.

I think this order is applied to the entry title in menuconfig, and is not the config key? If so, I will change it.

It's the title shown by menuconfig, i.e., "SOPHGO DesignWare PCIe controller" here.

author maintainer
#20 lore raw

Re: [PATCH 2/2] PCI: sophgo-dwc: Add Sophgo SG2044 PCIe driver

Quoted 18 lines · Bjorn Helgaas
Quoted 17 lines · Inochi Amaoto
Quoted 7 lines · Bjorn Helgaas
Quoted 6 lines · Inochi Amaoto

Add support for DesignWare-based PCIe controller in SG2044 SoC.

drivers/pci/controller/dwc/Kconfig +0 -0
@@ -341,6 +341,16 @@ config PCIE_ROCKCHIP_DW_EP
 	  Enables support for the DesignWare PCIe controller in the
 	  Rockchip SoC (except RK3399) to work in endpoint mode.
 
Quoted 6 lines

drivers/pci/controller/dwc/Kconfig config PCIE_ROCKCHIP_DW_EP · line 345

Quoted 2 lines
drivers/pci/controller/dwc/Kconfig +2 -0
+config PCIE_SOPHGO_DW
+	bool "SOPHGO DesignWare PCIe controller"

What's the canonical styling of "SOPHGO"? I see "Sophgo" in the subject line and in Chen Wang's SG2042 series. Pick the official styling and use it consistently.

This is my mistake. It should be "Sophgo", I will change it.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Reorder this so the menuconfig menu items remain alphabetically sorted.

I think this order is applied to the entry title in menuconfig, and is not the config key? If so, I will change it.

It's the title shown by menuconfig, i.e., "SOPHGO DesignWare PCIe controller" here.

Thanks, I will reorder it.

Regards,
Inochi