PCI: introduce TC9564 misc driver
Subsystems (5)
v4 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 3 and version 4:
- Dropped the pci-ep-bus@0 node from the DT binding example, because we have found we can do without programming translation unit, which is the only user of this bus (BAR).
- Modified some details for the TC9564_PCI Kconfig:
- Added "depends on OF"
- Added "select PCI_DYNAMIC_OF_NODES"
- Added "select PCI_QUIRKS"
- Added "default m"
- Probe now uses pci_enable_device() rather than pcim_enable_device(), and all error and exit paths handle calling pci_disable_device()
Version 3 is available here:
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 | 146 ++++++++++++++++++ MAINTAINERS | 7 + arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 30 ++++ drivers/misc/Kconfig | 15 ++ drivers/misc/Makefile | 1 + drivers/misc/tc9564-pci.c | 84 ++++++++++ drivers/pci/quirks.c | 1 + 7 files changed, 284 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml create mode 100644 drivers/misc/tc9564-pci.c
base-commit: b41f628f0cbcac09e6bfe7bc322e2d0c7c7403d0
Signature · 1 line
2.53.0
PATCH v4 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.
Multiple internal components are accessed via PCI function BARs, as indicated in the diagram below. This is facilitated by the use of the devicetree pci-ep-bus mechanism, and is demonstrated in the example.
---
v4: - Dropped pci-ep-bus@0 node from the example
.../bindings/misc/pci1179,0220.yaml | 146 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 152 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
Documentation/devicetree/bindings/misc/pci1179,0220.yaml new file +146 -0
@@ -0,0 +1,146 @@ +# 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@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
@@ -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
[email protected]
AI reviewRe: [PATCH v4 1/3] dt-bindings: misc: introduce pci1179,0220.yaml
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 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.
Multiple internal components are accessed via PCI function BARs, as indicated in the diagram below. This is facilitated by the use of the devicetree pci-ep-bus mechanism, and is demonstrated in the example.
Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>
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
Re: [PATCH v4 1/3] dt-bindings: misc: introduce pci1179,0220.yaml
In reply to Alex ElderQuoted 11 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.
Multiple internal components are accessed via PCI function BARs, as indicated in the diagram below. This is facilitated by the use of the devicetree pci-ep-bus mechanism, and is demonstrated in the example.
Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>
Quoted 8 lines
---
v4: - Dropped pci-ep-bus@0 node from the example.../bindings/misc/pci1179,0220.yaml | 146 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 152 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/pci1179,0220.yaml
PATCH v4 2/3 misc: tc9564: introduce base PCI driver
In reply to Alex ElderThe 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 that do MMIO via 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)).
---
v4: - Refined the definition of the TC9564_PCI Kconfig entry
- Now use pci_enable_device() rather than pcim_enable_device()
MAINTAINERS | 1 + drivers/misc/Kconfig | 15 +++++++ drivers/misc/Makefile | 1 + drivers/misc/tc9564-pci.c | 84 +++++++++++++++++++++++++++++++++++++++ drivers/pci/quirks.c | 1 + 5 files changed, 102 insertions(+) create mode 100644 drivers/misc/tc9564-pci.c
MAINTAINERS +1 -0
@@ -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 +15 -0
@@ -568,6 +568,21 @@ config MCHP_LAN966X_PCI - lan966x-miim (MDIO_MSCC_MIIM) - lan966x-switch (LAN966X_SWITCH) +config TC9564_PCI + tristate "Toshiba TC9564 PCI function support" + depends on OF + depends on PCI + select PCI_DYNAMIC_OF_NODES + select PCI_QUIRKS + default m + help + This enables support for two PCI functions implemented by the + embedded PCIe endpoint in the Toshiba TC9564 SoC. A platform + driver uses a pci-ep-bus node in devicetree to provide MMIO + access to other SoC devices through PCI function BARs. A PCI + quirk causes the ranges property in the endpoint's devicetree + node to be updated dynamically. + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -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
@@ -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
[email protected]
AI reviewRe: [PATCH v4 2/3] misc: tc9564: introduce base PCI driver
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] pci: of_pci_make_dev_node quirk fails to update ranges of existing DT node - [Medium] kconfig…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] pci: of_pci_make_dev_node quirk fails to update ranges of existing DT node
- [Medium] kconfig: TC9564_PCI selects PCI_DYNAMIC_OF_NODES without inheriting OF_IRQ dependency --
commit d693efad7a099f6326c4b836ade779f0f07366be
Author: Alex Elder <[email protected]>
misc: tc9564: introduce base PCI driver
The Toshiba TC9564 is small and highly-specialized SoC that implements a PCIe switch as well as an Ethernet AVB/TSN bridge. Create a new PCI driver under drivers/misc that binds with the embedded PCI endpoint functions within the TC9564 SoC. Use the PCI quirks mechanism to update endpoint device nodes dynamically.
Quoted 4 lines
drivers/misc/Kconfig +0
-0
[ ... ]
drivers/misc/Kconfig config MCHP_LAN966X_PCI · line 575
Quoted 9 lines
drivers/misc/Kconfig +5
-0@@ -568,6 +568,21 @@ config MCHP_LAN966X_PCI - lan966x-miim (MDIO_MSCC_MIIM) - lan966x-switch (LAN966X_SWITCH) +config TC9564_PCI + tristate "Toshiba TC9564 PCI function support" + depends on OF + depends on PCI + select PCI_DYNAMIC_OF_NODES
[Severity: Medium]
Can this cause a Kconfig unmet direct dependency warning?
PCI_DYNAMIC_OF_NODES explicitly defines 'depends on OF_IRQ' in drivers/pci/Kconfig. Selecting it here without inheriting its dependencies could cause unmet direct dependency warnings and potential build failures on architectures lacking OF_IRQ support.
Quoted 3 lines
drivers/misc/Kconfig +3
-0+ select PCI_QUIRKS + default m + help
[ ... ]
Quoted 4 lines
drivers/misc/tc9564-pci.c new file +0
-0
[ ... ]
Quoted 2 lines
drivers/misc/tc9564-pci.c new file +2
-0+/* Scan for pci-ep-bus (simple-bus) nodes and probe their sub-devices */ + ret =of_platform_default_populate (np,NULL , dev);
[ ... ]
drivers/pci/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node); · line 6394
Quoted 9 lines
drivers/pci/quirks.c +1
-0@@ -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);
[Severity: High]
Will this quirk successfully update the ranges property of the existing devicetree node?
Because the tc9564 device has a static device tree node, pci_set_of_node() attaches the static node to pdev->dev.of_node before this fixup runs.
Inside of_pci_make_dev_node(), the early check for an existing node:
if (pci_device_to_OF_node(pdev))
return;evaluates to true, causing it to return immediately. Consequently, of_pci_prop_ranges() is never executed.
This means endpoint platform devices populated by of_platform_default_populate() in tc9564_function_probe() will fail to map their MMIO addresses correctly, translating addresses using the placeholder static 'ranges' property rather than dynamically assigned PCI BAR addresses.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH v4 2/3] misc: tc9564: introduce base PCI driver
Quoted 2 lines · On 9/18/26 10:42 AM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] pci:of_pci_make_dev_nodequirk fails to update ranges of existing DT node
This series depends on another series that affects the code that is the subject of the above report.
https://lore.kernel.org/sashiko-reviews/[email protected]/
Quoted 1 line
- [Medium] kconfig:
TC9564_PCIselectsPCI_DYNAMIC_OF_NODESwithout inheritingOF_IRQdependency
I attempted to include this but wound up with a report of a circular dependency when configuring the kernel.
A bit more below.
Quoted 33 lines
--
commit
d693efad7a099f6326c4b836ade779f0f07366be
Author: Alex Elder <[email protected]>misc: tc9564: introduce base PCI driver
The Toshiba TC9564 is small and highly-specialized SoC that implements a PCIe switch as well as an Ethernet AVB/TSN bridge. Create a new PCI driver under
drivers/miscthat binds with the embedded PCI endpoint functions within the TC9564 SoC. Use the PCI quirks mechanism to update endpoint device nodes dynamically.Quoted 4 lines
drivers/misc/Kconfig +0
-0[ ... ]
drivers/misc/Kconfig config MCHP_LAN966X_PCI · line 575
Quoted 9 lines
drivers/misc/Kconfig +5
-0@@ -568,6 +568,21 @@ config MCHP_LAN966X_PCI - lan966x-miim (MDIO_MSCC_MIIM) - lan966x-switch (LAN966X_SWITCH) +config TC9564_PCI + tristate "Toshiba TC9564 PCI function support" + depends on OF + depends on PCI + select PCI_DYNAMIC_OF_NODES[Severity: Medium]
Can this cause aKconfigunmet direct dependency warning?
Quoted 4 lines
PCI_DYNAMIC_OF_NODESexplicitly defines 'depends onOF_IRQ' indrivers/pci/Kconfig. Selecting it here without inheriting its dependencies could cause unmet direct dependency warnings and potential build failures on architectures lackingOF_IRQsupport.
I attempted to include "depends on OF_IRQ", but that led to a circular dependency, so I simply left it out.
Quoted 36 lines
Quoted 4 lines
drivers/misc/Kconfig +3
-0+ select PCI_QUIRKS + default m + help[ ... ]
Quoted 4 lines
drivers/misc/tc9564-pci.c new file +0
-0[ ... ]
Quoted 2 lines
drivers/misc/tc9564-pci.c new file +2
-0+/* Scan for pci-ep-bus (simple-bus) nodes and probe their sub-devices */ + ret =of_platform_default_populate (np,NULL , dev);[ ... ]
drivers/pci/quirks.c DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node); · line 6394
Quoted 9 lines
drivers/pci/quirks.c +1
-0@@ -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);[Severity: High]
Will this quirk successfully update the ranges property of the existing devicetree node?Because the tc9564 device has a static device tree node,
pci_set_of_node()attaches the static node topdev->dev.of_nodebefore this fixup runs.
Quoted 7 lines
Inside
of_pci_make_dev_node(), the early check for an existing node:if (pci_device_to_OF_node(pdev)) return;evaluates to true, causing it to return immediately. Consequently,
of_pci_prop_ranges()is never executed.
The series mentioned above changes this exact code so that instead of returning immediately, it first checks to see if a non-bridge node has a pci-ep-bus sub-node. If it does, it generates a new ranges property for the endpoint and updates the devicetree to use it.
-Alex
Quoted 6 lines
This means endpoint platform devices populated by
of_platform_default_populate()intc9564_function_probe()will fail to map their MMIO addresses correctly, translating addresses using the placeholder static 'ranges' property rather than dynamically assigned PCI BAR addresses.
Re: [PATCH v4 2/3] misc: tc9564: introduce base PCI driver
In reply to Alex Elder[+cc Andrea, Herve, Lizhi for of_pci_make_dev_node() quirks]
Quoted 15 lines · 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 that do MMIO via the PCI BARs.
Create a new PCI driver under
drivers/miscthat 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 callof_platform_default_populate()to scan for the any endpoint bus children, and probe all devices defined therein.
Quoted 7 lines
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 inpci_bus_add_device()(viapci_fixup_device(pci_fixup_final, dev)).Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>
Not an issue for this patch, but I'm not sure the quirk mechanism is the best mechanism for doing this. It's not working around a device defect like most quirks do.
I wonder if pci_bus_add_device() should unconditionally call a wrapper that calls of_pci_make_dev_node() for bridges and any device that appears in an allow-list. I guess it sort of amounts to the same thing in the end, but it might be a little more explicit and not subject to CONFIG_PCI_QUIRKS.
Quoted 12 lines
+++
b/drivers/pci/quirks.cdrivers/pci/quirks.c +1
-0@@ -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
Re: [PATCH v4 2/3] misc: tc9564: introduce base PCI driver
Quoted 26 lines · Bjorn Helgaas
[+cc Andrea, Herve, Lizhi for
of_pci_make_dev_node()quirks]Quoted 15 lines · 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 that do MMIO via the PCI BARs.
Create a new PCI driver under
drivers/miscthat 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 callof_platform_default_populate()to scan for the any endpoint bus children, and probe all devices defined therein.Quoted 7 lines
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 inpci_bus_add_device()(viapci_fixup_device(pci_fixup_final, dev)).Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>
Quoted 5 lines
Not an issue for this patch, but I'm not sure the quirk mechanism is the best mechanism for doing this. It's not working around a device defect like most quirks do.
I pretty much agree with you. I think I mentioned this before (though it might have been in a private conversation) that it is an intentional act to call of_pci_make_dev_node() for an endpoint (and not just a bridge). And that's different from a hardware quirk. You only need to do it if there's a pci-ep-bus sub-node on the endpoint. (I'd have to verify this on the other users of this approach to be 100% sure though.)
Quoted 5 lines
I wonder if
pci_bus_add_device()should unconditionally call a wrapper that callsof_pci_make_dev_node()for bridges and any device that appears in an allow-list. I guess it sort of amounts to the same thing in the end, but it might be a little more explicit and not subject toCONFIG_PCI_QUIRKS.
Yes, I think it would be better to separate this case from PCI quirks, which are really intended for anomalous hardware behavior.
I'd like to get these things merged, but would be willing to work on this sort of thing (and/or on separating this driver type, as Arnd suggested elsewhere).
Thanks a lot Bjorn.
-Alex
Quoted 12 lines
Quoted 12 lines
+++
b/drivers/pci/quirks.cdrivers/pci/quirks.c +1
-0@@ -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
Re: [PATCH v4 2/3] misc: tc9564: introduce base PCI driver
Hi Alex, Bjorn,
Quoted 33 lines · On Fri, 18 Sep 2026 12:49:53 -0500 Alex Elder <[email protected]> wrote:
Quoted 26 lines · Bjorn Helgaas
[+cc Andrea, Herve, Lizhi for
of_pci_make_dev_node()quirks]Quoted 15 lines · 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 that do MMIO via the PCI BARs.
Create a new PCI driver under
drivers/miscthat 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 callof_platform_default_populate()to scan for the any endpoint bus children, and probe all devices defined therein.Quoted 7 lines
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 inpci_bus_add_device()(viapci_fixup_device(pci_fixup_final, dev)).Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>Quoted 5 lines
Not an issue for this patch, but I'm not sure the quirk mechanism is the best mechanism for doing this. It's not working around a device defect like most quirks do.
Quoted 7 lines
I pretty much agree with you. I think I mentioned this before (though it might have been in a private conversation) that it is an intentional act to call
of_pci_make_dev_node()for an endpoint (and not just a bridge). And that's different from a hardware quirk. You only need to do it if there's a pci-ep-bus sub-node on the endpoint. (I'd have to verify this on the other users of this approach to be 100% sure though.)
I agree, a quirk is not the best way to trig the of_pci_make_dev_node() call. An allow-list seems better.
Alex, on LAN966x, the pci-ep-bus is not present. The OF node must be created (call to of_pci_make_dev_node()) and the lan966x_pci driver will apply an overlay on this OF node created at run-time.
The pci-ep-bus is described in the OF overlay [1].
[1] https://elixir.bootlin.com/linux/v7.3-rc3/source/drivers/misc/lan966x_pci.dtso#L50
Best regards,
Hervé
Re: [PATCH v4 2/3] misc: tc9564: introduce base PCI driver
Quoted 46 lines · Herve Codina
Hi Alex, Bjorn,
Quoted 33 lines · On Fri, 18 Sep 2026 12:49:53 -0500 Alex Elder <[email protected]> wrote:
Quoted 26 lines · Bjorn Helgaas
[+cc Andrea, Herve, Lizhi for
of_pci_make_dev_node()quirks]Quoted 15 lines · 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 that do MMIO via the PCI BARs.
Create a new PCI driver under
drivers/miscthat 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 callof_platform_default_populate()to scan for the any endpoint bus children, and probe all devices defined therein.Quoted 7 lines
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 inpci_bus_add_device()(viapci_fixup_device(pci_fixup_final, dev)).Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>Quoted 5 lines
Not an issue for this patch, but I'm not sure the quirk mechanism is the best mechanism for doing this. It's not working around a device defect like most quirks do.
Quoted 7 lines
I pretty much agree with you. I think I mentioned this before (though it might have been in a private conversation) that it is an intentional act to call
of_pci_make_dev_node()for an endpoint (and not just a bridge). And that's different from a hardware quirk. You only need to do it if there's a pci-ep-bus sub-node on the endpoint. (I'd have to verify this on the other users of this approach to be 100% sure though.)
Quoted 2 lines
I agree, a quirk is not the best way to trig the
of_pci_make_dev_node()call. An allow-list seems better.
We're talking about calling of_pci_make_dev_node() on non-bridge nodes in pci_bus_add_device().
A separate series I've been posting is updating that code path so it updates the ranges property even for (endpoint) nodes that have a non-null devicetree node pointer. I use the same quirk to cause this to occur. But now I realize the quirk might be intended to create a *new* node, so I may have to re-think it a bit.
https://lore.kernel.org/lkml/[email protected]/
Are there any cases other than a PCI endpoint having a pci-ep-bus sub-node where of_pci_make_dev_node() needs to be called on an endpoint?
Could we simply call of_pci_make_dev_node() unconditionally in pci_bus_add_device(), and have of_pci_make_dev_node() only proceed for endpoints that have such a child node?
(I haven't chased down all of the PCI quirks that call of_pci_make_dev_node() yet. Do the XILINX examples use pci-ep-bus?)
Quoted 3 lines
Alex, on LAN966x, the pci-ep-bus is not present. The OF node must be created (call to
of_pci_make_dev_node()) and thelan966x_pcidriver will apply an overlay on this OF node created at run-time.
Understood. But the overlay does contain it.
After applying the overlay, the driver parses the node (using of_platform_default_populate()). And because of the PCI quirk, of_pci_make_dev_node() gets called for the PCI endpoint, right?
So again, is calling of_pci_make_dev_node() on a PCI endpoint *only* related to the endpoint having a pci-ep-bus sub-node? When else does a PCI endpoint need a devicetree node?
-Alex
Quoted 6 lines
The pci-ep-bus is described in the OF overlay [1].
[1] https://elixir.bootlin.com/linux/v7.3-rc3/source/drivers/misc/lan966x_pci.dtso#L50
Best regards,
Hervé
PATCH v4 3/3 arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
In reply to Alex ElderThe 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.
--- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +30 -0
@@ -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
[email protected]
AI reviewRe: [PATCH v4 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] pci: MMIO translation failure due to static dummy ranges bypassing dynamic update --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pci: MMIO translation failure due to static dummy ranges bypassing dynamic update --
commit 07e53b54e0b29671e1a08f764661a81fe5484062
Author: Alex Elder <[email protected]>
arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
This commit adds devicetree nodes for a PCIe endpoint and its peripheral buses on the QCS6490 RB3gen2 platform. It also defines static ranges for the endpoint BARs, with the expectation that these will be updated dynamically.
Quoted 5 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0
-0
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 963
Quoted 9 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +5
-0@@ -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>,
[Severity: High]
Does defining these dummy ranges statically bypass the dynamic update?
During PCI enumeration, pci_set_of_node() binds existing nodes like dev@0,0 to the corresponding pci_dev. Later, when the PCI quirk calls of_pci_make_dev_node() to dynamically update the ranges, of_pci_make_dev_node() checks if (pci_device_to_OF_node(pdev)) and returns immediately without calling of_pci_add_properties().
As a result, the dummy ranges are left intact, which causes child devices on the PCI endpoint bus to use these static ranges instead of the actual BAR addresses assigned by the PCI core. Will this lead to invalid memory accesses or driver probe failures?
Quoted 9 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +9
-0+ <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>;
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 982
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +6
-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>,
[Severity: High]
This appears to have the same issue. Because the dev@0,1 node is already present, the dynamic update logic in of_pci_make_dev_node() will bypass it.
Child devices under this node will then attempt to translate MMIO addresses using these static dummy ranges instead of the actual BAR addresses assigned by the PCI core.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH v4 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
Quoted 2 lines · On 9/18/26 10:39 AM, [email protected] wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] pci: MMIO translation failure due to static dummy ranges bypassing dynamic update
The same Sashiko report was made in version 2 of this series.
https://lore.kernel.org/sashiko-reviews/[email protected]/
(I repeat and reword my explanation below.)
If I knew how to make Sashiko take into account the prerequisite series I would gladly do so:
https://lore.kernel.org/lkml/[email protected]/
Quoted 30 lines
--
commit
07e53b54e0b29671e1a08f764661a81fe5484062
Author: Alex Elder <[email protected]>arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
This commit adds devicetree nodes for a PCIe endpoint and its peripheral buses on the QCS6490 RB3gen2 platform. It also defines static ranges for the endpoint BARs, with the expectation that these will be updated dynamically.
Quoted 5 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0
-0arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 963
Quoted 9 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +5
-0@@ -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>,[Severity: High]
Does defining these dummy ranges statically bypass the dynamic update?
Quoted 5 lines
During PCI enumeration,
pci_set_of_node()binds existing nodes like dev@0,0 to the correspondingpci_dev. Later, when the PCI quirk callsof_pci_make_dev_node()to dynamically update the ranges,of_pci_make_dev_node()checks if (pci_device_to_OF_node(pdev)) and returns immediately without callingof_pci_add_properties().
The series mentioned above changes this code so that, rather than returning immediately in this exact case, it updates the ranges property to incorporate the BAR addresses assigned during PCI enumeration.
Quoted 4 lines
As a result, the dummy ranges are left intact, which causes child devices on the PCI endpoint bus to use these static ranges instead of the actual BAR addresses assigned by the PCI core. Will this lead to invalid memory accesses or driver probe failures?
And with the above series in place, the ranges are *not* left intact.
-Alex
Quoted 28 lines
Quoted 9 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +9
-0+ <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>;arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts pcie@3,0 { · line 982
Quoted 10 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +6
-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>,[Severity: High]
This appears to have the same issue. Because the dev@0,1 node is already present, the dynamic update logic inof_pci_make_dev_node()will bypass it.Child devices under this node will then attempt to translate MMIO addresses using these static dummy ranges instead of the actual BAR addresses assigned by the PCI core.
Greg KH
maintainerRe: [PATCH v4 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
In reply to Alex ElderQuoted 71 lines · 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.
Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>--- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +30
-0@@ -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
This doesn't apply to the char-misc-testing branch :(
So I took the first two patches only.
thanks,
greg k-h
Re: [PATCH v4 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
Quoted 66 lines · Greg KH
Quoted 65 lines · 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.
Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>--- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +30
-0@@ -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>; + };
Quoted 8 lines
Quoted 6 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0
-0}; }; };Signature · 1 line
2.53.0This doesn't apply to the char-misc-testing branch :(
Sorry about that. It does apply to to the for-next branch for Qualcomm, so this should probably get merged through that path.
https://lore.kernel.org/lkml/[email protected]/
Quoted 1 line
So I took the first two patches only.
Thank you.
-Alex
Quoted 3 lines
thanks,
greg k-h
Greg KH
maintainerRe: [PATCH v4 3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
Quoted 74 lines · Alex Elder
Quoted 64 lines · Greg KH
Quoted 63 lines · 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.
Co-developed-by Daniel Thompson <[email protected]>Signed-off-by Daniel Thompson <[email protected]>Signed-off-by Alex Elder <[email protected]>--- arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+)arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +30
-0@@ -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>; + };Quoted 8 lines
Quoted 6 lines
arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts +0
-0}; }; };Signature · 1 line
2.53.0This doesn't apply to the char-misc-testing branch :(
Quoted 4 lines
Sorry about that. It does apply to to the for-next branch for Qualcomm, so this should probably get merged through that path.
I suggest sending it to whoever maintains that tree.
Re: (subset) [PATCH v4 0/3] PCI: introduce TC9564 misc driver
In reply to Alex ElderQuoted 9 lines · Alex Elder
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.
[...]
Applied, thanks!
[3/3] arm64: dts: qcom: qcs6490-rb3gen2: add endpoint buses
commit: 12f074acca972ca6b3a2317c2349ed93446e01e5
Best regards,
Signature · 1 line
Bjorn Andersson <[email protected]>