diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2020-06-04 12:59:09 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2020-06-04 12:59:09 -0500 |
commit | 8ab064e93103592bb38f8e77d52e15561df619ec (patch) | |
tree | 941fde10a82dabb1b216e03dd0021b0fc2d7cae9 /drivers/pci/pcie | |
parent | 15d5a0157f31a874c94a0c8142c9bd7d494cb374 (diff) | |
parent | 11fdcf05032812bd23cdc42850d1f650376ec09d (diff) |
Merge branch 'pci/enumeration'
- Fix pci_register_host_bridge() device_register() error handling (Rob
Herring)
- Fix pci_host_bridge struct device release/free handling (Rob Herring)
- Program MPS for RCiEP devices (Ashok Raj)
- Inherit PTM settings from Switch Upstream Port so we can enable PTM on
Endpoints (Bjorn Helgaas)
- Add #defines for bridge windows (PCI_BRIDGE_IO_WINDOW,
PCI_BRIDGE_MEM_WINDOW, etc) (Krzysztof Wilczynski)
* pci/enumeration:
pcmcia: Use CardBus window names (PCI_CB_BRIDGE_IO_0_WINDOW etc) when freeing
PCI: Use bridge window names (PCI_BRIDGE_IO_WINDOW etc)
PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port
PCI: Program MPS for RCiEP devices
PCI: Fix pci_host_bridge struct device release/free handling
PCI: Fix pci_register_host_bridge() device_register() error handling
Diffstat (limited to 'drivers/pci/pcie')
-rw-r--r-- | drivers/pci/pcie/ptm.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/pci/pcie/ptm.c b/drivers/pci/pcie/ptm.c index 9361f3aa26ab..357a454cafa0 100644 --- a/drivers/pci/pcie/ptm.c +++ b/drivers/pci/pcie/ptm.c @@ -39,10 +39,6 @@ void pci_ptm_init(struct pci_dev *dev) if (!pci_is_pcie(dev)) return; - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); - if (!pos) - return; - /* * Enable PTM only on interior devices (root ports, switch ports, * etc.) on the assumption that it causes no link traffic until an @@ -52,6 +48,23 @@ void pci_ptm_init(struct pci_dev *dev) pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END)) return; + /* + * Switch Downstream Ports are not permitted to have a PTM + * capability; their PTM behavior is controlled by the Upstream + * Port (PCIe r5.0, sec 7.9.16). + */ + ups = pci_upstream_bridge(dev); + if (pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM && + ups && ups->ptm_enabled) { + dev->ptm_granularity = ups->ptm_granularity; + dev->ptm_enabled = 1; + return; + } + + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_PTM); + if (!pos) + return; + pci_read_config_dword(dev, pos + PCI_PTM_CAP, &cap); local_clock = (cap & PCI_PTM_GRANULARITY_MASK) >> 8; @@ -61,7 +74,6 @@ void pci_ptm_init(struct pci_dev *dev) * the spec recommendation (PCIe r3.1, sec 7.32.3), select the * furthest upstream Time Source as the PTM Root. */ - ups = pci_upstream_bridge(dev); if (ups && ups->ptm_enabled) { ctrl = PCI_PTM_CTRL_ENABLE; if (ups->ptm_granularity == 0) |