Commit Graph

3162 Commits

Author SHA1 Message Date
Richard Zhu
c9dc7d7303 PCI: imx6: Move clock enable after core reset assertion
Commit 610fa91d98 ("PCI: imx6: Assert PERST# before enabling regulators")
inadvertently moved clock enablement before core reset assertion, breaking
PCI device initialization on i.MX6Q Apalis platforms with
ASM1061/ASM1062 SATA controllers connected:

  imx6q-pcie 1ffc000.pcie: host bridge /soc/pcie@1ffc000 ranges:
  imx6q-pcie 1ffc000.pcie:       IO 0x0001f80000..0x0001f8ffff -> 0x0000000000
  imx6q-pcie 1ffc000.pcie:      MEM 0x0001000000..0x0001efffff -> 0x0001000000
  imx6q-pcie 1ffc000.pcie: config reg[1] 0x01f00000 == cpu 0x01f00000
  imx6q-pcie 1ffc000.pcie: iATU: unroll F, 4 ob, 4 ib, align 64K, limit 4G
  imx6q-pcie 1ffc000.pcie: Link: Only Gen1 is enabled
  imx6q-pcie 1ffc000.pcie: Link failed to come up. LTSSM: POLL_CONFIG
  imx6q-pcie 1ffc000.pcie: probe with driver imx6q-pcie failed with error -110

NOTE: It is not 100% clear if the issue is specific to the ASM1061/ASM1062
device or on the specific power-up sequence (reset vs cold-power-on).

To fix this regression, restore the original sequence where clocks are
enabled after asserting core reset and configuring the controller type.

Fixes: 610fa91d98 ("PCI: imx6: Assert PERST# before enabling regulators")
Reported-by: Leonardo Costa <leoreis.costa@gmail.com>
Closes: https://lore.kernel.org/all/bl7i3obu2clzsgeoct2a4mtfhv6typcjdqmgneropf3hpgwve6@n2m5uhlduw57/T/#u
Reported-by: Franz Schnyder <fra.schnyder@gmail.com>
Closes: https://lore.kernel.org/all/t65y5d54axtksbfs7r4olcefqhwm6m4dz3njgnrnf7fcotj74i@o7avoznlafbj/
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
[bhelgaas: move to pci/for-linus for v7.3]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org # 7.2+
Link: https://patch.msgid.link/20260813095003.356062-1-hongxing.zhu@oss.nxp.com
2026-09-17 16:54:34 -05:00
Linus Torvalds
5e6ff28676 hyperv-next for v7.3-rc1
-----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEIbPD0id6easf0xsudhRwX5BBoF4FAmqPVgsTHHdlaS5saXVA
 a2VybmVsLm9yZwAKCRB2FHBfkEGgXhzaB/4k6+7PbPA0xM7C+1Nu7mU1XKNnc1Ep
 TSiDrrxCEXFJH1SK65yXhsd3TPmgF/rLB0hLBTg23Xts1hDiL6/Hwk9Xne25NaFJ
 VxvBNqOwgda2n1o1yk2m1KIVp4c2S5CTnICI/ka/gQph27kgj006px7G/ZOjRG+M
 5+EMk4vc5xYKb9J3QHvyNoiKBwv0uNWlJkX5Ali4NB+pE/KO92rpY45DefpEZNrO
 Rv4RUtK9PFE0lzY6EcYiZ5zAPF4SOTzTqyTZsg6HMgTLv1G4JAD7cRlXP1sPN9YQ
 KJijoZ1C7b4Ih75m8xv4tdumxTvu7LCfZoiBhn3V9+H/SXWe2WquaFOt
 =yZjb
 -----END PGP SIGNATURE-----

Merge tag 'hyperv-next-signed-20260826' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux

Pull hyperv updates from Wei Liu:

 - Decrypt netvsc buffer on contiguous direct-map addresses (Kameron
   Carr)

 - Drop WS2012/2012R2 & Win8/8.1 Hyper-V support (Michael Kelley)

 - Use more meaningful errnos for hypercall status code (Hardik Garg)

 - Fix lost interrupts on CPU hot-unplug for Hyper-V PCI/MSI (Naman
   Jain)

 - Reserve more MSHV vectors for Linux root partition (Wei Liu)

* tag 'hyperv-next-signed-20260826' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
  clocksource: hyper-v: Remove support for stimer interrupts in message mode
  scsi: storvsc: Remove support for storvsc protocol of old Hyper-V hosts
  hv_netvsc: Remove GPADL teardown special case for old Hyper-V hosts
  hv_sock: Remove check for old Hyper-V hosts
  Drivers: hv: Remove support for WS2012/2012R2 & Win8/8.1 version of Hyper-V
  hv_netvsc: Allocate send/receive buffers using vmbus_alloc_buffer()
  Drivers: hv: vmbus: Add vmbus_alloc_buffer()/vmbus_free_buffer() for CoCo VMs
  Drivers: hv: vmbus: add vmbus_establish_gpadl_caller_decrypted()
  Drivers: hv: vmbus: Skip VMBus module cleanup for non-nested root partition
  x86/hyperv: reserve more vectors
  PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip
  Drivers: hv: Use meaningful errnos for hypercall status codes
2026-08-26 16:47:40 -07:00
Naman Jain
86bdd16e8f PCI: hv: Set irq_retrigger callback for the Hyper-V PCI MSI irqchip
The Hyper-V vPCI MSI irqchip never installs an irq_retrigger() callback.

On CPU hot-unplug fixup_irqs() migrates the interrupts which are affine to
the outgoing CPU to a new target. If an interrupt still has its pending bit
set in the outgoing CPU's IRR at that point, fixup_irqs() resends it on the
new target through the irqchip's irq_retrigger() callback. As the Hyper-V
PCI/MSI chip does not provide that callback, the pending interrupt is
silently dropped, which can result in lost interrupts, stalls and "No irq
handler for vector" messages during CPU hotplug.

Install irq_chip_retrigger_hierarchy() as the irq_retrigger() callback for
the Hyper-V PCI/MSI irqchip, so that a pending interrupt is resent on its
new target CPU via the parent x86 vector domain.

Fixes: 4daace0d8c ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
Cc: stable@vger.kernel.org
Suggested-by: Long Li <longli@microsoft.com>
Suggested-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Aditya Garg <gargaditya@linux.microsoft.com>
Reviewed-by: Shradha Gupta <shradhagupta@linux.microsoft.com>
Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
2026-08-24 00:21:39 +00:00
Linus Torvalds
570f7e331f pci-v7.3-changes
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAmqIy5UUHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vw79g//dJCdLjB7Hu/pYOkkZ1VGpQC4x8eu
 RR2if7TxHOceOkzIzd9OB68NU3KLuBthyMRdcfZ5VjayiRKZHbY1NnQX8qzoXsPM
 F10QbJ/JOhZF0bvtr5nkTS2659AkHfMgiEPAN1hN6M0gHzFEB0vNoYb9lgMRkdXm
 3jxMX8tq1x8QlbpiTx5nmfHtbK40u8BI/zcpsBW6P8LHmRMhlEgLViPDNVNfup9p
 OK4Ra/jeExIkODwVI5ngBJgtetcXs5jFPgAkbk+efjU32VSLUwIETj2l1JsfDh79
 taj7XKEYReghFIvIUmm0vkNZU3CRvkMdoZQnep/HypxpPc5cJAFcHRpAb70QRgA5
 CbHeFKfFr4D1fOXyUq0atbpb4O3wZdCRgaULDgRmP7TmLIY+8VaUv4wjYDi9vVW9
 QVxxFmaydF4lRLsKGrUX5755QVMTAN7Hyqs984R/zi66WjF1MLPqXkaqOKZxrjj8
 8oJ9HCLX+B1hHnIENN/D0kcc1YSsruCke2RF0FFDpc3N48Y0LOGyof5S7GUx2Z1+
 MohLF/Y8TSsdmzo9a25OZ8Oyq+kyZ1spDYbpBmN/Pqu3GZBNBan7EsbY5pg0LVG+
 NtQv7+oX7Q4VGmbDvxfGCwauA3ekaSfyIW0KJtk5y1xLJO2pAQn4QOBqUZtYtyJf
 wu10ek23s7w9wbI=
 =cNUI
 -----END PGP SIGNATURE-----

