Skip to contentSkip to conversation

PCI: introduce TC9564 misc driver

PATCH Superseded Alex Elder 2 participants 9 messages Sep 15

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Alex Elder

author
#0 lore raw

v3 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.

The driver is placed in the "misc" directory, following the practice of other PCI endpoint bus drivers.

This version of the series was sent quickly after version 2, to just address some very simple Sashiko-reported observations before others had a chance to comment.

-Alex

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

Between version 2 and version 3:
- Call of_platform_depopulate() if case of_platform_populate() returns an error in tc9564_function_probe()
- Eliminated an unnecessary dependency in the Kconfig file
- Updated "parent addresses" in the DTS file
- Fixed a dumb typo in the binding
- Note:
- Ignoring the Sashiko report about the place holder ranges possibly not being updated at runtime. (The above-mentioned prerequisite series will cause them to be updated.)
- Ignoring the Sashiko report that the pci-ep-bus nodes should include a reg property that matches the node's unit number.

Version 2 is available here:
https://lore.kernel.org/lkml/[email protected]/

Between version 1 and version 2:
- Updated the block diagram in the binding to include BAR2 and SRAM
- Use KBUILD_MODNAME for the driver name
- Removed bogus initialization of pci_driver->driver field
- Added the third patch, which defines pci-ep-bus DTS information.
- Now based on the Qualcomm for-next branch

Version 1 is available here:
https://lore.kernel.org/lkml/[email protected]/

Alex Elder (3):
dt-bindings: misc: introduce pci1179,0220.yaml
misc: tc9564: introduce base PCI driver
arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses

 .../bindings/misc/pci1179,0220.yaml           | 154 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts  |  30 ++++
 drivers/misc/Kconfig                          |   9 +
 drivers/misc/Makefile                         |   1 +
 drivers/misc/tc9564-pci.c                     |  84 ++++++++++
 drivers/pci/quirks.c                          |   1 +
 7 files changed, 286 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
 create mode 100644 drivers/misc/tc9564-pci.c

base-commit: 27b3028b7d65cbc44fc5b60d2e977ce55cf186f1

Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v3 1/3 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.

---
v3: - Fixed a typo (TC9654 -> TC9564)

 .../bindings/misc/pci1179,0220.yaml           | 154 ++++++++++++++++++
 MAINTAINERS                                   |   6 +
 2 files changed, 160 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +154 -0
new file mode 100644
index 0000000000000..51c8293cd924d
@@ -0,0 +1,154 @@
+# 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 || BAR | BAR | BAR |  |
+    |       |            |    |  0  ||  2  ||  4  ||  0  |  2  |  4  |  |
+    |       | DS1    DS2 |    ---.------.------.--++--------------.---  |
+    |       --++------++--       :      :      :                  :     |
+    |         ||      ||         :   ---.--    :.......           :     |
+    |         ||      ||         :   |SRAM|    :      :           :     |
+    |         ||      ||         :   ------    :   ---.---        :     |
+    |         ||      ||         :         ....:   |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 TC9564 (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,0 {
+        reg = <0x0  0x0>;
+        #address-cells = <3>;
+        #size-cells = <2>;
+        device_type = "pci";
+        ranges = <0x83000000 0x0 0x0  0x0  0x0 0x1fd00000>;
+
+        dev@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 0x4000  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000000 0x0 0x84000  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>;
+            };
+        };
+
+        dev@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 0x4000  0x0 0x80000>,
+                     <0x4 0x0 0x0  0x83000100 0x0 0x84000  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 6096dab7121e8..aa6b805e1ab2b 100644
@@ -27670,6 +27670,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 v3 1/3] dt-bindings: misc: introduce pci1179,0220.yaml

Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 7 lines

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.

Sashiko has reviewed this patch and found no issues. It looks great!

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

PATCH v3 2/3 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)).

---
v3: - Dropped Kconfig dependence on REGMAP_MMIO
- Added call to of_platform_depopulate() on error in the probe function

 MAINTAINERS               |  1 +
 drivers/misc/Kconfig      |  9 +++++
 drivers/misc/Makefile     |  1 +
 drivers/misc/tc9564-pci.c | 84 +++++++++++++++++++++++++++++++++++++++
 drivers/pci/quirks.c      |  1 +
 5 files changed, 96 insertions(+)
 create mode 100644 drivers/misc/tc9564-pci.c
MAINTAINERS +1 -0
index aa6b805e1ab2b..cf846853fdc79 100644
@@ -27675,6 +27675,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 +9 -0
index 7364931dad3a1..c35f9dda355a6 100644
@@ -568,6 +568,15 @@ 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
+	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 +84 -0

84 lines not on this page · raw message

