Skip to contentSkip to conversation

PCI: introduce TC9564 misc driver

PATCH Superseded Alex Elder 6 participants 24 messages Aug 13 – Aug 21

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

cover PCI: introduce TC9564 misc driver

The Toshiba TC9564 is specialized SoC that implements a PCIe switch as well as an Ethernet AVB/TSN bridge. It also implements other functions, including a reset and clock controller, an address translation unit, and a few other devices. PCIe BARs provide access to registers that manage these IP blocks, and the SoC is modeled using a PCI endpoint bus in devicetree. This allows the IP blocks to be bound to platform drivers using MMIO through the PCI BARs.

This series introduces the simple PCI driver necessary to implement the PCI endpoint bus. It enables the device, enables master access, and then scans the devicetree subnodes to discover any devices defined within the endpoint buses.

-Alex

Note: to work correctly, this series depends on this:
https://lore.kernel.org/lkml/[email protected]/

Alex Elder (2):
dt-bindings: misc: introduce pci1179,0220.yaml
misc: tc9564: introduce base PCI driver

 .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 drivers/misc/Kconfig                          |  10 ++
 drivers/misc/Makefile                         |   1 +
 drivers/misc/tc9564-pci.c                     |  89 +++++++++++
 drivers/pci/quirks.c                          |   1 +
 6 files changed, 258 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
 create mode 100644 drivers/misc/tc9564-pci.c

base-commit: 5e6de6a2b522f659defacb1551d0465ba6ce13cf

Signature · 1 line
2.53.0
author
#1 lore raw

PATCH 1/2 dt-bindings: misc: introduce pci1179,0220.yaml

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

---
 .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 156 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +150 -0
new file mode 100644
index 0000000000000..30a76f377eec8
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/pci1179,0220.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC9564 internal PCI endpoint function
+
+maintainers:
+  - Alex Elder <[email protected]>
+  - Daniel Thompson <[email protected]>
+
+description: >
+  The Toshiba TC9564 is specialized SoC that implements a PCIe switch
+  as well as an Ethernet AVB/TSN bridge.  In addition to these, the SoC
+  implements other functions, including a reset and clock controller,
+  an address translation unit, and a few other devices.
+
+  The PCI switch has three downstream ports.  The first two are exposed
+  externally, while the third is used by an internal PCIe endpoint.  The
+  internal endpoint implements two PCIe functions, and attached to each
+  of these is a 10 Gbps capable Synopsys Ethernet controller and an
+  interrupt controller that converts internal "wired" interrupts into
+  MSIs delivered to the host.
+
+  PCIe BARs provide access to registers that manage almost all IP blocks.
+  The SoC is modeled using a PCI endpoint bus.  The IP blocks are bound
+  to platform drivers that access the hardware using MMIO through the
+  PCI BARs.
+
+          ------------------------------------
+          |               Host               |
+          -----........---------------...-----
+              |        |             |   |
+              |  PCIe  |             |I2C|
+              |        |             |   |
+    ----------+........+-------------+...+---------------------------
+    |         |upstream|          |          |     ---------------- |
+    | Toshiba | Port 0 |          |          +-----+ PCIe pwrctrl | |
+    | TC9564  ----++----          |   I2C    |     ---------------- |
+    |  SoC        ||              |controller|     ---------------- |
+    |             ||              |          +-----+     GPIO     | |
+    |             ||              |          |     |  controller  | |
+    |       ------++------        ------------     ---------------- |
+    |       |     US     |                                          |
+    |       |            |    ------------------------------------- |
+    |       |         DS3+====+          downstream port 3        | |
+    |       |            |    |-----------------------------------| |
+    |       |    PCIe    |    |       embedded PCIe endpoint      | |
+    |       |            |    |~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~| |
+    |       |   Switch   |    | PCIe function 0 | PCIe function 1 | |
+    |       |            |    |-----------------+-----------------| |
+    |       |            |    |  BAR  | |  BAR  |         |  BAR  | |
+    |       |            |    |   0   | |   4   |         |   4   | |
+    |       | DS1    DS2 |    ----.---- ----.----         ----.---- |
+    |       --++------++--        :      ...:                 :...  |
+    |         ||      ||          :      :  :   -------       :  |  |
+    |         ||      ||   -------.---  -.- :...|clock|       : -.- |
+    |         ||      ||   |translate|  |M| :   -------       : |M| |
+    |         ||      ||   -----------  |S| :                 : |S| |
+    |         ||      ||                |I| :   -------       : |I| |
+    |         ||      ||                |G| :...|reset|       : |G| |
+    |         ||      ||                |E| :   -------       : |E| |
+    | --------++--  --++--------        |N| :                 : |N| |
+    | |downstream|  |downstream|      ------.----       ------.---- |
+    | |  port 1  |  |  port 2  |      | XGMAC 0 |       | XGMAC 1 | |
+    --+..........+--+..........+-------+.......+---------+.....+-----
+                                      |       |          |     |
+                                      |USXGMII|          |SGMII|
+                                      |       |          |     |
+                                    ---+.....+---      --+.....+--
+                                    |  Ethernet |      | Ethernet|
+                                    |    PHY    |      |   PHY   |
+                                    -------------      -----------
+
+allOf:
+  - $ref: /schemas/pci/pci-ep-bus.yaml
+
+properties:
+  compatible:
+    const: pci1179,0220 # Toshiba TC96564 (a.k.a. Qualcomm QPS615)
+
+  reg:
+    maxItems: 1
+    description: PCI Bus/Device/Function config space address
+
+unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - '#address-cells'
+  - '#size-cells'
+  - ranges
+
+examples:
+  - |
+    pcie@0 {
+        reg = <0x0  0x0>;
+        #address-cells = <3>;
+        #size-cells = <2>;
+        device_type = "pci";
+        ranges = <0x83000000 0x0 0x0  0x0  0x0 0x1fd00000>;
+
+        pci@0,0 {
+            compatible = "pci1179,0220";
+            reg = <0x0 0x0 0x0 0x0 0x0>;
+            #address-cells = <3>;
+            #size-cells = <2>;
+            /* Ranges will be updated dynamically */
+            ranges = <0x0 0x0 0x0  0x83000000 0x0 0x0  0x0 0x4000>,
+                     <0x2 0x0 0x0  0x83000000 0x0 0x0  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000000 0x0 0x0  0x0 0x200000>;
+
+            pci-ep-bus@0 {
+                compatible = "simple-bus";
+                #address-cells = <1>;
+                #size-cells = <1>;
+                /* Map 0x0-0x3fff to BAR 0 */
+                ranges = <0x0  0x0 0x0 0x0  0x4000>;
+            };
+
+            pci-ep-bus@4 {
+                compatible = "simple-bus";
+                #address-cells = <1>;
+                #size-cells = <1>;
+                /* Map 0x0-0x1fffff to BAR 4 */
+                ranges = <0x0  0x4 0x0 0x0  0x200000>;
+            };
+        };
+
+        pci@0,1 {
+            compatible = "pci1179,0220";
+            reg = <0x100 0x0 0x0 0x0 0x0>;
+            #address-cells = <3>;
+            #size-cells = <2>;
+            /* Ranges will be updated dynamically */
+            ranges = <0x0 0x0 0x0  0x83000100 0x0 0x0  0x0 0x4000>,
+                     <0x2 0x0 0x0  0x83000100 0x0 0x0  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000100 0x0 0x0  0x0 0x200000>;
+
+            pci-ep-bus@4 {
+                compatible = "simple-bus";
+                #address-cells = <1>;
+                #size-cells = <1>;
+                /* Map 0x0-0x1fffff to BAR 4 */
+                ranges = <0x0  0x4 0x0 0x0  0x200000>;
+            };
+        };
+    };
MAINTAINERS +6 -0
index 15c7dc516f7cf..7b7966ad3dea5 100644
@@ -27615,6 +27615,12 @@ F:	Documentation/devicetree/bindings/media/i2c/toshiba,tc358743.txt
 F:	drivers/media/i2c/tc358743*
 F:	include/media/i2c/tc358743.h
 
