Skip to contentSkip to conversation

Add JH7110 PCIe driver support

PATCH In review Minda Chen 5 participants 19 messages Apr 6, 2023 – Apr 12, 2023

Subsystems (6)
lore
Share & tools
lore

Minda Chen

author
#0 lore raw

cover Add JH7110 PCIe driver support

This patchset adds PCIe driver for the StarFive JH7110 SoC. The patch has been tested on the VisionFive 2 board. The test devices include M.2 NVMe SSD and Realtek 8169 Ethernet adapter.

This patchset should be applied after the patchset [1], [2], [3] and[4]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/
[4] https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

This patchset is base on v6.3-rc4

patch 1 is PCIe dt-binding document.
patch 2 is PCIe 2.0 driver codes.
patch 3 is PCIe device tree configuration.

Minda Chen (3):
dt-binding: pci: add JH7110 PCIe dt-binding documents.
pcie: starfive: add StarFive JH7110 PCIe driver.
riscv: dts: starfive: add PCIe dts configuration for JH7110

 .../bindings/pci/starfive,jh7110-pcie.yaml    | 163 +++
 MAINTAINERS                                   |   6 +
 .../jh7110-starfive-visionfive-2.dtsi         |  58 ++
 arch/riscv/boot/dts/starfive/jh7110.dtsi      |  88 ++
 drivers/pci/controller/Kconfig                |   8 +
 drivers/pci/controller/Makefile               |   1 +
 drivers/pci/controller/pcie-starfive.c        | 958 ++++++++++++++++++
 7 files changed, 1282 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
 create mode 100644 drivers/pci/controller/pcie-starfive.c

base-commit: 197b6b60ae7bc51dd0814953c562833143b292aa
prerequisite-patch-id: 55390537360f25c8b9cbfdc30b73ade004f436f7
prerequisite-patch-id: bb939c0c7c26b08addfccd890f9d3974b6eaec53
prerequisite-patch-id: 8a6f135bcabdad4a4bfb21f0c6a0ffd2bb57efe7
prerequisite-patch-id: c2366f993a9d85e28c06d8d09f064dd5e8b29a61
prerequisite-patch-id: 50d53a21f91f4087fc80b6f1f72864adfb0002b9
prerequisite-patch-id: 0df3703af91c30f1ca2c47f5609012f2d7200028
prerequisite-patch-id: 89f049f951e5acf75aab92541992f816fd0acc0d
prerequisite-patch-id: 551fae54377090044c3612fca9740a9b359abdd2
prerequisite-patch-id: c7fdf904f398d478f0ed6d57eb878982bc73329d
prerequisite-patch-id: 1b2d0982b18da060c82134f05bf3ce16425bac8d
prerequisite-patch-id: 090ba4b78d47bc19204916e76fdbc70021785388
prerequisite-patch-id: a5d9e0f7d4f8163f566678894cf693015119f2d9
prerequisite-patch-id: 4637a8fa2334a45fa6b64351f4e9e28d3e2d60d3
prerequisite-patch-id: 32647ec60a3b614e1c59ec8e54cb511ae832c22f
prerequisite-patch-id: aa06658ecf89c92d0dfdd6a4ba6d9e6e67532971
prerequisite-patch-id: 258ea5f9b8bf41b6981345dcc81795f25865d38f
prerequisite-patch-id: 8b6f2c9660c0ac0ee4e73e4c21aca8e6b75e81b9
prerequisite-patch-id: dbb0c0151b8bdf093e6ce79fd2fe3f60791a6e0b
prerequisite-patch-id: e7773c977a7b37692e9792b21cc4f17fa58f9215
prerequisite-patch-id: d57e95d31686772abc4c4d5aa1cadc344dc293cd
prerequisite-patch-id: 9f911969d0a550648493952c99096d26e05d4d83
prerequisite-patch-id: 41eddeabff082d08a76d8da523f90da4b5218d28
prerequisite-patch-id: 2ddada18ab6ea5cd1da14212aaf59632f5203d40
prerequisite-patch-id: 398744c61913c76a35754de867c4f820ca7a8d99
prerequisite-patch-id: 1a2c49c1cf81607f062f35898457037d86598cf9
prerequisite-patch-id: f59269382164b5d642a5e10443ca447f5caa595c
prerequisite-patch-id: 1babe83d6bf999bad17584dc595480f9070a5369
prerequisite-patch-id: d95ea69f88a048ef702dceed0f2edee31e6fdfd2
prerequisite-patch-id: 77be3d122d66df813f13088141ce27b21107a341
prerequisite-patch-id: 9fbb7ad1dd258bb8ff5946c4a0e59de4bfd82a04
prerequisite-patch-id: a02411a8fe009acc0888e4a7d60233c9ee5a1e71
prerequisite-patch-id: 6f6984916dffd0cc66aa733c9b6bd3a55495a50c
prerequisite-patch-id: 584c256c9acb52ee2773d0c81c3f4977fc18155a
prerequisite-patch-id: b37ac15032973e1fcd918f157c82a0606775c9e9
prerequisite-patch-id: 999c243dca89d56d452aa52ea3e181358b5c1d80
prerequisite-patch-id: ca653566085079839fb3dc1e722effafbc8109a4
prerequisite-patch-id: 2fe72c216673efe690db54cbf500ba7f15e6247a
prerequisite-patch-id: 776afb78743657e4a6bfebd2cd8a44c5c9017ee2
prerequisite-patch-id: c9b92e6d1531d0a9fb122d9d038cc3d9df380e0f
prerequisite-patch-id: c0fa5b1d697ab8434954a81a5992cf66d0cfafb8
prerequisite-patch-id: 1cca26d07ec4bc7ea07b1c6815631c8bf8224366
prerequisite-patch-id: 331bafaf79b4bb7c09152eb16598cdc9ba8096e9
prerequisite-patch-id: 9f2286829c70b6940c83834b150df685ab02c591
prerequisite-patch-id: b25b8295d7b8fdf1b45b634df5c2a7a7f9dfba76
prerequisite-patch-id: 9d3aab2e4428be5b1235a57dad3bf14eae5275fd
prerequisite-patch-id: 6090abbef6164dd0cc87d44c486a7eb1b5f64946

Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 1/3 dt-binding: pci: add JH7110 PCIe dt-binding documents.

Add PCIe controller driver dt-binding documents
for StarFive JH7110 SoC platform.

---
 .../bindings/pci/starfive,jh7110-pcie.yaml    | 163 ++++++++++++++++++
 1 file changed, 163 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +163 -0
new file mode 100644
index 000000000000..fa4829766195
@@ -0,0 +1,163 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/starfive,jh7110-pcie.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 PCIe 2.0 host controller
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/pci/pci-bus.yaml#
+  - $ref: /schemas/interrupt-controller/msi-controller.yaml#
+
+properties:
+  compatible:
+    const: starfive,jh7110-pcie
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: reg
+      - const: config
+
+  msi-parent: true
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: noc
+      - const: tl
+      - const: axi_mst0
+      - const: apb
+
+  resets:
+    items:
+      - description: AXI MST0 reset
+      - description: AXI SLAVE reset
+      - description: AXI SLAVE0 reset
+      - description: PCIE BRIDGE reset
+      - description: PCIE CORE reset
+      - description: PCIE APB reset
+
+  reset-names:
+    items:
+      - const: mst0
+      - const: slv0
+      - const: slv
+      - const: brg
+      - const: core
+      - const: apb
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register3 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe. Total 4 regsisters offset
+      for PCIe.
+
+  pwren-gpios:
+    description: Should specify the GPIO for controlling the PCI bus device power on.
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"
+  - interrupts
+  - interrupt-map-mask
+  - interrupt-map
+  - clocks
+  - clock-names
+  - resets
+  - msi-controller
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pcie0: pcie@2B000000 {
+            compatible = "starfive,jh7110-pcie";
+            #address-cells = <3>;
+            #size-cells = <2>;
+            #interrupt-cells = <1>;
+            reg = <0x0 0x2B000000 0x0 0x1000000>,
+                  <0x9 0x40000000 0x0 0x10000000>;
+            reg-names = "reg", "config";
+            device_type = "pci";
+            starfive,stg-syscon = <&stg_syscon 0xc0 0xc4 0x130 0x1b8>;
+            bus-range = <0x0 0xff>;
+            ranges = <0x82000000  0x0 0x30000000  0x0 0x30000000 0x0 0x08000000>,
+                     <0xc3000000  0x9 0x00000000  0x9 0x00000000 0x0 0x40000000>;
+            interrupt-parent = <&plic>;
+            interrupts = <56>;
+            interrupt-map-mask = <0x0 0x0 0x0 0x7>;
+            interrupt-map = <0x0 0x0 0x0 0x1 &pcie_intc0 0x1>,
+                            <0x0 0x0 0x0 0x2 &pcie_intc0 0x2>,
+                            <0x0 0x0 0x0 0x3 &pcie_intc0 0x3>,
+                            <0x0 0x0 0x0 0x4 &pcie_intc0 0x4>;
+            msi-parent = <&pcie0>;
+            msi-controller;
+            clocks = <&syscrg 86>,
+                     <&stgcrg 10>,
+                     <&stgcrg 8>,
+                     <&stgcrg 9>;
+            clock-names = "noc", "tl", "axi_mst0", "apb";
+            resets = <&stgcrg 11>,
+                     <&stgcrg 12>,
+                     <&stgcrg 13>,
+                     <&stgcrg 14>,
+                     <&stgcrg 15>,
+                     <&stgcrg 16>;
+
+            pcie_intc0: interrupt-controller {
+                #address-cells = <0>;
+                #interrupt-cells = <1>;
+                interrupt-controller;
+            };
+        };
+    };
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

Quoted 2 lines · Minda Chen

Add PCIe controller driver dt-binding documents
for StarFive JH7110 SoC platform.

Use subject prefixes matching the subsystem (which you can get for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching). Missing: 's'

Subject: drop second/last, redundant "dt-binding documents". The "dt-bindings" prefix is already stating that these are bindings and documentation.

Drop also full stop.

Quoted 79 lines
---
 .../bindings/pci/starfive,jh7110-pcie.yaml    | 163 ++++++++++++++++++
 1 file changed, 163 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +66 -0
new file mode 100644
index 000000000000..fa4829766195
@@ -0,0 +1,163 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/starfive,jh7110-pcie.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 PCIe 2.0 host controller
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/pci/pci-bus.yaml#
+  - $ref: /schemas/interrupt-controller/msi-controller.yaml#
+
+properties:
+  compatible:
+    const: starfive,jh7110-pcie
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: reg
+      - const: config
+
+  msi-parent: true
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: noc
+      - const: tl
+      - const: axi_mst0
+      - const: apb
+
+  resets:
+    items:
+      - description: AXI MST0 reset
+      - description: AXI SLAVE reset
+      - description: AXI SLAVE0 reset
+      - description: PCIE BRIDGE reset
+      - description: PCIE CORE reset
+      - description: PCIE APB reset
+
+  reset-names:
+    items:
+      - const: mst0
+      - const: slv0
+      - const: slv
+      - const: brg
+      - const: core
+      - const: apb
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 76

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+        - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register3 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe. Total 4 regsisters offset
+      for PCIe.
+
+  pwren-gpios:
+    description: Should specify the GPIO for controlling the PCI bus device power on.

What are these? Different than defined in gpio-consumer-common?

Quoted 20 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +20 -0
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"

Keep consistent quotes - either ' or "

Are you sure this is correct? You have interrupt controller as child node.

