[PATCH v1 03/12] PCI: hotplug: add and expose link disable API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When a PCIe-based FPGA card is reprogrammed, it temporarily
disappears from the PCIe bus. This needs to be managed to
avoid PCIe errors while the device is not present. Also,
re-probing and rescan the PCI devices must be performed after
loading the new images. Export functions from pciehp driver
necessary for disable and enable the PCI link of a PCI hotplug
bridge.

Signed-off-by: Tianfei Zhang <tianfei.zhang@xxxxxxxxx>
---
 drivers/pci/hotplug/pciehp.h     | 1 +
 drivers/pci/hotplug/pciehp_hpc.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index c7f455a3b08f..8b58d0e84644 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -195,6 +195,7 @@ int pciehp_get_raw_indicator_status(struct hotplug_slot *h_slot, u8 *status);
 int pciehp_slot_reset(struct pcie_device *dev);
 
 int pciehp_link_enable(struct controller *ctrl);
+int pciehp_link_disable(struct controller *ctrl);
 
 static inline const char *slot_name(struct controller *ctrl)
 {
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index 11e4bc58aec0..729546c0c1f9 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -353,6 +353,12 @@ int pciehp_link_enable(struct controller *ctrl)
 }
 EXPORT_SYMBOL_NS_GPL(pciehp_link_enable, PCIEHP);
 
+int pciehp_link_disable(struct controller *ctrl)
+{
+	return __pciehp_link_set(ctrl, false);
+}
+EXPORT_SYMBOL_NS_GPL(pciehp_link_disable, PCIEHP);
+
 int pciehp_get_raw_indicator_status(struct hotplug_slot *hotplug_slot,
 				    u8 *status)
 {
-- 
2.38.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux