Changes between Version 22 and Version 23 of PCI


Ignore:
Timestamp:
05/08/2026 07:34:46 PM (32 hours ago)
Author:
Ryan Erb
Comment:

add info for pcie reset

Legend:

Unmodified
Added
Removed
Modified
  • PCI

    v22 v23  
    263263Note that by default the Linux kernel will not alter ECRC Generation / Check and considers this configured by boot firmware. This can be overridden by enabling CONFIG_PCIE_ECRC in the kernel and passing the kernel cmdline 'ecrc=0' to force disable or 'ecrc=1' to force enable
    264264
     265[=#reset]
     266= PCIe Reset
     267
     268PCIe reset is controlled by the driver and the devices are sensitive to this reset. Typically the signal is named PERST#.
     269
     270Reset signals are routed to the FSA/Mini-PCIe sockets.
     271
     272On boards without a switch this is typically a GPIO and on boards with a PCIe switch a GPIO drives the PERST# of the switch and the switch automatically controls the PERST# signal going to each down-stream socket and they can not be independently controlled.
     273
     274
     275
     276
     277=== Manual Control of PCIe Reset
     278
     279For very special circumstances, it may be desired to manually control the PERST# (active low) signal. Note that other things may be on the PCIe bus, such as Ethernet, etc. Many devices cannot be reset on a live board, but rather it's part of a special sequencing at the time of boot.
     280
     281You can remove the reset-gpio property from the device-tree for the PCI node so that the PCI driver won't be able to toggle it. This means you will need to drive it manually. Additionally you need to remove the PCI devices from the kernel before you toggle reset, then trigger the kernel to rescan.
     282
     283You need to know the dt path for the PCI controller (which varies per SoC) and the GPIO mapped to PERST# (which varies per board). Both of these things can be determined by looking at the device-tree.
     284
     285Example: using an Venice GW72xx imx8mm-gw72xx-0x to remove PERST# from the kernel driver to allow toggling it manually in userspace.
     286
     287U-Boot:
     288{{{
     289setenv preboot "$preboot; gpio set GPIO4_6" # imx8mm-gw72xx PERST# is GPIO4_6 and is low on powerup; drive high
     290setenv fixfdt 'fdt addr $fdt_addr_r && fdt rm /soc@0/pcie@33800000 reset-gpio' # remove PERST# from driver for imx8mm
     291saveenv
     292boot
     293}}}
     294
     295Linux:
     296{{{
     297# verify reset-gpio is missing from the dt
     298ls /proc/device-tree/soc@0/pcie@33800000/reset-gpio
     299# verify your PCI devices enumerated
     300lspci
     301# enable console printk so we can see enumeration
     302echo 8 > /proc/sys/kernel/printk
     303# remove pci devices from kernel
     304for dev in /sys/bus/pci/devices/*; do echo 1 | tee "$dev/remove"; done
     305# toggle GPIO
     306gpioset gpiochip3 6=0; sleep 1; gpioset gpiochip3 6=1
     307# trigger kernel to rescan
     308echo 1 > /sys/bus/pci/rescan
     309}}}
     310
     311While this will fundamentally reset devices that use PERST# it is not guaranteed to not cause any issues with kernel or userspace software as those devices disappear and reappear. You will need to test this to verify it suits your needs.
     312
     313
    265314
    266315[=#enumeration]