Quoted 7 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +7 -0
+  - interrupts
+  - interrupt-map-mask
+  - interrupt-map
+  - clocks
+  - clock-names
+  - resets
+  - msi-controller

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 123

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pcie0: pcie@2B000000 {

Lowercase hex. Everywhere.

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 129

Quoted 6 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +6 -0
+            compatible = "starfive,jh7110-pcie";
+            #address-cells = <3>;
+            #size-cells = <2>;
+            #interrupt-cells = <1>;
+            reg = <0x0 0x2B000000 0x0 0x1000000>,
+                  <0x9 0x40000000 0x0 0x10000000>;

reg (and reg-names and ranges) is always second property.

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 142

Quoted 13 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +13 -0
+            reg-names = "reg", "config";
+            device_type = "pci";
+            starfive,stg-syscon = <&stg_syscon 0xc0 0xc4 0x130 0x1b8>;
+            bus-range = <0x0 0xff>;
+            ranges = <0x82000000  0x0 0x30000000  0x0 0x30000000 0x0 0x08000000>,
+                     <0xc3000000  0x9 0x00000000  0x9 0x00000000 0x0 0x40000000>;
+            interrupt-parent = <&plic>;
+            interrupts = <56>;
+            interrupt-map-mask = <0x0 0x0 0x0 0x7>;
+            interrupt-map = <0x0 0x0 0x0 0x1 &pcie_intc0 0x1>,
+                            <0x0 0x0 0x0 0x2 &pcie_intc0 0x2>,
+                            <0x0 0x0 0x0 0x3 &pcie_intc0 0x3>,
+                            <0x0 0x0 0x0 0x4 &pcie_intc0 0x4>;

Best regards,
Krzysztof

maintainer
#3 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

Quoted 27 lines · Krzysztof Kozlowski
Quoted 13 lines · Minda Chen
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +13 -0
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"

Keep consistent quotes - either ' or "

Quoted 1 line

Are you sure this is correct? You have interrupt controller as child node.

I know existing stuff in-tree is far from a guarantee that it'll be right, but this does at least follow what we've got for PolarFire SoC:
Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml

Both PLDA and both RISC-V w/ a PLIC as the interrupt controller, so in similar waters.
This note existed in the original text form binding of the Microchip PCI controller:

| +NOTE:
| +The core provides a single interrupt for both INTx/MSI messages. So,
| +create an interrupt controller node to support 'interrupt-map' DT
| +functionality.  The driver will create an IRQ domain for this map, decode
| +the four INTx interrupts in ISR and route them to this domain.

Given the similarities, I figure the same requirement applies here too. Minda?

Cheers,
Conor.

maintainer
#4 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

Quoted 38 lines · Conor Dooley
Quoted 27 lines · Krzysztof Kozlowski
Quoted 13 lines · Minda Chen
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +13 -0
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"

Keep consistent quotes - either ' or "

Quoted 1 line

Are you sure this is correct? You have interrupt controller as child node.

I know existing stuff in-tree is far from a guarantee that it'll be right, but this does at least follow what we've got for PolarFire SoC:
Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml

Both PLDA and both RISC-V w/ a PLIC as the interrupt controller, so in similar waters.
This note existed in the original text form binding of the Microchip PCI controller:

Quoted 8 lines
| +NOTE:
| +The core provides a single interrupt for both INTx/MSI messages. So,
| +create an interrupt controller node to support 'interrupt-map' DT
| +functionality.  The driver will create an IRQ domain for this map, decode
| +the four INTx interrupts in ISR and route them to this domain.

Given the similarities, I figure the same requirement applies here too. Minda?

Further, if, as I currently suspect, there's a lot of commonality here, should the binding as well as the driver be split into common pdla bits and microchip/starfive specific ones?

Suppose that's more one for you Krzysztof.

Cheers,
Conor.

#5 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

Quoted 45 lines · Conor Dooley
Quoted 44 lines · Conor Dooley
Quoted 27 lines · Krzysztof Kozlowski
Quoted 13 lines · Minda Chen
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +13 -0
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"

Keep consistent quotes - either ' or "

Quoted 1 line

Are you sure this is correct? You have interrupt controller as child node.

I know existing stuff in-tree is far from a guarantee that it'll be right, but this does at least follow what we've got for PolarFire SoC:
Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml

Both PLDA and both RISC-V w/ a PLIC as the interrupt controller, so in similar waters.
This note existed in the original text form binding of the Microchip PCI controller:

| +NOTE:
| +The core provides a single interrupt for both INTx/MSI messages. So,
| +create an interrupt controller node to support 'interrupt-map' DT
| +functionality.  The driver will create an IRQ domain for this map, decode
| +the four INTx interrupts in ISR and route them to this domain.
Quoted 8 lines
Quoted 2 lines

Given the similarities, I figure the same requirement applies here too. Minda?

Further, if, as I currently suspect, there's a lot of commonality here, should the binding as well as the driver be split into common pdla bits and microchip/starfive specific ones?

Suppose that's more one for you Krzysztof.

Yeah, looks like only clocks and resets are different. At the end it depends how much code you would remove...

Best regards,
Krzysztof

author
#6 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

In reply to Conor Dooley
Quoted 44 lines · Conor Dooley
Quoted 27 lines · Krzysztof Kozlowski
Quoted 13 lines · Minda Chen
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +13 -0
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"

Keep consistent quotes - either ' or "

Quoted 1 line

Are you sure this is correct? You have interrupt controller as child node.

I know existing stuff in-tree is far from a guarantee that it'll be right, but this does at least follow what we've got for PolarFire SoC:
Documentation/devicetree/bindings/pci/microchip,pcie-host.yaml

Both PLDA and both RISC-V w/ a PLIC as the interrupt controller, so in similar waters.
This note existed in the original text form binding of the Microchip PCI controller:

| +NOTE:
| +The core provides a single interrupt for both INTx/MSI messages. So,
| +create an interrupt controller node to support 'interrupt-map' DT
| +functionality.  The driver will create an IRQ domain for this map, decode
| +the four INTx interrupts in ISR and route them to this domain.
Quoted 5 lines

Given the similarities, I figure the same requirement applies here too. Minda?

Cheers,
Conor.

Yes, Thanks very much.

author
#7 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

In reply to Krzysztof Kozlowski
Quoted 8 lines · Krzysztof Kozlowski
Quoted 2 lines · Minda Chen

Add PCIe controller driver dt-binding documents
for StarFive JH7110 SoC platform.

Use subject prefixes matching the subsystem (which you can get for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching). Missing: 's'

Quoted 6 lines

Subject: drop second/last, redundant "dt-binding documents". The "dt-bindings" prefix is already stating that these are bindings and documentation.

Drop also full stop.

ok, thanks

Quoted 83 lines
Quoted 83 lines
---
 .../bindings/pci/starfive,jh7110-pcie.yaml    | 163 ++++++++++++++++++
 1 file changed, 163 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +70 -0
new file mode 100644
index 000000000000..fa4829766195
@@ -0,0 +1,163 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/starfive,jh7110-pcie.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 PCIe 2.0 host controller
+
+maintainers:
+  - Minda Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/pci/pci-bus.yaml#
+  - $ref: /schemas/interrupt-controller/msi-controller.yaml#
+
+properties:
+  compatible:
+    const: starfive,jh7110-pcie
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: reg
+      - const: config
+
+  msi-parent: true
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: noc
+      - const: tl
+      - const: axi_mst0
+      - const: apb
+
+  resets:
+    items:
+      - description: AXI MST0 reset
+      - description: AXI SLAVE reset
+      - description: AXI SLAVE0 reset
+      - description: PCIE BRIDGE reset
+      - description: PCIE CORE reset
+      - description: PCIE APB reset
+
+  reset-names:
+    items:
+      - const: mst0
+      - const: slv0
+      - const: slv
+      - const: brg
+      - const: core
+      - const: apb
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register3 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+    description:
Quoted 9 lines

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 76

Quoted 6 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +6 -0
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe. Total 4 regsisters offset
+      for PCIe.
+
+  pwren-gpios:
+    description: Should specify the GPIO for controlling the PCI bus device power on.

What are these? Different than defined in gpio-consumer-common?

power gpio board level configuration. It it not a requried property

Quoted 47 lines
Quoted 20 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +20 -0
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 106

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"

Keep consistent quotes - either ' or "

Are you sure this is correct? You have interrupt controller as child node.

Quoted 11 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +11 -0
+  - interrupts
+  - interrupt-map-mask
+  - interrupt-map
+  - clocks
+  - clock-names
+  - resets
+  - msi-controller
+
+unevaluatedProperties: false
+
+examples:
Quoted 9 lines

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 123

Quoted 6 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +6 -0
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pcie0: pcie@2B000000 {

Lowercase hex. Everywhere.

ok

Quoted 9 lines

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 129

Quoted 6 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +6 -0
+            compatible = "starfive,jh7110-pcie";
+            #address-cells = <3>;
+            #size-cells = <2>;
+            #interrupt-cells = <1>;
+            reg = <0x0 0x2B000000 0x0 0x1000000>,
+                  <0x9 0x40000000 0x0 0x10000000>;

reg (and reg-names and ranges) is always second property.

ok

Quoted 18 lines

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 142

Quoted 13 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +13 -0
+            reg-names = "reg", "config";
+            device_type = "pci";
+            starfive,stg-syscon = <&stg_syscon 0xc0 0xc4 0x130 0x1b8>;
+            bus-range = <0x0 0xff>;
+            ranges = <0x82000000  0x0 0x30000000  0x0 0x30000000 0x0 0x08000000>,
+                     <0xc3000000  0x9 0x00000000  0x9 0x00000000 0x0 0x40000000>;
+            interrupt-parent = <&plic>;
+            interrupts = <56>;
+            interrupt-map-mask = <0x0 0x0 0x0 0x7>;
+            interrupt-map = <0x0 0x0 0x0 0x1 &pcie_intc0 0x1>,
+                            <0x0 0x0 0x0 0x2 &pcie_intc0 0x2>,
+                            <0x0 0x0 0x0 0x3 &pcie_intc0 0x3>,
+                            <0x0 0x0 0x0 0x4 &pcie_intc0 0x4>;

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

Quoted 20 lines · Minda Chen
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +11 -0
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register3 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+    description:
Quoted 9 lines

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 76

Quoted 6 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +6 -0
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe. Total 4 regsisters offset
+      for PCIe.
+
+  pwren-gpios:
+    description: Should specify the GPIO for controlling the PCI bus device power on.

What are these? Different than defined in gpio-consumer-common?

Quoted 1 line

power gpio board level configuration. It it not a requried property

What is "board level configuration"? Again - is it different than powerdown-gpios from gpio-consumer-common.yaml?

Best regards,
Krzysztof

author
#9 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Minda Chen
Quoted 20 lines
Quoted 7 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +7 -0
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 76

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+        - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register3 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe. Total 4 regsisters offset
+      for PCIe.
+
+  pwren-gpios:
+    description: Should specify the GPIO for controlling the PCI bus device power on.

What are these? Different than defined in gpio-consumer-common?

Quoted 6 lines
Quoted 1 line

power gpio board level configuration. It it not a requried property

What is "board level configuration"? Again - is it different than powerdown-gpios from gpio-consumer-common.yaml?

I am sorry. I will change to powerdown-gpios follow gpio-consumer-common.yaml

Quoted 4 lines

Best regards,
Krzysztof

#10 lore raw

Re: [PATCH v1 1/3] dt-binding: pci: add JH7110 PCIe dt-binding documents.

In reply to Minda Chen
Quoted 24 lines · Minda Chen

Add PCIe controller driver dt-binding documents
for StarFive JH7110 SoC platform.

---
 .../bindings/pci/starfive,jh7110-pcie.yaml    | 163 ++++++++++++++++++
 1 file changed, 163 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +8 -0
new file mode 100644
index 000000000000..fa4829766195
@@ -0,0 +1,163 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/starfive,jh7110-pcie.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: StarFive JH7110 PCIe 2.0 host controller
+

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +10 -0
+maintainers:
+  - Minda Chen <[email protected]>
+
+allOf:
+  - $ref: /schemas/pci/pci-bus.yaml#
+  - $ref: /schemas/interrupt-controller/msi-controller.yaml#
+
+properties:
+  compatible:
+    const: starfive,jh7110-pcie

Since this is a PLDA IP that is likely to be reused by other vendors, should this indicate the PLDA in the string?

Or the file name should be renamed to something like the synopsis dw-pcie?

Quoted 136 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +136 -0
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: reg
+      - const: config
+
+  msi-parent: true
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    maxItems: 4
+
+  clock-names:
+    items:
+      - const: noc
+      - const: tl
+      - const: axi_mst0
+      - const: apb
+
+  resets:
+    items:
+      - description: AXI MST0 reset
+      - description: AXI SLAVE reset
+      - description: AXI SLAVE0 reset
+      - description: PCIE BRIDGE reset
+      - description: PCIE CORE reset
+      - description: PCIE APB reset
+
+  reset-names:
+    items:
+      - const: mst0
+      - const: slv0
+      - const: slv
+      - const: brg
+      - const: core
+      - const: apb
+
+  starfive,stg-syscon:
+    $ref: /schemas/types.yaml#/definitions/phandle-array
+    items:
+      items:
+        - description: phandle to System Register Controller stg_syscon node.
+        - description: register0 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register1 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register2 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+        - description: register3 offset of STG_SYSCONSAIF__SYSCFG register for PCIe.
+    description:
+      The phandle to System Register Controller syscon node and the offset
+      of STG_SYSCONSAIF__SYSCFG register for PCIe. Total 4 regsisters offset
+      for PCIe.
+
+  pwren-gpios:
+    description: Should specify the GPIO for controlling the PCI bus device power on.
+    maxItems: 1
+
+  reset-gpios:
+    maxItems: 1
+
+  phys:
+    maxItems: 1
+
+  interrupt-controller:
+    type: object
+    properties:
+      '#address-cells':
+        const: 0
+
+      '#interrupt-cells':
+        const: 1
+
+      interrupt-controller: true
+
+    required:
+      - '#address-cells'
+      - '#interrupt-cells'
+      - interrupt-controller
+
+    additionalProperties: false
+
+required:
+  - reg
+  - reg-names
+  - "#interrupt-cells"
+  - interrupts
+  - interrupt-map-mask
+  - interrupt-map
+  - clocks
+  - clock-names
+  - resets
+  - msi-controller
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    bus {
+        #address-cells = <2>;
+        #size-cells = <2>;
+
+        pcie0: pcie@2B000000 {
+            compatible = "starfive,jh7110-pcie";
+            #address-cells = <3>;
+            #size-cells = <2>;
+            #interrupt-cells = <1>;
+            reg = <0x0 0x2B000000 0x0 0x1000000>,
+                  <0x9 0x40000000 0x0 0x10000000>;
+            reg-names = "reg", "config";
+            device_type = "pci";
+            starfive,stg-syscon = <&stg_syscon 0xc0 0xc4 0x130 0x1b8>;
+            bus-range = <0x0 0xff>;
+            ranges = <0x82000000  0x0 0x30000000  0x0 0x30000000 0x0 0x08000000>,
+                     <0xc3000000  0x9 0x00000000  0x9 0x00000000 0x0 0x40000000>;
+            interrupt-parent = <&plic>;
+            interrupts = <56>;
+            interrupt-map-mask = <0x0 0x0 0x0 0x7>;
+            interrupt-map = <0x0 0x0 0x0 0x1 &pcie_intc0 0x1>,
+                            <0x0 0x0 0x0 0x2 &pcie_intc0 0x2>,
+                            <0x0 0x0 0x0 0x3 &pcie_intc0 0x3>,
+                            <0x0 0x0 0x0 0x4 &pcie_intc0 0x4>;
+            msi-parent = <&pcie0>;
+            msi-controller;
+            clocks = <&syscrg 86>,
+                     <&stgcrg 10>,
+                     <&stgcrg 8>,
+                     <&stgcrg 9>;
+            clock-names = "noc", "tl", "axi_mst0", "apb";
+            resets = <&stgcrg 11>,
+                     <&stgcrg 12>,
+                     <&stgcrg 13>,
+                     <&stgcrg 14>,
+                     <&stgcrg 15>,

Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml

Quoted 10 lines
Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml new file +9 -1
+                     <&stgcrg 16>;
+
+            pcie_intc0: interrupt-controller {
+                #address-cells = <0>;
+                #interrupt-cells = <1>;
+                interrupt-controller;
+            };
+        };
+    };
--

Regards,
Bin

author
#11 lore raw

PATCH 2/3 pcie: starfive: add StarFive JH7110 PCIe driver.

In reply to Minda Chen

Add PCIe controller driver for StarFive JH7110
SoC platform. The PCIe controller is PCIe 2.0, single lane.

---
 MAINTAINERS                            |   6 +
 drivers/pci/controller/Kconfig         |   8 +
 drivers/pci/controller/Makefile        |   1 +
 drivers/pci/controller/pcie-starfive.c | 958 +++++++++++++++++++++++++
 4 files changed, 973 insertions(+)
 create mode 100644 drivers/pci/controller/pcie-starfive.c
MAINTAINERS +6 -0
index 0610bbf921bb..52501bcfd1ef 100644
@@ -19977,6 +19977,12 @@ F:	Documentation/devicetree/bindings/phy/starfive,jh7110-usb-phy.yaml
 F:	drivers/phy/starfive/phy-jh7110-pcie.c
 F:	drivers/phy/starfive/phy-jh7110-usb.c
 
+STARFIVE JH71X0 PCIE DRIVERS
+M:	Minda Chen <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/pci/starfive,jh7110-pcie.yaml
+F:	drivers/pci/controller/pcie-starfive.c
+
 STARFIVE JH71X0 USB DRIVERS
 M:	Emil Renner Berthing <[email protected]>
 M:	Minda Chen <[email protected]>
drivers/pci/controller/Kconfig +8 -0
index 42654035654a..3b39080018a5 100644
@@ -342,6 +342,14 @@ config PCIE_MT7621
 	help
 	  This selects a driver for the MediaTek MT7621 PCIe Controller.
 
+config PCIE_STARFIVE
+	tristate "StarFive JH7110 PCIe controller"
+	depends on PCI_MSI && OF
+	select PCI_MSI_IRQ_DOMAIN
+	help
+	  Say 'Y' here if you want kernel to support the StarFive JH7110
+	  PCIe Host driver.
+
 source "drivers/pci/controller/dwc/Kconfig"
 source "drivers/pci/controller/mobiveil/Kconfig"
 source "drivers/pci/controller/cadence/Kconfig"
drivers/pci/controller/Makefile +1 -0
index 37c8663de7fe..23708222db8a 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
 obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o
 obj-$(CONFIG_PCIE_APPLE) += pcie-apple.o
 obj-$(CONFIG_PCIE_MT7621) += pcie-mt7621.o
+obj-$(CONFIG_PCIE_STARFIVE) += pcie-starfive.o
 
 # pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW
 obj-y				+= dwc/
drivers/pci/controller/pcie-starfive.c new file +958 -0

958 lines not on this page · raw message

Signature · 1 line
2.17.1
author
#12 lore raw

PATCH 3/3 riscv: dts: starfive: add PCIe dts configuration for JH7110

In reply to Minda Chen

The PCIe is a PCIe2, single lane PCIe compliant controller.

---
 .../jh7110-starfive-visionfive-2.dtsi         | 58 ++++++++++++
 arch/riscv/boot/dts/starfive/jh7110.dtsi      | 88 +++++++++++++++++++
 2 files changed, 146 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +58 -0
index cf0a66faf5d3..4552919e69b0 100644
@@ -191,6 +191,50 @@
 		};
 	};
 