+TOSHIBA TC9564 PCI DRIVER
+M:	Alex Elder <[email protected]>
+M:	Daniel Thompson <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/misc/pci1179,0220.yaml
+
 TOSHIBA WMI HOTKEYS DRIVER
 M:	Azael Avalos <[email protected]>
 L:	[email protected]
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] The example DT nodes map multiple PCI BARs to the exact same parent physical address, and define…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The example DT nodes map multiple PCI BARs to the exact same parent physical address, and define unused BARs that contradict the hardware diagram.
- [Low] Typographical error in the compatible string comment.
--

--- Patch [1]: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml --- commit ee5f64080011b047dd81e1bbdc568f784c09b77f
Author: Alex Elder <[email protected]>

dt-bindings: misc: introduce pci1179,0220.yaml

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 4 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +0 -0
new file mode 100644

[ ... ]

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 81

Quoted 3 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +3 -0
+properties:
+  compatible:
+    const: pci1179,0220 # Toshiba TC96564 (a.k.a. Qualcomm QPS615)

[Severity: Low]
This isn't a bug, but there's a typo in this comment. It says TC96564 instead of TC9564.

[ ... ]

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 113

Quoted 9 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +9 -0
+        pci@0,0 {
+            compatible = "pci1179,0220";
+            reg = <0x0 0x0 0x0 0x0 0x0>;
+            #address-cells = <3>;
+            #size-cells = <2>;
+            /* Ranges will be updated dynamically */
+            ranges = <0x0 0x0 0x0  0x83000000 0x0 0x0  0x0 0x4000>,
+                     <0x2 0x0 0x0  0x83000000 0x0 0x0  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000000 0x0 0x0  0x0 0x200000>;

[Severity: Low]
Are these example ranges accurate for the hardware? The mappings configure BAR 0, BAR 2, and BAR 4 to use the identical parent physical address (0x83000000), which would result in overlapping memory regions.

Additionally, the hardware diagram in the binding description indicates BAR 2 is not present, but it is configured in this example.

[ ... ]

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 140

Quoted 9 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +9 -0
+        pci@0,1 {
+            compatible = "pci1179,0220";
+            reg = <0x100 0x0 0x0 0x0 0x0>;
+            #address-cells = <3>;
+            #size-cells = <2>;
+            /* Ranges will be updated dynamically */
+            ranges = <0x0 0x0 0x0  0x83000100 0x0 0x0  0x0 0x4000>,
+                     <0x2 0x0 0x0  0x83000100 0x0 0x0  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000100 0x0 0x0  0x0 0x200000>;

[Severity: Low]
Do these ranges match the hardware design for Function 1? The example maps BAR 0 and BAR 2 here, but the hardware diagram indicates Function 1 only uses BAR 4.

These mappings also map to the same parent physical address (0x83000100), causing overlapping memory regions similar to the previous node.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#3 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 20 lines · On 8/13/26 8:45 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] The example DT nodes map multiple PCI BARs to the exact same parent physical address, and define unused BARs that contradict the hardware diagram.
- [Low] Typographical error in the compatible string comment.
--

--- Patch [1]: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml --- commit ee5f64080011b047dd81e1bbdc568f784c09b77f
Author: Alex Elder <[email protected]>

dt-bindings: misc: introduce pci1179,0220.yaml

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 4 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +0 -0
new file mode 100644

[ ... ]

Quoted 7 lines

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 81

Quoted 3 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +3 -0
+properties:
+  compatible:
+    const: pci1179,0220 # Toshiba TC96564 (a.k.a. Qualcomm QPS615)

[Severity: Low]
This isn't a bug, but there's a typo in this comment. It says TC96564 instead of TC9564.

I will fix this in the next version.

Quoted 11 lines

[ ... ]

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 113

Quoted 9 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +9 -0
+        pci@0,0 {
+            compatible = "pci1179,0220";
+            reg = <0x0 0x0 0x0 0x0 0x0>;
+            #address-cells = <3>;
+            #size-cells = <2>;
+            /* Ranges will be updated dynamically */
+            ranges = <0x0 0x0 0x0  0x83000000 0x0 0x0  0x0 0x4000>,
+                     <0x2 0x0 0x0  0x83000000 0x0 0x0  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000000 0x0 0x0  0x0 0x200000>;
Quoted 4 lines

[Severity: Low]
Are these example ranges accurate for the hardware? The mappings configure BAR 0, BAR 2, and BAR 4 to use the identical parent physical address (0x83000000), which would result in overlapping memory regions.

Yes, and I could put something else in there, but this is related to another issue about the dynamic nature of assigned BAR base addresses. I sent out another series to propose a fix for that.

https://lore.kernel.org/lkml/[email protected]/

I'm interested to know if anyone has another suggestion for how best to represent this.

Quoted 2 lines

Additionally, the hardware diagram in the binding description indicates BAR 2 is not present, but it is configured in this example.

I find it very impressive that Sashiko interprets the ASCII art diagram this well...

The reality is that--at least when the ranges property is dynamically created--all BARs will have a range value defined in the ranges property, even if one or more is not used.

I chose this way of specifying this so that the relationship between the endpoint ranges property and the pci-ep-bus ranges properties were clear (indicating the BAR number in the first cell).

The remaining questions below have the same basic answers as I have already provided.

-Alex

Quoted 20 lines

[ ... ]

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 140

Quoted 9 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +9 -0
+        pci@0,1 {
+            compatible = "pci1179,0220";
+            reg = <0x100 0x0 0x0 0x0 0x0>;
+            #address-cells = <3>;
+            #size-cells = <2>;
+            /* Ranges will be updated dynamically */
+            ranges = <0x0 0x0 0x0  0x83000100 0x0 0x0  0x0 0x4000>,
+                     <0x2 0x0 0x0  0x83000100 0x0 0x0  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000100 0x0 0x0  0x0 0x200000>;

[Severity: Low]
Do these ranges match the hardware design for Function 1? The example maps BAR 0 and BAR 2 here, but the hardware diagram indicates Function 1 only uses BAR 4.

These mappings also map to the same parent physical address (0x83000100), causing overlapping memory regions similar to the previous node.

#4 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

In reply to Alex Elder
Quoted 4 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 8 lines
---
 .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 156 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

There are no properties in the binding except standard PCIe ones, so why do you need it in DT in the first place? We do not describe PCI devices in DT by default, so you are doing something unusual. Commit msg should explain that.

Best regards,
Krzysztof

author
#5 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 14 lines · Krzysztof Kozlowski
Quoted 4 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 8 lines
---
  .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
  MAINTAINERS                                   |   6 +
  2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

Quoted 4 lines

There are no properties in the binding except standard PCIe ones, so why do you need it in DT in the first place? We do not describe PCI devices in DT by default, so you are doing something unusual. Commit msg should explain that.

Maybe because it's using pci-ep-bus? I'm not sure I can answer your question though.

An earlier version used auxiliary devices. This time the PCI device sort of stands by itself as provider of the endpoint buses that are used by other devices within the SoC. There is otherwise no single driver (e.g., for an Ethernet interface) that is implemented as a PCI driver to bind with the hardware. The SoC drivers will all be platform drivers.

If you don't think this is needed, I'll gladly accept that.

But the PCI endpoint bus is a devicetree construct, and it seemed to me that using it needed to be documented somehow.

I'd appreciate guidance on how to think about it so I can document it properly (or not).

Thanks.

-Alex

Quoted 3 lines

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 15 lines · Alex Elder
Quoted 14 lines · Krzysztof Kozlowski
Quoted 12 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

---
  .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
  MAINTAINERS                                   |   6 +
  2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

Quoted 7 lines
Quoted 4 lines

There are no properties in the binding except standard PCIe ones, so why do you need it in DT in the first place? We do not describe PCI devices in DT by default, so you are doing something unusual. Commit msg should explain that.

Maybe because it's using pci-ep-bus? I'm not sure I can answer your question though.

What is pcie-ep bus? If a device is a PCI device (so not the host bridge), we do not need to define it in DT except a few cases and this does not look like one.

Quoted 7 lines

An earlier version used auxiliary devices. This time the PCI device sort of stands by itself as provider of the endpoint buses that are used by other devices within the SoC. There is otherwise no single driver (e.g., for an Ethernet interface) that is implemented as a PCI driver to bind with the hardware. The SoC drivers will all be platform drivers.

All this is driver explanation, so does not really answer my questions. Whether something is using platform bus or auxiliary devices it absolutely does not matter for the DT. It cannot even matter for DT.

Best regards,
Krzysztof

author
#7 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 21 lines · Krzysztof Kozlowski
Quoted 20 lines · Alex Elder
Quoted 18 lines · Krzysztof Kozlowski
Quoted 4 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 8 lines
---
   .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
   MAINTAINERS                                   |   6 +
   2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

There are no properties in the binding except standard PCIe ones, so why do you need it in DT in the first place? We do not describe PCI devices in DT by default, so you are doing something unusual. Commit msg should explain that.

Quoted 6 lines
Quoted 2 lines

Maybe because it's using pci-ep-bus? I'm not sure I can answer your question though.

What is pcie-ep bus? If a device is a PCI device (so not the host bridge), we do not need to define it in DT except a few cases and this does not look like one.

It's a weird case because PCI has its own enumeration method, so there should no need to involve devicetree.

Nevertheless the pci-ep-bus model *is* a devicetree thing related to PCI, describing devices accessible via PCI BARs.
Documentation/devicetree/bindings/pci/pci-ep-bus.yaml

It is used for the LAN966x SoC, however that driver loads the devicetree content dynamically using an overlay, and its overlay source is found under drivers/misc:
drivers/misc/lan966x_pci.c drivers/misc/lan966x_pci.dtso

This use of the LAN966x has no devicetree binding.

The Raspberry Pi RP1 also uses pci-ep-bus. It, however does have a binding:
Documentation/devicetree/bindings/misc/pci1de4,1.yaml

Quoted 10 lines
Quoted 6 lines

An earlier version used auxiliary devices. This time the PCI device sort of stands by itself as provider of the endpoint buses that are used by other devices within the SoC. There is otherwise no single driver (e.g., for an Ethernet interface) that is implemented as a PCI driver to bind with the hardware. The SoC drivers will all be platform drivers.

All this is driver explanation, so does not really answer my questions. Whether something is using platform bus or auxiliary devices it absolutely does not matter for the DT. It cannot even matter for DT.

I understand what you're saying, and I do agree with you.

Still, this is a strange case where the devicetree language is used to describe devices and properties that are not discoverable, using this pci-ep-bus devicetree *technique*.

The core PCI functionality gets discovered in the usual PCI way (enumeration). But this allows additional hardware to be described.

I think that if the devicetree language is used to describe hardware, having a binding to explain what's valid for that hardware description makes sense.

As I understand it, for the LAN966x, the original use of the SoC used an internal processor to run Linux. So platform drivers for the devices within the SoC were created that matched with compatible strings, etc.

Then in another mode, LAN966x is used as a PCI add-in card, and the pci-ep-bus allowed all of those other drivers to be used, unmodified.

So anyway, pci-ep-bus is an odd situation.

If the answer is "don't create a binding for this stuff, even if it gets defined in the devicetree file" then I'll accept that.

But my instinct is that it's good to use a binding to describe what the DTS describing the hardware should look like (despite it being accessed using what amounts to a logical bus).

-Alex

Quoted 3 lines

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

In reply to Alex Elder
Quoted 4 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 8 lines
---
 .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 156 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@0:compatible: ['simple-bus'] does not contain items matching the given schema
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@0: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@4:compatible: ['simple-bus'] does not contain items matching the given schema
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@4: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): ranges: 'oneOf' conditional failed, one must be fixed:

	[[0, 0, 0, 2197815296, 0, 0, 0, 16384], [2, 0, 0, 2197815296, 0, 0, 0, 524288], [4, 0, 0, 2197815296, 0, 0, 0, 2097152]] is not of type 'boolean'
	0 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	2 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	4 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml

Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): pci-ep-bus@4:compatible: ['simple-bus'] does not contain items matching the given schema
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): pci-ep-bus@4: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): ranges: 'oneOf' conditional failed, one must be fixed:

	[[0, 0, 0, 2197815552, 0, 0, 0, 16384], [2, 0, 0, 2197815552, 0, 0, 0, 524288], [4, 0, 0, 2197815552, 0, 0, 0, 2097152]] is not of type 'boolean'
	0 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	2 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	4 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml

Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

