Hi,
We have a custom K2E based board running Linux, which we are using to connect to an FPGA over PCIe using our own device driver. This is currently all working fine in normal operation, but we have a requirement where we would like to be able to reload the FPGA with a different bitfile 'on the fly', i.e. without rebooting Linux.
This would require us to:
- Unload our device driver
- Potentially remove the PCIe device from Linux, e.g. using /sys/bus/pci/devices/<device>/remove
- Reboot the FPGA with the new image
- Re-initialise PCIe in Linux, e.g. link training, enumeration etc
- Re-load our device driver
We have tried using various combinations of '/sys/bus/pci/devices/<device>/remove' and '/sys/bus/pci/rescan', and have also toggled LTSSM_EN in the CMD_STATUS register to re-train the link, but cannot get PCIe to properly re-initialise and enumerate.
Is it possible to re-initialise PCIe in this way, i.e. without rebooting? I assume we would effectively need to cause keystone_pcie_setup() and keystone_pcie_rc_init(), at least, to be called again after re-loading the FPGA. Is there a way to do this?
Thanks