]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/pci/hotplug/pciehp_hpc.c
PCI: pciehp: Clear Presence Detect and Data Link Layer Status Changed on resume
[mirror_ubuntu-bionic-kernel.git] / drivers / pci / hotplug / pciehp_hpc.c
index 7bab0606f1a9f1d04e9529a22b1354b1f73844c3..8e653ffbda07b375d658c5e33b7bc6bda323f433 100644 (file)
@@ -673,7 +673,7 @@ static irqreturn_t pcie_isr(int irq, void *dev_id)
        return handled;
 }
 
-void pcie_enable_notification(struct controller *ctrl)
+static void pcie_enable_notification(struct controller *ctrl)
 {
        u16 cmd, mask;
 
@@ -711,6 +711,17 @@ void pcie_enable_notification(struct controller *ctrl)
                 pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, cmd);
 }
 
+void pcie_reenable_notification(struct controller *ctrl)
+{
+       /*
+        * Clear both Presence and Data Link Layer Changed to make sure
+        * those events still fire after we have re-enabled them.
+        */
+       pcie_capability_write_word(ctrl->pcie->port, PCI_EXP_SLTSTA,
+                                  PCI_EXP_SLTSTA_PDC | PCI_EXP_SLTSTA_DLLSC);
+       pcie_enable_notification(ctrl);
+}
+
 static void pcie_disable_notification(struct controller *ctrl)
 {
        u16 mask;
@@ -848,6 +859,13 @@ struct controller *pcie_init(struct pcie_device *dev)
        if (pdev->hotplug_user_indicators)
                slot_cap &= ~(PCI_EXP_SLTCAP_AIP | PCI_EXP_SLTCAP_PIP);
 
+       /*
+        * We assume no Thunderbolt controllers support Command Complete events,
+        * but some controllers falsely claim they do.
+        */
+       if (pdev->is_thunderbolt)
+               slot_cap |= PCI_EXP_SLTCAP_NCCS;
+
        ctrl->slot_cap = slot_cap;
        mutex_init(&ctrl->ctrl_lock);
        init_waitqueue_head(&ctrl->queue);