author
#9 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 15 lines · Rob Herring (Arm)
Quoted 4 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

Quoted 8 lines
---
  .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
  MAINTAINERS                                   |   6 +
  2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

Quoted 1 line

My bot found errors running 'make dt_binding_check' on your patch:

I don't see these errors, so I'm probably running an old version of something? I'll try to sort it out. Sorry about that.

-Alex

Quoted 50 lines

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@0:compatible: ['simple-bus'] does not contain items matching the given schema
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@0: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@4:compatible: ['simple-bus'] does not contain items matching the given schema
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): pci-ep-bus@4: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): ranges: 'oneOf' conditional failed, one must be fixed:

	[[0, 0, 0, 2197815296, 0, 0, 0, 16384], [2, 0, 0, 2197815296, 0, 0, 0, 524288], [4, 0, 0, 2197815296, 0, 0, 0, 2097152]] is not of type 'boolean'
	0 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	2 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	4 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml

Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,0 (pci1179,0220): 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): pci-ep-bus@4:compatible: ['simple-bus'] does not contain items matching the given schema
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): pci-ep-bus@4: 'reg' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): ranges: 'oneOf' conditional failed, one must be fixed:

	[[0, 0, 0, 2197815552, 0, 0, 0, 16384], [2, 0, 0, 2197815552, 0, 0, 0, 524288], [4, 0, 0, 2197815552, 0, 0, 0, 2097152]] is not of type 'boolean'
	0 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	2 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	4 is not one of [16777216, 33554432, 50331648, 1107296256, 1124073472, 2164260864, 2181038080, 2197815296, 3254779904, 3271557120]
	from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml

