aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-10-13 14:35:47 -0400
committerBjorn Helgaas <bhelgaas@google.com>2017-11-06 19:49:00 -0500
commitdb63d40017a523d127ec78328fed643918c7c54c (patch)
tree63d1cc602cf4232761473018bacd4dba4a6b10c1
parent499022396a381d1b681105b74ac366017ce051e9 (diff)
PCI: pciehp: Do not clear Presence Detect Changed during initialization
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>
-rw-r--r--drivers/pci/hotplug/pciehp_hpc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
index fd0877e92b05..7bab0606f1a9 100644
--- a/drivers/pci/hotplug/pciehp_hpc.c
+++ b/drivers/pci/hotplug/pciehp_hpc.c
@@ -858,11 +858,16 @@ struct controller *pcie_init(struct pcie_device *dev)
858 if (link_cap & PCI_EXP_LNKCAP_DLLLARC) 858 if (link_cap & PCI_EXP_LNKCAP_DLLLARC)
859 ctrl->link_active_reporting = 1; 859 ctrl->link_active_reporting = 1;
860 860
861 /* Clear all remaining event bits in Slot Status register */ 861 /*
862 * Clear all remaining event bits in Slot Status register except
863 * Presence Detect Changed. We want to make sure possible
864 * hotplug event is triggered when the interrupt is unmasked so
865 * that we don't lose that event.
866 */
862 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA, 867 pcie_capability_write_word(pdev, PCI_EXP_SLTSTA,
863 PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD | 868 PCI_EXP_SLTSTA_ABP | PCI_EXP_SLTSTA_PFD |
864 PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_PDC | 869 PCI_EXP_SLTSTA_MRLSC | PCI_EXP_SLTSTA_CC |
865 PCI_EXP_SLTSTA_CC | PCI_EXP_SLTSTA_DLLSC); 870 PCI_EXP_SLTSTA_DLLSC);
866 871
867 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", 872 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",
868 (slot_cap & PCI_EXP_SLTCAP_PSN) >> 19, 873 (slot_cap & PCI_EXP_SLTCAP_PSN) >> 19,