PCI: cortina: Add CS7542 PCIe host and PHY support
Subsystems (5)
v3 cover PCI: cortina: Add CS7542 PCIe host and PHY support
Add a Snow Bush PCIe SerDes PHY and DesignWare host glue for CS7542. The combined global-controls prerequisite supplies PCIe gates and resets; this series contains no separate or duplicate global-control driver.
Prerequisite on Linux v7.4-rc4: the combined clock/reset/pinctrl v4, posted on 25 November:
https://lore.kernel.org/all/[email protected]/
Brian's review places the early clock and separately probing reset providers in that prerequisite. Local v5 error-path corrections are included in the current integration tests; they keep its PCIe clock/reset IDs and consumer interface unchanged. Binding review remains ongoing. Board DTS enablement is separate. Ethernet is not a prerequisite.
The host protects its 512-byte root configuration limit, owns the combined INTx/MSI lifecycle and reads link status from the application wrapper. Unused SATA mode, hotplug and suspend remain outside this support.
Before the reset timing change, an Almond+ Linux v7.4-rc4 RAM run passed with all three Root Ports/endpoints and Root Port MSI enabled after enumeration. xHCI serviced MSI-X interrupts with three vectors, then forced legacy INTx with no MSI vectors, then restored MSI-X. Complete host unload/reload, repeated enumeration, real PCI OF nodes and factory calibration/MAC NVMEM lookups all passed. Two NE load/unload cycles and external LAN1 traffic ran alongside the live PCIe hosts without changing their reset bits. The watchdog automatically returned to the installed firmware; no flash writes were performed.
The updated host compiled for ARM with reset-controller support enabled and disabled. Its framework-disabled object has no unresolved reset symbols. The current reset sequence also passed the error-path tests.
Earlier independent ARM GCC14.2 W=1 vmlinux/modules with PHY/host=m and COMPILE_TEST=n, full combined multi_v7 built-in/module builds, binding examples and actual-source config/DBI/probe/Root-Port/MSI tests passed. Two expected reset-core WARN/-EBUSY traces came from the fixture's intentional duplicate-exclusive NE reset requests, not PCIe operations. The fixture did not reset an active NE DMA consumer.
The lock serializes MMIO against the IRQ latch and teardown; it cannot eliminate a physical link transition before IRQ delivery. Link-loss gating remains conservative no-retrain policy, not a newly established silicon requirement for upstream RC configuration. Non-identity MSI bus-window arithmetic has host-test coverage; the hardware run used this board's existing windows and unchanged comparator tokens.
Final self-review also exercised the actual MSI/GPIO policy helpers in 12 GCC and Clang ASan/UBSan cases each. The independent ARM build of vmlinux and modules with host/PHY=m, COMPILE_TEST=n and no platform series passed again after those fixes. Exact Linux 6.18 ARM W=1 Werror objects and the combined personal image build pass. An actual normal-image RAM boot enumerated the three Root Ports and endpoints and reached its root filesystem with 432844 KiB available to Linux, then the watchdog returned automatically to unchanged NAND OpenWrt. This boot is not hardware fault injection or a new non-identity DMA-window test. The two Wi-Fi Root Ports share one physical PERST# GPIO; independent hotplug is not qualified.
Changes in v3:
- Hold the host reset through PHY preparation. Wait 10 ms before deasserting it and 10 ms afterwards before accessing the host.
- Drop the PCIe consumer's Kconfig select of RESET_CONTROLLER.
- Balance the PHY reference clock if power-on and its cleanup both fail.
- Put PERST# on the Root Port child; retain three independent hosts and acquire the board's shared Wi-Fi reset GPIO only once.
- Assert the core before clock/PHY setup and release endpoint PERST#
after Root Port setup, using the standard reset configuration wait.
- Describe MSI addresses as internal PCI bus match tokens, preserve their tested values and reject overlap with translated PCI memory windows.
- Keep v2 config/DBI/IRQ serialization; describe the no-retrain latch as conservative software policy, with no physical link-loss race claim.
- Preserve pci=nomsi in post-enumeration setup; an uninitialized receiver must not be enabled. Skip the optional PERST# lookup when the Root Port has no reset-gpios, including builds with GPIOLIB disabled.
- Address Kconfig/include ordering, bounded polling constants, error response helper, block comments, formatting and cleanup labels.
- Move the global binding, clock gates and reset provider into the independent shared-controls prerequisite; drop former patches 2 and 3.
- Keep only DWC export, PHY, host and their ownership in this series.
- Preserve existing PCIe reset IDs 0..2 and clock IDs 3..5.
- Link to v2: https://patch.msgid.link/[email protected]
---
Fil Dunsky (6):
PCI: dwc: Export the multiplexed MSI interrupt handler
dt-bindings: phy: Describe CS7542 PCIe SerDes
phy: Add CS7542 PCIe SerDes support
dt-bindings: PCI: Describe the CS7542 host controller
PCI: cs7542: Add CS7542 PCIe host support
MAINTAINERS: Add CS7542 PCIe support
.../bindings/pci/cortina,cs7542-pcie.yaml | 157 +++++ .../bindings/phy/cortina,cs7542-pcie-phy.yaml | 67 +++ MAINTAINERS | 6 +- drivers/pci/controller/dwc/Kconfig | 12 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-cs7542.c | 658 +++++++++++++++++++++ drivers/pci/controller/dwc/pcie-designware-host.c | 1 + drivers/phy/Kconfig | 11 + drivers/phy/Makefile | 2 + drivers/phy/phy-cs7542-pcie.c | 236 ++++++++ 10 files changed, 1150 insertions(+), 1 deletion(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261123-b4-cs7542-pcie-224e359c8698
prerequisite-change-id: 20261123-cs7542-syscon-273d545c7af2:v4
prerequisite-patch-id: a9208276c628f8741a807d0e5c5945d4bf211c8a
prerequisite-patch-id: 65d46bb3caaa8518ee561f65d3f603ade396fff9
prerequisite-patch-id: a0ed5fbcfa308b16eaf265371a6697ad0aea6802
prerequisite-patch-id: bb8ffd99cb30e5a0b47881f6ba19a36329d5f4f2
prerequisite-patch-id: 7fbe9405265ef3d1ec62811415a46c0061afd7c8
prerequisite-patch-id: 01ece2c91e080d5cae6af81944159373776484ca
Best regards,
Signature · 1 line
Fil Dunsky <[email protected]>
PATCH v3 1/6 PCI: dwc: Export the multiplexed MSI interrupt handler
Allow modular host glue with a combined application interrupt to dispatch the internal MSI receiver without installing a second chained handler.
--- drivers/pci/controller/dwc/pcie-designware-host.c | 1 + 1 file changed, 1 insertion(+)
drivers/pci/controller/dwc/pcie-designware-host.c +1 -0
@@ -85,6 +85,7 @@ void dw_handle_msi_irq(struct dw_pcie_rp *pp)generic_handle_demux_domain_irq (pp->msi_irq_domain, irq_off + pos); } } +EXPORT_SYMBOL_GPL (dw_handle_msi_irq);/* Chained MSI interrupt service routine */ static void dw_chained_msi_isr (struct irq_desc *desc)
Signature · 1 line
2.53.0
PATCH v3 2/6 dt-bindings: phy: Describe CS7542 PCIe SerDes
In reply to Fil DunskyDescribe three Snow Bush lanes, their shared status bank, global reset controls and 24 MHz reference. PCIe is the only supported operating mode.
--- .../bindings/phy/cortina,cs7542-pcie-phy.yaml | 67 ++++++++++++++++++++++ 1 file changed, 67 insertions(+)
Documentation/devicetree/bindings/phy/cortina,cs7542-pcie-phy.yaml new file +67 -0
@@ -0,0 +1,67 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/cortina,cs7542-pcie-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 PCIe SerDes + +maintainers: + - Fil Dunsky <[email protected]> + +description: | + Three Snow Bush SerDes lanes shared by PCIe and SATA. Only PCIe mode + with a 24 MHz reference is described. The PHY specifier is the lane + number, 0 through 2. The status resource contains the shared PHY + status registers, with a stride of 0x80 bytes per lane. + +properties: + compatible: + const: cortina,cs7542-pcie-phy + + reg: + items: + - description: Lane 0 programming registers + - description: Lane 1 programming registers + - description: Lane 2 programming registers + - description: Shared PHY status registers + + reg-names: + items: + - const: phy0 + - const: phy1 + - const: phy2 + - const: status + + clocks: + maxItems: 1 + description: 24 MHz SerDes reference clock + + cortina,global-syscon: + $ref: /schemas/types.yaml#/definitions/phandle + description: Global control syscon providing lane reset and mode selection + + "#phy-cells": + const: 1 + +required: + - compatible + - reg + - reg-names + - clocks + - cortina,global-syscon + - "#phy-cells" + +additionalProperties: false + +examples: + - | + phy@f00a1000 { + compatible = "cortina,cs7542-pcie-phy"; + reg = <0xf00a1000 0x400>, <0xf00a5000 0x400>, + <0xf00a9000 0x400>, <0xf00a0e00 0x180>; + reg-names = "phy0", "phy1", "phy2", "status"; + clocks = <&ref24>; + cortina,global-syscon = <&global>; + #phy-cells = <1>; + };
Signature · 1 line
2.53.0
PATCH v3 3/6 phy: Add CS7542 PCIe SerDes support
In reply to Fil DunskyProvide per-lane generic PHYs using the vendor 24 MHz programming table and revision-dependent value. Sequence power and reset through the shared global regmap and fail on CMU lock timeout with balanced power cleanup. Use the shared PHY status bank without overlapping PCIe wrapper resources.
Release the reference clock if power-on fails, including when the power-down register write used for cleanup also fails.
--- drivers/phy/Kconfig | 11 ++ drivers/phy/Makefile | 2 + drivers/phy/phy-cs7542-pcie.c | 236 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 249 insertions(+)
drivers/phy/Kconfig +11 -0
@@ -204,4 +204,15 @@ source "drivers/phy/tegra/Kconfig" source "drivers/phy/ti/Kconfig" source "drivers/phy/xilinx/Kconfig" +config PHY_CS7542_PCIE + tristate "Cortina Systems CS7542 PCIe SerDes" + depends on OF && HAS_IOMEM && COMMON_CLK + select GENERIC_PHY + select MFD_SYSCON + help + Support the three CS7542 Snow Bush SerDes lanes in PCIe mode + with a 24 MHz reference clock. Lane resets share the global syscon. + SATA mode and other reference frequencies are not supported. + The module is called phy-cs7542-pcie. + endmenu
drivers/phy/Makefile +2 -0
@@ -55,3 +55,5 @@ obj-$(CONFIG_GENERIC_PHY) += allwinner/ \ tegra/ \ ti/ \ xilinx/ + +obj-$(CONFIG_PHY_CS7542_PCIE) += phy-cs7542-pcie.o
drivers/phy/phy-cs7542-pcie.c new file +236 -0
236 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v3 4/6 dt-bindings: PCI: Describe the CS7542 host controller
In reply to Fil DunskyDescribe the DesignWare host wrapper, clock/reset/PHY consumers, combined interrupt and INTx domain. Document the root configuration access limit.
--- .../bindings/pci/cortina,cs7542-pcie.yaml | 157 +++++++++++++++++++++ 1 file changed, 157 insertions(+)
Documentation/devicetree/bindings/pci/cortina,cs7542-pcie.yaml new file +157 -0
@@ -0,0 +1,157 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/cortina,cs7542-pcie.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cortina Systems CS7542 PCIe host controller + +maintainers: + - Fil Dunsky <[email protected]> + +description: | + DesignWare host with a Cortina application wrapper. A single interrupt + multiplexes four INTx lines, the internal MSI receiver and link errors. + Root-port configuration is accessible only below offset 0x200; the + DesignWare private register bank starts at offset 0x700. + +allOf: + - $ref: /schemas/pci/snps,dw-pcie.yaml# + +properties: + compatible: + const: cortina,cs7542-pcie + + reg: + items: + - description: DBI registers including the viewport iATU + - description: Downstream configuration window + - description: Application wrapper registers + + reg-names: + items: + - const: dbi + - const: config + - const: app + + clocks: + maxItems: 1 + + interrupts: + maxItems: 1 + + interrupt-names: + const: msi + + resets: + maxItems: 1 + + phys: + maxItems: 1 + + phy-names: + const: pcie + + num-lanes: + const: 1 + + reset-gpios: false + + interrupt-controller: + type: object + additionalProperties: false + properties: + "#address-cells": + const: 0 + "#interrupt-cells": + const: 1 + interrupt-controller: true + required: + - "#address-cells" + - "#interrupt-cells" + - interrupt-controller + +patternProperties: + "^pcie@[0-9a-f]+,[0-7]$": + type: object + $ref: /schemas/pci/pci-pci-bridge.yaml# + additionalProperties: true + description: | + The single Root Port of this controller. Endpoint PERST# belongs to + this port, rather than the host bridge. + properties: + reset-gpios: + maxItems: 1 + description: Optional active-low endpoint PERST# + required: + - compatible + - reg + - device_type + - '#address-cells' + - '#size-cells' + - ranges + +required: + - compatible + - reg + - reg-names + - clocks + - interrupts + - interrupt-names + - resets + - phys + - phy-names + - num-lanes + - pcie@0,0 + - interrupt-controller + - interrupt-map + - interrupt-map-mask + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/clock/cortina,cs7542-clock.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/reset/cortina,cs7542-reset.h> + + pcie@80000000 { + compatible = "cortina,cs7542-pcie"; + reg = <0x80000000 0x1000>, <0x80001000 0x1000>, + <0xf00a0000 0x100>; + reg-names = "dbi", "config", "app"; + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + bus-range = <0 0xff>; + num-lanes = <1>; + ranges = <0x82000000 0 0x80200000 0x80200000 0 0x1fe00000>; + clocks = <&global CS7542_CLK_PCIE0>; + interrupt-parent = <&gic>; + interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "msi"; + resets = <&global CS7542_RESET_PCIE0>; + phys = <&serdes 0>; + phy-names = "pcie"; + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie_intc 1>, + <0 0 0 2 &pcie_intc 2>, + <0 0 0 3 &pcie_intc 3>, + <0 0 0 4 &pcie_intc 4>; + + pcie@0,0 { + compatible = "pciclass,0604"; + reg = <0 0 0 0 0>; + device_type = "pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges; + }; + + pcie_intc: interrupt-controller { + #address-cells = <0>; + #interrupt-cells = <1>; + interrupt-controller; + }; + };
Signature · 1 line
2.53.0
PATCH v3 5/6 PCI: cs7542: Add CS7542 PCIe host support
In reply to Fil DunskyAdd DesignWare host glue consuming separate clock, reset and PHY providers. Use live link status and stop previous training before enumeration. Finish endpoint teardown before draining the shared IRQ and freeing MSI domains. Dispatch enabled INTx/MSI sources through one application interrupt and use its MSI target window.
Prevent root configuration accesses at and above 0x200, including direct DesignWare DBI reads, while preserving the private CSR bank and separate iATU callback base. Unwind power and IRQ domains on failure and removal.
Read live link/LTSSM state through the application wrapper. After link loss, block configuration and DBI accesses until controller reset and reprobe.
Hold the controller reset throughout PHY power-up. After the PHY is ready, wait 10 ms before releasing the reset and another 10 ms before accessing the host registers. The host uses the reset consumer API.
--- drivers/pci/controller/dwc/Kconfig | 12 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-cs7542.c | 658 +++++++++++++++++++++++++++++++ 3 files changed, 671 insertions(+)
drivers/pci/controller/dwc/Kconfig +12 -0
@@ -95,6 +95,17 @@ config PCIE_ARTPEC6_EP Enables support for the PCIe controller in the ARTPEC-6 SoC to work in endpoint mode. This uses the DesignWare core. +config PCIE_CS7542 + tristate "Cortina Systems CS7542 PCIe controller" + depends on OF && HAS_IOMEM && PCI_MSI && COMMON_CLK + select PCIE_DW_HOST + select GENERIC_PHY + help + Enable the DesignWare PCIe host controllers on Cortina CS7542. + The global clock/reset provider and a generic PHY are required. + The application interrupt handles both legacy INTx and MSI. + The module is called pcie-cs7542. + config PCIE_ESWIN tristate "ESWIN PCIe controller" depends on ARCH_ESWIN || COMPILE_TEST
@@ -577,4 +588,5 @@ config PCIE_ULTRARISC By default, this symbol is enabled when ARCH_ULTRARISC is active, requiring no further configuration on that platform. + endmenu
drivers/pci/controller/dwc/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o obj-$(CONFIG_PCIE_AMD_MDB) += pcie-amd-mdb.o obj-$(CONFIG_PCIE_ANDES_QILAI) += pcie-andes-qilai.o +obj-$(CONFIG_PCIE_CS7542) += pcie-cs7542.o obj-$(CONFIG_PCIE_ESWIN) += pcie-eswin.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
drivers/pci/controller/dwc/pcie-cs7542.c new file +658 -0
658 lines not on this page · raw message
Signature · 1 line
2.53.0
PATCH v3 6/6 MAINTAINERS: Add CS7542 PCIe support
In reply to Fil DunskyCover the PCIe host, SerDes PHY and their bindings under the existing CS7542 global control entry. The shared clock/reset provider and reset specifier header are already covered by the prerequisite series.
--- MAINTAINERS | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
MAINTAINERS +5 -1
@@ -2949,13 +2949,17 @@ F: tools/perf/tests/shell/coresight/* F: tools/perf/util/cs-etm-decoder/* F: tools/perf/util/cs-etm.* -ARM/CORTINA SYSTEMS CS7542 GLOBAL CONTROL +ARM/CORTINA SYSTEMS CS7542 GLOBAL CONTROL AND PCIE M: Fil Dunsky <[email protected]> L: [email protected] (moderated for non-subscribers) S: Maintained +F: Documentation/devicetree/bindings/pci/cortina,cs7542-pcie.yaml +F: Documentation/devicetree/bindings/phy/cortina,cs7542-pcie-phy.yaml F: Documentation/devicetree/bindings/pinctrl/cortina,cs7542-pinctrl.yaml F: Documentation/devicetree/bindings/soc/cortina/ F: drivers/clk/clk-cs7542.c +F: drivers/pci/controller/dwc/pcie-cs7542.c +F: drivers/phy/phy-cs7542-pcie.c F: drivers/pinctrl/pinctrl-cs7542.c F: drivers/reset/reset-cs7542.c F: include/dt-bindings/clock/cortina,cs7542-clock.h
Signature · 1 line
2.53.0
[email protected]
AI reviewSashiko has finished reviewing this 6-patch series:
Sashiko has finished reviewing this 6-patch series:
- Patches 1-5: no issues found.
- Patch 6: skipped (not reviewed).
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]