Documentation/devicetree/bindings/misc/pci1179,0220.example.dtb: pci@0,1 (pci1179,0220): 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus-common.yaml

doc reference errors (make refcheckdocs):

See https://patchwork.kernel.org/project/devicetree/patch/[email protected]

The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.

maintainer
#10 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 16 lines · Alex Elder
Quoted 15 lines · Rob Herring (Arm)
Quoted 12 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

---
  .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
  MAINTAINERS                                   |   6 +
  2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

Quoted 4 lines
Quoted 1 line

My bot found errors running 'make dt_binding_check' on your patch:

I don't see these errors, so I'm probably running an old version of something? I'll try to sort it out. Sorry about that.

Are you setting DT_SCHEMA_FILES? If so, read the rest of the msg that was cut. :)

You can also now do 'make misc/pci1179,0220.yaml' which checks your example against all schemas rather than against only your schema.

Rob

author
#11 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 17 lines · Rob Herring
Quoted 16 lines · Alex Elder
Quoted 15 lines · Rob Herring (Arm)
Quoted 12 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

---
   .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
   MAINTAINERS                                   |   6 +
   2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

My bot found errors running 'make dt_binding_check' on your patch:

I don't see these errors, so I'm probably running an old version of something? I'll try to sort it out. Sorry about that.

Are you setting DT_SCHEMA_FILES? If so, read the rest of the msg that was cut. :)

Yes I do set (export) DT_SCHEMA_FILES to the file I want to check.

yamllint --version
yamllint 1.38.0

pip3 install dtschema --upgrade
...reports a long list of "Requirement already satisfied" messages

I suspect I'm running local versions and something is out of date.

Quoted 2 lines

You can also now do 'make misc/pci1179,0220.yaml' which checks your example against all schemas rather than against only your schema.

That's good to know.

I'll spend some more time trying to reproduce the errors soon.

Thanks for following up.

					-Alex>
Quoted 1 line

Rob

maintainer
#12 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

In reply to Alex Elder
Quoted 3 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

A better subject would be "dt-bindings: misc: Add Toshiba PC9564 endpoint functon device".

Quoted 86 lines
---
 .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 156 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +71 -0