drivers/pci/quirks.c +1 -0
index de9bbccda21fd..54e310c4153df 100644
@@ -6391,6 +6391,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
#4 lore raw

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

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] tc9564: missing Kconfig dependencies on OF and PCI_DYNAMIC_OF_NODES --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tc9564: missing Kconfig dependencies on OF and PCI_DYNAMIC_OF_NODES --

commit e821d4f3b3a6f26cf2df684fa3788ceb3794a058
Author: Alex Elder <[email protected]>
Subject: misc: tc9564: introduce base PCI driver

This commit introduces a base PCI driver for the Toshiba TC9564 SoC. It binds with embedded PCIe endpoint functions within the chip to perform basic PCI initialization. The driver then uses Open Firmware APIs to populate and probe endpoint bus children.

drivers/misc/Kconfig config MCHP_LAN966X_PCI · line 573

Quoted 10 lines
drivers/misc/Kconfig +3 -0
@@ -568,6 +568,15 @@ 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

[Severity: Medium]
Should this configuration also depend on OF and PCI_DYNAMIC_OF_NODES?

Because the driver relies entirely on Open Firmware to function, compiling it without CONFIG_OF or CONFIG_PCI_DYNAMIC_OF_NODES will result in a successful build but an unconditional runtime probe failure.

[ ... ]

Quoted 4 lines
drivers/misc/tc9564-pci.c new file +0 -0
@@ -0,0 +1,84 @@

[ ... ]

drivers/misc/tc9564-pci.c line 41

Quoted 11 lines
drivers/misc/tc9564-pci.c new file +11 -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);
+	if (!np)
+		return dev_err_probe(dev, -EINVAL, "no devicetree node\n");

[Severity: Medium]
Will this probe fail unconditionally if the required dependencies are missing?

If CONFIG_OF is disabled, dev_of_node() will always return NULL, causing dev_err_probe() to trigger here.

Similarly, this commit relies on of_pci_make_dev_node() via a PCI quirk to dynamically create the devicetree node for the PCIe function. If CONFIG_PCI_DYNAMIC_OF_NODES is disabled, of_pci_make_dev_node() compiles to an empty stub, meaning the node is never created.

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

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

Quoted 20 lines · On 9/15/26 1:22 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] tc9564: missing Kconfig dependencies on OF and PCI_DYNAMIC_OF_NODES --

commit e821d4f3b3a6f26cf2df684fa3788ceb3794a058
Author: Alex Elder <[email protected]>
Subject: misc: tc9564: introduce base PCI driver

This commit introduces a base PCI driver for the Toshiba TC9564 SoC. It binds with embedded PCIe endpoint functions within the chip to perform basic PCI initialization. The driver then uses Open Firmware APIs to populate and probe endpoint bus children.

Quoted 7 lines
drivers/misc/Kconfig +0 -0
@@ -568,6 +568,15 @@ config MCHP_LAN966X_PCI
  	    - lan966x-miim (MDIO_MSCC_MIIM)
  	    - lan966x-switch (LAN966X_SWITCH)
 
Quoted 6 lines

drivers/misc/Kconfig config MCHP_LAN966X_PCI · line 573

Quoted 3 lines
drivers/misc/Kconfig +3 -0
+config TC9564_PCI
+	tristate "Toshiba TC9564 PCI function support"
+	depends on PCI

[Severity: Medium]
Should this configuration also depend on OF and PCI_DYNAMIC_OF_NODES?

I thought about this but intentionally omitted it, because *this* driver doesn't depend on PCI_DYNAMIC_OF_NODES (at least, not at compile time).

Quoted 3 lines

Because the driver relies entirely on Open Firmware to function, compiling it without CONFIG_OF or CONFIG_PCI_DYNAMIC_OF_NODES will result in a successful build but an unconditional runtime probe failure.

I don't mind adding the dependency. Even if not having it is technically OK, for the driver to actually function as desired those things must be defined.

If anyone feels strongly that adding "depends on OF" and "depends on PCI_DYNAMIC_OF_NODES" to the TC9564_PCI Kconfig option should *not* be there, please say so.

I'm not going to post a new version of this series for at least a few days, but without objection I'll add these changes when I do.

-Alex

Quoted 29 lines

[ ... ]

Quoted 4 lines
drivers/misc/tc9564-pci.c new file +0 -0
@@ -0,0 +1,84 @@

[ ... ]

drivers/misc/tc9564-pci.c line 41

Quoted 11 lines
drivers/misc/tc9564-pci.c new file +11 -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);
+	if (!np)
+		return dev_err_probe(dev, -EINVAL, "no devicetree node\n");

[Severity: Medium]
Will this probe fail unconditionally if the required dependencies are missing?