+	pcie0_wake_default: pcie0_wake_default {
+		wake-pins {
+			pinmux = <GPIOMUX(32, GPOUT_HIGH, GPOEN_ENABLE, GPI_NONE)>;
+			bias-disable;
+			drive-strength = <2>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+
+	pcie0_clkreq_default: pcie0_clkreq_default {
+		clkreq-pins {
+			bias-disable;
+			pinmux = <GPIOMUX(27, GPOUT_HIGH, GPOEN_ENABLE, GPI_NONE)>;
+			drive-strength = <2>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+
+	pcie1_wake_default: pcie1_wake_default {
+		wake-pins {
+			bias-disable;
+			pinmux = <GPIOMUX(21, GPOUT_HIGH, GPOEN_ENABLE, GPI_NONE)>;
+			drive-strength = <2>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+
+	pcie1_clkreq_default: pcie1_clkreq_default {
+		clkreq-pins {
+			bias-disable;
+			pinmux = <GPIOMUX(29, GPOUT_HIGH, GPOEN_ENABLE, GPI_NONE)>;
+			drive-strength = <2>;
+			input-enable;
+			input-schmitt-disable;
+			slew-rate = <0>;
+		};
+	};
+
 	uart0_pins: uart0-0 {
 		tx-pins {
 			pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
@@ -228,3 +272,17 @@
 	dr_mode = "peripheral";
 	status = "okay";
 };
+
+&pcie0 {
+	pinctrl-names = "default";
+	reset-gpios = <&sysgpio 26 GPIO_ACTIVE_LOW>;
+	phys = <&pciephy0>;
+	status = "okay";
+};
+
+&pcie1 {
+	pinctrl-names = "default";
+	reset-gpios = <&sysgpio 28 GPIO_ACTIVE_LOW>;
+	phys = <&pciephy1>;
+	status = "okay";
+};
arch/riscv/boot/dts/starfive/jh7110.dtsi +88 -0

93 lines not on this page · raw message

Signature · 1 line
2.17.1
#13 lore raw

Re: [PATCH v1 3/3] riscv: dts: starfive: add PCIe dts configuration for JH7110

Quoted 13 lines · Minda Chen

The PCIe is a PCIe2, single lane PCIe compliant controller.

---
 .../jh7110-starfive-visionfive-2.dtsi         | 58 ++++++++++++
 arch/riscv/boot/dts/starfive/jh7110.dtsi      | 88 +++++++++++++++++++
 2 files changed, 146 insertions(+)
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +0 -0
index cf0a66faf5d3..4552919e69b0 100644

arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi line 194

Quoted 4 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +1 -0
@@ -191,6 +191,50 @@
 		};
 	};
 
+	pcie0_wake_default: pcie0_wake_default {

No underscores in node names. Test your patches against bindings before sending.

Quoted 26 lines
arch/riscv/boot/dts/starfive/jh7110-starfive-visionfive-2.dtsi +14 -0
 	uart0_pins: uart0-0 {
 		tx-pins {
 			pinmux = <GPIOMUX(5, GPOUT_SYS_UART0_TX,
@@ -228,3 +272,17 @@
 	dr_mode = "peripheral";
 	status = "okay";
 };
+
+&pcie0 {
+	pinctrl-names = "default";
+	reset-gpios = <&sysgpio 26 GPIO_ACTIVE_LOW>;
+	phys = <&pciephy0>;
+	status = "okay";
+};
+
+&pcie1 {
+	pinctrl-names = "default";
+	reset-gpios = <&sysgpio 28 GPIO_ACTIVE_LOW>;
+	phys = <&pciephy1>;
+	status = "okay";
+};
arch/riscv/boot/dts/starfive/jh7110.dtsi +0 -0
index 2f67196ffac0..c309ec550ba7 100644

arch/riscv/boot/dts/starfive/jh7110.dtsi line 646

Quoted 5 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +2 -0
@@ -642,5 +642,93 @@
 			#reset-cells = <1>;
 			power-domains = <&pwrc JH7110_PD_VOUT>;
 		};
+
+		pcie0: pcie@2B000000 {

Lower case hex.

arch/riscv/boot/dts/starfive/jh7110.dtsi line 650

Quoted 4 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +4 -0
+			compatible = "starfive,jh7110-pcie";
+			#address-cells = <3>;
+			#size-cells = <2>;
+			#interrupt-cells = <1>;

Why reg is not second property?

arch/riscv/boot/dts/starfive/jh7110.dtsi line 659

Quoted 9 lines
arch/riscv/boot/dts/starfive/jh7110.dtsi +9 -0
+			reg = <0x0 0x2B000000 0x0 0x1000000
+			       0x9 0x40000000 0x0 0x10000000>;
+			reg-names = "reg", "config";
+			device_type = "pci";
+			starfive,stg-syscon = <&stg_syscon 0xc0 0xc4 0x130 0x1b8>;
+			bus-range = <0x0 0xff>;
+			ranges = <0x82000000  0x0 0x30000000  0x0 0x30000000 0x0 0x08000000>,
+				 <0xc3000000  0x9 0x00000000  0x9 0x00000000 0x0 0x40000000>;
+			interrupts = <56>;

Your binding requires cells, so I am pretty sure you did not test what you wrote.

Best regards,
Krzysztof

#14 lore raw
In reply to Minda Chen

+CC Daire

Hey Minda,

Quoted 3 lines · Minda Chen

This patchset adds PCIe driver for the StarFive JH7110 SoC. The patch has been tested on the VisionFive 2 board. The test devices include M.2 NVMe SSD and Realtek 8169 Ethernet adapter.

I was talking with Daire last week about some changes he's working on for the microchip driver, and we seemed to recall an off-list email sent to Daire & Bjorn about extracting the common PLDA bits from the pcie-microchip-host driver to be used with an (at that point) unreleased SoC. Perhaps Bjorn has this in his mailbox somewhere still, our corporate mail policy scrubs things from over a year ago & I could not find it.

I realised that that may actually have been StarFive, and the driver on your GitHub [1] certainly felt very familiar to Daire (he said it was very similar to his earlier revisions of his driver).

I've not looked at a diff between this and the version you ship on GitHub, but first a quick inspection it mostly just looks like you did s/plda/sifive/ on the file.

I'm obviously not a PCI maintainer, but if there are common bits between the two drivers, extracting common bits seems like a good idea to me...

https://github.com/starfive-tech/linux/blob/JH7110_VisionFive2_devel/drivers/pci/controller/pcie-plda.c

Quoted 6 lines

This patchset should be applied after the patchset [1], [2], [3] and[4]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/
[4] https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

How many of the dependencies here are compiletime for the driver & how many of them are just for the dts patch?

Cheers,
Conor.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#15 lore raw

Gah, I never actually CCed Daire. Apologies for the additional email.

Quoted 36 lines · Conor Dooley

+CC Daire

Hey Minda,

Quoted 3 lines · Minda Chen

This patchset adds PCIe driver for the StarFive JH7110 SoC. The patch has been tested on the VisionFive 2 board. The test devices include M.2 NVMe SSD and Realtek 8169 Ethernet adapter.

I was talking with Daire last week about some changes he's working on for the microchip driver, and we seemed to recall an off-list email sent to Daire & Bjorn about extracting the common PLDA bits from the pcie-microchip-host driver to be used with an (at that point) unreleased SoC. Perhaps Bjorn has this in his mailbox somewhere still, our corporate mail policy scrubs things from over a year ago & I could not find it.

I realised that that may actually have been StarFive, and the driver on your GitHub [1] certainly felt very familiar to Daire (he said it was very similar to his earlier revisions of his driver).

I've not looked at a diff between this and the version you ship on GitHub, but first a quick inspection it mostly just looks like you did s/plda/sifive/ on the file.

I'm obviously not a PCI maintainer, but if there are common bits between the two drivers, extracting common bits seems like a good idea to me...

https://github.com/starfive-tech/linux/blob/JH7110_VisionFive2_devel/drivers/pci/controller/pcie-plda.c

Quoted 6 lines

This patchset should be applied after the patchset [1], [2], [3] and[4]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/
[4] https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

Quoted 5 lines

How many of the dependencies here are compiletime for the driver & how many of them are just for the dts patch?

Cheers,
Conor.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

author
#16 lore raw
Quoted 24 lines · Conor Dooley

Gah, I never actually CCed Daire. Apologies for the additional email.

Quoted 21 lines · Conor Dooley

+CC Daire

Hey Minda,

Quoted 3 lines · Minda Chen

This patchset adds PCIe driver for the StarFive JH7110 SoC. The patch has been tested on the VisionFive 2 board. The test devices include M.2 NVMe SSD and Realtek 8169 Ethernet adapter.

I was talking with Daire last week about some changes he's working on for the microchip driver, and we seemed to recall an off-list email sent to Daire & Bjorn about extracting the common PLDA bits from the pcie-microchip-host driver to be used with an (at that point) unreleased SoC. Perhaps Bjorn has this in his mailbox somewhere still, our corporate mail policy scrubs things from over a year ago & I could not find it.

I realised that that may actually have been StarFive, and the driver on your GitHub [1] certainly felt very familiar to Daire (he said it was very similar to his earlier revisions of his driver).

Quoted 7 lines
Quoted 6 lines

I've not looked at a diff between this and the version you ship on GitHub, but first a quick inspection it mostly just looks like you did s/plda/sifive/ on the file.

I'm obviously not a PCI maintainer, but if there are common bits between the two drivers, extracting common bits seems like a good idea to me...

Thanks. It is pleasure to using same common codes. Does common bits changes

will upstream soon?
And I see there are many difference between pcie-microchip-host and our codes.

Quoted 11 lines
Quoted 11 lines

https://github.com/starfive-tech/linux/blob/JH7110_VisionFive2_devel/drivers/pci/controller/pcie-plda.c

Quoted 6 lines

This patchset should be applied after the patchset [1], [2], [3] and[4]:
[1] https://patchwork.kernel.org/project/linux-riscv/cover/[email protected]/
[2] https://lore.kernel.org/all/[email protected]/
[3] https://patchwork.kernel.org/project/linux-phy/cover/[email protected]/
[4] https://patchwork.kernel.org/project/linux-usb/cover/[email protected]/

How many of the dependencies here are compiletime for the driver & how many of them are just for the dts patch?

PCIe rely on stg clock in [1], rely on stg syscon in [2]. Patch [2] is accepted now. Maybe I will delete this. both [3] and [4] is PHY dependency.

Quoted 4 lines
Quoted 2 lines

Cheers,
Conor.

#17 lore raw

Hey Minda,

Quoted 23 lines · Minda Chen
Quoted 22 lines · Conor Dooley
Quoted 21 lines · Conor Dooley
Quoted 3 lines · Minda Chen

This patchset adds PCIe driver for the StarFive JH7110 SoC. The patch has been tested on the VisionFive 2 board. The test devices include M.2 NVMe SSD and Realtek 8169 Ethernet adapter.

I was talking with Daire last week about some changes he's working on for the microchip driver, and we seemed to recall an off-list email sent to Daire & Bjorn about extracting the common PLDA bits from the pcie-microchip-host driver to be used with an (at that point) unreleased SoC. Perhaps Bjorn has this in his mailbox somewhere still, our corporate mail policy scrubs things from over a year ago & I could not find it.

I realised that that may actually have been StarFive, and the driver on your GitHub [1] certainly felt very familiar to Daire (he said it was very similar to his earlier revisions of his driver).

I've not looked at a diff between this and the version you ship on GitHub, but first a quick inspection it mostly just looks like you did s/plda/sifive/ on the file.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

I'm obviously not a PCI maintainer, but if there are common bits between the two drivers, extracting common bits seems like a good idea to me...

Thanks. It is pleasure to using same common codes. Does common bits changes will upstream soon?

I don't quite get what you mean. We've got some changes that are in progress here:
https://lore.kernel.org/linux-pci/[email protected]/
We've been quiet there for a while, but Daire's back looking into Robin's comments in there about the range parsing/window setup at the moment.

I'm not sure if that's what you mean though, since you said "common bits" & Daire was doing that work in a world where there was no jh7110 driver in the mix.
Extracting common bits would be part of the process of adding a new driver, as I don't think there's any real reason to do so without another in-tree user.

Quoted 1 line

And I see there are many difference between pcie-microchip-host and our codes.

Right. I'd expect there to be a fair difference between our integrations of the IP, and therefore there'll be a bunch of non-shareable bits.

You need the stg,syscon & phy bits, and the clock/reset handling is clearly different too.

Quoted 1 line
Quoted 1 line
Quoted 1 line

https://github.com/starfive-tech/linux/blob/JH7110_VisionFive2_devel/drivers/pci/controller/pcie-plda.c

I had a bit of a read through this again today with Daire to check what the differences actually are and it *looked* like the main, non-implementation related, differences were the extra "event" domain that was created to simplify the driver & the bottom half interrupt handling.
That all came out of the review process, so it's likely that some of the same requests would be made of you by the PCI maintainers anyway.

As an aside, you should probably run checkpatch --strict on this submission, there's a rake of coding style "issues" in the new code you've added.

Cheers,
Conor.

author
#18 lore raw
Quoted 38 lines · Conor Dooley

Hey Minda,

Quoted 23 lines · Minda Chen
Quoted 22 lines · Conor Dooley
Quoted 21 lines · Conor Dooley
Quoted 3 lines · Minda Chen

This patchset adds PCIe driver for the StarFive JH7110 SoC. The patch has been tested on the VisionFive 2 board. The test devices include M.2 NVMe SSD and Realtek 8169 Ethernet adapter.

I was talking with Daire last week about some changes he's working on for the microchip driver, and we seemed to recall an off-list email sent to Daire & Bjorn about extracting the common PLDA bits from the pcie-microchip-host driver to be used with an (at that point) unreleased SoC. Perhaps Bjorn has this in his mailbox somewhere still, our corporate mail policy scrubs things from over a year ago & I could not find it.

I realised that that may actually have been StarFive, and the driver on your GitHub [1] certainly felt very familiar to Daire (he said it was very similar to his earlier revisions of his driver).

I've not looked at a diff between this and the version you ship on GitHub, but first a quick inspection it mostly just looks like you did s/plda/sifive/ on the file.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

I'm obviously not a PCI maintainer, but if there are common bits between the two drivers, extracting common bits seems like a good idea to me...

Thanks. It is pleasure to using same common codes. Does common bits changes will upstream soon?

I don't quite get what you mean. We've got some changes that are in progress here:
https://lore.kernel.org/linux-pci/[email protected]/
We've been quiet there for a while, but Daire's back looking into Robin's comments in there about the range parsing/window setup at the moment.

Quoted 7 lines

I'm not sure if that's what you mean though, since you said "common bits" & Daire was doing that work in a world where there was no jh7110 driver in the mix.
Extracting common bits would be part of the process of adding a new driver, as I don't think there's any real reason to do so without another in-tree user.

OK, I know extracting common bits is microchip new PCIe driver codes changed.
Just ignore my previous comments.
Maybe I will try to restructuring the driver code according to corporate e-mail which has been sent one year ago.

Quoted 10 lines
Quoted 1 line

And I see there are many difference between pcie-microchip-host and our codes.

Right. I'd expect there to be a fair difference between our integrations of the IP, and therefore there'll be a bunch of non-shareable bits.

You need the stg,syscon & phy bits, and the clock/reset handling is clearly different too.

Quoted 1 line
Quoted 1 line
Quoted 1 line

https://github.com/starfive-tech/linux/blob/JH7110_VisionFive2_devel/drivers/pci/controller/pcie-plda.c

Quoted 8 lines

I had a bit of a read through this again today with Daire to check what the differences actually are and it *looked* like the main, non-implementation related, differences were the extra "event" domain that was created to simplify the driver & the bottom half interrupt handling.
That all came out of the review process, so it's likely that some of the same requests would be made of you by the PCI maintainers anyway.

Thanks. I will check it and change my codes.

Quoted 4 lines

As an aside, you should probably run checkpatch --strict on this submission, there's a rake of coding style "issues" in the new code you've added.

I do not run checkpatch with "--strict". I will run with it.

Quoted 2 lines

Cheers,
Conor.