new file mode 100644
index 0000000000000..30a76f377eec8
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/pci1179,0220.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC9564 internal PCI endpoint function
+
+maintainers:
+  - Alex Elder <[email protected]>
+  - Daniel Thompson <[email protected]>
+
+description: >
+  The Toshiba TC9564 is specialized SoC that implements a PCIe switch
+  as well as an Ethernet AVB/TSN bridge.  In addition to these, the SoC
+  implements other functions, including a reset and clock controller,
+  an address translation unit, and a few other devices.
+
+  The PCI switch has three downstream ports.  The first two are exposed
+  externally, while the third is used by an internal PCIe endpoint.  The
+  internal endpoint implements two PCIe functions, and attached to each
+  of these is a 10 Gbps capable Synopsys Ethernet controller and an
+  interrupt controller that converts internal "wired" interrupts into
+  MSIs delivered to the host.
+
+  PCIe BARs provide access to registers that manage almost all IP blocks.
+  The SoC is modeled using a PCI endpoint bus.  The IP blocks are bound
+  to platform drivers that access the hardware using MMIO through the
+  PCI BARs.
+
+          ------------------------------------
+          |               Host               |
+          -----........---------------...-----
+              |        |             |   |
+              |  PCIe  |             |I2C|
+              |        |             |   |
+    ----------+........+-------------+...+---------------------------
+    |         |upstream|          |          |     ---------------- |
+    | Toshiba | Port 0 |          |          +-----+ PCIe pwrctrl | |
+    | TC9564  ----++----          |   I2C    |     ---------------- |
+    |  SoC        ||              |controller|     ---------------- |
+    |             ||              |          +-----+     GPIO     | |
+    |             ||              |          |     |  controller  | |
+    |       ------++------        ------------     ---------------- |
+    |       |     US     |                                          |
+    |       |            |    ------------------------------------- |
+    |       |         DS3+====+          downstream port 3        | |
+    |       |            |    |-----------------------------------| |
+    |       |    PCIe    |    |       embedded PCIe endpoint      | |
+    |       |            |    |~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~| |
+    |       |   Switch   |    | PCIe function 0 | PCIe function 1 | |
+    |       |            |    |-----------------+-----------------| |
+    |       |            |    |  BAR  | |  BAR  |         |  BAR  | |
+    |       |            |    |   0   | |   4   |         |   4   | |
+    |       | DS1    DS2 |    ----.---- ----.----         ----.---- |
+    |       --++------++--        :      ...:                 :...  |
+    |         ||      ||          :      :  :   -------       :  |  |
+    |         ||      ||   -------.---  -.- :...|clock|       : -.- |
+    |         ||      ||   |translate|  |M| :   -------       : |M| |
+    |         ||      ||   -----------  |S| :                 : |S| |
+    |         ||      ||                |I| :   -------       : |I| |
+    |         ||      ||                |G| :...|reset|       : |G| |
+    |         ||      ||                |E| :   -------       : |E| |
+    | --------++--  --++--------        |N| :                 : |N| |
+    | |downstream|  |downstream|      ------.----       ------.---- |
+    | |  port 1  |  |  port 2  |      | XGMAC 0 |       | XGMAC 1 | |
+    --+..........+--+..........+-------+.......+---------+.....+-----
+                                      |       |          |     |
+                                      |USXGMII|          |SGMII|
+                                      |       |          |     |
+                                    ---+.....+---      --+.....+--

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 81

Quoted 10 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +10 -0
+                                    |  Ethernet |      | Ethernet|
+                                    |    PHY    |      |   PHY   |
+                                    -------------      -----------
+
+allOf:
+  - $ref: /schemas/pci/pci-ep-bus.yaml
+
+properties:
+  compatible:
+    const: pci1179,0220 # Toshiba TC96564 (a.k.a. Qualcomm QPS615)

Perhaps somewhere besides a comment say what the relationship to a Qualcomm device is.

Rob

author
#13 lore raw

Re: [PATCH 1/2] dt-bindings: misc: introduce pci1179,0220.yaml

Quoted 7 lines · Rob Herring
Quoted 3 lines · Alex Elder

Define the binding for the Toshiba TC9564 PCI endpoint function device. The third downstream PCIe switch port within this chip has an embedded PCIe controller, and that implements two of these PCIe functions.

A better subject would be "dt-bindings: misc: Add Toshiba PC9564 endpoint functon device".

OK. And yes, I'll do a better job explaining that the TC9564 is (to the best of my knowledge) also sold (but re-branded) as the Qualcomm QPS615. I'll see if Qualcomm has a particular wording they'd prefer.

Thanks.

-Alex

Quoted 102 lines
Quoted 87 lines
---
  .../bindings/misc/pci1179,0220.yaml           | 150 ++++++++++++++++++
  MAINTAINERS                                   |   6 +
  2 files changed, 156 insertions(+)

create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml

Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +71 -0
new file mode 100644
index 0000000000000..30a76f377eec8
@@ -0,0 +1,150 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/misc/pci1179,0220.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Toshiba TC9564 internal PCI endpoint function
+
+maintainers:
+  - Alex Elder <[email protected]>
+  - Daniel Thompson <[email protected]>
+
+description: >
+  The Toshiba TC9564 is specialized SoC that implements a PCIe switch
+  as well as an Ethernet AVB/TSN bridge.  In addition to these, the SoC
+  implements other functions, including a reset and clock controller,
+  an address translation unit, and a few other devices.
+
+  The PCI switch has three downstream ports.  The first two are exposed
+  externally, while the third is used by an internal PCIe endpoint.  The
+  internal endpoint implements two PCIe functions, and attached to each
+  of these is a 10 Gbps capable Synopsys Ethernet controller and an
+  interrupt controller that converts internal "wired" interrupts into
+  MSIs delivered to the host.
+
+  PCIe BARs provide access to registers that manage almost all IP blocks.
+  The SoC is modeled using a PCI endpoint bus.  The IP blocks are bound
+  to platform drivers that access the hardware using MMIO through the
+  PCI BARs.
+
+          ------------------------------------
+          |               Host               |
+          -----........---------------...-----
+              |        |             |   |
+              |  PCIe  |             |I2C|
+              |        |             |   |
+    ----------+........+-------------+...+---------------------------
+    |         |upstream|          |          |     ---------------- |
+    | Toshiba | Port 0 |          |          +-----+ PCIe pwrctrl | |
+    | TC9564  ----++----          |   I2C    |     ---------------- |
+    |  SoC        ||              |controller|     ---------------- |
+    |             ||              |          +-----+     GPIO     | |
+    |             ||              |          |     |  controller  | |
+    |       ------++------        ------------     ---------------- |
+    |       |     US     |                                          |
+    |       |            |    ------------------------------------- |
+    |       |         DS3+====+          downstream port 3        | |
+    |       |            |    |-----------------------------------| |
+    |       |    PCIe    |    |       embedded PCIe endpoint      | |
+    |       |            |    |~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~| |
+    |       |   Switch   |    | PCIe function 0 | PCIe function 1 | |
+    |       |            |    |-----------------+-----------------| |
+    |       |            |    |  BAR  | |  BAR  |         |  BAR  | |
+    |       |            |    |   0   | |   4   |         |   4   | |
+    |       | DS1    DS2 |    ----.---- ----.----         ----.---- |
+    |       --++------++--        :      ...:                 :...  |
+    |         ||      ||          :      :  :   -------       :  |  |
+    |         ||      ||   -------.---  -.- :...|clock|       : -.- |
+    |         ||      ||   |translate|  |M| :   -------       : |M| |
+    |         ||      ||   -----------  |S| :                 : |S| |
+    |         ||      ||                |I| :   -------       : |I| |
+    |         ||      ||                |G| :...|reset|       : |G| |
+    |         ||      ||                |E| :   -------       : |E| |
+    | --------++--  --++--------        |N| :                 : |N| |
+    | |downstream|  |downstream|      ------.----       ------.---- |
+    | |  port 1  |  |  port 2  |      | XGMAC 0 |       | XGMAC 1 | |
+    --+..........+--+..........+-------+.......+---------+.....+-----
+                                      |       |          |     |
+                                      |USXGMII|          |SGMII|
+                                      |       |          |     |
+                                    ---+.....+---      --+.....+--