If CONFIG_OF is disabled, dev_of_node() will always return NULL, causing dev_err_probe() to trigger here.>
Similarly, this commit relies on of_pci_make_dev_node() via a PCI quirk to dynamically create the devicetree node for the PCIe function. If CONFIG_PCI_DYNAMIC_OF_NODES is disabled, of_pci_make_dev_node() compiles to an empty stub, meaning the node is never created.

author
#6 lore raw

PATCH v3 3/3 arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses

In reply to Alex Elder

The TC9564 SoC incorporates a PCIe switch, which is connected via the second PCI segment (0001) on the RB3gen2 platform. The third downstream port of that switch (pcie@3,0) has an embedded PCIe endpoint that implements two PCIe functions.

The SoC implements other peripherals, and they will be accessed via PCI endpoint bus. Define the devicetree nodes representing these buses, including the mapping of each BAR's address range to its local address space.

The endpoint's ranges property must be defined, but it will be updated dynamically to include all BARs. As a result of this update, the parent address portion of each range will reflect the specific address assigned to the BAR.

---
v3: - Updated ranges property "parent" addresses so they're unique

 arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 30 ++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +30 -0
index 3bb5fca8e2b13..5b7f5292a8864 100644
@@ -955,11 +955,41 @@ pcie@3,0 {
 			bus-range = <0x5 0xff>;
 
 			dev@0,0 {
+				compatible = "pci1179,0220";
 				reg = <0x50000 0x0 0x0 0x0 0x0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				/* Ranges will be updated dynamically */
+				ranges = <0x0 0x0 0x0  0x83050000 0x0 0x0  0x0 0x4000>,
+					 <0x2 0x0 0x0  0x83050000 0x0 0x4000  0x0 0x80000>,
+					 <0x4 0x0 0x0  0x83050000 0x0 0x84000  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>;
+				};
 			};
 
 			dev@0,1 {
+				compatible = "pci1179,0220";
 				reg = <0x50100 0x0 0x0 0x0 0x0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				/* Ranges will be updated dynamically */
+				ranges = <0x0 0x0 0x0  0x83050100 0x0 0x0  0x0 0x4000>,
+					 <0x2 0x0 0x0  0x83050100 0x0 0x4000  0x0 0x80000>,
+					 <0x4 0x0 0x0  0x83050100 0x0 0x84000  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>;
+				};
 			};
 		};
 	};
Signature · 1 line
2.53.0
#7 lore raw

Re: [PATCH v3 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] PCI endpoint dynamic ranges update fails due to static node definition - [Low] dtc warning…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] PCI endpoint dynamic ranges update fails due to static node definition
- [Low] dtc warning: pci-ep-bus@4 unit-address lacks reg property
--

commit 8f41aa3c7aef831e8b83dd47d6e93a9ac9228f4f
Author: Alex Elder <[email protected]>

arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses

The TC9564 SoC incorporates a PCIe switch, which is connected via the second PCI segment (0001) on the RB3gen2 platform. The downstream port has an embedded PCIe endpoint that implements two PCIe functions, and this patch adds the devicetree nodes representing these buses.

Quoted 6 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0 -0
index 3bb5fca8e2b13..5b7f5292a8864 100644
@@ -955,11 +955,41 @@ pcie@3,0 {
 			bus-range = <0x5 0xff>;

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 965

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +7 -0
 
 			dev@0,0 {
+				compatible = "pci1179,0220";
 				reg = <0x50000 0x0 0x0 0x0 0x0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				/* Ranges will be updated dynamically */
+				ranges = <0x0 0x0 0x0  0x83050000 0x0 0x0  0x0 0x4000>,
+					 <0x2 0x0 0x0  0x83050000 0x0 0x4000  0x0 0x80000>,
+					 <0x4 0x0 0x0  0x83050000 0x0 0x84000  0x0 0x200000>;

[Severity: High]
Will these ranges actually be updated dynamically during boot?

The commit message states the ranges property will be updated dynamically. However, the PCI quirk calls of_pci_make_dev_node() which has an early return if the device node is already statically defined in the device tree:

    if (pci_device_to_OF_node(pdev))
        return;

Since dev@0,0 is defined here in the devicetree, it seems they are linked during initial PCI enumeration, causing the update to be skipped entirely. Furthermore, even if the early return was bypassed, the update uses __of_add_property(), which rejects existing properties with -EEXIST.

Could this leave devices on the pci-ep-bus with invalid MMIO addresses mapped to unassigned PCI regions?

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 973

Quoted 8 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +8 -0
+
+				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>;
+				};

[Severity: Low]
Does this unit address trigger a devicetree compiler warning?

The pci-ep-bus@4 node is assigned a unit address of @4, but it lacks a matching reg property. According to the Devicetree specification, if a node uses a unit address, it must have a matching reg property.

For simple buses without a reg property, the unit address must match the first child address in the ranges property, which is 0x0 here, rather than 4.

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 984

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +7 -0
 			};
 
 			dev@0,1 {
+				compatible = "pci1179,0220";
 				reg = <0x50100 0x0 0x0 0x0 0x0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				/* Ranges will be updated dynamically */
+				ranges = <0x0 0x0 0x0  0x83050100 0x0 0x0  0x0 0x4000>,
+					 <0x2 0x0 0x0  0x83050100 0x0 0x4000  0x0 0x80000>,
+					 <0x4 0x0 0x0  0x83050100 0x0 0x84000  0x0 0x200000>;

[Severity: High]
As with dev@0,0 above, it appears this node might also be skipped by of_pci_make_dev_node() because it is statically defined. Will this prevent the ranges property from being dynamically updated for this second endpoint?

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 973

Quoted 8 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +8 -0
+
+				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>;
+				};

