]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
PCI: pciehp: Do not clear Presence Detect Changed during initialization
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 13 Oct 2017 18:35:47 +0000 (21:35 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 7 Nov 2017 00:49:00 +0000 (18:49 -0600)
It is possible that the hotplug event has already happened before the
driver is attached to a PCIe hotplug downstream port. If we just clear the
status we never get the hotplug interrupt and thus the event will be
missed.

To make sure that does not happen, we leave Presence Detect Changed bit
untouched during initialization. Then once the event is unmasked we get an
interrupt and handle the hotplug event properly.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/hotplug/pciehp_hpc.c

index fd0877e92b055b200c978b063e04feb33b9f79ed..7bab0606f1a9f1d04e9529a22b1354b1f73844c3 100644 (file)
@@ -858,11 +858,16 @@ struct controller *pcie_init(struct pcie_device *dev)
        if (link_cap & PCI_EXP_LNKCAP_DLLLARC)
                ctrl->link_active_reporting = 1;
 
-       /* Clear all remaining event bits in Slot Status register */
+       /*
+        * Clear all remaining event bits in Slot Status register except
+        * Presence Detect Changed. We want to make sure possible
+        * hotplug event is triggered when the interrupt is unmasked so
+        * that we don't lose that event.
+        */
        pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
                PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD |
-               PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC |
-               PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC);
+               PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_CC |
+               PCI_EXP_SLTSTA_DLLSC);
 
        ctrl_info(ctrl, "Slot #%d AttnBtn%c PwrCtrl%c MRL%c AttnInd%c PwrInd%c HotPlug%c Surprise%c Interlock%c NoCompl%c LLActRep%c\n",
                (slot_cap & PCI_EXP_SLTCAP_PSN) >> 19,