Documentation/devicetree/bindings/misc/pci1179,0220.yaml line 81

Quoted 10 lines
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +10 -0
+                                    |  Ethernet |      | Ethernet|
+                                    |    PHY    |      |   PHY   |
+                                    -------------      -----------
+
+allOf:
+  - $ref: /schemas/pci/pci-ep-bus.yaml
+
+properties:
+  compatible:
+    const: pci1179,0220 # Toshiba TC96564 (a.k.a. Qualcomm QPS615)

Perhaps somewhere besides a comment say what the relationship to a Qualcomm device is.

Rob

author
#14 lore raw

PATCH 2/2 misc: tc9564: introduce base PCI driver

In reply to Alex Elder

The Toshiba TC9564 is small and highly-specialized SoC that implements a PCIe switch as well as an Ethernet AVB/TSN bridge. In addition to these, the SoC implements other functions, including a reset and clock controller, an address translation unit, and a few other devices. PCIe BARs provide access to registers that manage these IP blocks, and the SoC is modeled using a PCI endpoint bus in devicetree. This allows the IP blocks to be bound to platform drivers using MMIO through the PCI BARs.

Create a new PCI driver under drivers/misc that binds with the embedded PCI endpoint functions within the TC9564 SoC. Because these functions will use devicetree pci-ep-bus to provide access to other IP blocks within the TC9564 chip, the main purpose of this driver is to do basic PCI initialization, then call of_platform_default_populate() to scan for the any endpoint bus children, and probe all devices defined therein.

Because we're using pci-ep-bus, we need to use the PCI quirks mechanism to have of_pci_make_dev_node() be called for each endpoint device in pci_bus_add_device() (via pci_fixup_device(pci_fixup_final, dev)).

---
 MAINTAINERS               |  1 +
 drivers/misc/Kconfig      | 10 +++++
 drivers/misc/Makefile     |  1 +
 drivers/misc/tc9564-pci.c | 89 +++++++++++++++++++++++++++++++++++++++
 drivers/pci/quirks.c      |  1 +
 5 files changed, 102 insertions(+)
 create mode 100644 drivers/misc/tc9564-pci.c
MAINTAINERS +1 -0
index 7b7966ad3dea5..125fa60122c4e 100644
@@ -27620,6 +27620,7 @@ M:	Alex Elder <[email protected]>
 M:	Daniel Thompson <[email protected]>
 S:	Maintained
 F:	Documentation/devicetree/bindings/misc/pci1179,0220.yaml
+F:	drivers/misc/tc9564-pci.c
 
 TOSHIBA WMI HOTKEYS DRIVER
 M:	Azael Avalos <[email protected]>
drivers/misc/Kconfig +10 -0
index 7364931dad3a1..91950d2928f07 100644
@@ -568,6 +568,16 @@ config MCHP_LAN966X_PCI
 	    - lan966x-miim (MDIO_MSCC_MIIM)
 	    - lan966x-switch (LAN966X_SWITCH)
 
+config TC9564_PCI
+	tristate "Toshiba TC9564 PCI function support"
+	depends on PCI
+	select REGMAP_MMIO
+	help
+	  This enables support for the two PCI functions implemented by
+	  the embedded PCIe endpoint in the Toshiba TC9564 SoC.  This
+	  driver uses a pci-ep-bus node in devicetree to provide MMIO
+	  access to other SoC devices through PCI function BARs.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index e8d8d5d88c0df..7cc3d615d37a4 100644
@@ -71,3 +71,4 @@ obj-y				+= keba/
 obj-y				+= amd-sbi/
 obj-$(CONFIG_MISC_RP1)		+= rp1/
 obj-$(CONFIG_INTEL_SSEI)	+= issei/
+obj-$(CONFIG_TC9564_PCI)	+= tc9564-pci.o
drivers/misc/tc9564-pci.c new file +89 -0

89 lines not on this page · raw message