[Severity: Low]
Does this second pci-ep-bus@4 node also trigger a compiler warning for missing a reg property while having a unit address?

Quoted 3 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0 -0
 			};
 		};
 	};
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
author
#8 lore raw

Re: [PATCH v3 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses

Quoted 9 lines · On 9/15/26 1:25 PM, [email protected] wrote:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] PCI endpoint dynamic ranges update fails due to static node definition
- [Low] dtc warning: pci-ep-bus@4 unit-address lacks reg property
--

commit 8f41aa3c7aef831e8b83dd47d6e93a9ac9228f4f
Author: Alex Elder <[email protected]>

arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses

This Sashiko report mentions only things that were explicitly ignored on the previous version, so I will take no action.

-Alex

Quoted 94 lines

The TC9564 SoC incorporates a PCIe switch, which is connected via the second PCI segment (0001) on the RB3gen2 platform. The downstream port has an embedded PCIe endpoint that implements two PCIe functions, and this patch adds the devicetree nodes representing these buses.

Quoted 6 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0 -0
index 3bb5fca8e2b13..5b7f5292a8864 100644
@@ -955,11 +955,41 @@ pcie@3,0 {
  			bus-range = <0x5 0xff>;

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 965

Quoted 10 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +7 -0
 
  			dev@0,0 {
+				compatible = "pci1179,0220";
  				reg = <0x50000 0x0 0x0 0x0 0x0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				/* Ranges will be updated dynamically */
+				ranges = <0x0 0x0 0x0  0x83050000 0x0 0x0  0x0 0x4000>,
+					 <0x2 0x0 0x0  0x83050000 0x0 0x4000  0x0 0x80000>,
+					 <0x4 0x0 0x0  0x83050000 0x0 0x84000  0x0 0x200000>;

[Severity: High]
Will these ranges actually be updated dynamically during boot?

The commit message states the ranges property will be updated dynamically. However, the PCI quirk calls of_pci_make_dev_node() which has an early return if the device node is already statically defined in the device tree:

     if (pci_device_to_OF_node(pdev))
         return;

Since dev@0,0 is defined here in the devicetree, it seems they are linked during initial PCI enumeration, causing the update to be skipped entirely. Furthermore, even if the early return was bypassed, the update uses __of_add_property(), which rejects existing properties with -EEXIST.

Could this leave devices on the pci-ep-bus with invalid MMIO addresses mapped to unassigned PCI regions?

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 973

Quoted 8 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +8 -0
+
+				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>;
+				};

[Severity: Low]
Does this unit address trigger a devicetree compiler warning?

The pci-ep-bus@4 node is assigned a unit address of @4, but it lacks a matching reg property. According to the Devicetree specification, if a node uses a unit address, it must have a matching reg property.

For simple buses without a reg property, the unit address must match the first child address in the ranges property, which is 0x0 here, rather than 4.

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 984

Quoted 11 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +7 -0
  			};
 
  			dev@0,1 {
+				compatible = "pci1179,0220";
  				reg = <0x50100 0x0 0x0 0x0 0x0>;
+				#address-cells = <3>;
+				#size-cells = <2>;
+				/* Ranges will be updated dynamically */
+				ranges = <0x0 0x0 0x0  0x83050100 0x0 0x0  0x0 0x4000>,
+					 <0x2 0x0 0x0  0x83050100 0x0 0x4000  0x0 0x80000>,
+					 <0x4 0x0 0x0  0x83050100 0x0 0x84000  0x0 0x200000>;

[Severity: High]
As with dev@0,0 above, it appears this node might also be skipped by of_pci_make_dev_node() because it is statically defined. Will this prevent the ranges property from being dynamically updated for this second endpoint?

arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 973

Quoted 8 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +8 -0
+
+				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>;
+				};

[Severity: Low]
Does this second pci-ep-bus@4 node also trigger a compiler warning for missing a reg property while having a unit address?

Quoted 3 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0 -0
  			};
  		};
  	};