Merge tag 'pci-v7.3-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull PCI updates from Bjorn Helgaas:
 "Resource management:

   - Add hotplug reservation only once (not at each level of the
     hierarchy) so bridge windows don't grow more than necessary (Ilpo
     Järvinen)

  Driver binding:

   - Rework device matching so device ID lifetime only needs to cover
     the probe path since dynamic IDs can be removed at any time (Gary
     Guo)

  Error handling:

   - Update mappings of AER errors to agent & layer and log them for
     each individual error when multiple errors detected (Lukas Wunner)

   - Log Error Source only once, not twice in separate messages (Lukas
     Wunner)

   - Emit TLP Log only for unmasked errors (Lukas Wunner)

   - Support Advisory Non-Fatal Errors (Lukas Wunner)

   - Allow DPC on all Downstream Ports, not just Root Ports, when OS
     controls AER (Darshit Shah)

  ASPM:

   - Program the same ASPM Control values for every function of
     multi-function devices, as recommended by the PCIe spec (Krishna
     Chaitanya Chundru)

   - Avoid L0s for Realtek RTS525A, where it causes an AER interrupt
     storm (Max Lee)

   - Avoid ASPM L0s, L1, and L1 PM Substates based on 'aspm-no-l0s',
     'aspm-no-l1' [1], and 'aspm-no-l1ss' DT properties (Krishna
     Chaitanya Chundru)

  Power management:

   - Allow D3 for native hotplug-capable Root Ports on non-x86 platforms
     (we avoid D3 for these ports on x86 because some old platforms
     didn't validate it) (Manivannan Sadhasivam)

   - Allow portdrv to claim Ports even if they don't support services
     (AER, PME, DPC, hotplug, etc) so it can do power management (Brian
     Norris)

  Power control:

   - Add support for PCIe WAKE# interrupt when described via DT (Krishna
     Chaitanya Chundru)

   - For the TC9563 PCIe switch:

       - Take a reference on the I2C adapter to avoid uninterruptible
         hang when unloading an I2C module while in-use (Johan Hovold)

       - Update DT binding and driver to restrict Tx Amplitude, DFE and
         N_FTS to USP, DSP1 and DSP2 (Manivannan Sadhasivam)

       - Power off only external-facing ports (DSP1, DSP2), leaving USP
         and DSP3 (aka VDSP) powered up (Manivannan Sadhasivam)

       - Move integrated MAC Endpoint out of the list of internal ports
         and configure it separately (Manivannan Sadhasivam)

  Virtualization:

   - Add ACS quirk for Pericom PI7C9X2G608 switches (Tim Harvey)

   - Fix a long-standing bug in the Intel PCH Root Port MPC ACS quirk
     that didn't update the intended INTEL_MPC_REG_IRBNCE bit because it
     used a 16-bit config write when a 32-bit write was intended
     (Mohamad Raizudeen)

  Procfs:

   - Avoid spurious runtime PM wakeup on config space accesses that are
     outside config space and fail before reaching PCI (Krzysztof
     Wilczyński)

   - Warn on user-space writes to kernel-exclusive config space regions,
     as we already do for sysfs (Krzysztof Wilczyński)

   - Check credentials of opener, not reader, for config space reads, as
     we already do for sysfs (Krzysztof Wilczyński)

  Sysfs:

   - In pci_write_legacy_io(), avoid out-of-bounds reads from the user
     buffer and fix incorrect ioport write data (1-byte writes on
     little-endian powerpc, 2- and 4-byte writes on big-endian powerpc)
     (Krzysztof Wilczyński)

   - In pci_read_legacy_io(), fix incorrect ioport read data for 2- and
     4-byte reads on big-endian powerpc (Krzysztof Wilczyński)

   - Fix I/O port accessor argument order in Alpha pci_legacy_write()
     (Krzysztof Wilczyński)

   - Avoid spurious runtime PM wakeup on config space accesses that are
     outside config space and fail before reaching PCI (Krzysztof
     Wilczyński)

   - Return -EINVAL, not -ENODEV, for mmap of I/O BAR that fails because
     the arch doesn't support it, as we do for procfs (Krzysztof
     Wilczyński)

   - Check for LOCKDOWN_PCI_ACCESS for legacy_io and legacy_mem, as we
     do for other config space accessors (Krzysztof Wilczyński)

  Peer-to-peer DMA:

   - Add Nvidia Vera Rubin to list of platforms that support P2PDMA
     (Leon Romanovsky)

  Endpoint framework:

   - Check doorbell SUCCESS bit in pci_endpoint_test to avoid treating
     some failures as successes (Niklas Cassel)

   - Fail doorbell test when the trigger IRQ is missed (Niklas Cassel)

  New native PCIe controller drivers:

   - Add DT binding and driver for NVIDIA Tegra264 (Thierry Reding)

  Native PCIe controllers:

   - Use common wait time definitions for PCIe link monitoring instead
     of defining driver-private duplicates (Thierry Reding)

  Generic host bridge driver:

   - Fix NULL pointer dereference that caused enumeration failures on
     32-bit CAM systems (Steffen Persvold)

  Amlogic Meson PCIe controller driver:

   - Correct the PERST# GPIO state so it remains asserted until power
     and REFCLK become stable to fix enumeration failure (Ronald
     Claveau)

  ASPEED PCIe controller driver:

   - Switch to irq_domain_create_linear() so we can obsolete
     irq_domain_add_linear() (Jiri Slaby)

  Cadence PCIe controller driver:

   - Add MODULE_DEVICE_TABLE to generate module aliases for OF-based
     module autoloading (Pengpeng Hou)

   - Add debugfs 'ltssm_status' file for LGA- and HPA-based Cadence
     controllers (Hans Zhang)

   - Support up to x4 (not x2) lanes for J200 (Takuma Fujiwara)

   - Fix host/endpoint dependencies for cadence-plat driver to fix link
     error when cadence-plat is built-in but the host or endpoint driver
     is modular (Aksh Garg)

  Freescale i.MX6 PCIe controller driver:

   - Add imx6 intr/aer/pme interrupt lines for i.MX95 (Richard Zhu)

   - Remove PERST# checking from pci_host_common_parse_port() so callers
     can decide whether to fall back to legacy DT binding with PERST# in
     the host bridge (Sherry Sun)

   - Fix build issues when PCI_PWRCTRL_GENERIC or PCI_HOST_COMMON is a
     module (Arnd Bergmann)

   - Create pwrctrl devices only once by doing it from imx_pcie_probe()
     instead of imx_pcie_host_init(), which is used during both probe
     and resume (Sherry Sun)

   - Use 'dw_pcie_rp->skip_pwrctrl_off' to avoid powering off devices
     during suspend to preserve wakeup capability (Sherry Sun)

   - Add runtime PM support for i.MX95 to allow dynamic power management
     when the link is idle (Richard Zhu)

  Intel VMD host bridge driver:

   - Support device ID 0x28C1 and assume that BIOS has already
     enumerated the hierarchy below VMD and stored bus range info for OS
     to use (Nirmal Patel)

   - Add support for VMCONFIG BUS_RESTRICT_CFG=3, which makes it
     possible to enumerate downstream devices on Intel Arrow Lake-HX
     systems and probably others (Ali Alaei)

   - Pay attention to _OSC negotiation for VMD hierarchy only when
     running on bare metal, not when running in a VM (Nirmal Patel)

   - Add Nova Lake (NVL) and Dunlow (DNL) Device IDs (Szymon Durawa)

  MediaTek PCIe controller driver:

   - Add support for PCIe controller in EcoNet EN7528 and EN751221 SoCs
     (Caleb James DeLisle)

  MediaTek PCIe Gen3 controller driver:

   - Add mediatek-gen3 'memory-region' for restricted DMA buffer
     (Chen-Yu Tsai)

  NVIDIA Tegra264 PCIe controller driver:

   - Distinguish Tegra264 C0 PCIe controller for internal GPU from C1-C5
     controllers so the unit address matches the first 'reg' entry
     (Thierry Reding)

   - Add Tegra264 Root Port stanzas to prepare for generic WAKE#
     handling (Thierry Reding)

  Qualcomm PCIe controller driver:

   - Add IPQ9650 compatible with global interrupt (Kathiravan
     Thirumoorthy)

   - Add IPQ5210 compatible with IPQ9574 fallback (Varadarajan
     Narayanan)

   - Add DT binding and driver support for Hawi SoC (Matthew Leung)

   - Skip PERST# GPIOs provided by downstream PCIe devices, which should
     be handled by drivers of those devices (Manivannan Sadhasivam)

   - Stop advertising Attention Button Present (no Qcom SoCs support
     Attention Buttons) so pciehp can use Presence Detect Changed events
     (Qiang Yu)

  Renesas R-Car PCIe controller driver:

   - Add rcar-gen4-pci-host optional 'msi-parent' for GIT ITS (Marek
     Vasut)

   - When MSI is enabled but iMSI-RX is not used, configure AXIINTC to
     allow GIT ITS to handle MSI (Marek Vasut)

   - Refactor GIC600 implementation to make it easier to add platforms
     that only support 32-bit addressing (Marek Vasut)

   - Add Renesas R-Car Gen4 S4/V4H/V4M to the list of GIC600
     integrations that only support 32-bit addressing (Marek Vasut)

  Renesas RZ/G3S PCIe controller driver:

   - Add DT binding and driver support for RZ/V2H(P) SoC, which contains
     two PCIe controllers, configured either as a single x4 link or two
     independent x2 link controllers (Lad Prabhakar)

  SpacemiT K1 PCIe controller driver:

   - Add missing MODULE_DEVICE_TABLE() to generate module alias info for
     OF-based module autoloading (Pengpeng Hou)

  StarFive PCIe controller driver:

   - Fix resource leaks on error paths in host_init() (Ali Tariq)

   - Fix runtime PM handling and teardown ordering to avoid register
     access while power or clocks are disabled (Ali Tariq)

   - Check for runtime PM resume failure to avoid register access while
     power or clocks are disabled (Ali Tariq)

  Synopsys DesignWare PCIe controller driver:

   - Add LECARC PMU IDs to the DWC RAS/DES VSEC list so it can take
     advantage of the existing debugfs support for silicon debug, error
     injection, and event counters (Brett Zhou)

   - Factor pcie_valid_speed() and pci_bus_speed2lnkctl2() out of bwctrl
     so they can be shared by the DWC core (Hans Zhang)

   - Flush MSI writes from endpoint before unmapping the iATU, as we
     already do for MSI-X writes (Niklas Cassel)

   - Unmap MSI iATU window before mapping MSI-X window, to avoid a
     subsequent MSI write using a disabled aperture and losing the
     interrupt (Niklas Cassel)

   - Change endpoint .pre_init() and .init() callbacks to return errors
     and handle them (Marek Vasut)

  UltraRISC PCIe controller driver:

   - Add 'core', 'dbi', and 'aux' clocks to DT binding and manage them
     in the driver (Jia Wang)

   - Use module_platform_driver() since this may be built as a module,
     though not removable because IRQs can't be safely disposed (Jia
     Wang)

  MicroSemi Switchtec management driver:

   - Add Microchip PCI1008 device ID and include it in NTB DMA alias
     quirk (Logan Gunthorpe)

  Miscellaneous:

   - Document how to write PCI Host Controller drivers (Manivannan
     Sadhasivam)

   - Fix typos in documentation (D'Orus Tsitera)

   - Use %pe format specifier to print error pointers so we get symbolic
     errname when available (Krzysztof Wilczyński)"

* tag 'pci-v7.3-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci: (124 commits)
  PCI: vmd: Add Nova Lake (NVL) and Dunlow (DNL) Device IDs
  PCI: tegra264: Add Tegra264 support
  dt-bindings: PCI: tegra264: Switch to PCIe Root Port bindings
  dt-bindings: PCI: tegra264: Strictly distinguish C0 from C1-C5
  PCI/AER: Support Advisory Non-Fatal Errors
  PCI: Fix 32-bit config write in Intel PCH Root Port MPC ACS quirk
  PCI: dwc: Handle return value from endpoint .pre_init callback
  PCI: dwc: Handle return value from endpoint .init callback
  PCI: dwc: Add PCI ID for LECARC PCIe PMU
  PCI/ASPM: Mask ASPM states based on Devicetree properties
  PCI/ASPM: Disable/restore ASPM on every function for multi-function devices
  Documentation: PCI: Document how to write PCI Host Controller drivers
  PCI/ASPM: Use pcie_capability_clear_and_set_word() for ASPM disable/restore
  PCI: Add support for PCIe WAKE# interrupt
  PCI: Allow D3 for native hotplug-capable Root Ports on non-x86 platforms
  dt-bindings: PCI: Correct white-space style
  PCI/ASPM: Avoid L0s for Realtek RTS525A
  PCI: ultrarisc: Use module_platform_driver()
  PCI: ultrarisc: Get and enable DP1000 PCIe controller clocks
  dt-bindings: PCI: ultrarisc: Add required DP1000 PCIe clocks
  ...
2026-08-23 12:44:10 -07:00
Bjorn Helgaas
9324becc39 Merge branch 'pci/misc'
- Fix typos in documentation (D'Orus Tsitera)

- Use %pe format specifier to print error pointers so we get symbolic
  errname when available (Krzysztof Wilczyński)

* pci/misc:
  PCI: Use %pe format specifier to print error pointers
  Documentation: PCI: Fix sysfs-bus-pci typo
2026-08-21 16:40:48 -05:00
Bjorn Helgaas
70cbec6fec Merge branch 'pci/controller/misc'
- Use common wait time definitions for PCIe link monitoring instead of
  defining driver-private duplicates (Thierry Reding)

- Add LECARC PMU IDs to the DWC RAS/DES VSEC list so it can take advantage
  of the existing debugfs support for silicon debug, error injection, and
  event counters (Brett Zhou)

* pci/controller/misc:
  PCI: dwc: Add PCI ID for LECARC PCIe PMU
  PCI: Use standard wait times for PCIe link monitoring
2026-08-21 16:40:47 -05:00
Bjorn Helgaas
25a22c9078 Merge branch 'pci/controller/xgene'
- Drop unnecessary OF node reference (Yuho Choi)

* pci/controller/xgene:
  PCI: xgene: Drop unnecessary OF node reference
2026-08-21 16:40:47 -05:00
Bjorn Helgaas
e0aba454f8 Merge branch 'pci/controller/vmd'
- Support device ID 0x28C1 and assume that BIOS has already enumerated the
  hierarchy below VMD and stored bus range info for OS to use (Nirmal
  Patel)

- Add support for VMCONFIG BUS_RESTRICT_CFG=3, which makes it possible to
  enumerate downstream devices on Intel Arrow Lake-HX systems and probably
  others (Ali Alaei)

- Observe _OSC negotiation for VMD hierarchy only when running on bare
  metal, not when running in a VM (Nirmal Patel)

- Add Nova Lake (NVL) and Dunlow (DNL) Device IDs (Szymon Durawa)

* pci/controller/vmd:
  PCI: vmd: Add Nova Lake (NVL) and Dunlow (DNL) Device IDs
  PCI: vmd: Only copy root bridge _OSC control flags in bare metal OS
  PCI: vmd: Handle BUS_RESTRICT_CFG value 3 for Arrow Lake-HX
  PCI: vmd: Add feature to scan BIOS-enumerated devices
2026-08-21 16:40:47 -05:00
Bjorn Helgaas
b130a2caf5 Merge branch 'pci/controller/tegra264'
- Distinguish Tegra264 C0 PCIe controller for internal GPU from C1-C5
  controllers so the unit address matches the first 'reg' entry (Thierry
  Reding)

- Add Tegra264 Root Port stanzas to prepare for generic WAKE# handling
  (Thierry Reding)

- Add NVIDIA Tegra264 driver (Thierry Reding)

* pci/controller/tegra264:
  PCI: tegra264: Add Tegra264 support
  dt-bindings: PCI: tegra264: Switch to PCIe Root Port bindings
  dt-bindings: PCI: tegra264: Strictly distinguish C0 from C1-C5
2026-08-21 16:40:46 -05:00
Bjorn Helgaas
003bb33da9 Merge branch 'pci/controller/rzg3s-host'
- Add DT binding and driver support for RZ/V2H(P) SoC, which contains two
  PCIe controllers, configured either as a single x4 link or two
  independent x2 link controllers (Lad Prabhakar)

* pci/controller/rzg3s-host:
  PCI: rzg3s-host: Add support for RZ/V2H(P) SoC
  PCI: rzg3s-host: Prepare System Controller handling for multiple controllers
  PCI: rzg3s-host: Use shared reset controls for power domain resets
  dt-bindings: PCI: renesas,r9a08g045-pcie: Add RZ/V2H(P) support
2026-08-21 16:40:46 -05:00
Bjorn Helgaas
707ba6063c Merge branch 'pci/controller/mediatek'
- Add support for PCIe controller in EcoNet EN7528 and EN751221 SoCs (Caleb
  James DeLisle)

* pci/controller/mediatek:
  PCI: mediatek: Add support for EcoNet EN7528 SoC
2026-08-21 16:40:45 -05:00
Bjorn Helgaas
2d022e66d5 Merge branch 'pci/controller/plda-starfive'
- Fix resource leaks on error paths in host_init() (Ali Tariq)

- Fix runtime PM handling and teardown ordering to avoid register access
  while power or clocks are disabled (Ali Tariq)

- Check for runtime PM resume failure to avoid register access while power
  or clocks are disabled (Ali Tariq)

* pci/controller/plda-starfive:
  PCI: starfive: Fix unchecked pm_runtime_get_sync() in probe
  PCI: starfive: Fix Runtime PM handling and teardown ordering
  PCI: starfive: Fix resource leaks on error paths in host_init()
2026-08-21 16:40:45 -05:00
Bjorn Helgaas
e6859eee41 Merge branch 'pci/controller/plda-host'
- Fix event IRQ user-after-free issues (Ali Tariq)

- Fix IRQ domain leaks in error paths (Ali Tariq)

* pci/controller/plda-host:
  PCI: plda: Fix IRQ domain leaks in the error paths of plda_init_interrupts()
  PCI: plda: Fix use-after-free of event IRQs during teardown
2026-08-21 16:40:44 -05:00
Bjorn Helgaas
3d3fce9435 Merge branch 'pci/controller/dwc-ultrarisc'
- Add 'core', 'dbi', and 'aux' clocks to DT binding and manage them in the
  driver (Jia Wang)

- Use module_platform_driver() since this may be built as a module, though
  not removable because IRQs can't be safely disposed (Jia Wang)

* pci/controller/dwc-ultrarisc:
  PCI: ultrarisc: Use module_platform_driver()
  PCI: ultrarisc: Get and enable DP1000 PCIe controller clocks
  dt-bindings: PCI: ultrarisc: Add required DP1000 PCIe clocks
2026-08-21 16:40:44 -05:00
Bjorn Helgaas
2a66fae91e Merge branch 'pci/controller/dwc-spacemit-k1'
- Add missing MODULE_DEVICE_TABLE() to generate module alias info for
  OF-based module autoloading (Pengpeng Hou)

* pci/controller/dwc-spacemit-k1:
  PCI: spacemit: Add missing MODULE_DEVICE_TABLE()
2026-08-21 16:40:44 -05:00
Bjorn Helgaas
45b3d1baf4 Merge branch 'pci/controller/dwc-rcar-gen4'
- When MSI is enabled but iMSI-RX is not used, configure AXIINTC to allow
  GIT ITS to handle MSI (Marek Vasut)

- Refactor GIC600 implementation to make it easier to add platforms that
  only support 32-bit addressing (Marek Vasut)

- Add Renesas R-Car Gen4 S4/V4H/V4M to the list of GIC600 integrations that
  only support 32-bit addressing (Marek Vasut)

* pci/controller/dwc-rcar-gen4:
  irqchip/gic-v3: Add Renesas R-Car Gen4 erratum workaround
  irqchip/gic-v3: Refactor GIC600 limited to 32bit PA erratum handling
  PCI: rcar-gen4: Configure AXIINTC if iMSI-RX is not used
  PCI: dwc: Move iMSI-RX check before calling 'pp->ops->init()'
2026-08-21 16:40:43 -05:00
Bjorn Helgaas
1579362594 Merge branch 'pci/controller/dwc-qcom'
- Add DT binding and driver support for Hawi SoC (Matthew Leung)

- Skip PERST# GPIOs provided by downstream PCIe devices, which should be
  handled by drivers of those devices (Manivannan Sadhasivam)

- Stop advertising Attention Button Present (no Qcom SoCs support Attention
  Buttons) so pciehp can use Presence Detect Changed events (Qiang Yu)

* pci/controller/dwc-qcom:
  PCI: qcom: Clear Attention Button Present in Slot Capabilities
  PCI: qcom: Rename qcom_pcie_set_slot_nccs() to qcom_pcie_set_slot_cap()
  PCI: qcom: Skip PERST# GPIOs provided by downstream PCIe devices
  PCI: qcom: Add support for Hawi
  dt-bindings: PCI: qcom: Document Hawi and Maili PCIe Controllers
2026-08-21 16:40:43 -05:00
Bjorn Helgaas
9bb52aa197 Merge branch 'pci/controller/dwc-meson'
- Correct the PERST# GPIO state so it remains asserted until power and
  REFCLK become stable to fix enumeration failure (Ronald Claveau)

* pci/controller/dwc-meson:
  PCI: meson: Fix GPIO state while requesting PERST#
2026-08-21 16:40:42 -05:00
Bjorn Helgaas
ab345fad8f Merge branch 'pci/controller/dwc-keystone'
- Fix OF node reference leak in init (Yuho Choi)

* pci/controller/dwc-keystone:
  PCI: keystone: Fix OF node reference leak in init
2026-08-21 16:40:42 -05:00
Bjorn Helgaas
3e01ebb619 Merge branch 'pci/controller/dwc-imx6'
- Remove PERST# checking from pci_host_common_parse_port() so callers can
  decide whether to fall back to legacy DT binding with PERST# in the host
  bridge (Sherry Sun)

- Fix build issues when PCI_PWRCTRL_GENERIC or PCI_HOST_COMMON is a module
  (Arnd Bergmann)

- Create pwrctrl devices only once by doing it from imx_pcie_probe()
  instead of imx_pcie_host_init(), which is used during both probe and
  resume (Sherry Sun)

- Use 'dw_pcie_rp->skip_pwrctrl_off' to avoid powering off devices during
  suspend to preserve wakeup capability (Sherry Sun)

- Add runtime PM support for i.MX95 to allow dynamic power management when
  the link is idle (Richard Zhu)

* pci/controller/dwc-imx6:
  PCI: imx6: Add runtime PM support for i.MX95
  PCI: imx6: Add 'skip_pwrctrl_off' flag support
  PCI: imx6: Move pci_pwrctrl_create_devices() to imx_pcie_probe()
  PCI: imx6: Fix building against PCI_PWRCTRL_GENERIC
  PCI: imx6: Fix building against PCI_HOST_COMMON
  PCI: host-generic: Move legacy DT binding fallback decision to caller of pci_host_common_parse_ports()
2026-08-21 16:40:42 -05:00
Bjorn Helgaas
71aabbe6d4 Merge branch 'pci/controller/dwc'
- Factor pcie_valid_speed() and pci_bus_speed2lnkctl2() out of bwctrl so
  they can be shared by the DWC core (Hans Zhang)

- Flush MSI writes from endpoint before unmapping the iATU, as we already
  do for MSI-X writes (Niklas Cassel)

- Unmap MSI iATU window before mapping MSI-X window, to avoid a subsequent
  MSI write using a disabled aperture and losing the interrupt (Niklas
  Cassel)

- Change endpoint .pre_init() and .init() callbacks to return errors and
  handle them (Marek Vasut)

* pci/controller/dwc:
  PCI: dwc: Handle return value from endpoint .pre_init callback
  PCI: dwc: Handle return value from endpoint .init callback
  PCI: dwc: ep: Fix unmap potentially unmapping the wrong iATU
  PCI: dwc: ep: Flush cached MSI write before unmapping the iATU
  PCI: dwc: Use common speed conversion function
  PCI: Move pci_bus_speed2lnkctl2() to public header
  PCI: Add public pcie_valid_speed() for shared validation
2026-08-21 16:40:41 -05:00
Bjorn Helgaas
4bba1f9306 Merge branch 'pci/controller/cadence'
- Add missing MODULE_DEVICE_TABLE to generate module aliases for OF-based
  module autoloading (Pengpeng Hou)

- Add debugfs 'ltssm_status' file for LGA- and HPA-based Cadence
  controllers (Hans Zhang)

- Support up to x4 (not x2) lanes for J200 (Takuma Fujiwara)

- Fix host/endpoint dependencies for cadence-plat driver to fix link error
  when cadence-plat is built-in but the host or endpoint driver is modular
  (Aksh Garg)

* pci/controller/cadence:
  PCI: cadence: Fix host/endpoint dependencies for cadence-plat driver
  PCI: j721e: Fix incorrect max_lanes for J7200
  PCI: cadence: Add LGA IP debugfs for LTSSM status
  PCI: cadence: Add HPA IP debugfs for LTSSM status
  PCI: cadence: Add HPA architecture flag
  PCI: cadence: Add missing MODULE_DEVICE_TABLE()
2026-08-21 16:40:41 -05:00
Bjorn Helgaas
1ef0f8a7f0 Merge branch 'pci/controller/aspeed'
- Switch to irq_domain_create_linear() so we can obsolete
  irq_domain_add_linear() (Jiri Slaby)

* pci/controller/aspeed:
  PCI: aspeed: Switch to irq_domain_create_linear()
2026-08-21 16:40:40 -05:00
Bjorn Helgaas
c4afb0b2d3 Merge branch 'pci/controller/host-generic'
- Fix NULL pointer dereference that caused enumeration failures on 32-bit
  CAM systems (Steffen Persvold)

* pci/controller/host-generic:
  PCI: host-generic: Fix NULL pointer dereference on 32-bit CAM systems
2026-08-21 16:40:40 -05:00
Szymon Durawa
55aa45154f PCI: vmd: Add Nova Lake (NVL) and Dunlow (DNL) Device IDs
Add VMD Device ID Support for Intel NVL/DNL processors.

Suggested-by: Nirmal Patel <nirmal.patel@linux.intel.com>
Signed-off-by: Szymon Durawa <szymon.durawa@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Nirmal Patel <nirmal.patel@linux.intel.com>
Cc: Jonathan Derrick <jonathan.derrick@linux.dev>
Link: https://patch.msgid.link/20260819130523.398493-1-szymon.durawa@linux.intel.com
2026-08-19 12:39:01 -05:00
Thierry Reding
01c3c27a0e PCI: tegra264: Add Tegra264 support
Add a driver for the PCIe controller found on NVIDIA Tegra264 SoCs. The
driver is very basic, with its main purpose being to set up the address
translation registers and then registering a standard PCIe Host Bridge
making use of ECAM.

Co-developed-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Signed-off-by: Manikanta Maddireddy <mmaddireddy@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
[mani: tweaked MAINTAINERS entry to support this new driver and binding]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260814-tegra264-pcie-v10-3-05d08c592b05@nvidia.com
2026-08-19 12:13:16 -05:00
Marek Vasut
c1366b72ad PCI: dwc: Handle return value from endpoint .pre_init callback
Add return value handling for struct dw_pcie_ep_ops .pre_init callback.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Roy Zang <Roy.Zang@nxp.com>
Link: https://patch.msgid.link/20260728012548.465139-3-marek.vasut+renesas@mailbox.org
2026-08-13 08:38:29 +02:00
Marek Vasut
face365457 PCI: dwc: Handle return value from endpoint .init callback
Add return value handling for struct dw_pcie_ep_ops .init callback.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>
Acked-by: Roy Zang <Roy.Zang@nxp.com>
Link: https://patch.msgid.link/20260728012548.465139-2-marek.vasut+renesas@mailbox.org
2026-08-13 08:38:29 +02:00
Jia Wang
22a415e623 PCI: ultrarisc: Use module_platform_driver()
CONFIG_PCIE_ULTRARISC is a tristate option and may be built as a module.
Use module_platform_driver() so the driver uses the standard registration
helper for both built-in and module configurations.

Leave .remove() unset because the driver registers an internal MSI
controller and the IRQs cannot be safely disposed during removal.

Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260731-ultrarisc-pci-clk-v4-3-d738b491e49a@ultrarisc.com
2026-08-10 19:44:38 -05:00
Jia Wang
e152c295d3 PCI: ultrarisc: Get and enable DP1000 PCIe controller clocks
Add the required core, dbi, and aux clocks for the DP1000 PCIe controller
and enable them before initializing the controller.

Also manage the clocks across system suspend and resume.

Fixes: 5fc35740c3 ("PCI: ultrarisc: Add UltraRISC DP1000 PCIe Root Complex driver")
Signed-off-by: Jia Wang <wangjia@ultrarisc.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260731-ultrarisc-pci-clk-v4-2-d738b491e49a@ultrarisc.com
2026-08-10 19:43:48 -05:00
Jakub Kicinski
4fa4977a0d Quite a bunch more work, of note:
- iwlwifi: new FW version support
  - mt76:
    - mt7928 support
    - mt7925 NAN support
    - mt7996 AP powersave improvements
  - rtw89:
    - LED support
    - RTL8922DE support
    - dual-BT coex for RTL8922D
  - ath12k: AHB platform MultiPD support
  - cfg80211: pre-assign cookies for operations
  - mac80211: AQL support for multicast
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEpeA8sTs3M8SN2hR410qiO8sPaAAFAmp0efQACgkQ10qiO8sP
 aACLlQ//RIWyRR5ss0/CFHKOasGxbffdlEbByQLpj2lM5z1X1rZEs3+JyHUM3ulf
 AqZmlU5vVtiNSgGwcL/2+E1BdUQdWLhnqkjAGHtKDh9LT06eix4e2VMLLqY9WdQ+
 E5l1hSfrKck7f1C+orhRhKWbGzWJ5kVuIIARTcPPMMi9VnCzVJ6vuREFgwX8i7j5
 xFiLGJSaynL9zQoKSaXhcEpyIMVox/lD1BY3HLuVm9ldJD5+KtLb3vkKgf52DbI6
 Cx3znqDfpOzfb3VHnoCWn6GVNTAtZGNA+NM9+RWFIHAe2jIbRfgG7tgDiemC9NJ9
 HrmgIMR8uLHc0EPCripsckzENmaAgv6opSb2RAJL7blZ/hSzVulDg+ejVCe87FN6
 3joldI2Rwpp90kFLLqm3JV8yrE97mZXPzA7zqt+uvEuHOTRrfskKIk6nDifsnhcn
 pK/y9CpqpHyLbvynPS/BPQSyazO+f4GVq7J8mxZXqvV9q9i8g40qjCmp7jKiNCH9
 4rWooGTwFRmVcfmnfc0XK/xMC/FrQ7C6grl+YFudP6FxJ1MOyLqApkthO6W4pGIr
 spH1s4eaHYdM1l9kOlMfnGtLXF/RBFDX5pSnKRnkZYGklZJxUtrOj1hFc4c0lF0I
 lKf2KWf223eFTnSeMe77UozS/C3cDQFBmegdsKzNJaFKsP4mWuc=
 =L5q1
 -----END PGP SIGNATURE-----

Merge tag 'wireless-next-2026-08-06' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next

Johannes Berg says:

====================
Quite a bunch more work, of note:
 - iwlwifi: new FW version support
 - mt76:
   - mt7928 support
   - mt7925 NAN support
   - mt7996 AP powersave improvements
 - rtw89:
   - LED support
   - RTL8922DE support
   - dual-BT coex for RTL8922D
 - ath12k: AHB platform MultiPD support
 - cfg80211: pre-assign cookies for operations
 - mac80211: AQL support for multicast

* tag 'wireless-next-2026-08-06' of https://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next: (403 commits)
  wifi: nxpwifi: bound uAP association event IEs to the event buffer
  wifi: nxpwifi: detach sync command buffer on interrupted wait
  wifi: brcmfmac: Fix memory leak in brcmf_sdio_read_control()
  wifi: rsi: Fix types to appease CFI
  wifi: mac80211: skip default WMM setup for AP_VLAN links
  wifi: nxpwifi: fix multiple static analysis errors and warnings
  wifi: morsemicro: MM81X should be invisible and selected by its users
  wifi: nxp: NXPWIFI should be invisible and selected by its users
  wifi: cfg80211: stop PMSR before P2P and NAN teardown
  wifi: mac80211: disconnect on CSA to channel 0
  wifi: brcmfmac: fix P2P action frame handling without device vif
  wifi: brcmfmac: Set DMA direction for msgbuf packet IDs
  wifi: brcmfmac: validate msgbuf flowring IDs before use
  wifi: mac80211: fix RCU usage in peer probing
  wifi: mac80211: fix RCU dereference in throughput estimate
  wifi: wilc1000: validate monitor transmit frame headers
  wifi: mac80211: skip unused probe response countdown offsets
  wifi: zd1211rw: reject secondary interfaces to prevent conflicts
  wifi: nl80211: clean up color-change beacon data on errors
  wifi: mac80211: send TWT teardown to peer after setup TX failure
  ...
====================

Link: https://patch.msgid.link/20260806121304.190084-3-johannes@sipsolutions.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-06 12:39:11 -07:00
Aksh Garg
79752653c1 PCI: cadence: Fix host/endpoint dependencies for cadence-plat driver
The cadence-plat driver has a single platform driver that can be built-in
or a loadable module, but it calls two separate backend drivers depending
on whether it is a host or endpoint.

If one of the mode is build as built-in and another as loadable module,
we end up with a situation where the built-in pcie-cadence-plat driver
tries to call the modular host or endpoint driver, which causes a link
failure:

  ld: error: undefined symbol: cdns_pcie_ep_setup
  >>> referenced by pcie-cadence-plat.c
  >>>               drivers/pci/controller/cadence/pcie-cadence-plat.o:(cdns_plat_pcie_probe) in archive vmlinux.a

  ld: error: undefined symbol: cdns_pcie_host_setup
  >>> referenced by pcie-cadence-plat.c
  >>>               drivers/pci/controller/cadence/pcie-cadence-plat.o:(cdns_plat_pcie_probe) in archive vmlinux.a

Fix this by moving the 'select' of PCIE_CADENCE_HOST and PCIE_CADENCE_EP
from the individual PLAT_HOST/PLAT_EP symbols into the common PCIE_CADENCE_PLAT
symbol, conditioned on which backends (modes) are enabled.

Fixes: 611627a4e5 ("PCI: cadence: Add module support for platform controller driver")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Closes: https://lore.kernel.org/linux-next/589ea512-93c6-4e1c-83d7-ba45a0b35843@infradead.org/
Signed-off-by: Aksh Garg <a-garg7@ti.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20260805105014.3952686-1-a-garg7@ti.com
2026-08-06 12:41:49 -05:00
Wilfred Mallawa
b376b3ff9c PCI: dw-rockchip: Implement .reset_root_port() and use for link down
The PCIe link may go down in cases like firmware crashes or unstable
connections. When this occurs, the Root Port must be reset to restore the
functionality. However, the current driver lacks link down handling,
forcing users to reboot the system to recover.

Implement the .reset_root_port() callback for link down handling for the
Rockchip DWC PCIe host controller. The RC is reset, reconfigured, and link
training initiated to recover from the link down event.

This also by extension fixes issues with sysfs-initiated bus resets.
Currently, the endpoint device is non-functional after a sysfs initiated
bus reset (it may link up with downgraded link status).  With the link down
handling support, a sysfs initiated bus reset works as intended. Testing
conducted on a ROCK5B board with an M.2 NVMe drive.

Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
[bhelgaas: subject]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20260727172654.605988-4-cassel@kernel.org
2026-08-04 16:34:15 -05:00
Manivannan Sadhasivam
4d88cb82a6 PCI: qcom: Implement .reset_root_port() and use for link down
The PCIe link can go down under circumstances such as the device firmware
crash, link instability, etc. When that happens, the Root Port needs to be
reset to make it operational again. Currently, the driver is not handling
the link down event, so users have to restart the machine to make PCIe link
operational again. Fix it by detecting the link down event and resetting
the Root Port.

Since the Qcom PCIe controllers report the link down event through the
'global' IRQ, enable the link down event by setting PARF_INT_ALL_LINK_DOWN
in the PARF_INT_ALL_MASK register.

In the case of the event, iterate through the available Root Ports and call
pci_host_handle_link_down() API with Root Port 'pci_dev' to let the PCI
core handle the link down condition. Since Qcom PCIe controllers only
support one Root Port per controller instance, the API will be called only
once. But the looping is necessary as there is no PCI API available to
fetch the Root Port instance without the child 'pci_dev'.

The API will internally call the 'pci_host_bridge::reset_root_port()'
callback to reset the Root Port in a platform-specific way. Implement the
callback to reset the Root Port by first resetting the PCIe core, followed
by reinitializing the resources and then finally starting the link again.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
[bhelgaas: subject]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Link: https://patch.msgid.link/20260729-pci-port-reset-v9-4-53570b92064d@oss.qualcomm.com
2026-08-04 16:33:30 -05:00
Niklas Cassel
9de09b807a PCI: dwc: ep: Fix unmap potentially unmapping the wrong iATU
The MSI path in dw_pcie_ep_raise_msi_irq() keeps its outbound iATU window
mapped across writes as a cache. The MSI-X path in
dw_pcie_ep_raise_msix_irq() maps and unmaps a window around every write.
Both use the same local aperture, ep->msi_mem_phys, as the CPU side address
that the iATU translates to the host's MSI or MSI-X target.

If dw_pcie_ep_raise_msi_irq() has cached its mapping and
dw_pcie_ep_raise_msix_irq() is then called, dw_pcie_ep_map_addr() allocates
a fresh outbound window for the MSI-X target. It does not notice that
ep->msi_mem_phys is already mapped by the MSI window, because
dw_pcie_ep_outbound_atu() only looks for a free window and does not
deduplicate by address. The controller now has two iATU windows whose
outbound_addr[] entry equals ep->msi_mem_phys.

When dw_pcie_ep_raise_msix_irq() later calls dw_pcie_ep_unmap_addr() to
tear down its own window, the lookup in dw_pcie_find_index() walks
ob_window_map in ascending index order and returns the first match. That is
the MSI window, since it was mapped first. The MSI window is torn down, the
MSI-X window is left in place, and ep->msi_iatu_mapped is never cleared.
The next MSI writel() therefore takes the cached fast path, writes into an
aperture whose iATU has been disabled, and the interrupt is silently lost.

To fix this issue, unmap the cached MSI iATU in dw_pcie_ep_raise_msix_irq()
before the MSI-X map, and clear ep->msi_iatu_mapped so that the next MSI
writel() reprograms the window. This guarantees that at most one iATU
window maps ep->msi_mem_phys at any time, so the subsequent
dw_pcie_find_index() call unambiguously returns the MSI-X window.

Fixes: 8719c64e76 ("PCI: dwc: ep: Cache MSI outbound iATU mapping")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
[mani: commit log]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://lore.kernel.org/linux-pci/20260729051542.DC2741F000E9@smtp.kernel.org/
Link: https://patch.msgid.link/20260730133123.1420413-6-cassel@kernel.org
2026-08-03 19:06:53 +02:00
Niklas Cassel
1b01d725d8 PCI: dwc: ep: Flush cached MSI write before unmapping the iATU
The MSI-X path already flushes any posted MSI-X write before tearing down
its iATU mapping. That was added by commit c22533c66c ("PCI: dwc: ep:
Flush MSI-X write before unmapping its ATU entry") to make sure the write
reaches the Root Complex before the outbound window that translates it
disappears.

The MSI path has the same problem but no equivalent flush. When the
Endpoint driver caches an MSI target address and later observes that the
Root Complex has changed it, dw_pcie_ep_raise_msi_irq() unmaps the existing
iATU entry and reprograms it for the new address. Between the last MSI
writel() and the unmap there may still be a posted write sitting in the
fabric, and unmapping the iATU entry can drop or misroute that write.

Fix this by reading back from the mapped MSI window before the unmap. The
readback drains any posted MSI writes through the same iATU entry that
mapped them, which is the same logic the MSI-X path uses.

Fixes: 468711a40d ("PCI: dwc: ep: Refresh MSI Message Address cache on change")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/linux-pci/20260729214859.B9E2B1F00A3A@smtp.kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
[mani: commit log]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260730133123.1420413-5-cassel@kernel.org
2026-08-03 18:37:10 +02:00
Johannes Berg
3a006d09a2 rtw-next patches for v7.3
Some random cleanups and fixes on rtlwifi, rtw88 and rtw89. The major
 features added to rtw89 are listed:
 
 rtw89:
 
  - add LED support
 
  - update BT-coexistence mechanism to support dual Bluetooth for RTL8922D
 
  - support WiFi 7 chip RTL8922DE
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEuyEnvMdOsBl1WjpdjlvZYmhshd8FAmpuqQAACgkQjlvZYmhs
 hd+RcxAAvOxWrvFuWBkpZoo9+z7COPtpDhOVfBCEnx2qpMtm9sUSHGsCaOuETvm+
 AZAUG2GpYFzcOEVIawdX7CAMd2sg7MXVPxgKrY0VO+SVuFCnbWOp/AqJOqdgC5fA
 HZHfBT+yHGiMh7U/F8p8rDtXrXS+7v5yld8yyNEXhxCK647HKFA84qLqY4f4wFN3
 MtN30B5Pj0mlTCAM+h7W6j2uc5h88jj7fjNDQa3SehfM3q/i6h8cXkTx/dw2i2ul
 XWtPIADYjwZFfL20BujIVOyVQQrUnFb2SZhoBeQn1sru5c0yzfklOa5SFscynuex
 XOIF3PhUeSBnNxP233vBJNx/ZwWRlZCjdXPqdBpX/g26FxCzNL/i1gjzP2X4Uz25
 QaS/6mWB4ZRoexoPWDf6XbeYmDjFtY3A1ecwOSsUSul5PSPzoeYrQExWx6BuRsE0
 vXH+FmgZUEmiQULgiIoglGdaerScI2p5U9AkIaoviBkbdb8bBj1FG3iMMR+K6pM4
 ERQtV5Y4mQ8DDhBGjcAwvccciawNeUYx5qz5rfn4dFZYZo7mntoLhGl/zbF/JvbA
 B55EH3jAR1ekyqy0pumUQKce0IZzb0Ogk24dfZHu84ZHca3+grSJUuuWxYId1BUq
 CoEfXuDLQ750r3dONF/R8y/g4FXnoC/U1LRq83k3mgTUqFeMZeE=
 =8EO5
 -----END PGP SIGNATURE-----

Merge tag 'rtw-next-2026-08-02' of https://github.com/pkshih/rtw

Ping-Ke Shih says:
==================
rtw-next patches for v7.3

Some random cleanups and fixes on rtlwifi, rtw88 and rtw89. The major
features added to rtw89 are listed:

rtw89:

 - add LED support

 - update BT-coexistence mechanism to support dual Bluetooth for RTL8922D

 - support WiFi 7 chip RTL8922DE
==================

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2026-08-02 18:50:03 +02:00
Krzysztof Wilczyński
ce3294cef6 PCI: Use %pe format specifier to print error pointers
Currently, several files in the PCI tree print error pointers using
the %ld format specifier together with an explicit PTR_ERR()
conversion, which prints the numeric errno value.

Thus, at every affected call site, use the %pe format specifier, which
exists specifically to print error pointers, and pass the error pointer
directly.  With CONFIG_SYMBOLIC_ERRNAME enabled, this prints a symbolic
error name such as -ENOMEM, falling back to the numeric errno value
otherwise.  As such, the explicit PTR_ERR() conversion is no longer
needed.

No functional changes intended.

Link: https://patch.msgid.link/20260720210839.1507406-1-kwilczynski@kernel.org
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
2026-08-01 04:03:30 +00:00
Manivannan Sadhasivam
4c99bace4f PCI: host-common: Add link down handling for Root Ports
The PCIe link, when down, needs to be recovered to bring it back. But on
some platforms, that cannot be done in a generic way as link recovery
procedure is platform specific. Add a new pci_host_handle_link_down() that
could be called by the host bridge drivers for a specific Root Port when
the link goes down.

pci_host_handle_link_down() accepts a 'pci_dev' corresponding to the Root
Port that observed the link down event. If CONFIG_PCIEAER is enabled, it
calls pcie_do_recovery() with 'pci_channel_io_frozen' as the state.  This
will result in the execution of the AER Fatal error handling code.  Since
the link down recovery is pretty much the same as AER Fatal error handling,
reuse pcie_do_recovery() here.

The AER .error_detected() callback will be triggered for all of the
downstream devices, but not for the Root Port itself as there is nothing to
do for the Root Ports in the callbacks. Finally, pci_host_reset_root_port()
will be called for the Root Port, which will reset the Root Port using the
.reset_root_port() callback to recover the link. Once that's done, resume
message will be broadcasted to the bridge and the downstream devices,
indicating successful link recovery.

But if CONFIG_PCIEAER is not enabled in the kernel, only
pci_host_reset_root_port() will be called, which will in turn call
pci_bus_error_reset() to just reset the Root Port as there is no way we
could inform the drivers about link recovery.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Brian Norris <briannorris@chromium.org>
Tested-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Tested-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260729-pci-port-reset-v9-3-53570b92064d@oss.qualcomm.com
2026-07-31 17:08:54 -05:00
Linus Torvalds
596254ecc5 pci-v7.2-fixes-1
-----BEGIN PGP SIGNATURE-----
 
 iQJIBAABCgAyFiEEgMe7l+5h9hnxdsnuWYigwDrT+vwFAmpsv30UHGJoZWxnYWFz
 QGdvb2dsZS5jb20ACgkQWYigwDrT+vx05BAAlX0ggF2vDuKKQK1Q67oBANG+ANZq
 wAyMibleGWHvUfknsxcioGoXr+oZrI2fbuvaz1id2Tlx3vByfYiSihrNz4BrDbny
 H+YD2Mqhz0aaanb+G1WEqRndCyRLtYmsr0cUAp7giBh22t43tgdIBvKr2PsCsKCo
 WiEUP/QvxYuiJ73g6s7RqbwIYSzk/9MMSDhoO83c/gRZcY/r47KY19ysLevQ/176
 h0xC73EV6UF0dqe485jt24/zzYkN70zV3FscPMLkU7s0Fd2jzRm/zktS7tbLTUg2
 PZwqCnHc4dytoqEmcycrQHGNiPRQCCOnqcsSlWcMzPPBdYCR1EUictiYXgq0Bd4T
 EvvjHHl3/9IVCWgkz7rKmLz8V7GWoJSH11Ykh3AWWc7roFsTn1UH2YY+85/Asfv+
 /vuo2G7zskKE5WOSaEOLBvYi84FRge3FxA3XPgMYTOePTqIpjjJ6eglZRmxEhid5
 IrJhaB0O9kNuRR3Nu85lgHqL35Pp5AUVOLqyXELvcbBBJHtm1PTgjAZjyRIm0Rn7
 YINhuQr3gw+3vKaXGB8qHqXMG1/hdMkHH9t6LEqAqFtRrTZjzquGg5oFnJOYINCL
 VinNH6/G1qIYBThTVDMeVSTUqCbkz97eedzyGo92oqpUdhseWyaaV4vwW1ss4DWv
 QSN25brLKheYiKk=
 =YyK4
 -----END PGP SIGNATURE-----

Merge tag 'pci-v7.2-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci

Pull pci fixes from Bjorn Helgaas:

 - Remove Karthikeyan Mitran from Mobiveil MAINTAINERS PCIe entry since
   email bounces (Manivannan Sadhasivam)

 - Preserve i.MX6Q, i.MX6QP, and i.MX6SX Root Port MSI/MSI-X
   Capabilities when using iMSI-RX to work around hardware defect
   (Soeren Moch)

 - Reorder i.MX6Q/DL PHY power up to fix boot hang regression (Richard
   Zhu)

* tag 'pci-v7.2-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci:
  PCI: imx6: Fix i.MX6Q/DL boot hang caused by improper PHY power sequencing
  PCI: imx6: Keep i.MX6 Root Port MSI/MSI-X Capabilities with iMSI-RX to work around hardware bug
  MAINTAINERS: Drop Karthikeyan Mitran from Mobiveil PCIe entry
2026-07-31 10:11:52 -07:00
Qiang Yu
65ccb2203e PCI: qcom: Clear Attention Button Present in Slot Capabilities
Qcom PCIe Root Ports advertise the Attention Button Present (ABP) bit in
the Slot Capabilities register, but the slots have no attention button.

When ABP is set, pcie_enable_notification() in the pciehp driver enables
the Attention Button Pressed interrupt (ABPE) and leaves the Presence
Detect Changed interrupt (PDCE) disabled. As a result, presence detect
changes are never reported, and surprise hot-plug detection that relies on
Presence Detect Changed events does not work.

Clear the Attention Button Present (ABP) bit in the Slot Capabilities
register so pciehp Presence Detect Changed events work.

Signed-off-by: Qiang Yu <qiang.yu@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
[bhelgaas: say what the patch does in the commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> # X1E80100 CRD
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260713-b4-clear_abp_0713-v2-2-4f0333a98d4e@oss.qualcomm.com
2026-07-31 11:42:56 -05:00
Manivannan Sadhasivam
3663795872 PCI: dwc: ep: Clear MSI iATU mapping in dw_pcie_ep_cleanup()
The MSI iATU mapping is currently only cleared when the endpoint is
stopped via configfs or when the host updates the MSI address/size.
This avoids redundant iATU reconfiguration every time the endpoint
raises an MSI interrupt.

However, a fundamental reset triggered by PERST# assert/deassert
resets all iATU inbound/outbound registers without going through the
configfs stop path. If the host also retains the same MSI address/size
after PERST# deassert, the driver never clears the stale MSI iATU
mapping. It then continues using this stale mapping to raise the MSI
interrupts, which can cause IOMMU faults and MSI failures on the host.

Fix this by clearing the MSI iATU mapping inside dw_pcie_ep_cleanup(),
which is already called as part of the PERST# assert/deassert sequence.
This unmaps the MSI iATU region and sets the msi_iatu_mapped flag to
false, ensuring that dw_pcie_ep_raise_msi_irq() performs a fresh iATU
mapping on its next invocation, regardless of whether the host changed
the MSI address/size.

Fixes: 8719c64e76 ("PCI: dwc: ep: Cache MSI outbound iATU mapping")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260729-pci-port-reset-v9-1-53570b92064d@oss.qualcomm.com
2026-07-30 18:42:49 +02:00
Ali Tariq
aaae917990 PCI: starfive: Fix unchecked pm_runtime_get_sync() in probe
pm_runtime_get_sync() is called in starfive_pcie_probe() without
checking its return value. If runtime resume fails, the driver
proceeds to configure PCIe hardware through regmap_update_bits(),
enable clocks and resets, and power on the PHY, even though the
device may not actually be powered.

pm_runtime_get_sync() also increments the usage counter even when
resume fails, which would leave the counter unbalanced if this
error path were later handled without additional cleanup.

Switch to pm_runtime_resume_and_get(), which balances the usage
counter internally on failure, and bail out of probe before any
hardware is touched if resume does not succeed.

Tested on StarFive VisionFive 2 v1.2A board.

Fixes: 6168efbeba ("PCI: starfive: Enable controller runtime PM before probing host bridge")
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260718153352.661930-1-alitariq45892@gmail.com
2026-07-29 18:42:43 +02:00
Ali Tariq
fb9f797347 PCI: starfive: Fix Runtime PM handling and teardown ordering
The starfive_pcie_remove() path incorrectly disabled runtime PM
before executing plda_pcie_host_deinit(), which can cause unmanaged
hardware register access in plda_pcie_host_deinit() while power domains or
clocks are disabled.

Fix this by restructuring starfive_pcie_remove() to deinitialize the host
controller first while runtime PM is active, followed by a synchronous
pm_runtime_put_sync() and pm_runtime_disable().

This bug was found in automated AI review by sashiko-bot.

Fixes: 39b91eb40c ("PCI: starfive: Add JH7110 PCIe controller")
Closes: https://lore.kernel.org/linux-pci/20260712180440.423421F000E9@smtp.kernel.org/
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260718133825.445041-1-alitariq45892@gmail.com
2026-07-29 18:37:39 +02:00
Ali Tariq
19a30bbb64 PCI: plda: Fix IRQ domain leaks in the error paths of plda_init_interrupts()
plda_init_interrupts() initializes IRQ domains and creates IRQ mapping but
does not unwind them when later step fails.

If platform_get_irq() or either irq_create_mapping() fails
in plda_init_interrupts(), the domains are never deinitialized. If
irq_create_mapping() fails, port->intx_irq stays initialized.

Hence, remove the IRQ domains in the error path by calling
plda_pcie_irq_domain_deinit().

Since plda_pcie_irq_domain_deinit() now disposes of the intx_irq and
msi_irq mappings itself before removing their domains, the msi_irq
mapping failure path can go directly to err_irq_domain_deinit instead of
disposing of port->intx_irq separately first.

This issue was found by automated review of sashiko-bot

Fixes: 4602c370bd ("PCI: microchip: Move IRQ functions to pcie-plda-host.c")
Fixes: 76c9113968 ("PCI: plda: Add host init/deinit and map bus functions")
Closes: https://lore.kernel.org/linux-pci/20260718120701.DF4111F000E9@smtp.kernel.org/
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
[mani: commit log]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260723142824.726655-1-alitariq45892@gmail.com
2026-07-29 18:33:19 +02:00
Ali Tariq
26b73bae01 PCI: plda: Fix use-after-free of event IRQs during teardown
plda_pcie_irq_domain_deinit() removes pcie->event_domain via
irq_domain_remove(), but the per-event IRQs mapped from that domain
are requested with devm_request_irq() in plda_init_interrupts(). The
actual free_irq() for a devm-managed IRQ is deferred by devres until
after the calling probe()/remove() function returns.

This means irq_domain_remove() can free the domain's internal data
before the deferred free_irq() for IRQs still mapped into it has run.
When devres later processes that deferred cleanup, it can end up
dereferencing the already-freed domain.

Free each event IRQ explicitly with devm_free_irq() before removing
the domain. This triggers the free immediately and removes the IRQ
from the devres tracking list, so devres will not attempt to free it
a second time later.

Also dispose of the event, INTx, and MSI IRQ mappings with
irq_dispose_mapping() before their owning domains are removed.

Finally, guard the calls to irq_set_chained_handler_and_data() for
pcie->irq, pcie->msi_irq, and pcie->intx_irq so they only run when
those fields hold a valid (>0) IRQ number.

This is a pre-existing issue, flagged by automated review during work
on an earlier, unrelated patch to this driver.

Build-tested and boot-tested on StarFive VisionFive v1.2A board

Fixes: 76c9113968 ("PCI: plda: Add host init/deinit and map bus functions")
Closes: https://lore.kernel.org/linux-pci/20260714115343.4D49E1F000E9@smtp.kernel.org/
Signed-off-by: Ali Tariq <alitariq45892@gmail.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260723140434.675512-2-alitariq45892@gmail.com
2026-07-29 18:30:41 +02:00
Thierry Reding
9cb1b6a781 PCI: Use standard wait times for PCIe link monitoring
Instead of defining the wait values for each driver, use common values
defined in the core pci.h header file. Note that while most drivers use
the usleep_range(), it looks like these were mostly cargo culted and
msleep() is a better choice given the fixed delay that the specification
calls for. Convert all drivers to msleep() and use the existing
definition.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Aksh Garg <a-garg7@ti.com>
Link: https://patch.msgid.link/20260716-tegra264-pcie-v8-3-23e51589229b@nvidia.com
2026-07-29 16:37:44 +02:00
Nirmal Patel
2162572d34 PCI: vmd: Only copy root bridge _OSC control flags in bare metal OS
Only in a bare metal OS environment, the _OSC control flags like Hotplug,
PME, AER, etc. reflect the physical root bridge capabilities. But in a VM
environment, these flags reflect the hypervisor policy and in most cases,
the hypervisor disables all of these control flags to the guest.

So copying these flags would needlessly disable these features in the VMD
owned Root Ports. Hence, copy the flags only when VMD is running in a bare
metal OS environment.

Signed-off-by: Nirmal Patel <nirmal.patel@linux.intel.com>
[mani: commit log and comment rewording]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Link: https://patch.msgid.link/20260713220844.561357-1-nirmal.patel@intel.com
2026-07-29 13:43:04 +02:00
Qiang Yu
9f46f9d696 PCI: qcom: Rename qcom_pcie_set_slot_nccs() to qcom_pcie_set_slot_cap()
qcom_pcie_set_slot_nccs() currently only sets the NCCS field in the Slot
Capabilities register. A following patch adds programming of another
field in the same register, so rename the function to
qcom_pcie_set_slot_cap() to reflect that it configures Slot Capabilities
as a whole, not just NCCS.

No functional change intended.

Signed-off-by: Qiang Yu <qiang.yu@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>
Link: https://patch.msgid.link/20260713-b4-clear_abp_0713-v2-1-4f0333a98d4e@oss.qualcomm.com
2026-07-29 10:21:21 +02:00
Richard Zhu
7678e81498 PCI: imx6: Fix i.MX6Q/DL boot hang caused by improper PHY power sequencing
commit 610fa91d98 ("PCI: imx6: Assert PERST# before enabling regulators")
introduced a boot hang on i.MX6Q/DL variants by reordering
imx_pcie_host_init() to call imx6q_pcie_enable_ref_clk() (which powered up
the PHY) before imx6q_pcie_core_reset() (which powered it back down).

Before 610fa91d98, the sequence was:

  1. imx_pcie_assert_core_reset() - power down PHY (set TEST_PD), set
     REF_CLK_EN
  2. imx_pcie_clk_enable() - power up PHY (clear TEST_PD), set REF_CLK_EN
  3. Link training starts with PHY powered up (TEST_PD cleared)
  4. Link training succeeds

After 610fa91d98, the sequence became:

  1. imx_pcie_clk_enable() - power up PHY (clear TEST_PD), set REF_CLK_EN
  2. imx_pcie_assert_core_reset() - power down PHY (set TEST_PD), set
     REF_CLK_EN
  3. imx_pcie_deassert_core_reset() - does nothing
  4. Link training starts with PHY powered down (TEST_PD set)
  5. Link training fails and boot hangs when PHY register accesses hang

To fix this:

  - Remove TEST_PD PHY power control from imx6q_pcie_enable_ref_clk()
  - Remove REF_CLK_EN control from imx6q_pcie_core_reset()
  - Add TEST_PD PHY power control to imx6qp_pcie_core_reset(), which
    previously relied on imx6q_pcie_enable_ref_clk() to power up the PHY by
    clearing TEST_PD
  - Clear TEST_PD to power on PHY in imx_pcie_deassert_core_reset()

These changes together ensure the correct sequence:

  1. REF_CLK_EN set in clk_enable() (TEST_PD untouched)
  2. TEST_PD set in assert_core_reset() (PHY power off)
  3. TEST_PD cleared in deassert_core_reset() (PHY power on)
  4. Link training starts with proper PHY state

The i.MX6Q/DL PCIe PHY requires approximately 120us between TEST_PD
de-assertion and link training start. Add usleep_range(200, 500) in
imx6q_pcie_core_reset() after clearing TEST_PD to satisfy this requirement.

Add explicit imx_pcie_assert_core_reset() calls in error paths and
host_exit() to ensure no power leak.

Fixes: 610fa91d98 ("PCI: imx6: Assert PERST# before enabling regulators")
Reported-by: Leonardo Costa <leoreis.costa@gmail.com>
Closes: https://lore.kernel.org/lkml/20260629143439.361560-1-leoreis.costa@gmail.com/
Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Tested-by: Leonardo Costa <leonardo.costa@toradex.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20260728035159.2702021-1-hongxing.zhu@oss.nxp.com
2026-07-28 11:37:06 -05:00