drivers/pci/quirks.c +1 -0
index 6501c949c5b76..b484f1b1d0e71 100644
@@ -6388,6 +6388,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5021, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REDHAT, 0x0005, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, 0x9660, of_pci_make_dev_node);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TOSHIBA, 0x0220, of_pci_make_dev_node);
 
 /*
  * Devices known to require a longer delay before first config space access
Signature · 1 line
2.53.0
maintainer
#15 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

Quoted 1 line · Alex Elder

+#define DRIVER_NAME "tc9564-pci"

What about just using KBUILD_MODNAME?

drivers/misc/tc9564-pci.c line 34

Quoted 2 lines
drivers/misc/tc9564-pci.c new file +2 -0
+static int
+tc9564_function_probe(struct pci_dev *pdev, const struct pci_device_id *id)

But wow, this is a tiny driver, feels odd to have it in misc/ but ok, if you think it should be here...

thanks,

greg k-h

maintainer
#16 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

Quoted 10 lines · Greg KH
Quoted 1 line · Alex Elder

+#define DRIVER_NAME "tc9564-pci"

What about just using KBUILD_MODNAME?

drivers/misc/tc9564-pci.c line 34

Quoted 2 lines
drivers/misc/tc9564-pci.c new file +2 -0
+static int
+tc9564_function_probe(struct pci_dev *pdev, const struct pci_device_id *id)

But wow, this is a tiny driver, feels odd to have it in misc/ but ok, if you think it should be here...

We have drivers/misc/rp1/ and drivers/misc/lan966x_pci*.c with similar functionality, so at least there is precedence for putting them here.

From the old days, we still have drivers/mfd/sm501.c, drivers/mfd/cs5535-mfd.c, and a few others that open-code the on-chip components as mfd cels instead of using devicetree description.

At some point, we should think about grouping them into a separate subdirectory.

Arnd

author
#17 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Greg KH
Quoted 1 line · Alex Elder

+#define DRIVER_NAME "tc9564-pci"

What about just using KBUILD_MODNAME?

Quoted 8 lines
Quoted 5 lines

drivers/misc/tc9564-pci.c line 34

Quoted 2 lines
drivers/misc/tc9564-pci.c new file +2 -0
+static int
+tc9564_function_probe(struct pci_dev *pdev, const struct pci_device_id *id)

But wow, this is a tiny driver, feels odd to have it in misc/ but ok, if you think it should be here...

We have drivers/misc/rp1/ and drivers/misc/lan966x_pci*.c with similar functionality, so at least there is precedence for putting them here.

Yes, exactly.

Quoted 6 lines

From the old days, we still have drivers/mfd/sm501.c, drivers/mfd/cs5535-mfd.c,
and a few others that open-code the on-chip components as mfd cels instead of using devicetree description.

At some point, we should think about grouping them into a separate subdirectory.

You mean for systems modeled with PCI endpoint bus, right?

If there is consensus that now is a good time to do that I don't mind doing that work, but won't unless it's clearly requested.

-Alex

Quoted 2 lines

Arnd

author
#18 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

In reply to Greg KH
Quoted 4 lines · Greg KH
Quoted 1 line · Alex Elder

+#define DRIVER_NAME "tc9564-pci"

What about just using KBUILD_MODNAME?

Yes, I'll use that. The underscore versus dash doesn't matter...

Quoted 6 lines

drivers/misc/tc9564-pci.c line 34

Quoted 3 lines
drivers/misc/tc9564-pci.c new file +2 -0
+static int
+tc9564_function_probe(struct pci_dev *pdev, const struct pci_device_id *id)

But wow, this is a tiny driver, feels odd to have it in misc/ but ok, if you think it should be here...

I put it in misc/ because lan966xc_pci.c, which also uses a pci-ep-bus, is located there. That driver also calls of_platform_default_populate(), though it also loads a DT overlay which isn't needed here.

It is indeed tiny, and your comment makes me think it could easily become a generic driver (along the lines of "simple-mfd-i2c.c"). That way other similar future SoCs could just add their compatible string.

So two questions (for anyone):
- Would that be preferred--rename this to target a generic situation? For example, "static-pci-ep-bus.c"?
- Where should such a driver be located? For example, drivers/misc/, drivers/pci/controller/, or something else?

-Alex

Quoted 3 lines

thanks,

greg k-h

#19 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

In reply to Alex Elder
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Missing PCI IRQ vector allocation prevents MSI/MSI-X usage for high-speed child devices. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing PCI IRQ vector allocation prevents MSI/MSI-X usage for high-speed child devices. --

--- Patch [2]: [PATCH 2/2] misc: tc9564: introduce base PCI driver --- commit e66bfe4041c21f48829a22eb54cde73756806870
Author: Alex Elder <[email protected]>
misc: tc9564: introduce base PCI driver

This commit introduces a base PCI driver for the Toshiba TC9564 SoC which implements a PCIe switch and Ethernet AVB/TSN bridge. The driver binds to the embedded PCI endpoint functions, performs basic PCI initialization, and uses devicetree to populate any endpoint bus children.

[ ... ]

Quoted 5 lines
drivers/misc/tc9564-pci.c new file +0 -0
new file mode 100644
index 0000000000000..d3ffcac1c522f

[ ... ]

Quoted 9 lines
drivers/misc/tc9564-pci.c new file +9 -0
+static int
+tc9564_function_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np;
+	int ret;
+
+	/* Despite being a PCI device, we require devicetree */
+	np = dev_of_node(dev);

drivers/misc/tc9564-pci.c line 51

Quoted 10 lines
drivers/misc/tc9564-pci.c new file +10 -0
+	if (!np)
+		return dev_err_probe(dev, -EINVAL, "no devicetree node\n");
+
+	ret = pcim_enable_device(pdev);
+	if (ret)
+		return ret;
+
+	pci_set_master(pdev);
+
+	/* Scan for pci-ep-bus nodes and probe their sub-devices */

[Severity: High]
Does this setup sequence omit PCI IRQ vector allocation?

Without calling pci_alloc_irq_vectors() in tc9564_function_probe() before populating the child devices, the Linux PCI core won't configure the device's MSI/MSI-X capabilities with host addresses and data payloads.

Since child platform drivers cannot safely allocate PCI IRQ vectors on behalf of their parent PCI device, will the high-speed child devices (like the 10Gbps Ethernet XGMACs) be forced to share a single legacy INTx interrupt, or fail entirely if the host platform does not support legacy PCI interrupts?

Quoted 11 lines
drivers/misc/tc9564-pci.c new file +11 -0
+	ret = of_platform_default_populate(np, NULL, dev);
+	if (ret)
+		goto err_clear_master;
+
+	return 0;
+
+err_clear_master:
+	pci_clear_master(pdev);
+
+	return dev_err_probe(dev, ret, "failed to populate platform bus\n");
+}

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author
#20 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

Quoted 47 lines · On 8/13/26 8:59 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Missing PCI IRQ vector allocation prevents MSI/MSI-X usage for high-speed child devices. --

--- Patch [2]: [PATCH 2/2] misc: tc9564: introduce base PCI driver --- commit e66bfe4041c21f48829a22eb54cde73756806870
Author: Alex Elder <[email protected]>
misc: tc9564: introduce base PCI driver

This commit introduces a base PCI driver for the Toshiba TC9564 SoC which implements a PCIe switch and Ethernet AVB/TSN bridge. The driver binds to the embedded PCI endpoint functions, performs basic PCI initialization, and uses devicetree to populate any endpoint bus children.

[ ... ]

Quoted 5 lines
drivers/misc/tc9564-pci.c new file +0 -0
new file mode 100644
index 0000000000000..d3ffcac1c522f

[ ... ]

Quoted 9 lines
drivers/misc/tc9564-pci.c new file +9 -0
+static int
+tc9564_function_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+	struct device *dev = &pdev->dev;
+	struct device_node *np;
+	int ret;
+
+	/* Despite being a PCI device, we require devicetree */
+	np = dev_of_node(dev);

drivers/misc/tc9564-pci.c line 51

Quoted 10 lines
drivers/misc/tc9564-pci.c new file +10 -0
+	if (!np)
+		return dev_err_probe(dev, -EINVAL, "no devicetree node\n");
+
+	ret = pcim_enable_device(pdev);
+	if (ret)
+		return ret;
+
+	pci_set_master(pdev);
+
+	/* Scan for pci-ep-bus nodes and probe their sub-devices */

[Severity: High]
Does this setup sequence omit PCI IRQ vector allocation?

Quoted 3 lines

Without calling pci_alloc_irq_vectors() in tc9564_function_probe() before populating the child devices, the Linux PCI core won't configure the device's MSI/MSI-X capabilities with host addresses and data payloads.

I will investigate this. I don't have a good answer at the moment.

-Alex

Quoted 19 lines

Since child platform drivers cannot safely allocate PCI IRQ vectors on behalf of their parent PCI device, will the high-speed child devices (like the 10Gbps Ethernet XGMACs) be forced to share a single legacy INTx interrupt, or fail entirely if the host platform does not support legacy PCI interrupts?

Quoted 11 lines
drivers/misc/tc9564-pci.c new file +11 -0
+	ret = of_platform_default_populate(np, NULL, dev);
+	if (ret)
+		goto err_clear_master;
+
+	return 0;
+
+err_clear_master:
+	pci_clear_master(pdev);
+
+	return dev_err_probe(dev, ret, "failed to populate platform bus\n");
+}

[ ... ]

#21 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

In reply to Alex Elder

drivers/misc/tc9564-pci.c line 83

Quoted 8 lines · Alex Elder
drivers/misc/tc9564-pci.c new file +8 -0
+static struct pci_driver tc9564_function_driver = {
+	.name		= DRIVER_NAME,
+	.id_table	= tc9564_function_id_table,
+	.probe		= tc9564_function_probe,
+	.remove		= tc9564_function_remove,
+	.driver		= {
+		.name		= DRIVER_NAME,
+		.owner		= THIS_MODULE,

You just copied some old driver. Why do you need this?

Quoted 21 lines
drivers/misc/tc9564-pci.c new file +6 -0
+	},
+};
+module_pci_driver(tc9564_function_driver);
+
+MODULE_DESCRIPTION("Toshiba TC9564 PCIe Embedded Function Driver");
+MODULE_LICENSE("GPL");
drivers/pci/quirks.c +1 -0
index 6501c949c5b76..b484f1b1d0e71 100644
@@ -6388,6 +6388,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5021, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REDHAT, 0x0005, of_pci_make_dev_node);
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, 0x9660, of_pci_make_dev_node);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TOSHIBA, 0x0220, of_pci_make_dev_node);
 
 /*
  * Devices known to require a longer delay before first config space access
Signature · 1 line
2.53.0
author
#22 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

Quoted 11 lines · Krzysztof Kozlowski

drivers/misc/tc9564-pci.c line 83

Quoted 8 lines · Alex Elder
drivers/misc/tc9564-pci.c new file +8 -0
+static struct pci_driver tc9564_function_driver = {
+	.name		= DRIVER_NAME,
+	.id_table	= tc9564_function_id_table,
+	.probe		= tc9564_function_probe,
+	.remove		= tc9564_function_remove,
+	.driver		= {
+		.name		= DRIVER_NAME,
+		.owner		= THIS_MODULE,

You just copied some old driver. Why do you need this?

What do you mean I "just copied some old driver"?

I do now see that a PCI driver doesn't need to set it, because pci_register_driver() sets it automatically.

I will remove that in the next version.

					-Alex>
Quoted 21 lines
Quoted 21 lines
drivers/misc/tc9564-pci.c new file +6 -0
+	},
+};
+module_pci_driver(tc9564_function_driver);
+
+MODULE_DESCRIPTION("Toshiba TC9564 PCIe Embedded Function Driver");
+MODULE_LICENSE("GPL");
drivers/pci/quirks.c +1 -0
index 6501c949c5b76..b484f1b1d0e71 100644
@@ -6388,6 +6388,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node);
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5021, of_pci_make_dev_node);
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REDHAT, 0x0005, of_pci_make_dev_node);
  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_EFAR, 0x9660, of_pci_make_dev_node);
+DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TOSHIBA, 0x0220, of_pci_make_dev_node);
 
  /*
   * Devices known to require a longer delay before first config space access
Signature · 1 line
2.53.0
#23 lore raw

Re: [PATCH 2/2] misc: tc9564: introduce base PCI driver

Quoted 13 lines · Alex Elder
Quoted 11 lines · Krzysztof Kozlowski

drivers/misc/tc9564-pci.c line 83

Quoted 8 lines · Alex Elder
drivers/misc/tc9564-pci.c new file +8 -0
+static struct pci_driver tc9564_function_driver = {
+	.name		= DRIVER_NAME,
+	.id_table	= tc9564_function_id_table,
+	.probe		= tc9564_function_probe,
+	.remove		= tc9564_function_remove,
+	.driver		= {
+		.name		= DRIVER_NAME,
+		.owner		= THIS_MODULE,

You just copied some old driver. Why do you need this?

Quoted 6 lines

What do you mean I "just copied some old driver"?

I do now see that a PCI driver doesn't need to set it, because pci_register_driver() sets it automatically.

I will remove that in the next version.

Old driver because we removed it 13 years ago from all drivers and only a few left-overs were still hanging around.

Best regards,
Krzysztof