Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pci-v5.19-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci

Pull pci updates from Bjorn Helgaas:
"Resource management:

- Restrict E820 clipping to PCI host bridge windows (Bjorn Helgaas)

- Log E820 clipping better (Bjorn Helgaas)

- Add kernel cmdline options to enable/disable E820 clipping (Hans de
Goede)

- Disable E820 reserved region clipping for IdeaPads, Yoga, Yoga
Slip, Acer Spin 5, Clevo Barebone systems where clipping leaves no
usable address space for touchpads, Thunderbolt devices, etc (Hans
de Goede)

- Disable E820 clipping by default starting in 2023 (Hans de Goede)

PCI device hotplug:

- Include files to remove implicit dependencies (Christophe Leroy)

- Only put Root Ports in D3 if they can signal and wake from D3 so
AMD Yellow Carp doesn't miss hotplug events (Mario Limonciello)

Power management:

- Define pci_restore_standard_config() only for CONFIG_PM_SLEEP since
it's unused otherwise (Krzysztof Kozlowski)

- Power up devices completely, including anything platform firmware
needs to do, during runtime resume (Rafael J. Wysocki)

- Move pci_resume_bus() to PM callbacks so we observe the required
bridge power-up delays (Rafael J. Wysocki)

- Drop unneeded runtime_d3cold device flag (Rafael J. Wysocki)

- Split pci_raw_set_power_state() between pci_power_up() and a new
pci_set_low_power_state() (Rafael J. Wysocki)

- Set current_state to D3cold if config read returns ~0, indicating
the device is not accessible (Rafael J. Wysocki)

- Do not call pci_update_current_state() from pci_power_up() so BARs
and ASPM config are restored correctly (Rafael J. Wysocki)

- Write 0 to PMCSR in pci_power_up() in all cases (Rafael J. Wysocki)

- Split pci_power_up() to pci_set_full_power_state() to avoid some
redundant operations (Rafael J. Wysocki)

- Skip restoring BARs if device is not in D0 (Rafael J. Wysocki)

- Rearrange and clarify pci_set_power_state() (Rafael J. Wysocki)

- Remove redundant BAR restores from pci_pm_thaw_noirq() (Rafael J.
Wysocki)

Virtualization:

- Acquire device lock before config space access lock to avoid AB/BA
deadlock with sriov_numvfs_store() (Yicong Yang)

Error handling:

- Clear MULTI_ERR_COR/UNCOR_RCV bits, which a race could previously
leave permanently set (Kuppuswamy Sathyanarayanan)

Peer-to-peer DMA:

- Whitelist Intel Skylake-E Root Ports regardless of which devfn they
are (Shlomo Pongratz)

ASPM:

- Override L1 acceptable latency advertised by Intel DG2 so ASPM L1
can be enabled (Mika Westerberg)

Cadence PCIe controller driver:

- Set up device-specific register to allow PTM Responder to be
enabled by the normal architected bit (Christian Gmeiner)

- Override advertised FLR support since the controller doesn't
implement FLR correctly (Parshuram Thombare)

Cadence PCIe endpoint driver:

- Correct bitmap size for the ob_region_map of outbound window usage
(Dan Carpenter)

Freescale i.MX6 PCIe controller driver:

- Fix PERST# assertion/deassertion so we observe the required delays
before accessing device (Francesco Dolcini)

Freescale Layerscape PCIe controller driver:

- Add "big-endian" DT property (Hou Zhiqiang)

- Update SCFG DT property (Hou Zhiqiang)

- Add "aer", "pme", "intr" DT properties (Li Yang)

- Add DT compatible strings for ls1028a (Xiaowei Bao)

Intel VMD host bridge driver:

- Assign VMD IRQ domain before enumeration to avoid IOMMU interrupt
remapping errors when MSI-X remapping is disabled (Nirmal Patel)

- Revert VMD workaround that kept MSI-X remapping enabled when IOMMU
remapping was enabled (Nirmal Patel)

Marvell MVEBU PCIe controller driver:

- Add of_pci_get_slot_power_limit() to parse the
'slot-power-limit-milliwatt' DT property (Pali Rohár)

- Add mvebu support for sending Set_Slot_Power_Limit message (Pali
Rohár)

MediaTek PCIe controller driver:

- Fix refcount leak in mtk_pcie_subsys_powerup() (Miaoqian Lin)

MediaTek PCIe Gen3 controller driver:

- Reset PHY and MAC at probe time (AngeloGioacchino Del Regno)

Microchip PolarFlare PCIe controller driver:

- Add chained_irq_enter()/chained_irq_exit() calls to mc_handle_msi()
and mc_handle_intx() to avoid lost interrupts (Conor Dooley)

- Fix interrupt handling race (Daire McNamara)

NVIDIA Tegra194 PCIe controller driver:

- Drop tegra194 MSI register save/restore, which is unnecessary since
the DWC core does it (Jisheng Zhang)

Qualcomm PCIe controller driver:

- Add SM8150 SoC DT binding and support (Bhupesh Sharma)

- Fix pipe clock imbalance (Johan Hovold)

- Fix runtime PM imbalance on probe errors (Johan Hovold)

- Fix PHY init imbalance on probe errors (Johan Hovold)

- Convert DT binding to YAML (Dmitry Baryshkov)

- Update DT binding to show that resets aren't required for
MSM8996/APQ8096 platforms (Dmitry Baryshkov)

- Add explicit register names per chipset in DT binding (Dmitry
Baryshkov)

- Add sc7280-specific clock and reset definitions to DT binding
(Dmitry Baryshkov)

Rockchip PCIe controller driver:

- Fix bitmap size when searching for free outbound region (Dan
Carpenter)

Rockchip DesignWare PCIe controller driver:

- Remove "snps,dw-pcie" from rockchip-dwc DT "compatible" property
because it's not fully compatible with rockchip (Peter Geis)

- Reset rockchip-dwc controller at probe (Peter Geis)

- Add rockchip-dwc INTx support (Peter Geis)

Synopsys DesignWare PCIe controller driver:

- Return error instead of success if DMA mapping of MSI area fails
(Jiantao Zhang)

Miscellaneous:

- Change pci_set_dma_mask() documentation references to
dma_set_mask() (Alex Williamson)"

* tag 'pci-v5.19-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (64 commits)
dt-bindings: PCI: qcom: Add schema for sc7280 chipset
dt-bindings: PCI: qcom: Specify reg-names explicitly
dt-bindings: PCI: qcom: Do not require resets on msm8996 platforms
dt-bindings: PCI: qcom: Convert to YAML
PCI: qcom: Fix unbalanced PHY init on probe errors
PCI: qcom: Fix runtime PM imbalance on probe errors
PCI: qcom: Fix pipe clock imbalance
PCI: qcom: Add SM8150 SoC support
dt-bindings: pci: qcom: Document PCIe bindings for SM8150 SoC
x86/PCI: Disable E820 reserved region clipping starting in 2023
x86/PCI: Disable E820 reserved region clipping via quirks
x86/PCI: Add kernel cmdline options to use/ignore E820 reserved regions
PCI: microchip: Fix potential race in interrupt handling
PCI/AER: Clear MULTI_ERR_COR/UNCOR_RCV bits
PCI: cadence: Clear FLR in device capabilities register
PCI: cadence: Allow PTM Responder to be enabled
PCI: vmd: Revert 2565e5b69c44 ("PCI: vmd: Do not disable MSI-X remapping if interrupt remapping is enabled by IOMMU.")
PCI: vmd: Assign VMD IRQ domain before enumeration
PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
PCI: rockchip-dwc: Add legacy interrupt support
...

+1649 -751
+2 -2
Documentation/PCI/pci.rst
··· 273 273 While all drivers should explicitly indicate the DMA capability 274 274 (e.g. 32 or 64 bit) of the PCI bus master, devices with more than 275 275 32-bit bus master capability for streaming data need the driver 276 - to "register" this capability by calling pci_set_dma_mask() with 276 + to "register" this capability by calling dma_set_mask() with 277 277 appropriate parameters. In general this allows more efficient DMA 278 278 on systems where System RAM exists above 4G _physical_ address. 279 279 280 280 Drivers for all PCI-X and PCIe compliant devices must call 281 - set_dma_mask() as they are 64-bit DMA devices. 281 + dma_set_mask() as they are 64-bit DMA devices. 282 282 283 283 Similarly, drivers must also "register" this capability if the device 284 284 can directly address "coherent memory" in System RAM above 4G physical
+9
Documentation/admin-guide/kernel-parameters.txt
··· 4099 4099 please report a bug. 4100 4100 nocrs [X86] Ignore PCI host bridge windows from ACPI. 4101 4101 If you need to use this, please report a bug. 4102 + use_e820 [X86] Use E820 reservations to exclude parts of 4103 + PCI host bridge windows. This is a workaround 4104 + for BIOS defects in host bridge _CRS methods. 4105 + If you need to use this, please report a bug to 4106 + <linux-pci@vger.kernel.org>. 4107 + no_e820 [X86] Ignore E820 reservations for PCI host 4108 + bridge windows. This is the default on modern 4109 + hardware. If you need to use this, please report 4110 + a bug to <linux-pci@vger.kernel.org>. 4102 4111 routeirq Do IRQ routing for all PCI devices. 4103 4112 This is normally done in pci_enable_device(), 4104 4113 so this option is a temporary workaround
+38 -27
Documentation/devicetree/bindings/pci/layerscape-pci.txt
··· 23 23 "fsl,ls1012a-pcie" 24 24 "fsl,ls1028a-pcie" 25 25 EP mode: 26 + "fsl,ls1028a-pcie-ep", "fsl,ls-pcie-ep" 26 27 "fsl,ls1046a-pcie-ep", "fsl,ls-pcie-ep" 27 28 "fsl,ls1088a-pcie-ep", "fsl,ls-pcie-ep" 28 29 "fsl,ls2088a-pcie-ep", "fsl,ls-pcie-ep" ··· 31 30 - reg: base addresses and lengths of the PCIe controller register blocks. 32 31 - interrupts: A list of interrupt outputs of the controller. Must contain an 33 32 entry for each entry in the interrupt-names property. 34 - - interrupt-names: Must include the following entries: 35 - "intr": The interrupt that is asserted for controller interrupts 33 + - interrupt-names: It could include the following entries: 34 + "aer": Used for interrupt line which reports AER events when 35 + non MSI/MSI-X/INTx mode is used 36 + "pme": Used for interrupt line which reports PME events when 37 + non MSI/MSI-X/INTx mode is used 38 + "intr": Used for SoCs(like ls2080a, lx2160a, ls2080a, ls2088a, ls1088a) 39 + which has a single interrupt line for miscellaneous controller 40 + events(could include AER and PME events). 36 41 - fsl,pcie-scfg: Must include two entries. 37 42 The first entry must be a link to the SCFG device node 38 - The second entry must be '0' or '1' based on physical PCIe controller index. 43 + The second entry is the physical PCIe controller index starting from '0'. 39 44 This is used to get SCFG PEXN registers 40 45 - dma-coherent: Indicates that the hardware IP block can ensure the coherency 41 46 of the data transferred from/to the IP block. This can avoid the software 42 47 cache flush/invalid actions, and improve the performance significantly. 43 48 49 + Optional properties: 50 + - big-endian: If the PEX_LUT and PF register block is in big-endian, specify 51 + this property. 52 + 44 53 Example: 45 54 46 - pcie@3400000 { 47 - compatible = "fsl,ls1021a-pcie"; 48 - reg = <0x00 0x03400000 0x0 0x00010000 /* controller registers */ 49 - 0x40 0x00000000 0x0 0x00002000>; /* configuration space */ 50 - reg-names = "regs", "config"; 51 - interrupts = <GIC_SPI 177 IRQ_TYPE_LEVEL_HIGH>; /* controller interrupt */ 52 - interrupt-names = "intr"; 53 - fsl,pcie-scfg = <&scfg 0>; 54 - #address-cells = <3>; 55 - #size-cells = <2>; 56 - device_type = "pci"; 57 - dma-coherent; 58 - num-lanes = <4>; 59 - bus-range = <0x0 0xff>; 60 - ranges = <0x81000000 0x0 0x00000000 0x40 0x00010000 0x0 0x00010000 /* downstream I/O */ 61 - 0xc2000000 0x0 0x20000000 0x40 0x20000000 0x0 0x20000000 /* prefetchable memory */ 62 - 0x82000000 0x0 0x40000000 0x40 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ 63 - #interrupt-cells = <1>; 64 - interrupt-map-mask = <0 0 0 7>; 65 - interrupt-map = <0000 0 0 1 &gic GIC_SPI 91 IRQ_TYPE_LEVEL_HIGH>, 66 - <0000 0 0 2 &gic GIC_SPI 188 IRQ_TYPE_LEVEL_HIGH>, 67 - <0000 0 0 3 &gic GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>, 68 - <0000 0 0 4 &gic GIC_SPI 192 IRQ_TYPE_LEVEL_HIGH>; 69 - }; 55 + pcie@3400000 { 56 + compatible = "fsl,ls1088a-pcie"; 57 + reg = <0x00 0x03400000 0x0 0x00100000>, /* controller registers */ 58 + <0x20 0x00000000 0x0 0x00002000>; /* configuration space */ 59 + reg-names = "regs", "config"; 60 + interrupts = <0 108 IRQ_TYPE_LEVEL_HIGH>; /* aer interrupt */ 61 + interrupt-names = "aer"; 62 + #address-cells = <3>; 63 + #size-cells = <2>; 64 + device_type = "pci"; 65 + dma-coherent; 66 + num-viewport = <256>; 67 + bus-range = <0x0 0xff>; 68 + ranges = <0x81000000 0x0 0x00000000 0x20 0x00010000 0x0 0x00010000 /* downstream I/O */ 69 + 0x82000000 0x0 0x40000000 0x20 0x40000000 0x0 0x40000000>; /* non-prefetchable memory */ 70 + msi-parent = <&its>; 71 + #interrupt-cells = <1>; 72 + interrupt-map-mask = <0 0 0 7>; 73 + interrupt-map = <0000 0 0 1 &gic 0 0 0 109 IRQ_TYPE_LEVEL_HIGH>, 74 + <0000 0 0 2 &gic 0 0 0 110 IRQ_TYPE_LEVEL_HIGH>, 75 + <0000 0 0 3 &gic 0 0 0 111 IRQ_TYPE_LEVEL_HIGH>, 76 + <0000 0 0 4 &gic 0 0 0 112 IRQ_TYPE_LEVEL_HIGH>; 77 + iommu-map = <0 &smmu 0 1>; /* Fixed-up by bootloader */ 78 + };
-397
Documentation/devicetree/bindings/pci/qcom,pcie.txt
··· 1 - * Qualcomm PCI express root complex 2 - 3 - - compatible: 4 - Usage: required 5 - Value type: <stringlist> 6 - Definition: Value should contain 7 - - "qcom,pcie-ipq8064" for ipq8064 8 - - "qcom,pcie-ipq8064-v2" for ipq8064 rev 2 or ipq8065 9 - - "qcom,pcie-apq8064" for apq8064 10 - - "qcom,pcie-apq8084" for apq8084 11 - - "qcom,pcie-msm8996" for msm8996 or apq8096 12 - - "qcom,pcie-ipq4019" for ipq4019 13 - - "qcom,pcie-ipq8074" for ipq8074 14 - - "qcom,pcie-qcs404" for qcs404 15 - - "qcom,pcie-sc8180x" for sc8180x 16 - - "qcom,pcie-sdm845" for sdm845 17 - - "qcom,pcie-sm8250" for sm8250 18 - - "qcom,pcie-sm8450-pcie0" for PCIe0 on sm8450 19 - - "qcom,pcie-sm8450-pcie1" for PCIe1 on sm8450 20 - - "qcom,pcie-ipq6018" for ipq6018 21 - 22 - - reg: 23 - Usage: required 24 - Value type: <prop-encoded-array> 25 - Definition: Register ranges as listed in the reg-names property 26 - 27 - - reg-names: 28 - Usage: required 29 - Value type: <stringlist> 30 - Definition: Must include the following entries 31 - - "parf" Qualcomm specific registers 32 - - "dbi" DesignWare PCIe registers 33 - - "elbi" External local bus interface registers 34 - - "config" PCIe configuration space 35 - - "atu" ATU address space (optional) 36 - 37 - - device_type: 38 - Usage: required 39 - Value type: <string> 40 - Definition: Should be "pci". As specified in snps,dw-pcie.yaml 41 - 42 - - #address-cells: 43 - Usage: required 44 - Value type: <u32> 45 - Definition: Should be 3. As specified in snps,dw-pcie.yaml 46 - 47 - - #size-cells: 48 - Usage: required 49 - Value type: <u32> 50 - Definition: Should be 2. As specified in snps,dw-pcie.yaml 51 - 52 - - ranges: 53 - Usage: required 54 - Value type: <prop-encoded-array> 55 - Definition: As specified in snps,dw-pcie.yaml 56 - 57 - - interrupts: 58 - Usage: required 59 - Value type: <prop-encoded-array> 60 - Definition: MSI interrupt 61 - 62 - - interrupt-names: 63 - Usage: required 64 - Value type: <stringlist> 65 - Definition: Should contain "msi" 66 - 67 - - #interrupt-cells: 68 - Usage: required 69 - Value type: <u32> 70 - Definition: Should be 1. As specified in snps,dw-pcie.yaml 71 - 72 - - interrupt-map-mask: 73 - Usage: required 74 - Value type: <prop-encoded-array> 75 - Definition: As specified in snps,dw-pcie.yaml 76 - 77 - - interrupt-map: 78 - Usage: required 79 - Value type: <prop-encoded-array> 80 - Definition: As specified in snps,dw-pcie.yaml 81 - 82 - - clocks: 83 - Usage: required 84 - Value type: <prop-encoded-array> 85 - Definition: List of phandle and clock specifier pairs as listed 86 - in clock-names property 87 - 88 - - clock-names: 89 - Usage: required 90 - Value type: <stringlist> 91 - Definition: Should contain the following entries 92 - - "iface" Configuration AHB clock 93 - 94 - - clock-names: 95 - Usage: required for ipq/apq8064 96 - Value type: <stringlist> 97 - Definition: Should contain the following entries 98 - - "core" Clocks the pcie hw block 99 - - "phy" Clocks the pcie PHY block 100 - - "aux" Clocks the pcie AUX block 101 - - "ref" Clocks the pcie ref block 102 - - clock-names: 103 - Usage: required for apq8084/ipq4019 104 - Value type: <stringlist> 105 - Definition: Should contain the following entries 106 - - "aux" Auxiliary (AUX) clock 107 - - "bus_master" Master AXI clock 108 - - "bus_slave" Slave AXI clock 109 - 110 - - clock-names: 111 - Usage: required for msm8996/apq8096 112 - Value type: <stringlist> 113 - Definition: Should contain the following entries 114 - - "pipe" Pipe Clock driving internal logic 115 - - "aux" Auxiliary (AUX) clock 116 - - "cfg" Configuration clock 117 - - "bus_master" Master AXI clock 118 - - "bus_slave" Slave AXI clock 119 - 120 - - clock-names: 121 - Usage: required for ipq8074 122 - Value type: <stringlist> 123 - Definition: Should contain the following entries 124 - - "iface" PCIe to SysNOC BIU clock 125 - - "axi_m" AXI Master clock 126 - - "axi_s" AXI Slave clock 127 - - "ahb" AHB clock 128 - - "aux" Auxiliary clock 129 - 130 - - clock-names: 131 - Usage: required for ipq6018 132 - Value type: <stringlist> 133 - Definition: Should contain the following entries 134 - - "iface" PCIe to SysNOC BIU clock 135 - - "axi_m" AXI Master clock 136 - - "axi_s" AXI Slave clock 137 - - "axi_bridge" AXI bridge clock 138 - - "rchng" 139 - 140 - - clock-names: 141 - Usage: required for qcs404 142 - Value type: <stringlist> 143 - Definition: Should contain the following entries 144 - - "iface" AHB clock 145 - - "aux" Auxiliary clock 146 - - "master_bus" AXI Master clock 147 - - "slave_bus" AXI Slave clock 148 - 149 - - clock-names: 150 - Usage: required for sdm845 151 - Value type: <stringlist> 152 - Definition: Should contain the following entries 153 - - "aux" Auxiliary clock 154 - - "cfg" Configuration clock 155 - - "bus_master" Master AXI clock 156 - - "bus_slave" Slave AXI clock 157 - - "slave_q2a" Slave Q2A clock 158 - - "tbu" PCIe TBU clock 159 - - "pipe" PIPE clock 160 - 161 - - clock-names: 162 - Usage: required for sc8180x and sm8250 163 - Value type: <stringlist> 164 - Definition: Should contain the following entries 165 - - "aux" Auxiliary clock 166 - - "cfg" Configuration clock 167 - - "bus_master" Master AXI clock 168 - - "bus_slave" Slave AXI clock 169 - - "slave_q2a" Slave Q2A clock 170 - - "tbu" PCIe TBU clock 171 - - "ddrss_sf_tbu" PCIe SF TBU clock 172 - - "pipe" PIPE clock 173 - 174 - - clock-names: 175 - Usage: required for sm8450-pcie0 and sm8450-pcie1 176 - Value type: <stringlist> 177 - Definition: Should contain the following entries 178 - - "aux" Auxiliary clock 179 - - "cfg" Configuration clock 180 - - "bus_master" Master AXI clock 181 - - "bus_slave" Slave AXI clock 182 - - "slave_q2a" Slave Q2A clock 183 - - "tbu" PCIe TBU clock 184 - - "ddrss_sf_tbu" PCIe SF TBU clock 185 - - "pipe" PIPE clock 186 - - "pipe_mux" PIPE MUX 187 - - "phy_pipe" PIPE output clock 188 - - "ref" REFERENCE clock 189 - - "aggre0" Aggre NoC PCIe0 AXI clock, only for sm8450-pcie0 190 - - "aggre1" Aggre NoC PCIe1 AXI clock 191 - 192 - - resets: 193 - Usage: required 194 - Value type: <prop-encoded-array> 195 - Definition: List of phandle and reset specifier pairs as listed 196 - in reset-names property 197 - 198 - - reset-names: 199 - Usage: required for ipq/apq8064 200 - Value type: <stringlist> 201 - Definition: Should contain the following entries 202 - - "axi" AXI reset 203 - - "ahb" AHB reset 204 - - "por" POR reset 205 - - "pci" PCI reset 206 - - "phy" PHY reset 207 - 208 - - reset-names: 209 - Usage: required for apq8084 210 - Value type: <stringlist> 211 - Definition: Should contain the following entries 212 - - "core" Core reset 213 - 214 - - reset-names: 215 - Usage: required for ipq/apq8064 216 - Value type: <stringlist> 217 - Definition: Should contain the following entries 218 - - "axi_m" AXI master reset 219 - - "axi_s" AXI slave reset 220 - - "pipe" PIPE reset 221 - - "axi_m_vmid" VMID reset 222 - - "axi_s_xpu" XPU reset 223 - - "parf" PARF reset 224 - - "phy" PHY reset 225 - - "axi_m_sticky" AXI sticky reset 226 - - "pipe_sticky" PIPE sticky reset 227 - - "pwr" PWR reset 228 - - "ahb" AHB reset 229 - - "phy_ahb" PHY AHB reset 230 - - "ext" EXT reset 231 - 232 - - reset-names: 233 - Usage: required for ipq8074 234 - Value type: <stringlist> 235 - Definition: Should contain the following entries 236 - - "pipe" PIPE reset 237 - - "sleep" Sleep reset 238 - - "sticky" Core Sticky reset 239 - - "axi_m" AXI Master reset 240 - - "axi_s" AXI Slave reset 241 - - "ahb" AHB Reset 242 - - "axi_m_sticky" AXI Master Sticky reset 243 - 244 - - reset-names: 245 - Usage: required for ipq6018 246 - Value type: <stringlist> 247 - Definition: Should contain the following entries 248 - - "pipe" PIPE reset 249 - - "sleep" Sleep reset 250 - - "sticky" Core Sticky reset 251 - - "axi_m" AXI Master reset 252 - - "axi_s" AXI Slave reset 253 - - "ahb" AHB Reset 254 - - "axi_m_sticky" AXI Master Sticky reset 255 - - "axi_s_sticky" AXI Slave Sticky reset 256 - 257 - - reset-names: 258 - Usage: required for qcs404 259 - Value type: <stringlist> 260 - Definition: Should contain the following entries 261 - - "axi_m" AXI Master reset 262 - - "axi_s" AXI Slave reset 263 - - "axi_m_sticky" AXI Master Sticky reset 264 - - "pipe_sticky" PIPE sticky reset 265 - - "pwr" PWR reset 266 - - "ahb" AHB reset 267 - 268 - - reset-names: 269 - Usage: required for sc8180x, sdm845, sm8250 and sm8450 270 - Value type: <stringlist> 271 - Definition: Should contain the following entries 272 - - "pci" PCIe core reset 273 - 274 - - power-domains: 275 - Usage: required for apq8084 and msm8996/apq8096 276 - Value type: <prop-encoded-array> 277 - Definition: A phandle and power domain specifier pair to the 278 - power domain which is responsible for collapsing 279 - and restoring power to the peripheral 280 - 281 - - vdda-supply: 282 - Usage: required 283 - Value type: <phandle> 284 - Definition: A phandle to the core analog power supply 285 - 286 - - vdda_phy-supply: 287 - Usage: required for ipq/apq8064 288 - Value type: <phandle> 289 - Definition: A phandle to the analog power supply for PHY 290 - 291 - - vdda_refclk-supply: 292 - Usage: required for ipq/apq8064 293 - Value type: <phandle> 294 - Definition: A phandle to the analog power supply for IC which generates 295 - reference clock 296 - - vddpe-3v3-supply: 297 - Usage: optional 298 - Value type: <phandle> 299 - Definition: A phandle to the PCIe endpoint power supply 300 - 301 - - phys: 302 - Usage: required for apq8084 and qcs404 303 - Value type: <phandle> 304 - Definition: List of phandle(s) as listed in phy-names property 305 - 306 - - phy-names: 307 - Usage: required for apq8084 and qcs404 308 - Value type: <stringlist> 309 - Definition: Should contain "pciephy" 310 - 311 - - <name>-gpios: 312 - Usage: optional 313 - Value type: <prop-encoded-array> 314 - Definition: List of phandle and GPIO specifier pairs. Should contain 315 - - "perst-gpios" PCIe endpoint reset signal line 316 - - "wake-gpios" PCIe endpoint wake signal line 317 - 318 - * Example for ipq/apq8064 319 - pcie@1b500000 { 320 - compatible = "qcom,pcie-apq8064", "qcom,pcie-ipq8064", "snps,dw-pcie"; 321 - reg = <0x1b500000 0x1000 322 - 0x1b502000 0x80 323 - 0x1b600000 0x100 324 - 0x0ff00000 0x100000>; 325 - reg-names = "dbi", "elbi", "parf", "config"; 326 - device_type = "pci"; 327 - linux,pci-domain = <0>; 328 - bus-range = <0x00 0xff>; 329 - num-lanes = <1>; 330 - #address-cells = <3>; 331 - #size-cells = <2>; 332 - ranges = <0x81000000 0 0 0x0fe00000 0 0x00100000 /* I/O */ 333 - 0x82000000 0 0 0x08000000 0 0x07e00000>; /* memory */ 334 - interrupts = <GIC_SPI 238 IRQ_TYPE_NONE>; 335 - interrupt-names = "msi"; 336 - #interrupt-cells = <1>; 337 - interrupt-map-mask = <0 0 0 0x7>; 338 - interrupt-map = <0 0 0 1 &intc 0 36 IRQ_TYPE_LEVEL_HIGH>, /* int_a */ 339 - <0 0 0 2 &intc 0 37 IRQ_TYPE_LEVEL_HIGH>, /* int_b */ 340 - <0 0 0 3 &intc 0 38 IRQ_TYPE_LEVEL_HIGH>, /* int_c */ 341 - <0 0 0 4 &intc 0 39 IRQ_TYPE_LEVEL_HIGH>; /* int_d */ 342 - clocks = <&gcc PCIE_A_CLK>, 343 - <&gcc PCIE_H_CLK>, 344 - <&gcc PCIE_PHY_CLK>, 345 - <&gcc PCIE_AUX_CLK>, 346 - <&gcc PCIE_ALT_REF_CLK>; 347 - clock-names = "core", "iface", "phy", "aux", "ref"; 348 - resets = <&gcc PCIE_ACLK_RESET>, 349 - <&gcc PCIE_HCLK_RESET>, 350 - <&gcc PCIE_POR_RESET>, 351 - <&gcc PCIE_PCI_RESET>, 352 - <&gcc PCIE_PHY_RESET>, 353 - <&gcc PCIE_EXT_RESET>; 354 - reset-names = "axi", "ahb", "por", "pci", "phy", "ext"; 355 - pinctrl-0 = <&pcie_pins_default>; 356 - pinctrl-names = "default"; 357 - }; 358 - 359 - * Example for apq8084 360 - pcie0@fc520000 { 361 - compatible = "qcom,pcie-apq8084", "snps,dw-pcie"; 362 - reg = <0xfc520000 0x2000>, 363 - <0xff000000 0x1000>, 364 - <0xff001000 0x1000>, 365 - <0xff002000 0x2000>; 366 - reg-names = "parf", "dbi", "elbi", "config"; 367 - device_type = "pci"; 368 - linux,pci-domain = <0>; 369 - bus-range = <0x00 0xff>; 370 - num-lanes = <1>; 371 - #address-cells = <3>; 372 - #size-cells = <2>; 373 - ranges = <0x81000000 0 0 0xff200000 0 0x00100000 /* I/O */ 374 - 0x82000000 0 0x00300000 0xff300000 0 0x00d00000>; /* memory */ 375 - interrupts = <GIC_SPI 243 IRQ_TYPE_NONE>; 376 - interrupt-names = "msi"; 377 - #interrupt-cells = <1>; 378 - interrupt-map-mask = <0 0 0 0x7>; 379 - interrupt-map = <0 0 0 1 &intc 0 244 IRQ_TYPE_LEVEL_HIGH>, /* int_a */ 380 - <0 0 0 2 &intc 0 245 IRQ_TYPE_LEVEL_HIGH>, /* int_b */ 381 - <0 0 0 3 &intc 0 247 IRQ_TYPE_LEVEL_HIGH>, /* int_c */ 382 - <0 0 0 4 &intc 0 248 IRQ_TYPE_LEVEL_HIGH>; /* int_d */ 383 - clocks = <&gcc GCC_PCIE_0_CFG_AHB_CLK>, 384 - <&gcc GCC_PCIE_0_MSTR_AXI_CLK>, 385 - <&gcc GCC_PCIE_0_SLV_AXI_CLK>, 386 - <&gcc GCC_PCIE_0_AUX_CLK>; 387 - clock-names = "iface", "master_bus", "slave_bus", "aux"; 388 - resets = <&gcc GCC_PCIE_0_BCR>; 389 - reset-names = "core"; 390 - power-domains = <&gcc PCIE0_GDSC>; 391 - vdda-supply = <&pma8084_l3>; 392 - phys = <&pciephy0>; 393 - phy-names = "pciephy"; 394 - perst-gpio = <&tlmm 70 GPIO_ACTIVE_LOW>; 395 - pinctrl-0 = <&pcie0_pins_default>; 396 - pinctrl-names = "default"; 397 - };
+714
Documentation/devicetree/bindings/pci/qcom,pcie.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pci/qcom,pcie.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Qualcomm PCI express root complex 8 + 9 + maintainers: 10 + - Bjorn Andersson <bjorn.andersson@linaro.org> 11 + - Stanimir Varbanov <svarbanov@mm-sol.com> 12 + 13 + description: | 14 + Qualcomm PCIe root complex controller is bansed on the Synopsys DesignWare 15 + PCIe IP. 16 + 17 + properties: 18 + compatible: 19 + enum: 20 + - qcom,pcie-ipq8064 21 + - qcom,pcie-ipq8064-v2 22 + - qcom,pcie-apq8064 23 + - qcom,pcie-apq8084 24 + - qcom,pcie-msm8996 25 + - qcom,pcie-ipq4019 26 + - qcom,pcie-ipq8074 27 + - qcom,pcie-qcs404 28 + - qcom,pcie-sc7280 29 + - qcom,pcie-sc8180x 30 + - qcom,pcie-sdm845 31 + - qcom,pcie-sm8150 32 + - qcom,pcie-sm8250 33 + - qcom,pcie-sm8450-pcie0 34 + - qcom,pcie-sm8450-pcie1 35 + - qcom,pcie-ipq6018 36 + 37 + reg: 38 + minItems: 4 39 + maxItems: 5 40 + 41 + reg-names: 42 + minItems: 4 43 + maxItems: 5 44 + 45 + interrupts: 46 + maxItems: 1 47 + 48 + interrupt-names: 49 + items: 50 + - const: msi 51 + 52 + # Common definitions for clocks, clock-names and reset. 53 + # Platform constraints are described later. 54 + clocks: 55 + minItems: 3 56 + maxItems: 12 57 + 58 + clock-names: 59 + minItems: 3 60 + maxItems: 12 61 + 62 + resets: 63 + minItems: 1 64 + maxItems: 12 65 + 66 + resets-names: 67 + minItems: 1 68 + maxItems: 12 69 + 70 + vdda-supply: 71 + description: A phandle to the core analog power supply 72 + 73 + vdda_phy-supply: 74 + description: A phandle to the core analog power supply for PHY 75 + 76 + vdda_refclk-supply: 77 + description: A phandle to the core analog power supply for IC which generates reference clock 78 + 79 + vddpe-3v3-supply: 80 + description: A phandle to the PCIe endpoint power supply 81 + 82 + phys: 83 + maxItems: 1 84 + 85 + phy-names: 86 + items: 87 + - const: pciephy 88 + 89 + power-domains: 90 + maxItems: 1 91 + 92 + perst-gpios: 93 + description: GPIO controlled connection to PERST# signal 94 + maxItems: 1 95 + 96 + wake-gpios: 97 + description: GPIO controlled connection to WAKE# signal 98 + maxItems: 1 99 + 100 + required: 101 + - compatible 102 + - reg 103 + - reg-names 104 + - interrupts 105 + - interrupt-names 106 + - "#interrupt-cells" 107 + - interrupt-map-mask 108 + - interrupt-map 109 + - clocks 110 + - clock-names 111 + 112 + allOf: 113 + - $ref: /schemas/pci/pci-bus.yaml# 114 + - if: 115 + properties: 116 + compatible: 117 + contains: 118 + enum: 119 + - qcom,pcie-apq8064 120 + - qcom,pcie-ipq4019 121 + - qcom,pcie-ipq8064 122 + - qcom,pcie-ipq8064v2 123 + - qcom,pcie-ipq8074 124 + - qcom,pcie-qcs404 125 + then: 126 + properties: 127 + reg: 128 + minItems: 4 129 + maxItems: 4 130 + reg-names: 131 + items: 132 + - const: dbi # DesignWare PCIe registers 133 + - const: elbi # External local bus interface registers 134 + - const: parf # Qualcomm specific registers 135 + - const: config # PCIe configuration space 136 + 137 + - if: 138 + properties: 139 + compatible: 140 + contains: 141 + enum: 142 + - qcom,pcie-ipq6018 143 + then: 144 + properties: 145 + reg: 146 + minItems: 5 147 + maxItems: 5 148 + reg-names: 149 + items: 150 + - const: dbi # DesignWare PCIe registers 151 + - const: elbi # External local bus interface registers 152 + - const: atu # ATU address space 153 + - const: parf # Qualcomm specific registers 154 + - const: config # PCIe configuration space 155 + 156 + - if: 157 + properties: 158 + compatible: 159 + contains: 160 + enum: 161 + - qcom,pcie-apq8084 162 + - qcom,pcie-msm8996 163 + - qcom,pcie-sdm845 164 + then: 165 + properties: 166 + reg: 167 + minItems: 4 168 + maxItems: 4 169 + reg-names: 170 + items: 171 + - const: parf # Qualcomm specific registers 172 + - const: dbi # DesignWare PCIe registers 173 + - const: elbi # External local bus interface registers 174 + - const: config # PCIe configuration space 175 + 176 + - if: 177 + properties: 178 + compatible: 179 + contains: 180 + enum: 181 + - qcom,pcie-sc7280 182 + - qcom,pcie-sc8180x 183 + - qcom,pcie-sm8250 184 + - qcom,pcie-sm8450-pcie0 185 + - qcom,pcie-sm8450-pcie1 186 + then: 187 + properties: 188 + reg: 189 + minItems: 5 190 + maxItems: 5 191 + reg-names: 192 + items: 193 + - const: parf # Qualcomm specific registers 194 + - const: dbi # DesignWare PCIe registers 195 + - const: elbi # External local bus interface registers 196 + - const: atu # ATU address space 197 + - const: config # PCIe configuration space 198 + 199 + - if: 200 + properties: 201 + compatible: 202 + contains: 203 + enum: 204 + - qcom,pcie-apq8064 205 + - qcom,pcie-ipq8064 206 + - qcom,pcie-ipq8064v2 207 + then: 208 + properties: 209 + clocks: 210 + minItems: 3 211 + maxItems: 5 212 + clock-names: 213 + minItems: 3 214 + items: 215 + - const: core # Clocks the pcie hw block 216 + - const: iface # Configuration AHB clock 217 + - const: phy # Clocks the pcie PHY block 218 + - const: aux # Clocks the pcie AUX block, not on apq8064 219 + - const: ref # Clocks the pcie ref block, not on apq8064 220 + resets: 221 + minItems: 5 222 + maxItems: 6 223 + reset-names: 224 + minItems: 5 225 + items: 226 + - const: axi # AXI reset 227 + - const: ahb # AHB reset 228 + - const: por # POR reset 229 + - const: pci # PCI reset 230 + - const: phy # PHY reset 231 + - const: ext # EXT reset, not on apq8064 232 + required: 233 + - vdda-supply 234 + - vdda_phy-supply 235 + - vdda_refclk-supply 236 + 237 + - if: 238 + properties: 239 + compatible: 240 + contains: 241 + enum: 242 + - qcom,pcie-apq8084 243 + then: 244 + properties: 245 + clocks: 246 + minItems: 4 247 + maxItems: 4 248 + clock-names: 249 + items: 250 + - const: iface # Configuration AHB clock 251 + - const: master_bus # Master AXI clock 252 + - const: slave_bus # Slave AXI clock 253 + - const: aux # Auxiliary (AUX) clock 254 + resets: 255 + maxItems: 1 256 + reset-names: 257 + items: 258 + - const: core # Core reset 259 + 260 + - if: 261 + properties: 262 + compatible: 263 + contains: 264 + enum: 265 + - qcom,pcie-ipq4019 266 + then: 267 + properties: 268 + clocks: 269 + minItems: 3 270 + maxItems: 3 271 + clock-names: 272 + items: 273 + - const: aux # Auxiliary (AUX) clock 274 + - const: master_bus # Master AXI clock 275 + - const: slave_bus # Slave AXI clock 276 + resets: 277 + minItems: 12 278 + maxItems: 12 279 + reset-names: 280 + items: 281 + - const: axi_m # AXI master reset 282 + - const: axi_s # AXI slave reset 283 + - const: pipe # PIPE reset 284 + - const: axi_m_vmid # VMID reset 285 + - const: axi_s_xpu # XPU reset 286 + - const: parf # PARF reset 287 + - const: phy # PHY reset 288 + - const: axi_m_sticky # AXI sticky reset 289 + - const: pipe_sticky # PIPE sticky reset 290 + - const: pwr # PWR reset 291 + - const: ahb # AHB reset 292 + - const: phy_ahb # PHY AHB reset 293 + 294 + - if: 295 + properties: 296 + compatible: 297 + contains: 298 + enum: 299 + - qcom,pcie-msm8996 300 + then: 301 + oneOf: 302 + - properties: 303 + clock-names: 304 + items: 305 + - const: pipe # Pipe Clock driving internal logic 306 + - const: aux # Auxiliary (AUX) clock 307 + - const: cfg # Configuration clock 308 + - const: bus_master # Master AXI clock 309 + - const: bus_slave # Slave AXI clock 310 + - properties: 311 + clock-names: 312 + items: 313 + - const: pipe # Pipe Clock driving internal logic 314 + - const: bus_master # Master AXI clock 315 + - const: bus_slave # Slave AXI clock 316 + - const: cfg # Configuration clock 317 + - const: aux # Auxiliary (AUX) clock 318 + properties: 319 + clocks: 320 + minItems: 5 321 + maxItems: 5 322 + resets: false 323 + reset-names: false 324 + 325 + - if: 326 + properties: 327 + compatible: 328 + contains: 329 + enum: 330 + - qcom,pcie-ipq8074 331 + then: 332 + properties: 333 + clocks: 334 + minItems: 5 335 + maxItems: 5 336 + clock-names: 337 + items: 338 + - const: iface # PCIe to SysNOC BIU clock 339 + - const: axi_m # AXI Master clock 340 + - const: axi_s # AXI Slave clock 341 + - const: ahb # AHB clock 342 + - const: aux # Auxiliary clock 343 + resets: 344 + minItems: 7 345 + maxItems: 7 346 + reset-names: 347 + items: 348 + - const: pipe # PIPE reset 349 + - const: sleep # Sleep reset 350 + - const: sticky # Core Sticky reset 351 + - const: axi_m # AXI Master reset 352 + - const: axi_s # AXI Slave reset 353 + - const: ahb # AHB Reset 354 + - const: axi_m_sticky # AXI Master Sticky reset 355 + 356 + - if: 357 + properties: 358 + compatible: 359 + contains: 360 + enum: 361 + - qcom,pcie-ipq6018 362 + then: 363 + properties: 364 + clocks: 365 + minItems: 5 366 + maxItems: 5 367 + clock-names: 368 + items: 369 + - const: iface # PCIe to SysNOC BIU clock 370 + - const: axi_m # AXI Master clock 371 + - const: axi_s # AXI Slave clock 372 + - const: axi_bridge # AXI bridge clock 373 + - const: rchng 374 + resets: 375 + minItems: 8 376 + maxItems: 8 377 + reset-names: 378 + items: 379 + - const: pipe # PIPE reset 380 + - const: sleep # Sleep reset 381 + - const: sticky # Core Sticky reset 382 + - const: axi_m # AXI Master reset 383 + - const: axi_s # AXI Slave reset 384 + - const: ahb # AHB Reset 385 + - const: axi_m_sticky # AXI Master Sticky reset 386 + - const: axi_s_sticky # AXI Slave Sticky reset 387 + 388 + - if: 389 + properties: 390 + compatible: 391 + contains: 392 + enum: 393 + - qcom,pcie-qcs404 394 + then: 395 + properties: 396 + clocks: 397 + minItems: 4 398 + maxItems: 4 399 + clock-names: 400 + items: 401 + - const: iface # AHB clock 402 + - const: aux # Auxiliary clock 403 + - const: master_bus # AXI Master clock 404 + - const: slave_bus # AXI Slave clock 405 + resets: 406 + minItems: 6 407 + maxItems: 6 408 + reset-names: 409 + items: 410 + - const: axi_m # AXI Master reset 411 + - const: axi_s # AXI Slave reset 412 + - const: axi_m_sticky # AXI Master Sticky reset 413 + - const: pipe_sticky # PIPE sticky reset 414 + - const: pwr # PWR reset 415 + - const: ahb # AHB reset 416 + 417 + - if: 418 + properties: 419 + compatible: 420 + contains: 421 + enum: 422 + - qcom,pcie-sc7280 423 + then: 424 + properties: 425 + clocks: 426 + minItems: 11 427 + maxItems: 11 428 + clock-names: 429 + items: 430 + - const: pipe # PIPE clock 431 + - const: pipe_mux # PIPE MUX 432 + - const: phy_pipe # PIPE output clock 433 + - const: ref # REFERENCE clock 434 + - const: aux # Auxiliary clock 435 + - const: cfg # Configuration clock 436 + - const: bus_master # Master AXI clock 437 + - const: bus_slave # Slave AXI clock 438 + - const: slave_q2a # Slave Q2A clock 439 + - const: tbu # PCIe TBU clock 440 + - const: ddrss_sf_tbu # PCIe SF TBU clock 441 + resets: 442 + maxItems: 1 443 + reset-names: 444 + items: 445 + - const: pci # PCIe core reset 446 + 447 + - if: 448 + properties: 449 + compatible: 450 + contains: 451 + enum: 452 + - qcom,pcie-sdm845 453 + then: 454 + oneOf: 455 + # Unfortunately the "optional" ref clock is used in the middle of the list 456 + - properties: 457 + clocks: 458 + minItems: 8 459 + maxItems: 8 460 + clock-names: 461 + items: 462 + - const: pipe # PIPE clock 463 + - const: aux # Auxiliary clock 464 + - const: cfg # Configuration clock 465 + - const: bus_master # Master AXI clock 466 + - const: bus_slave # Slave AXI clock 467 + - const: slave_q2a # Slave Q2A clock 468 + - const: ref # REFERENCE clock 469 + - const: tbu # PCIe TBU clock 470 + - properties: 471 + clocks: 472 + minItems: 7 473 + maxItems: 7 474 + clock-names: 475 + items: 476 + - const: pipe # PIPE clock 477 + - const: aux # Auxiliary clock 478 + - const: cfg # Configuration clock 479 + - const: bus_master # Master AXI clock 480 + - const: bus_slave # Slave AXI clock 481 + - const: slave_q2a # Slave Q2A clock 482 + - const: tbu # PCIe TBU clock 483 + properties: 484 + resets: 485 + maxItems: 1 486 + reset-names: 487 + items: 488 + - const: pci # PCIe core reset 489 + 490 + - if: 491 + properties: 492 + compatible: 493 + contains: 494 + enum: 495 + - qcom,pcie-sc8180x 496 + - qcom,pcie-sm8150 497 + - qcom,pcie-sm8250 498 + then: 499 + oneOf: 500 + # Unfortunately the "optional" ref clock is used in the middle of the list 501 + - properties: 502 + clocks: 503 + minItems: 9 504 + maxItems: 9 505 + clock-names: 506 + items: 507 + - const: pipe # PIPE clock 508 + - const: aux # Auxiliary clock 509 + - const: cfg # Configuration clock 510 + - const: bus_master # Master AXI clock 511 + - const: bus_slave # Slave AXI clock 512 + - const: slave_q2a # Slave Q2A clock 513 + - const: ref # REFERENCE clock 514 + - const: tbu # PCIe TBU clock 515 + - const: ddrss_sf_tbu # PCIe SF TBU clock 516 + - properties: 517 + clocks: 518 + minItems: 8 519 + maxItems: 8 520 + clock-names: 521 + items: 522 + - const: pipe # PIPE clock 523 + - const: aux # Auxiliary clock 524 + - const: cfg # Configuration clock 525 + - const: bus_master # Master AXI clock 526 + - const: bus_slave # Slave AXI clock 527 + - const: slave_q2a # Slave Q2A clock 528 + - const: tbu # PCIe TBU clock 529 + - const: ddrss_sf_tbu # PCIe SF TBU clock 530 + properties: 531 + resets: 532 + maxItems: 1 533 + reset-names: 534 + items: 535 + - const: pci # PCIe core reset 536 + 537 + - if: 538 + properties: 539 + compatible: 540 + contains: 541 + enum: 542 + - qcom,pcie-sm8450-pcie0 543 + then: 544 + properties: 545 + clocks: 546 + minItems: 12 547 + maxItems: 12 548 + clock-names: 549 + items: 550 + - const: pipe # PIPE clock 551 + - const: pipe_mux # PIPE MUX 552 + - const: phy_pipe # PIPE output clock 553 + - const: ref # REFERENCE clock 554 + - const: aux # Auxiliary clock 555 + - const: cfg # Configuration clock 556 + - const: bus_master # Master AXI clock 557 + - const: bus_slave # Slave AXI clock 558 + - const: slave_q2a # Slave Q2A clock 559 + - const: ddrss_sf_tbu # PCIe SF TBU clock 560 + - const: aggre0 # Aggre NoC PCIe0 AXI clock 561 + - const: aggre1 # Aggre NoC PCIe1 AXI clock 562 + resets: 563 + maxItems: 1 564 + reset-names: 565 + items: 566 + - const: pci # PCIe core reset 567 + 568 + - if: 569 + properties: 570 + compatible: 571 + contains: 572 + enum: 573 + - qcom,pcie-sm8450-pcie1 574 + then: 575 + properties: 576 + clocks: 577 + minItems: 11 578 + maxItems: 11 579 + clock-names: 580 + items: 581 + - const: pipe # PIPE clock 582 + - const: pipe_mux # PIPE MUX 583 + - const: phy_pipe # PIPE output clock 584 + - const: ref # REFERENCE clock 585 + - const: aux # Auxiliary clock 586 + - const: cfg # Configuration clock 587 + - const: bus_master # Master AXI clock 588 + - const: bus_slave # Slave AXI clock 589 + - const: slave_q2a # Slave Q2A clock 590 + - const: ddrss_sf_tbu # PCIe SF TBU clock 591 + - const: aggre1 # Aggre NoC PCIe1 AXI clock 592 + resets: 593 + maxItems: 1 594 + reset-names: 595 + items: 596 + - const: pci # PCIe core reset 597 + 598 + - if: 599 + not: 600 + properties: 601 + compatible: 602 + contains: 603 + enum: 604 + - qcom,pcie-apq8064 605 + - qcom,pcie-ipq4019 606 + - qcom,pcie-ipq8064 607 + - qcom,pcie-ipq8064v2 608 + - qcom,pcie-ipq8074 609 + - qcom,pcie-qcs404 610 + then: 611 + required: 612 + - power-domains 613 + 614 + - if: 615 + not: 616 + properties: 617 + compatibles: 618 + contains: 619 + enum: 620 + - qcom,pcie-msm8996 621 + then: 622 + required: 623 + - resets 624 + - reset-names 625 + 626 + unevaluatedProperties: false 627 + 628 + examples: 629 + - | 630 + #include <dt-bindings/interrupt-controller/arm-gic.h> 631 + pcie@1b500000 { 632 + compatible = "qcom,pcie-ipq8064"; 633 + reg = <0x1b500000 0x1000>, 634 + <0x1b502000 0x80>, 635 + <0x1b600000 0x100>, 636 + <0x0ff00000 0x100000>; 637 + reg-names = "dbi", "elbi", "parf", "config"; 638 + device_type = "pci"; 639 + linux,pci-domain = <0>; 640 + bus-range = <0x00 0xff>; 641 + num-lanes = <1>; 642 + #address-cells = <3>; 643 + #size-cells = <2>; 644 + ranges = <0x81000000 0 0 0x0fe00000 0 0x00100000>, 645 + <0x82000000 0 0 0x08000000 0 0x07e00000>; 646 + interrupts = <GIC_SPI 238 IRQ_TYPE_LEVEL_HIGH>; 647 + interrupt-names = "msi"; 648 + #interrupt-cells = <1>; 649 + interrupt-map-mask = <0 0 0 0x7>; 650 + interrupt-map = <0 0 0 1 &intc 0 36 IRQ_TYPE_LEVEL_HIGH>, 651 + <0 0 0 2 &intc 0 37 IRQ_TYPE_LEVEL_HIGH>, 652 + <0 0 0 3 &intc 0 38 IRQ_TYPE_LEVEL_HIGH>, 653 + <0 0 0 4 &intc 0 39 IRQ_TYPE_LEVEL_HIGH>; 654 + clocks = <&gcc 41>, 655 + <&gcc 43>, 656 + <&gcc 44>, 657 + <&gcc 42>, 658 + <&gcc 248>; 659 + clock-names = "core", "iface", "phy", "aux", "ref"; 660 + resets = <&gcc 27>, 661 + <&gcc 26>, 662 + <&gcc 25>, 663 + <&gcc 24>, 664 + <&gcc 23>, 665 + <&gcc 22>; 666 + reset-names = "axi", "ahb", "por", "pci", "phy", "ext"; 667 + pinctrl-0 = <&pcie_pins_default>; 668 + pinctrl-names = "default"; 669 + vdda-supply = <&pm8921_s3>; 670 + vdda_phy-supply = <&pm8921_lvs6>; 671 + vdda_refclk-supply = <&ext_3p3v>; 672 + }; 673 + - | 674 + #include <dt-bindings/interrupt-controller/arm-gic.h> 675 + #include <dt-bindings/gpio/gpio.h> 676 + pcie@fc520000 { 677 + compatible = "qcom,pcie-apq8084"; 678 + reg = <0xfc520000 0x2000>, 679 + <0xff000000 0x1000>, 680 + <0xff001000 0x1000>, 681 + <0xff002000 0x2000>; 682 + reg-names = "parf", "dbi", "elbi", "config"; 683 + device_type = "pci"; 684 + linux,pci-domain = <0>; 685 + bus-range = <0x00 0xff>; 686 + num-lanes = <1>; 687 + #address-cells = <3>; 688 + #size-cells = <2>; 689 + ranges = <0x81000000 0 0 0xff200000 0 0x00100000>, 690 + <0x82000000 0 0x00300000 0xff300000 0 0x00d00000>; 691 + interrupts = <GIC_SPI 243 IRQ_TYPE_LEVEL_HIGH>; 692 + interrupt-names = "msi"; 693 + #interrupt-cells = <1>; 694 + interrupt-map-mask = <0 0 0 0x7>; 695 + interrupt-map = <0 0 0 1 &intc 0 244 IRQ_TYPE_LEVEL_HIGH>, 696 + <0 0 0 2 &intc 0 245 IRQ_TYPE_LEVEL_HIGH>, 697 + <0 0 0 3 &intc 0 247 IRQ_TYPE_LEVEL_HIGH>, 698 + <0 0 0 4 &intc 0 248 IRQ_TYPE_LEVEL_HIGH>; 699 + clocks = <&gcc 324>, 700 + <&gcc 325>, 701 + <&gcc 327>, 702 + <&gcc 323>; 703 + clock-names = "iface", "master_bus", "slave_bus", "aux"; 704 + resets = <&gcc 81>; 705 + reset-names = "core"; 706 + power-domains = <&gcc 1>; 707 + vdda-supply = <&pma8084_l3>; 708 + phys = <&pciephy0>; 709 + phy-names = "pciephy"; 710 + perst-gpios = <&tlmm 70 GPIO_ACTIVE_LOW>; 711 + pinctrl-0 = <&pcie0_pins_default>; 712 + pinctrl-names = "default"; 713 + }; 714 + ...
+1 -11
Documentation/devicetree/bindings/pci/rockchip-dw-pcie.yaml
··· 19 19 allOf: 20 20 - $ref: /schemas/pci/pci-bus.yaml# 21 21 22 - # We need a select here so we don't match all nodes with 'snps,dw-pcie' 23 - select: 24 - properties: 25 - compatible: 26 - contains: 27 - const: rockchip,rk3568-pcie 28 - required: 29 - - compatible 30 - 31 22 properties: 32 23 compatible: 33 24 items: 34 25 - const: rockchip,rk3568-pcie 35 - - const: snps,dw-pcie 36 26 37 27 reg: 38 28 items: ··· 100 110 #size-cells = <2>; 101 111 102 112 pcie3x2: pcie@fe280000 { 103 - compatible = "rockchip,rk3568-pcie", "snps,dw-pcie"; 113 + compatible = "rockchip,rk3568-pcie"; 104 114 reg = <0x3 0xc0800000 0x0 0x390000>, 105 115 <0x0 0xfe280000 0x0 0x10000>, 106 116 <0x3 0x80000000 0x0 0x100000>;
+5
arch/x86/include/asm/e820/api.h
··· 4 4 5 5 #include <asm/e820/types.h> 6 6 7 + struct device; 8 + struct resource; 9 + 7 10 extern struct e820_table *e820_table; 8 11 extern struct e820_table *e820_table_kexec; 9 12 extern struct e820_table *e820_table_firmware; ··· 45 42 extern void e820__register_nosave_regions(unsigned long limit_pfn); 46 43 47 44 extern int e820__get_entry_type(u64 start, u64 end); 45 + 46 + extern void remove_e820_regions(struct device *dev, struct resource *avail); 48 47 49 48 /* 50 49 * Returns true iff the specified range [start,end) is completely contained inside
+2
arch/x86/include/asm/pci_x86.h
··· 42 42 #define PCI_ROOT_NO_CRS 0x100000 43 43 #define PCI_NOASSIGN_BARS 0x200000 44 44 #define PCI_BIG_ROOT_WINDOW 0x400000 45 + #define PCI_USE_E820 0x800000 46 + #define PCI_NO_E820 0x1000000 45 47 46 48 extern unsigned int pci_probe; 47 49 extern unsigned long pirq_table_addr;
+16 -7
arch/x86/kernel/resource.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 + #include <linux/dev_printk.h> 2 3 #include <linux/ioport.h> 3 4 #include <asm/e820/api.h> 4 5 ··· 24 23 res->start = end + 1; 25 24 } 26 25 27 - static void remove_e820_regions(struct resource *avail) 26 + void remove_e820_regions(struct device *dev, struct resource *avail) 28 27 { 29 28 int i; 30 29 struct e820_entry *entry; 30 + u64 e820_start, e820_end; 31 + struct resource orig = *avail; 32 + 33 + if (!(avail->flags & IORESOURCE_MEM)) 34 + return; 31 35 32 36 for (i = 0; i < e820_table->nr_entries; i++) { 33 37 entry = &e820_table->entries[i]; 38 + e820_start = entry->addr; 39 + e820_end = entry->addr + entry->size - 1; 34 40 35 - resource_clip(avail, entry->addr, 36 - entry->addr + entry->size - 1); 41 + resource_clip(avail, e820_start, e820_end); 42 + if (orig.start != avail->start || orig.end != avail->end) { 43 + dev_info(dev, "clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n", 44 + &orig, avail, e820_start, e820_end); 45 + orig = *avail; 46 + } 37 47 } 38 48 } 39 49 ··· 55 43 * the low 1MB unconditionally, as this area is needed for some ISA 56 44 * cards requiring a memory range, e.g. the i82365 PCMCIA controller. 57 45 */ 58 - if (avail->flags & IORESOURCE_MEM) { 46 + if (avail->flags & IORESOURCE_MEM) 59 47 resource_clip(avail, BIOS_ROM_BASE, BIOS_ROM_END); 60 - 61 - remove_e820_regions(avail); 62 - } 63 48 }
+93
arch/x86/pci/acpi.c
··· 8 8 #include <linux/pci-acpi.h> 9 9 #include <asm/numa.h> 10 10 #include <asm/pci_x86.h> 11 + #include <asm/e820/api.h> 11 12 12 13 struct pci_root_info { 13 14 struct acpi_pci_root_info common; ··· 20 19 #endif 21 20 }; 22 21 22 + static bool pci_use_e820 = true; 23 23 static bool pci_use_crs = true; 24 24 static bool pci_ignore_seg; 25 25 ··· 40 38 { 41 39 printk(KERN_INFO "PCI: %s detected: ignoring ACPI _SEG\n", id->ident); 42 40 pci_ignore_seg = true; 41 + return 0; 42 + } 43 + 44 + static int __init set_no_e820(const struct dmi_system_id *id) 45 + { 46 + printk(KERN_INFO "PCI: %s detected: not clipping E820 regions from _CRS\n", 47 + id->ident); 48 + pci_use_e820 = false; 43 49 return 0; 44 50 } 45 51 ··· 145 135 DMI_MATCH(DMI_PRODUCT_NAME, "HP xw9300 Workstation"), 146 136 }, 147 137 }, 138 + 139 + /* 140 + * Many Lenovo models with "IIL" in their DMI_PRODUCT_VERSION have 141 + * an E820 reserved region that covers the entire 32-bit host 142 + * bridge memory window from _CRS. Using the E820 region to clip 143 + * _CRS means no space is available for hot-added or uninitialized 144 + * PCI devices. This typically breaks I2C controllers for touchpads 145 + * and hot-added Thunderbolt devices. See the commit log for 146 + * models known to require this quirk and related bug reports. 147 + */ 148 + { 149 + .callback = set_no_e820, 150 + .ident = "Lenovo *IIL* product version", 151 + .matches = { 152 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 153 + DMI_MATCH(DMI_PRODUCT_VERSION, "IIL"), 154 + }, 155 + }, 156 + 157 + /* 158 + * The Acer Spin 5 (SP513-54N) has the same E820 reservation covering 159 + * the entire _CRS 32-bit window issue as the Lenovo *IIL* models. 160 + * See https://bugs.launchpad.net/bugs/1884232 161 + */ 162 + { 163 + .callback = set_no_e820, 164 + .ident = "Acer Spin 5 (SP513-54N)", 165 + .matches = { 166 + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 167 + DMI_MATCH(DMI_PRODUCT_NAME, "Spin SP513-54N"), 168 + }, 169 + }, 170 + 171 + /* 172 + * Clevo X170KM-G barebones have the same E820 reservation covering 173 + * the entire _CRS 32-bit window issue as the Lenovo *IIL* models. 174 + * See https://bugzilla.kernel.org/show_bug.cgi?id=214259 175 + */ 176 + { 177 + .callback = set_no_e820, 178 + .ident = "Clevo X170KM-G Barebone", 179 + .matches = { 180 + DMI_MATCH(DMI_BOARD_NAME, "X170KM-G"), 181 + }, 182 + }, 148 183 {} 149 184 }; 150 185 ··· 199 144 200 145 if (year >= 0 && year < 2008 && iomem_resource.end <= 0xffffffff) 201 146 pci_use_crs = false; 147 + 148 + /* 149 + * Some firmware includes unusable space (host bridge registers, 150 + * hidden PCI device BARs, etc) in PCI host bridge _CRS. This is a 151 + * firmware defect, and 4dc2287c1805 ("x86: avoid E820 regions when 152 + * allocating address space") has clipped out the unusable space in 153 + * the past. 154 + * 155 + * But other firmware supplies E820 reserved regions that cover 156 + * entire _CRS windows, so clipping throws away the entire window, 157 + * leaving none for hot-added or uninitialized devices. These E820 158 + * entries are probably *not* a firmware defect, so disable the 159 + * clipping by default for post-2022 machines. 160 + * 161 + * We already have quirks to disable clipping for pre-2023 162 + * machines, and we'll likely need quirks to *enable* clipping for 163 + * post-2022 machines that incorrectly include unusable space in 164 + * _CRS. 165 + */ 166 + if (year >= 2023) 167 + pci_use_e820 = false; 202 168 203 169 dmi_check_system(pci_crs_quirks); 204 170 ··· 236 160 "if necessary, use \"pci=%s\" and report a bug\n", 237 161 pci_use_crs ? "Using" : "Ignoring", 238 162 pci_use_crs ? "nocrs" : "use_crs"); 163 + 164 + /* "pci=use_e820"/"pci=no_e820" on the kernel cmdline takes precedence */ 165 + if (pci_probe & PCI_NO_E820) 166 + pci_use_e820 = false; 167 + else if (pci_probe & PCI_USE_E820) 168 + pci_use_e820 = true; 169 + 170 + printk(KERN_INFO "PCI: %s E820 reservations for host bridge windows\n", 171 + pci_use_e820 ? "Using" : "Ignoring"); 172 + if (pci_probe & (PCI_NO_E820 | PCI_USE_E820)) 173 + printk(KERN_INFO "PCI: Please notify linux-pci@vger.kernel.org so future kernels can this automatically\n"); 239 174 } 240 175 241 176 #ifdef CONFIG_PCI_MMCONFIG ··· 386 299 int status; 387 300 388 301 status = acpi_pci_probe_root_resources(ci); 302 + 303 + if (pci_use_e820) { 304 + resource_list_for_each_entry(entry, &ci->resources) 305 + remove_e820_regions(&device->dev, entry->res); 306 + } 307 + 389 308 if (pci_use_crs) { 390 309 resource_list_for_each_entry_safe(entry, tmp, &ci->resources) 391 310 if (resource_is_pcicfg_ioport(entry->res))
+8
arch/x86/pci/common.c
··· 595 595 } else if (!strcmp(str, "nocrs")) { 596 596 pci_probe |= PCI_ROOT_NO_CRS; 597 597 return NULL; 598 + } else if (!strcmp(str, "use_e820")) { 599 + pci_probe |= PCI_USE_E820; 600 + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 601 + return NULL; 602 + } else if (!strcmp(str, "no_e820")) { 603 + pci_probe |= PCI_NO_E820; 604 + add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK); 605 + return NULL; 598 606 #ifdef CONFIG_PHYS_ADDR_T_64BIT 599 607 } else if (!strcmp(str, "big_root_window")) { 600 608 pci_probe |= PCI_BIG_ROOT_WINDOW;
+3
drivers/pci/controller/cadence/pci-j721e.c
··· 69 69 enum j721e_pcie_mode mode; 70 70 unsigned int quirk_retrain_flag:1; 71 71 unsigned int quirk_detect_quiet_flag:1; 72 + unsigned int quirk_disable_flr:1; 72 73 u32 linkdown_irq_regfield; 73 74 unsigned int byte_access_allowed:1; 74 75 }; ··· 308 307 static const struct j721e_pcie_data j7200_pcie_ep_data = { 309 308 .mode = PCI_MODE_EP, 310 309 .quirk_detect_quiet_flag = true, 310 + .quirk_disable_flr = true, 311 311 }; 312 312 313 313 static const struct j721e_pcie_data am64_pcie_rc_data = { ··· 407 405 return -ENOMEM; 408 406 409 407 ep->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag; 408 + ep->quirk_disable_flr = data->quirk_disable_flr; 410 409 411 410 cdns_pcie = &ep->pcie; 412 411 cdns_pcie->dev = dev;
+18 -3
drivers/pci/controller/cadence/pcie-cadence-ep.c
··· 187 187 struct cdns_pcie *pcie = &ep->pcie; 188 188 u32 r; 189 189 190 - r = find_first_zero_bit(&ep->ob_region_map, 191 - sizeof(ep->ob_region_map) * BITS_PER_LONG); 190 + r = find_first_zero_bit(&ep->ob_region_map, BITS_PER_LONG); 192 191 if (r >= ep->max_regions - 1) { 193 192 dev_err(&epc->dev, "no free outbound region\n"); 194 193 return -EINVAL; ··· 564 565 struct cdns_pcie_ep *ep = epc_get_drvdata(epc); 565 566 struct cdns_pcie *pcie = &ep->pcie; 566 567 struct device *dev = pcie->dev; 567 - int ret; 568 + int max_epfs = sizeof(epc->function_num_map) * 8; 569 + int ret, value, epf; 568 570 569 571 /* 570 572 * BIT(0) is hardwired to 1, hence function 0 is always enabled 571 573 * and can't be disabled anyway. 572 574 */ 573 575 cdns_pcie_writel(pcie, CDNS_PCIE_LM_EP_FUNC_CFG, epc->function_num_map); 576 + 577 + if (ep->quirk_disable_flr) { 578 + for (epf = 0; epf < max_epfs; epf++) { 579 + if (!(epc->function_num_map & BIT(epf))) 580 + continue; 581 + 582 + value = cdns_pcie_ep_fn_readl(pcie, epf, 583 + CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + 584 + PCI_EXP_DEVCAP); 585 + value &= ~PCI_EXP_DEVCAP_FLR; 586 + cdns_pcie_ep_fn_writel(pcie, epf, 587 + CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + 588 + PCI_EXP_DEVCAP, value); 589 + } 590 + } 574 591 575 592 ret = cdns_pcie_start_link(pcie); 576 593 if (ret) {
+10
drivers/pci/controller/cadence/pcie-cadence-host.c
··· 123 123 return ret; 124 124 } 125 125 126 + static void cdns_pcie_host_enable_ptm_response(struct cdns_pcie *pcie) 127 + { 128 + u32 val; 129 + 130 + val = cdns_pcie_readl(pcie, CDNS_PCIE_LM_PTM_CTRL); 131 + cdns_pcie_writel(pcie, CDNS_PCIE_LM_PTM_CTRL, val | CDNS_PCIE_LM_TPM_CTRL_PTMRSEN); 132 + } 133 + 126 134 static int cdns_pcie_host_start_link(struct cdns_pcie_rc *rc) 127 135 { 128 136 struct cdns_pcie *pcie = &rc->pcie; ··· 508 500 509 501 if (rc->quirk_detect_quiet_flag) 510 502 cdns_pcie_detect_quiet_min_delay_set(&rc->pcie); 503 + 504 + cdns_pcie_host_enable_ptm_response(pcie); 511 505 512 506 ret = cdns_pcie_start_link(pcie); 513 507 if (ret) {
+7
drivers/pci/controller/cadence/pcie-cadence.h
··· 116 116 #define LM_RC_BAR_CFG_APERTURE(bar, aperture) \ 117 117 (((aperture) - 2) << ((bar) * 8)) 118 118 119 + /* PTM Control Register */ 120 + #define CDNS_PCIE_LM_PTM_CTRL (CDNS_PCIE_LM_BASE + 0x0da8) 121 + #define CDNS_PCIE_LM_TPM_CTRL_PTMRSEN BIT(17) 122 + 119 123 /* 120 124 * Endpoint Function Registers (PCI configuration space for endpoint functions) 121 125 */ ··· 127 123 128 124 #define CDNS_PCIE_EP_FUNC_MSI_CAP_OFFSET 0x90 129 125 #define CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET 0xb0 126 + #define CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET 0xc0 130 127 #define CDNS_PCIE_EP_FUNC_SRIOV_CAP_OFFSET 0x200 131 128 132 129 /* ··· 362 357 * minimize time between read and write 363 358 * @epf: Structure to hold info about endpoint function 364 359 * @quirk_detect_quiet_flag: LTSSM Detect Quiet min delay set as quirk 360 + * @quirk_disable_flr: Disable FLR (Function Level Reset) quirk flag 365 361 */ 366 362 struct cdns_pcie_ep { 367 363 struct cdns_pcie pcie; ··· 378 372 spinlock_t lock; 379 373 struct cdns_pcie_epf *epf; 380 374 unsigned int quirk_detect_quiet_flag:1; 375 + unsigned int quirk_disable_flr:1; 381 376 }; 382 377 383 378
+14 -9
drivers/pci/controller/dwc/pci-imx6.c
··· 408 408 dev_err(dev, "failed to disable vpcie regulator: %d\n", 409 409 ret); 410 410 } 411 + 412 + /* Some boards don't have PCIe reset GPIO. */ 413 + if (gpio_is_valid(imx6_pcie->reset_gpio)) 414 + gpio_set_value_cansleep(imx6_pcie->reset_gpio, 415 + imx6_pcie->gpio_active_high); 411 416 } 412 417 413 418 static unsigned int imx6_pcie_grp_offset(const struct imx6_pcie *imx6_pcie) ··· 545 540 /* allow the clocks to stabilize */ 546 541 usleep_range(200, 500); 547 542 548 - /* Some boards don't have PCIe reset GPIO. */ 549 - if (gpio_is_valid(imx6_pcie->reset_gpio)) { 550 - gpio_set_value_cansleep(imx6_pcie->reset_gpio, 551 - imx6_pcie->gpio_active_high); 552 - msleep(100); 553 - gpio_set_value_cansleep(imx6_pcie->reset_gpio, 554 - !imx6_pcie->gpio_active_high); 555 - } 556 - 557 543 switch (imx6_pcie->drvdata->variant) { 558 544 case IMX8MQ: 559 545 reset_control_deassert(imx6_pcie->pciephy_reset); ··· 589 593 break; 590 594 case IMX6Q: /* Nothing to do */ 591 595 break; 596 + } 597 + 598 + /* Some boards don't have PCIe reset GPIO. */ 599 + if (gpio_is_valid(imx6_pcie->reset_gpio)) { 600 + msleep(100); 601 + gpio_set_value_cansleep(imx6_pcie->reset_gpio, 602 + !imx6_pcie->gpio_active_high); 603 + /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */ 604 + msleep(100); 592 605 } 593 606 594 607 return;
+2 -1
drivers/pci/controller/dwc/pcie-designware-host.c
··· 396 396 sizeof(pp->msi_msg), 397 397 DMA_FROM_DEVICE, 398 398 DMA_ATTR_SKIP_CPU_SYNC); 399 - if (dma_mapping_error(pci->dev, pp->msi_data)) { 399 + ret = dma_mapping_error(pci->dev, pp->msi_data); 400 + if (ret) { 400 401 dev_err(pci->dev, "Failed to map MSI data\n"); 401 402 pp->msi_data = 0; 402 403 goto err_free_msi;
+104 -15
drivers/pci/controller/dwc/pcie-dw-rockchip.c
··· 10 10 11 11 #include <linux/clk.h> 12 12 #include <linux/gpio/consumer.h> 13 + #include <linux/irqchip/chained_irq.h> 14 + #include <linux/irqdomain.h> 13 15 #include <linux/mfd/syscon.h> 14 16 #include <linux/module.h> 15 17 #include <linux/of_device.h> 18 + #include <linux/of_irq.h> 16 19 #include <linux/phy/phy.h> 17 20 #include <linux/platform_device.h> 18 21 #include <linux/regmap.h> ··· 29 26 */ 30 27 #define HIWORD_UPDATE(mask, val) (((mask) << 16) | (val)) 31 28 #define HIWORD_UPDATE_BIT(val) HIWORD_UPDATE(val, val) 29 + #define HIWORD_DISABLE_BIT(val) HIWORD_UPDATE(val, ~val) 32 30 33 31 #define to_rockchip_pcie(x) dev_get_drvdata((x)->dev) 34 32 ··· 40 36 #define PCIE_LINKUP (PCIE_SMLH_LINKUP | PCIE_RDLH_LINKUP) 41 37 #define PCIE_L0S_ENTRY 0x11 42 38 #define PCIE_CLIENT_GENERAL_CONTROL 0x0 39 + #define PCIE_CLIENT_INTR_STATUS_LEGACY 0x8 40 + #define PCIE_CLIENT_INTR_MASK_LEGACY 0x1c 43 41 #define PCIE_CLIENT_GENERAL_DEBUG 0x104 44 - #define PCIE_CLIENT_HOT_RESET_CTRL 0x180 42 + #define PCIE_CLIENT_HOT_RESET_CTRL 0x180 45 43 #define PCIE_CLIENT_LTSSM_STATUS 0x300 46 - #define PCIE_LTSSM_ENABLE_ENHANCE BIT(4) 44 + #define PCIE_LTSSM_ENABLE_ENHANCE BIT(4) 47 45 #define PCIE_LTSSM_STATUS_MASK GENMASK(5, 0) 48 46 49 47 struct rockchip_pcie { ··· 57 51 struct reset_control *rst; 58 52 struct gpio_desc *rst_gpio; 59 53 struct regulator *vpcie3v3; 54 + struct irq_domain *irq_domain; 60 55 }; 61 56 62 57 static int rockchip_pcie_readl_apb(struct rockchip_pcie *rockchip, ··· 70 63 u32 val, u32 reg) 71 64 { 72 65 writel_relaxed(val, rockchip->apb_base + reg); 66 + } 67 + 68 + static void rockchip_pcie_legacy_int_handler(struct irq_desc *desc) 69 + { 70 + struct irq_chip *chip = irq_desc_get_chip(desc); 71 + struct rockchip_pcie *rockchip = irq_desc_get_handler_data(desc); 72 + unsigned long reg, hwirq; 73 + 74 + chained_irq_enter(chip, desc); 75 + 76 + reg = rockchip_pcie_readl_apb(rockchip, PCIE_CLIENT_INTR_STATUS_LEGACY); 77 + 78 + for_each_set_bit(hwirq, &reg, 4) 79 + generic_handle_domain_irq(rockchip->irq_domain, hwirq); 80 + 81 + chained_irq_exit(chip, desc); 82 + } 83 + 84 + static void rockchip_intx_mask(struct irq_data *data) 85 + { 86 + rockchip_pcie_writel_apb(irq_data_get_irq_chip_data(data), 87 + HIWORD_UPDATE_BIT(BIT(data->hwirq)), 88 + PCIE_CLIENT_INTR_MASK_LEGACY); 89 + }; 90 + 91 + static void rockchip_intx_unmask(struct irq_data *data) 92 + { 93 + rockchip_pcie_writel_apb(irq_data_get_irq_chip_data(data), 94 + HIWORD_DISABLE_BIT(BIT(data->hwirq)), 95 + PCIE_CLIENT_INTR_MASK_LEGACY); 96 + }; 97 + 98 + static struct irq_chip rockchip_intx_irq_chip = { 99 + .name = "INTx", 100 + .irq_mask = rockchip_intx_mask, 101 + .irq_unmask = rockchip_intx_unmask, 102 + .flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND, 103 + }; 104 + 105 + static int rockchip_pcie_intx_map(struct irq_domain *domain, unsigned int irq, 106 + irq_hw_number_t hwirq) 107 + { 108 + irq_set_chip_and_handler(irq, &rockchip_intx_irq_chip, handle_level_irq); 109 + irq_set_chip_data(irq, domain->host_data); 110 + 111 + return 0; 112 + } 113 + 114 + static const struct irq_domain_ops intx_domain_ops = { 115 + .map = rockchip_pcie_intx_map, 116 + }; 117 + 118 + static int rockchip_pcie_init_irq_domain(struct rockchip_pcie *rockchip) 119 + { 120 + struct device *dev = rockchip->pci.dev; 121 + struct device_node *intc; 122 + 123 + intc = of_get_child_by_name(dev->of_node, "legacy-interrupt-controller"); 124 + if (!intc) { 125 + dev_err(dev, "missing child interrupt-controller node\n"); 126 + return -EINVAL; 127 + } 128 + 129 + rockchip->irq_domain = irq_domain_add_linear(intc, PCI_NUM_INTX, 130 + &intx_domain_ops, rockchip); 131 + of_node_put(intc); 132 + if (!rockchip->irq_domain) { 133 + dev_err(dev, "failed to get a INTx IRQ domain\n"); 134 + return -EINVAL; 135 + } 136 + 137 + return 0; 73 138 } 74 139 75 140 static void rockchip_pcie_enable_ltssm(struct rockchip_pcie *rockchip) ··· 190 111 { 191 112 struct dw_pcie *pci = to_dw_pcie_from_pp(pp); 192 113 struct rockchip_pcie *rockchip = to_rockchip_pcie(pci); 114 + struct device *dev = rockchip->pci.dev; 193 115 u32 val = HIWORD_UPDATE_BIT(PCIE_LTSSM_ENABLE_ENHANCE); 116 + int irq, ret; 117 + 118 + irq = of_irq_get_byname(dev->of_node, "legacy"); 119 + if (irq < 0) 120 + return irq; 121 + 122 + ret = rockchip_pcie_init_irq_domain(rockchip); 123 + if (ret < 0) 124 + dev_err(dev, "failed to init irq domain\n"); 125 + 126 + irq_set_chained_handler_and_data(irq, rockchip_pcie_legacy_int_handler, 127 + rockchip); 194 128 195 129 /* LTSSM enable control mode */ 196 130 rockchip_pcie_writel_apb(rockchip, val, PCIE_CLIENT_HOT_RESET_CTRL); ··· 244 152 if (IS_ERR(rockchip->rst_gpio)) 245 153 return PTR_ERR(rockchip->rst_gpio); 246 154 155 + rockchip->rst = devm_reset_control_array_get_exclusive(&pdev->dev); 156 + if (IS_ERR(rockchip->rst)) 157 + return dev_err_probe(&pdev->dev, PTR_ERR(rockchip->rst), 158 + "failed to get reset lines\n"); 159 + 247 160 return 0; 248 161 } 249 162 ··· 279 182 phy_power_off(rockchip->phy); 280 183 } 281 184 282 - static int rockchip_pcie_reset_control_release(struct rockchip_pcie *rockchip) 283 - { 284 - struct device *dev = rockchip->pci.dev; 285 - 286 - rockchip->rst = devm_reset_control_array_get_exclusive(dev); 287 - if (IS_ERR(rockchip->rst)) 288 - return dev_err_probe(dev, PTR_ERR(rockchip->rst), 289 - "failed to get reset lines\n"); 290 - 291 - return reset_control_deassert(rockchip->rst); 292 - } 293 - 294 185 static const struct dw_pcie_ops dw_pcie_ops = { 295 186 .link_up = rockchip_pcie_link_up, 296 187 .start_link = rockchip_pcie_start_link, ··· 307 222 if (ret) 308 223 return ret; 309 224 225 + ret = reset_control_assert(rockchip->rst); 226 + if (ret) 227 + return ret; 228 + 310 229 /* DON'T MOVE ME: must be enable before PHY init */ 311 230 rockchip->vpcie3v3 = devm_regulator_get_optional(dev, "vpcie3v3"); 312 231 if (IS_ERR(rockchip->vpcie3v3)) { ··· 330 241 if (ret) 331 242 goto disable_regulator; 332 243 333 - ret = rockchip_pcie_reset_control_release(rockchip); 244 + ret = reset_control_deassert(rockchip->rst); 334 245 if (ret) 335 246 goto deinit_phy; 336 247
+46 -45
drivers/pci/controller/dwc/pcie-qcom-ep.c
··· 223 223 disable_irq(pcie_ep->perst_irq); 224 224 } 225 225 226 - static int qcom_pcie_perst_deassert(struct dw_pcie *pci) 226 + static int qcom_pcie_enable_resources(struct qcom_pcie_ep *pcie_ep) 227 227 { 228 - struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci); 229 - struct device *dev = pci->dev; 230 - u32 val, offset; 231 228 int ret; 232 229 233 230 ret = clk_bulk_prepare_enable(ARRAY_SIZE(qcom_pcie_ep_clks), ··· 243 246 ret = phy_power_on(pcie_ep->phy); 244 247 if (ret) 245 248 goto err_phy_exit; 249 + 250 + return 0; 251 + 252 + err_phy_exit: 253 + phy_exit(pcie_ep->phy); 254 + err_disable_clk: 255 + clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks), 256 + qcom_pcie_ep_clks); 257 + 258 + return ret; 259 + } 260 + 261 + static void qcom_pcie_disable_resources(struct qcom_pcie_ep *pcie_ep) 262 + { 263 + phy_power_off(pcie_ep->phy); 264 + phy_exit(pcie_ep->phy); 265 + clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks), 266 + qcom_pcie_ep_clks); 267 + } 268 + 269 + static int qcom_pcie_perst_deassert(struct dw_pcie *pci) 270 + { 271 + struct qcom_pcie_ep *pcie_ep = to_pcie_ep(pci); 272 + struct device *dev = pci->dev; 273 + u32 val, offset; 274 + int ret; 275 + 276 + ret = qcom_pcie_enable_resources(pcie_ep); 277 + if (ret) { 278 + dev_err(dev, "Failed to enable resources: %d\n", ret); 279 + return ret; 280 + } 246 281 247 282 /* Assert WAKE# to RC to indicate device is ready */ 248 283 gpiod_set_value_cansleep(pcie_ep->wake, 1); ··· 364 335 ret = dw_pcie_ep_init_complete(&pcie_ep->pci.ep); 365 336 if (ret) { 366 337 dev_err(dev, "Failed to complete initialization: %d\n", ret); 367 - goto err_phy_power_off; 338 + goto err_disable_resources; 368 339 } 369 340 370 341 /* ··· 384 355 385 356 return 0; 386 357 387 - err_phy_power_off: 388 - phy_power_off(pcie_ep->phy); 389 - err_phy_exit: 390 - phy_exit(pcie_ep->phy); 391 - err_disable_clk: 392 - clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks), 393 - qcom_pcie_ep_clks); 358 + err_disable_resources: 359 + qcom_pcie_disable_resources(pcie_ep); 394 360 395 361 return ret; 396 362 } ··· 400 376 return; 401 377 } 402 378 403 - phy_power_off(pcie_ep->phy); 404 - phy_exit(pcie_ep->phy); 405 - clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks), 406 - qcom_pcie_ep_clks); 379 + qcom_pcie_disable_resources(pcie_ep); 407 380 pcie_ep->link_status = QCOM_PCIE_EP_LINK_DISABLED; 408 381 } 409 382 ··· 664 643 if (ret) 665 644 return ret; 666 645 667 - ret = clk_bulk_prepare_enable(ARRAY_SIZE(qcom_pcie_ep_clks), 668 - qcom_pcie_ep_clks); 669 - if (ret) 646 + ret = qcom_pcie_enable_resources(pcie_ep); 647 + if (ret) { 648 + dev_err(dev, "Failed to enable resources: %d\n", ret); 670 649 return ret; 671 - 672 - ret = qcom_pcie_ep_core_reset(pcie_ep); 673 - if (ret) 674 - goto err_disable_clk; 675 - 676 - ret = phy_init(pcie_ep->phy); 677 - if (ret) 678 - goto err_disable_clk; 679 - 680 - /* PHY needs to be powered on for dw_pcie_ep_init() */ 681 - ret = phy_power_on(pcie_ep->phy); 682 - if (ret) 683 - goto err_phy_exit; 650 + } 684 651 685 652 ret = dw_pcie_ep_init(&pcie_ep->pci.ep); 686 653 if (ret) { 687 654 dev_err(dev, "Failed to initialize endpoint: %d\n", ret); 688 - goto err_phy_power_off; 655 + goto err_disable_resources; 689 656 } 690 657 691 658 ret = qcom_pcie_ep_enable_irq_resources(pdev, pcie_ep); 692 659 if (ret) 693 - goto err_phy_power_off; 660 + goto err_disable_resources; 694 661 695 662 return 0; 696 663 697 - err_phy_power_off: 698 - phy_power_off(pcie_ep->phy); 699 - err_phy_exit: 700 - phy_exit(pcie_ep->phy); 701 - err_disable_clk: 702 - clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks), 703 - qcom_pcie_ep_clks); 664 + err_disable_resources: 665 + qcom_pcie_disable_resources(pcie_ep); 704 666 705 667 return ret; 706 668 } ··· 695 691 if (pcie_ep->link_status == QCOM_PCIE_EP_LINK_DISABLED) 696 692 return 0; 697 693 698 - phy_power_off(pcie_ep->phy); 699 - phy_exit(pcie_ep->phy); 700 - clk_bulk_disable_unprepare(ARRAY_SIZE(qcom_pcie_ep_clks), 701 - qcom_pcie_ep_clks); 694 + qcom_pcie_disable_resources(pcie_ep); 702 695 703 696 return 0; 704 697 }
+12 -11
drivers/pci/controller/dwc/pcie-qcom.c
··· 1238 1238 goto err_disable_clocks; 1239 1239 } 1240 1240 1241 - ret = clk_prepare_enable(res->pipe_clk); 1242 - if (ret) { 1243 - dev_err(dev, "cannot prepare/enable pipe clock\n"); 1244 - goto err_disable_clocks; 1245 - } 1246 - 1247 1241 /* Wait for reset to complete, required on SM8450 */ 1248 1242 usleep_range(1000, 1500); 1249 1243 ··· 1517 1523 .has_tbu_clk = true, 1518 1524 }; 1519 1525 1526 + static const struct qcom_pcie_cfg sm8150_cfg = { 1527 + /* sm8150 has qcom IP rev 1.5.0. However 1.5.0 ops are same as 1528 + * 1.9.0, so reuse the same. 1529 + */ 1530 + .ops = &ops_1_9_0, 1531 + }; 1532 + 1520 1533 static const struct qcom_pcie_cfg sm8250_cfg = { 1521 1534 .ops = &ops_1_9_0, 1522 1535 .has_tbu_clk = true, ··· 1628 1627 pp->ops = &qcom_pcie_dw_ops; 1629 1628 1630 1629 ret = phy_init(pcie->phy); 1631 - if (ret) { 1632 - pm_runtime_disable(&pdev->dev); 1630 + if (ret) 1633 1631 goto err_pm_runtime_put; 1634 - } 1635 1632 1636 1633 platform_set_drvdata(pdev, pcie); 1637 1634 1638 1635 ret = dw_pcie_host_init(pp); 1639 1636 if (ret) { 1640 1637 dev_err(dev, "cannot initialize host\n"); 1641 - pm_runtime_disable(&pdev->dev); 1642 - goto err_pm_runtime_put; 1638 + goto err_phy_exit; 1643 1639 } 1644 1640 1645 1641 return 0; 1646 1642 1643 + err_phy_exit: 1644 + phy_exit(pcie->phy); 1647 1645 err_pm_runtime_put: 1648 1646 pm_runtime_put(dev); 1649 1647 pm_runtime_disable(dev); ··· 1660 1660 { .compatible = "qcom,pcie-ipq4019", .data = &ipq4019_cfg }, 1661 1661 { .compatible = "qcom,pcie-qcs404", .data = &ipq4019_cfg }, 1662 1662 { .compatible = "qcom,pcie-sdm845", .data = &sdm845_cfg }, 1663 + { .compatible = "qcom,pcie-sm8150", .data = &sm8150_cfg }, 1663 1664 { .compatible = "qcom,pcie-sm8250", .data = &sm8250_cfg }, 1664 1665 { .compatible = "qcom,pcie-sc8180x", .data = &sc8180x_cfg }, 1665 1666 { .compatible = "qcom,pcie-sm8450-pcie0", .data = &sm8450_pcie0_cfg },
-9
drivers/pci/controller/dwc/pcie-tegra194.c
··· 186 186 #define N_FTS_VAL 52 187 187 #define FTS_VAL 52 188 188 189 - #define PORT_LOGIC_MSI_CTRL_INT_0_EN 0x828 190 - 191 189 #define GEN3_EQ_CONTROL_OFF 0x8a8 192 190 #define GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC_SHIFT 8 193 191 #define GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC_MASK GENMASK(23, 8) ··· 2187 2189 if (!pcie->link_state) 2188 2190 return 0; 2189 2191 2190 - /* Save MSI interrupt vector */ 2191 - pcie->msi_ctrl_int = dw_pcie_readl_dbi(&pcie->pci, 2192 - PORT_LOGIC_MSI_CTRL_INT_0_EN); 2193 2192 tegra_pcie_downstream_dev_to_D0(pcie); 2194 2193 tegra194_pcie_pme_turnoff(pcie); 2195 2194 tegra_pcie_unconfig_controller(pcie); ··· 2217 2222 ret = tegra194_pcie_start_link(&pcie->pci); 2218 2223 if (ret < 0) 2219 2224 goto fail_host_init; 2220 - 2221 - /* Restore MSI interrupt vector */ 2222 - dw_pcie_writel_dbi(&pcie->pci, PORT_LOGIC_MSI_CTRL_INT_0_EN, 2223 - pcie->msi_ctrl_int); 2224 2225 2225 2226 return 0; 2226 2227
+92 -5
drivers/pci/controller/pci-mvebu.c
··· 8 8 #include <linux/kernel.h> 9 9 #include <linux/module.h> 10 10 #include <linux/pci.h> 11 + #include <linux/bitfield.h> 11 12 #include <linux/clk.h> 12 13 #include <linux/delay.h> 13 14 #include <linux/gpio.h> ··· 67 66 #define PCIE_STAT_BUS 0xff00 68 67 #define PCIE_STAT_DEV 0x1f0000 69 68 #define PCIE_STAT_LINK_DOWN BIT(0) 69 + #define PCIE_SSPL_OFF 0x1a0c 70 + #define PCIE_SSPL_VALUE_SHIFT 0 71 + #define PCIE_SSPL_VALUE_MASK GENMASK(7, 0) 72 + #define PCIE_SSPL_SCALE_SHIFT 8 73 + #define PCIE_SSPL_SCALE_MASK GENMASK(9, 8) 74 + #define PCIE_SSPL_ENABLE BIT(16) 70 75 #define PCIE_RC_RTSTA 0x1a14 71 76 #define PCIE_DEBUG_CTRL 0x1a60 72 77 #define PCIE_DEBUG_SOFT_RESET BIT(20) ··· 118 111 struct mvebu_pcie_window iowin; 119 112 u32 saved_pcie_stat; 120 113 struct resource regs; 114 + u8 slot_power_limit_value; 115 + u8 slot_power_limit_scale; 121 116 struct irq_domain *intx_irq_domain; 122 117 raw_spinlock_t irq_lock; 123 118 int intx_irq; ··· 248 239 249 240 static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port) 250 241 { 251 - u32 ctrl, lnkcap, cmd, dev_rev, unmask; 242 + u32 ctrl, lnkcap, cmd, dev_rev, unmask, sspl; 252 243 253 244 /* Setup PCIe controller to Root Complex mode. */ 254 245 ctrl = mvebu_readl(port, PCIE_CTRL_OFF); ··· 300 291 301 292 /* Point PCIe unit MBUS decode windows to DRAM space. */ 302 293 mvebu_pcie_setup_wins(port); 294 + 295 + /* 296 + * Program Root Port to automatically send Set_Slot_Power_Limit 297 + * PCIe Message when changing status from Dl_Down to Dl_Up and valid 298 + * slot power limit was specified. 299 + */ 300 + sspl = mvebu_readl(port, PCIE_SSPL_OFF); 301 + sspl &= ~(PCIE_SSPL_VALUE_MASK | PCIE_SSPL_SCALE_MASK | PCIE_SSPL_ENABLE); 302 + if (port->slot_power_limit_value) { 303 + sspl |= port->slot_power_limit_value << PCIE_SSPL_VALUE_SHIFT; 304 + sspl |= port->slot_power_limit_scale << PCIE_SSPL_SCALE_SHIFT; 305 + sspl |= PCIE_SSPL_ENABLE; 306 + } 307 + mvebu_writel(port, sspl, PCIE_SSPL_OFF); 303 308 304 309 /* Mask all interrupt sources. */ 305 310 mvebu_writel(port, ~PCIE_INT_ALL_MASK, PCIE_INT_UNMASK_OFF); ··· 651 628 (PCI_EXP_LNKSTA_DLLLA << 16) : 0); 652 629 break; 653 630 654 - case PCI_EXP_SLTCTL: 655 - *value = PCI_EXP_SLTSTA_PDS << 16; 631 + case PCI_EXP_SLTCTL: { 632 + u16 slotctl = le16_to_cpu(bridge->pcie_conf.slotctl); 633 + u16 slotsta = le16_to_cpu(bridge->pcie_conf.slotsta); 634 + u32 val = 0; 635 + /* 636 + * When slot power limit was not specified in DT then 637 + * ASPL_DISABLE bit is stored only in emulated config space. 638 + * Otherwise reflect status of PCIE_SSPL_ENABLE bit in HW. 639 + */ 640 + if (!port->slot_power_limit_value) 641 + val |= slotctl & PCI_EXP_SLTCTL_ASPL_DISABLE; 642 + else if (!(mvebu_readl(port, PCIE_SSPL_OFF) & PCIE_SSPL_ENABLE)) 643 + val |= PCI_EXP_SLTCTL_ASPL_DISABLE; 644 + /* This callback is 32-bit and in high bits is slot status. */ 645 + val |= slotsta << 16; 646 + *value = val; 656 647 break; 648 + } 657 649 658 650 case PCI_EXP_RTSTA: 659 651 *value = mvebu_readl(port, PCIE_RC_RTSTA); ··· 812 774 mvebu_writel(port, new, PCIE_CAP_PCIEXP + PCI_EXP_LNKCTL); 813 775 break; 814 776 777 + case PCI_EXP_SLTCTL: 778 + /* 779 + * Allow to change PCIE_SSPL_ENABLE bit only when slot power 780 + * limit was specified in DT and configured into HW. 781 + */ 782 + if ((mask & PCI_EXP_SLTCTL_ASPL_DISABLE) && 783 + port->slot_power_limit_value) { 784 + u32 sspl = mvebu_readl(port, PCIE_SSPL_OFF); 785 + if (new & PCI_EXP_SLTCTL_ASPL_DISABLE) 786 + sspl &= ~PCIE_SSPL_ENABLE; 787 + else 788 + sspl |= PCIE_SSPL_ENABLE; 789 + mvebu_writel(port, sspl, PCIE_SSPL_OFF); 790 + } 791 + break; 792 + 815 793 case PCI_EXP_RTSTA: 816 794 /* 817 795 * PME Status bit in Root Status Register (PCIE_RC_RTSTA) ··· 922 868 /* 923 869 * Older mvebu hardware provides PCIe Capability structure only in 924 870 * version 1. New hardware provides it in version 2. 871 + * Enable slot support which is emulated. 925 872 */ 926 - bridge->pcie_conf.cap = cpu_to_le16(pcie_cap_ver); 873 + bridge->pcie_conf.cap = cpu_to_le16(pcie_cap_ver | PCI_EXP_FLAGS_SLOT); 874 + 875 + /* 876 + * Set Presence Detect State bit permanently as there is no support for 877 + * unplugging PCIe card from the slot. Assume that PCIe card is always 878 + * connected in slot. 879 + * 880 + * Set physical slot number to port+1 as mvebu ports are indexed from 881 + * zero and zero value is reserved for ports within the same silicon 882 + * as Root Port which is not mvebu case. 883 + * 884 + * Also set correct slot power limit. 885 + */ 886 + bridge->pcie_conf.slotcap = cpu_to_le32( 887 + FIELD_PREP(PCI_EXP_SLTCAP_SPLV, port->slot_power_limit_value) | 888 + FIELD_PREP(PCI_EXP_SLTCAP_SPLS, port->slot_power_limit_scale) | 889 + FIELD_PREP(PCI_EXP_SLTCAP_PSN, port->port+1)); 890 + bridge->pcie_conf.slotsta = cpu_to_le16(PCI_EXP_SLTSTA_PDS); 927 891 928 892 bridge->subsystem_vendor_id = ssdev_id & 0xffff; 929 893 bridge->subsystem_id = ssdev_id >> 16; ··· 1263 1191 { 1264 1192 struct device *dev = &pcie->pdev->dev; 1265 1193 enum of_gpio_flags flags; 1194 + u32 slot_power_limit; 1266 1195 int reset_gpio, ret; 1267 1196 u32 num_lanes; 1268 1197 ··· 1363 1290 1364 1291 port->reset_gpio = gpio_to_desc(reset_gpio); 1365 1292 } 1293 + 1294 + slot_power_limit = of_pci_get_slot_power_limit(child, 1295 + &port->slot_power_limit_value, 1296 + &port->slot_power_limit_scale); 1297 + if (slot_power_limit) 1298 + dev_info(dev, "%s: Slot power limit %u.%uW\n", 1299 + port->name, 1300 + slot_power_limit / 1000, 1301 + (slot_power_limit / 100) % 10); 1366 1302 1367 1303 port->clk = of_clk_get_by_name(child, NULL); 1368 1304 if (IS_ERR(port->clk)) { ··· 1670 1588 { 1671 1589 struct mvebu_pcie *pcie = platform_get_drvdata(pdev); 1672 1590 struct pci_host_bridge *bridge = pci_host_bridge_from_priv(pcie); 1673 - u32 cmd; 1591 + u32 cmd, sspl; 1674 1592 int i; 1675 1593 1676 1594 /* Remove PCI bus with all devices. */ ··· 1706 1624 1707 1625 /* Free config space for emulated root bridge. */ 1708 1626 pci_bridge_emul_cleanup(&port->bridge); 1627 + 1628 + /* Disable sending Set_Slot_Power_Limit PCIe Message. */ 1629 + sspl = mvebu_readl(port, PCIE_SSPL_OFF); 1630 + sspl &= ~(PCIE_SSPL_VALUE_MASK | PCIE_SSPL_SCALE_MASK | PCIE_SSPL_ENABLE); 1631 + mvebu_writel(port, sspl, PCIE_SSPL_OFF); 1709 1632 1710 1633 /* Disable and clear BARs and windows. */ 1711 1634 mvebu_pcie_disable_wins(port);
+1 -2
drivers/pci/controller/pci-versatile.c
··· 31 31 32 32 static int __init versatile_pci_slot_ignore(char *str) 33 33 { 34 - int retval; 35 34 int slot; 36 35 37 - while ((retval = get_option(&str, &slot))) { 36 + while (get_option(&str, &slot)) { 38 37 if ((slot < 0) || (slot > 31)) 39 38 pr_err("Illegal slot value: %d\n", slot); 40 39 else
+8
drivers/pci/controller/pcie-mediatek-gen3.c
··· 838 838 if (err) 839 839 return err; 840 840 841 + /* 842 + * The controller may have been left out of reset by the bootloader 843 + * so make sure that we get a clean start by asserting resets here. 844 + */ 845 + reset_control_assert(pcie->phy_reset); 846 + reset_control_assert(pcie->mac_reset); 847 + usleep_range(10, 20); 848 + 841 849 /* Don't touch the hardware registers before power up */ 842 850 err = mtk_pcie_power_up(pcie); 843 851 if (err)
+1
drivers/pci/controller/pcie-mediatek.c
··· 1008 1008 "mediatek,generic-pciecfg"); 1009 1009 if (cfg_node) { 1010 1010 pcie->cfg = syscon_node_to_regmap(cfg_node); 1011 + of_node_put(cfg_node); 1011 1012 if (IS_ERR(pcie->cfg)) 1012 1013 return PTR_ERR(pcie->cfg); 1013 1014 }
+12 -6
drivers/pci/controller/pcie-microchip-host.c
··· 406 406 static void mc_handle_msi(struct irq_desc *desc) 407 407 { 408 408 struct mc_pcie *port = irq_desc_get_handler_data(desc); 409 + struct irq_chip *chip = irq_desc_get_chip(desc); 409 410 struct device *dev = port->dev; 410 411 struct mc_msi *msi = &port->msi; 411 412 void __iomem *bridge_base_addr = ··· 415 414 u32 bit; 416 415 int ret; 417 416 417 + chained_irq_enter(chip, desc); 418 + 418 419 status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL); 419 420 if (status & PM_MSI_INT_MSI_MASK) { 421 + writel_relaxed(status & PM_MSI_INT_MSI_MASK, bridge_base_addr + ISTATUS_LOCAL); 420 422 status = readl_relaxed(bridge_base_addr + ISTATUS_MSI); 421 423 for_each_set_bit(bit, &status, msi->num_vectors) { 422 424 ret = generic_handle_domain_irq(msi->dev_domain, bit); ··· 428 424 bit); 429 425 } 430 426 } 427 + 428 + chained_irq_exit(chip, desc); 431 429 } 432 430 433 431 static void mc_msi_bottom_irq_ack(struct irq_data *data) ··· 438 432 void __iomem *bridge_base_addr = 439 433 port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; 440 434 u32 bitpos = data->hwirq; 441 - unsigned long status; 442 435 443 436 writel_relaxed(BIT(bitpos), bridge_base_addr + ISTATUS_MSI); 444 - status = readl_relaxed(bridge_base_addr + ISTATUS_MSI); 445 - if (!status) 446 - writel_relaxed(BIT(PM_MSI_INT_MSI_SHIFT), 447 - bridge_base_addr + ISTATUS_LOCAL); 448 437 } 449 438 450 439 static void mc_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) ··· 564 563 static void mc_handle_intx(struct irq_desc *desc) 565 564 { 566 565 struct mc_pcie *port = irq_desc_get_handler_data(desc); 566 + struct irq_chip *chip = irq_desc_get_chip(desc); 567 567 struct device *dev = port->dev; 568 568 void __iomem *bridge_base_addr = 569 569 port->axi_base_addr + MC_PCIE_BRIDGE_ADDR; 570 570 unsigned long status; 571 571 u32 bit; 572 572 int ret; 573 + 574 + chained_irq_enter(chip, desc); 573 575 574 576 status = readl_relaxed(bridge_base_addr + ISTATUS_LOCAL); 575 577 if (status & PM_MSI_INT_INTX_MASK) { ··· 585 581 bit); 586 582 } 587 583 } 584 + 585 + chained_irq_exit(chip, desc); 588 586 } 589 587 590 588 static void mc_ack_intx_irq(struct irq_data *data) ··· 1121 1115 {}, 1122 1116 }; 1123 1117 1124 - MODULE_DEVICE_TABLE(of, mc_pcie_of_match) 1118 + MODULE_DEVICE_TABLE(of, mc_pcie_of_match); 1125 1119 1126 1120 static struct platform_driver mc_pcie_driver = { 1127 1121 .probe = pci_host_common_probe,
+1 -2
drivers/pci/controller/pcie-rockchip-ep.c
··· 264 264 struct rockchip_pcie *pcie = &ep->rockchip; 265 265 u32 r; 266 266 267 - r = find_first_zero_bit(&ep->ob_region_map, 268 - sizeof(ep->ob_region_map) * BITS_PER_LONG); 267 + r = find_first_zero_bit(&ep->ob_region_map, BITS_PER_LONG); 269 268 /* 270 269 * Region 0 is reserved for configuration space and shouldn't 271 270 * be used elsewhere per TRM, so leave it out.
+4 -3
drivers/pci/controller/vmd.c
··· 6 6 7 7 #include <linux/device.h> 8 8 #include <linux/interrupt.h> 9 - #include <linux/iommu.h> 10 9 #include <linux/irq.h> 11 10 #include <linux/kernel.h> 12 11 #include <linux/module.h> ··· 812 813 * acceptable because the guest is usually CPU-limited and MSI 813 814 * remapping doesn't become a performance bottleneck. 814 815 */ 815 - if (iommu_capable(vmd->dev->dev.bus, IOMMU_CAP_INTR_REMAP) || 816 - !(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) || 816 + if (!(features & VMD_FEAT_CAN_BYPASS_MSI_REMAP) || 817 817 offset[0] || offset[1]) { 818 818 ret = vmd_alloc_irqs(vmd); 819 819 if (ret) ··· 851 853 vmd_attach_resources(vmd); 852 854 if (vmd->irq_domain) 853 855 dev_set_msi_domain(&vmd->bus->dev, vmd->irq_domain); 856 + else 857 + dev_set_msi_domain(&vmd->bus->dev, 858 + dev_get_msi_domain(&vmd->dev->dev)); 854 859 855 860 vmd_acpi_begin(); 856 861
+1
drivers/pci/hotplug/pnv_php.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/pci.h> 11 11 #include <linux/pci_hotplug.h> 12 + #include <linux/of_fdt.h> 12 13 13 14 #include <asm/opal.h> 14 15 #include <asm/pnv-pci.h>
+1
drivers/pci/hotplug/rpadlpar_core.c
··· 15 15 16 16 #include <linux/init.h> 17 17 #include <linux/module.h> 18 + #include <linux/of.h> 18 19 #include <linux/pci.h> 19 20 #include <linux/string.h> 20 21 #include <linux/vmalloc.h>
+2
drivers/pci/hotplug/rpaphp_core.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/module.h> 13 13 #include <linux/moduleparam.h> 14 + #include <linux/of.h> 14 15 #include <linux/pci.h> 15 16 #include <linux/pci_hotplug.h> 16 17 #include <linux/smp.h> ··· 21 20 #include <asm/eeh.h> /* for eeh_add_device() */ 22 21 #include <asm/rtas.h> /* rtas_call */ 23 22 #include <asm/pci-bridge.h> /* for pci_controller */ 23 + #include <asm/prom.h> 24 24 #include "../pci.h" /* for pci_add_new_bus */ 25 25 /* and pci_do_scan_bus */ 26 26 #include "rpaphp.h"
+1
drivers/pci/hotplug/rpaphp_pci.c
··· 8 8 * Send feedback to <lxie@us.ibm.com> 9 9 * 10 10 */ 11 + #include <linux/of.h> 11 12 #include <linux/pci.h> 12 13 #include <linux/string.h> 13 14
+1
drivers/pci/hotplug/rpaphp_slot.c
··· 11 11 #include <linux/kernel.h> 12 12 #include <linux/module.h> 13 13 #include <linux/sysfs.h> 14 + #include <linux/of.h> 14 15 #include <linux/pci.h> 15 16 #include <linux/string.h> 16 17 #include <linux/slab.h>
+70
drivers/pci/of.c
··· 633 633 return max_link_speed; 634 634 } 635 635 EXPORT_SYMBOL_GPL(of_pci_get_max_link_speed); 636 + 637 + /** 638 + * of_pci_get_slot_power_limit - Parses the "slot-power-limit-milliwatt" 639 + * property. 640 + * 641 + * @node: device tree node with the slot power limit information 642 + * @slot_power_limit_value: pointer where the value should be stored in PCIe 643 + * Slot Capabilities Register format 644 + * @slot_power_limit_scale: pointer where the scale should be stored in PCIe 645 + * Slot Capabilities Register format 646 + * 647 + * Returns the slot power limit in milliwatts and if @slot_power_limit_value 648 + * and @slot_power_limit_scale pointers are non-NULL, fills in the value and 649 + * scale in format used by PCIe Slot Capabilities Register. 650 + * 651 + * If the property is not found or is invalid, returns 0. 652 + */ 653 + u32 of_pci_get_slot_power_limit(struct device_node *node, 654 + u8 *slot_power_limit_value, 655 + u8 *slot_power_limit_scale) 656 + { 657 + u32 slot_power_limit_mw; 658 + u8 value, scale; 659 + 660 + if (of_property_read_u32(node, "slot-power-limit-milliwatt", 661 + &slot_power_limit_mw)) 662 + slot_power_limit_mw = 0; 663 + 664 + /* Calculate Slot Power Limit Value and Slot Power Limit Scale */ 665 + if (slot_power_limit_mw == 0) { 666 + value = 0x00; 667 + scale = 0; 668 + } else if (slot_power_limit_mw <= 255) { 669 + value = slot_power_limit_mw; 670 + scale = 3; 671 + } else if (slot_power_limit_mw <= 255*10) { 672 + value = slot_power_limit_mw / 10; 673 + scale = 2; 674 + slot_power_limit_mw = slot_power_limit_mw / 10 * 10; 675 + } else if (slot_power_limit_mw <= 255*100) { 676 + value = slot_power_limit_mw / 100; 677 + scale = 1; 678 + slot_power_limit_mw = slot_power_limit_mw / 100 * 100; 679 + } else if (slot_power_limit_mw <= 239*1000) { 680 + value = slot_power_limit_mw / 1000; 681 + scale = 0; 682 + slot_power_limit_mw = slot_power_limit_mw / 1000 * 1000; 683 + } else if (slot_power_limit_mw < 250*1000) { 684 + value = 0xEF; 685 + scale = 0; 686 + slot_power_limit_mw = 239*1000; 687 + } else if (slot_power_limit_mw <= 600*1000) { 688 + value = 0xF0 + (slot_power_limit_mw / 1000 - 250) / 25; 689 + scale = 0; 690 + slot_power_limit_mw = slot_power_limit_mw / (1000*25) * (1000*25); 691 + } else { 692 + value = 0xFE; 693 + scale = 0; 694 + slot_power_limit_mw = 600*1000; 695 + } 696 + 697 + if (slot_power_limit_value) 698 + *slot_power_limit_value = value; 699 + 700 + if (slot_power_limit_scale) 701 + *slot_power_limit_scale = scale; 702 + 703 + return slot_power_limit_mw; 704 + } 705 + EXPORT_SYMBOL_GPL(of_pci_get_slot_power_limit);
+15 -10
drivers/pci/p2pdma.c
··· 326 326 }; 327 327 328 328 /* 329 - * This lookup function tries to find the PCI device corresponding to a given 330 - * host bridge. 329 + * If the first device on host's root bus is either devfn 00.0 or a PCIe 330 + * Root Port, return it. Otherwise return NULL. 331 331 * 332 - * It assumes the host bridge device is the first PCI device in the 333 - * bus->devices list and that the devfn is 00.0. These assumptions should hold 334 - * for all the devices in the whitelist above. 332 + * We often use a devfn 00.0 "host bridge" in the pci_p2pdma_whitelist[] 333 + * (though there is no PCI/PCIe requirement for such a device). On some 334 + * platforms, e.g., Intel Skylake, there is no such host bridge device, and 335 + * pci_p2pdma_whitelist[] may contain a Root Port at any devfn. 335 336 * 336 - * This function is equivalent to pci_get_slot(host->bus, 0), however it does 337 - * not take the pci_bus_sem lock seeing __host_bridge_whitelist() must not 337 + * This function is similar to pci_get_slot(host->bus, 0), but it does 338 + * not take the pci_bus_sem lock since __host_bridge_whitelist() must not 338 339 * sleep. 339 340 * 340 341 * For this to be safe, the caller should hold a reference to a device on the ··· 351 350 352 351 if (!root) 353 352 return NULL; 354 - if (root->devfn != PCI_DEVFN(0, 0)) 355 - return NULL; 356 353 357 - return root; 354 + if (root->devfn == PCI_DEVFN(0, 0)) 355 + return root; 356 + 357 + if (pci_pcie_type(root) == PCI_EXP_TYPE_ROOT_PORT) 358 + return root; 359 + 360 + return NULL; 358 361 } 359 362 360 363 static bool __host_bridge_whitelist(struct pci_host_bridge *host,
+30 -11
drivers/pci/pci-acpi.c
··· 974 974 975 975 bool acpi_pci_bridge_d3(struct pci_dev *dev) 976 976 { 977 - const union acpi_object *obj; 978 - struct acpi_device *adev; 979 977 struct pci_dev *rpdev; 978 + struct acpi_device *adev; 979 + acpi_status status; 980 + unsigned long long state; 981 + const union acpi_object *obj; 980 982 981 983 if (acpi_pci_disabled || !dev->is_hotplug_bridge) 982 984 return false; ··· 987 985 if (acpi_pci_power_manageable(dev)) 988 986 return true; 989 987 990 - /* 991 - * The ACPI firmware will provide the device-specific properties through 992 - * _DSD configuration object. Look for the 'HotPlugSupportInD3' property 993 - * for the root port and if it is set we know the hierarchy behind it 994 - * supports D3 just fine. 995 - */ 996 988 rpdev = pcie_find_root_port(dev); 997 989 if (!rpdev) 998 990 return false; ··· 995 999 if (!adev) 996 1000 return false; 997 1001 998 - if (acpi_dev_get_property(adev, "HotPlugSupportInD3", 999 - ACPI_TYPE_INTEGER, &obj) < 0) 1002 + /* 1003 + * If the Root Port cannot signal wakeup signals at all, i.e., it 1004 + * doesn't supply a wakeup GPE via _PRW, it cannot signal hotplug 1005 + * events from low-power states including D3hot and D3cold. 1006 + */ 1007 + if (!adev->wakeup.flags.valid) 1000 1008 return false; 1001 1009 1002 - return obj->integer.value == 1; 1010 + /* 1011 + * If the Root Port cannot wake itself from D3hot or D3cold, we 1012 + * can't use D3. 1013 + */ 1014 + status = acpi_evaluate_integer(adev->handle, "_S0W", NULL, &state); 1015 + if (ACPI_SUCCESS(status) && state < ACPI_STATE_D3_HOT) 1016 + return false; 1017 + 1018 + /* 1019 + * The "HotPlugSupportInD3" property in a Root Port _DSD indicates 1020 + * the Port can signal hotplug events while in D3. We assume any 1021 + * bridges *below* that Root Port can also signal hotplug events 1022 + * while in D3. 1023 + */ 1024 + if (!acpi_dev_get_property(adev, "HotPlugSupportInD3", 1025 + ACPI_TYPE_INTEGER, &obj) && 1026 + obj->integer.value == 1) 1027 + return true; 1028 + 1029 + return false; 1003 1030 } 1004 1031 1005 1032 int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
+32 -13
drivers/pci/pci-driver.c
··· 522 522 pci_clear_master(pci_dev); 523 523 } 524 524 525 - #ifdef CONFIG_PM 525 + #ifdef CONFIG_PM_SLEEP 526 526 527 - /* Auxiliary functions used for system resume and run-time resume. */ 527 + /* Auxiliary functions used for system resume */ 528 528 529 529 /** 530 530 * pci_restore_standard_config - restore standard config registers of PCI device ··· 544 544 pci_pme_restore(pci_dev); 545 545 return 0; 546 546 } 547 + #endif /* CONFIG_PM_SLEEP */ 548 + 549 + #ifdef CONFIG_PM 550 + 551 + /* Auxiliary functions used for system resume and run-time resume */ 547 552 548 553 static void pci_pm_default_resume(struct pci_dev *pci_dev) 549 554 { ··· 556 551 pci_enable_wake(pci_dev, PCI_D0, false); 557 552 } 558 553 559 - #endif 560 - 561 - #ifdef CONFIG_PM_SLEEP 562 - 563 - static void pci_pm_default_resume_early(struct pci_dev *pci_dev) 554 + static void pci_pm_power_up_and_verify_state(struct pci_dev *pci_dev) 564 555 { 565 556 pci_power_up(pci_dev); 566 557 pci_update_current_state(pci_dev, PCI_D0); 558 + } 559 + 560 + static void pci_pm_default_resume_early(struct pci_dev *pci_dev) 561 + { 562 + pci_pm_power_up_and_verify_state(pci_dev); 567 563 pci_restore_state(pci_dev); 568 564 pci_pme_restore(pci_dev); 569 565 } 566 + 567 + static void pci_pm_bridge_power_up_actions(struct pci_dev *pci_dev) 568 + { 569 + pci_bridge_wait_for_secondary_bus(pci_dev); 570 + /* 571 + * When powering on a bridge from D3cold, the whole hierarchy may be 572 + * powered on into D0uninitialized state, resume them to give them a 573 + * chance to suspend again 574 + */ 575 + pci_resume_bus(pci_dev->subordinate); 576 + } 577 + 578 + #endif /* CONFIG_PM */ 579 + 580 + #ifdef CONFIG_PM_SLEEP 570 581 571 582 /* 572 583 * Default "suspend" method for devices that have no driver provided suspend, ··· 955 934 pcie_pme_root_status_cleanup(pci_dev); 956 935 957 936 if (!skip_bus_pm && prev_state == PCI_D3cold) 958 - pci_bridge_wait_for_secondary_bus(pci_dev); 937 + pci_pm_bridge_power_up_actions(pci_dev); 959 938 960 939 if (pci_has_legacy_pm_support(pci_dev)) 961 940 return 0; ··· 1089 1068 * in case the driver's "freeze" callbacks put it into a low-power 1090 1069 * state. 1091 1070 */ 1092 - pci_set_power_state(pci_dev, PCI_D0); 1071 + pci_pm_power_up_and_verify_state(pci_dev); 1093 1072 pci_restore_state(pci_dev); 1094 1073 1095 1074 if (pci_has_legacy_pm_support(pci_dev)) ··· 1333 1312 * to a driver because although we left it in D0, it may have gone to 1334 1313 * D3cold when the bridge above it runtime suspended. 1335 1314 */ 1336 - pci_restore_standard_config(pci_dev); 1315 + pci_pm_default_resume_early(pci_dev); 1337 1316 1338 1317 if (!pci_dev->driver) 1339 1318 return 0; ··· 1342 1321 pci_pm_default_resume(pci_dev); 1343 1322 1344 1323 if (prev_state == PCI_D3cold) 1345 - pci_bridge_wait_for_secondary_bus(pci_dev); 1324 + pci_pm_bridge_power_up_actions(pci_dev); 1346 1325 1347 1326 if (pm && pm->runtime_resume) 1348 1327 error = pm->runtime_resume(dev); 1349 - 1350 - pci_dev->runtime_d3cold = false; 1351 1328 1352 1329 return error; 1353 1330 }
+204 -157
drivers/pci/pci.c
··· 1068 1068 } 1069 1069 1070 1070 /** 1071 - * pci_raw_set_power_state - Use PCI PM registers to set the power state of 1072 - * given PCI device 1073 - * @dev: PCI device to handle. 1074 - * @state: PCI power state (D0, D1, D2, D3hot) to put the device into. 1075 - * 1076 - * RETURN VALUE: 1077 - * -EINVAL if the requested state is invalid. 1078 - * -EIO if device does not support PCI PM or its PM capabilities register has a 1079 - * wrong version, or device doesn't support the requested state. 1080 - * 0 if device already is in the requested state. 1081 - * 0 if device's power state has been successfully changed. 1082 - */ 1083 - static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state) 1084 - { 1085 - u16 pmcsr; 1086 - bool need_restore = false; 1087 - 1088 - /* Check if we're already there */ 1089 - if (dev->current_state == state) 1090 - return 0; 1091 - 1092 - if (!dev->pm_cap) 1093 - return -EIO; 1094 - 1095 - if (state < PCI_D0 || state > PCI_D3hot) 1096 - return -EINVAL; 1097 - 1098 - /* 1099 - * Validate transition: We can enter D0 from any state, but if 1100 - * we're already in a low-power state, we can only go deeper. E.g., 1101 - * we can go from D1 to D3, but we can't go directly from D3 to D1; 1102 - * we'd have to go from D3 to D0, then to D1. 1103 - */ 1104 - if (state != PCI_D0 && dev->current_state <= PCI_D3cold 1105 - && dev->current_state > state) { 1106 - pci_err(dev, "invalid power transition (from %s to %s)\n", 1107 - pci_power_name(dev->current_state), 1108 - pci_power_name(state)); 1109 - return -EINVAL; 1110 - } 1111 - 1112 - /* Check if this device supports the desired state */ 1113 - if ((state == PCI_D1 && !dev->d1_support) 1114 - || (state == PCI_D2 && !dev->d2_support)) 1115 - return -EIO; 1116 - 1117 - pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1118 - if (PCI_POSSIBLE_ERROR(pmcsr)) { 1119 - pci_err(dev, "can't change power state from %s to %s (config space inaccessible)\n", 1120 - pci_power_name(dev->current_state), 1121 - pci_power_name(state)); 1122 - return -EIO; 1123 - } 1124 - 1125 - /* 1126 - * If we're (effectively) in D3, force entire word to 0. 1127 - * This doesn't affect PME_Status, disables PME_En, and 1128 - * sets PowerState to 0. 1129 - */ 1130 - switch (dev->current_state) { 1131 - case PCI_D0: 1132 - case PCI_D1: 1133 - case PCI_D2: 1134 - pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 1135 - pmcsr |= state; 1136 - break; 1137 - case PCI_D3hot: 1138 - case PCI_D3cold: 1139 - case PCI_UNKNOWN: /* Boot-up */ 1140 - if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot 1141 - && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) 1142 - need_restore = true; 1143 - fallthrough; /* force to D0 */ 1144 - default: 1145 - pmcsr = 0; 1146 - break; 1147 - } 1148 - 1149 - /* Enter specified state */ 1150 - pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); 1151 - 1152 - /* 1153 - * Mandatory power management transition delays; see PCI PM 1.1 1154 - * 5.6.1 table 18 1155 - */ 1156 - if (state == PCI_D3hot || dev->current_state == PCI_D3hot) 1157 - pci_dev_d3_sleep(dev); 1158 - else if (state == PCI_D2 || dev->current_state == PCI_D2) 1159 - udelay(PCI_PM_D2_DELAY); 1160 - 1161 - pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1162 - dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); 1163 - if (dev->current_state != state) 1164 - pci_info_ratelimited(dev, "refused to change power state from %s to %s\n", 1165 - pci_power_name(dev->current_state), 1166 - pci_power_name(state)); 1167 - 1168 - /* 1169 - * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT 1170 - * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning 1171 - * from D3hot to D0 _may_ perform an internal reset, thereby 1172 - * going to "D0 Uninitialized" rather than "D0 Initialized". 1173 - * For example, at least some versions of the 3c905B and the 1174 - * 3c556B exhibit this behaviour. 1175 - * 1176 - * At least some laptop BIOSen (e.g. the Thinkpad T21) leave 1177 - * devices in a D3hot state at boot. Consequently, we need to 1178 - * restore at least the BARs so that the device will be 1179 - * accessible to its driver. 1180 - */ 1181 - if (need_restore) 1182 - pci_restore_bars(dev); 1183 - 1184 - if (dev->bus->self) 1185 - pcie_aspm_pm_state_change(dev->bus->self); 1186 - 1187 - return 0; 1188 - } 1189 - 1190 - /** 1191 1071 * pci_update_current_state - Read power state of given device and cache it 1192 1072 * @dev: PCI device to handle. 1193 1073 * @state: State to cache in case the device doesn't have the PM capability ··· 1081 1201 */ 1082 1202 void pci_update_current_state(struct pci_dev *dev, pci_power_t state) 1083 1203 { 1084 - if (platform_pci_get_power_state(dev) == PCI_D3cold || 1085 - !pci_device_is_present(dev)) { 1204 + if (platform_pci_get_power_state(dev) == PCI_D3cold) { 1086 1205 dev->current_state = PCI_D3cold; 1087 1206 } else if (dev->pm_cap) { 1088 1207 u16 pmcsr; 1089 1208 1090 1209 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1091 - dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); 1210 + if (PCI_POSSIBLE_ERROR(pmcsr)) { 1211 + dev->current_state = PCI_D3cold; 1212 + return; 1213 + } 1214 + dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; 1092 1215 } else { 1093 1216 dev->current_state = state; 1094 1217 } ··· 1189 1306 /** 1190 1307 * pci_power_up - Put the given device into D0 1191 1308 * @dev: PCI device to power up 1309 + * 1310 + * On success, return 0 or 1, depending on whether or not it is necessary to 1311 + * restore the device's BARs subsequently (1 is returned in that case). 1192 1312 */ 1193 1313 int pci_power_up(struct pci_dev *dev) 1194 1314 { 1195 - pci_platform_power_transition(dev, PCI_D0); 1315 + bool need_restore; 1316 + pci_power_t state; 1317 + u16 pmcsr; 1196 1318 1197 - /* 1198 - * Mandatory power management transition delays are handled in 1199 - * pci_pm_resume_noirq() and pci_pm_runtime_resume() of the 1200 - * corresponding bridge. 1201 - */ 1202 - if (dev->runtime_d3cold) { 1203 - /* 1204 - * When powering on a bridge from D3cold, the whole hierarchy 1205 - * may be powered on into D0uninitialized state, resume them to 1206 - * give them a chance to suspend again 1207 - */ 1208 - pci_resume_bus(dev->subordinate); 1319 + platform_pci_set_power_state(dev, PCI_D0); 1320 + 1321 + if (!dev->pm_cap) { 1322 + state = platform_pci_get_power_state(dev); 1323 + if (state == PCI_UNKNOWN) 1324 + dev->current_state = PCI_D0; 1325 + else 1326 + dev->current_state = state; 1327 + 1328 + if (state == PCI_D0) 1329 + return 0; 1330 + 1331 + return -EIO; 1209 1332 } 1210 1333 1211 - return pci_raw_set_power_state(dev, PCI_D0); 1334 + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1335 + if (PCI_POSSIBLE_ERROR(pmcsr)) { 1336 + pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n", 1337 + pci_power_name(dev->current_state)); 1338 + dev->current_state = PCI_D3cold; 1339 + return -EIO; 1340 + } 1341 + 1342 + state = pmcsr & PCI_PM_CTRL_STATE_MASK; 1343 + 1344 + need_restore = (state == PCI_D3hot || dev->current_state >= PCI_D3hot) && 1345 + !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET); 1346 + 1347 + if (state == PCI_D0) 1348 + goto end; 1349 + 1350 + /* 1351 + * Force the entire word to 0. This doesn't affect PME_Status, disables 1352 + * PME_En, and sets PowerState to 0. 1353 + */ 1354 + pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, 0); 1355 + 1356 + /* Mandatory transition delays; see PCI PM 1.2. */ 1357 + if (state == PCI_D3hot) 1358 + pci_dev_d3_sleep(dev); 1359 + else if (state == PCI_D2) 1360 + udelay(PCI_PM_D2_DELAY); 1361 + 1362 + end: 1363 + dev->current_state = PCI_D0; 1364 + if (need_restore) 1365 + return 1; 1366 + 1367 + return 0; 1368 + } 1369 + 1370 + /** 1371 + * pci_set_full_power_state - Put a PCI device into D0 and update its state 1372 + * @dev: PCI device to power up 1373 + * 1374 + * Call pci_power_up() to put @dev into D0, read from its PCI_PM_CTRL register 1375 + * to confirm the state change, restore its BARs if they might be lost and 1376 + * reconfigure ASPM in acordance with the new power state. 1377 + * 1378 + * If pci_restore_state() is going to be called right after a power state change 1379 + * to D0, it is more efficient to use pci_power_up() directly instead of this 1380 + * function. 1381 + */ 1382 + static int pci_set_full_power_state(struct pci_dev *dev) 1383 + { 1384 + u16 pmcsr; 1385 + int ret; 1386 + 1387 + ret = pci_power_up(dev); 1388 + if (ret < 0) 1389 + return ret; 1390 + 1391 + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1392 + dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; 1393 + if (dev->current_state != PCI_D0) { 1394 + pci_info_ratelimited(dev, "Refused to change power state from %s to D0\n", 1395 + pci_power_name(dev->current_state)); 1396 + } else if (ret > 0) { 1397 + /* 1398 + * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT 1399 + * INTERFACE SPECIFICATION, REV. 1.2", a device transitioning 1400 + * from D3hot to D0 _may_ perform an internal reset, thereby 1401 + * going to "D0 Uninitialized" rather than "D0 Initialized". 1402 + * For example, at least some versions of the 3c905B and the 1403 + * 3c556B exhibit this behaviour. 1404 + * 1405 + * At least some laptop BIOSen (e.g. the Thinkpad T21) leave 1406 + * devices in a D3hot state at boot. Consequently, we need to 1407 + * restore at least the BARs so that the device will be 1408 + * accessible to its driver. 1409 + */ 1410 + pci_restore_bars(dev); 1411 + } 1412 + 1413 + if (dev->bus->self) 1414 + pcie_aspm_pm_state_change(dev->bus->self); 1415 + 1416 + return 0; 1212 1417 } 1213 1418 1214 1419 /** ··· 1321 1350 { 1322 1351 if (bus) 1323 1352 pci_walk_bus(bus, __pci_dev_set_current_state, &state); 1353 + } 1354 + 1355 + /** 1356 + * pci_set_low_power_state - Put a PCI device into a low-power state. 1357 + * @dev: PCI device to handle. 1358 + * @state: PCI power state (D1, D2, D3hot) to put the device into. 1359 + * 1360 + * Use the device's PCI_PM_CTRL register to put it into a low-power state. 1361 + * 1362 + * RETURN VALUE: 1363 + * -EINVAL if the requested state is invalid. 1364 + * -EIO if device does not support PCI PM or its PM capabilities register has a 1365 + * wrong version, or device doesn't support the requested state. 1366 + * 0 if device already is in the requested state. 1367 + * 0 if device's power state has been successfully changed. 1368 + */ 1369 + static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state) 1370 + { 1371 + u16 pmcsr; 1372 + 1373 + if (!dev->pm_cap) 1374 + return -EIO; 1375 + 1376 + /* 1377 + * Validate transition: We can enter D0 from any state, but if 1378 + * we're already in a low-power state, we can only go deeper. E.g., 1379 + * we can go from D1 to D3, but we can't go directly from D3 to D1; 1380 + * we'd have to go from D3 to D0, then to D1. 1381 + */ 1382 + if (dev->current_state <= PCI_D3cold && dev->current_state > state) { 1383 + pci_dbg(dev, "Invalid power transition (from %s to %s)\n", 1384 + pci_power_name(dev->current_state), 1385 + pci_power_name(state)); 1386 + return -EINVAL; 1387 + } 1388 + 1389 + /* Check if this device supports the desired state */ 1390 + if ((state == PCI_D1 && !dev->d1_support) 1391 + || (state == PCI_D2 && !dev->d2_support)) 1392 + return -EIO; 1393 + 1394 + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1395 + if (PCI_POSSIBLE_ERROR(pmcsr)) { 1396 + pci_err(dev, "Unable to change power state from %s to %s, device inaccessible\n", 1397 + pci_power_name(dev->current_state), 1398 + pci_power_name(state)); 1399 + dev->current_state = PCI_D3cold; 1400 + return -EIO; 1401 + } 1402 + 1403 + pmcsr &= ~PCI_PM_CTRL_STATE_MASK; 1404 + pmcsr |= state; 1405 + 1406 + /* Enter specified state */ 1407 + pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); 1408 + 1409 + /* Mandatory power management transition delays; see PCI PM 1.2. */ 1410 + if (state == PCI_D3hot) 1411 + pci_dev_d3_sleep(dev); 1412 + else if (state == PCI_D2) 1413 + udelay(PCI_PM_D2_DELAY); 1414 + 1415 + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); 1416 + dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; 1417 + if (dev->current_state != state) 1418 + pci_info_ratelimited(dev, "Refused to change power state from %s to %s\n", 1419 + pci_power_name(dev->current_state), 1420 + pci_power_name(state)); 1421 + 1422 + if (dev->bus->self) 1423 + pcie_aspm_pm_state_change(dev->bus->self); 1424 + 1425 + return 0; 1324 1426 } 1325 1427 1326 1428 /** ··· 1437 1393 return 0; 1438 1394 1439 1395 if (state == PCI_D0) 1440 - return pci_power_up(dev); 1396 + return pci_set_full_power_state(dev); 1441 1397 1442 1398 /* 1443 1399 * This device is quirked not to be put into D3, so don't put it in ··· 1446 1402 if (state >= PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3)) 1447 1403 return 0; 1448 1404 1449 - /* 1450 - * To put device in D3cold, we put device into D3hot in native 1451 - * way, then put device into D3cold with platform ops 1452 - */ 1453 - error = pci_raw_set_power_state(dev, state > PCI_D3hot ? 1454 - PCI_D3hot : state); 1405 + if (state == PCI_D3cold) { 1406 + /* 1407 + * To put the device in D3cold, put it into D3hot in the native 1408 + * way, then put it into D3cold using platform ops. 1409 + */ 1410 + error = pci_set_low_power_state(dev, PCI_D3hot); 1455 1411 1456 - if (pci_platform_power_transition(dev, state)) 1457 - return error; 1412 + if (pci_platform_power_transition(dev, PCI_D3cold)) 1413 + return error; 1458 1414 1459 - /* Powering off a bridge may power off the whole hierarchy */ 1460 - if (state == PCI_D3cold) 1461 - pci_bus_set_current_state(dev->subordinate, PCI_D3cold); 1415 + /* Powering off a bridge may power off the whole hierarchy */ 1416 + if (dev->current_state == PCI_D3cold) 1417 + pci_bus_set_current_state(dev->subordinate, PCI_D3cold); 1418 + } else { 1419 + error = pci_set_low_power_state(dev, state); 1420 + 1421 + if (pci_platform_power_transition(dev, state)) 1422 + return error; 1423 + } 1462 1424 1463 1425 return 0; 1464 1426 } ··· 2768 2718 if (target_state == PCI_POWER_ERROR) 2769 2719 return -EIO; 2770 2720 2771 - dev->runtime_d3cold = target_state == PCI_D3cold; 2772 - 2773 2721 /* 2774 2722 * There are systems (for example, Intel mobile chips since Coffee 2775 2723 * Lake) where the power drawn while suspended can be significantly ··· 2785 2737 if (error) { 2786 2738 pci_enable_wake(dev, target_state, false); 2787 2739 pci_restore_ptm_state(dev); 2788 - dev->runtime_d3cold = false; 2789 2740 } 2790 2741 2791 2742 return error; ··· 5160 5113 5161 5114 void pci_dev_lock(struct pci_dev *dev) 5162 5115 { 5163 - pci_cfg_access_lock(dev); 5164 5116 /* block PM suspend, driver probe, etc. */ 5165 5117 device_lock(&dev->dev); 5118 + pci_cfg_access_lock(dev); 5166 5119 } 5167 5120 EXPORT_SYMBOL_GPL(pci_dev_lock); 5168 5121 5169 5122 /* Return 1 on successful lock, 0 on contention */ 5170 5123 int pci_dev_trylock(struct pci_dev *dev) 5171 5124 { 5172 - if (pci_cfg_access_trylock(dev)) { 5173 - if (device_trylock(&dev->dev)) 5125 + if (device_trylock(&dev->dev)) { 5126 + if (pci_cfg_access_trylock(dev)) 5174 5127 return 1; 5175 - pci_cfg_access_unlock(dev); 5128 + device_unlock(&dev->dev); 5176 5129 } 5177 5130 5178 5131 return 0; ··· 5181 5134 5182 5135 void pci_dev_unlock(struct pci_dev *dev) 5183 5136 { 5184 - device_unlock(&dev->dev); 5185 5137 pci_cfg_access_unlock(dev); 5138 + device_unlock(&dev->dev); 5186 5139 } 5187 5140 EXPORT_SYMBOL_GPL(pci_dev_unlock); 5188 5141
+15
drivers/pci/pci.h
··· 627 627 int of_pci_parse_bus_range(struct device_node *node, struct resource *res); 628 628 int of_get_pci_domain_nr(struct device_node *node); 629 629 int of_pci_get_max_link_speed(struct device_node *node); 630 + u32 of_pci_get_slot_power_limit(struct device_node *node, 631 + u8 *slot_power_limit_value, 632 + u8 *slot_power_limit_scale); 630 633 void pci_set_of_node(struct pci_dev *dev); 631 634 void pci_release_of_node(struct pci_dev *dev); 632 635 void pci_set_bus_of_node(struct pci_bus *bus); ··· 654 651 of_pci_get_max_link_speed(struct device_node *node) 655 652 { 656 653 return -EINVAL; 654 + } 655 + 656 + static inline u32 657 + of_pci_get_slot_power_limit(struct device_node *node, 658 + u8 *slot_power_limit_value, 659 + u8 *slot_power_limit_scale) 660 + { 661 + if (slot_power_limit_value) 662 + *slot_power_limit_value = 0; 663 + if (slot_power_limit_scale) 664 + *slot_power_limit_scale = 0; 665 + return 0; 657 666 } 658 667 659 668 static inline void pci_set_of_node(struct pci_dev *dev) { }
+6 -1
drivers/pci/pcie/aer.c
··· 101 101 #define ERR_COR_ID(d) (d & 0xffff) 102 102 #define ERR_UNCOR_ID(d) (d >> 16) 103 103 104 + #define AER_ERR_STATUS_MASK (PCI_ERR_ROOT_UNCOR_RCV | \ 105 + PCI_ERR_ROOT_COR_RCV | \ 106 + PCI_ERR_ROOT_MULTI_COR_RCV | \ 107 + PCI_ERR_ROOT_MULTI_UNCOR_RCV) 108 + 104 109 static int pcie_aer_disable; 105 110 static pci_ers_result_t aer_root_reset(struct pci_dev *dev); 106 111 ··· 1201 1196 struct aer_err_source e_src = {}; 1202 1197 1203 1198 pci_read_config_dword(rp, aer + PCI_ERR_ROOT_STATUS, &e_src.status); 1204 - if (!(e_src.status & (PCI_ERR_ROOT_UNCOR_RCV|PCI_ERR_ROOT_COR_RCV))) 1199 + if (!(e_src.status & AER_ERR_STATUS_MASK)) 1205 1200 return IRQ_NONE; 1206 1201 1207 1202 pci_read_config_dword(rp, aer + PCI_ERR_ROOT_ERR_SRC, &e_src.id);
+47
drivers/pci/quirks.c
··· 12 12 * file, where their drivers can use them. 13 13 */ 14 14 15 + #include <linux/bitfield.h> 15 16 #include <linux/types.h> 16 17 #include <linux/kernel.h> 17 18 #include <linux/export.h> ··· 5896 5895 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1536, rom_bar_overlap_defect); 5897 5896 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1537, rom_bar_overlap_defect); 5898 5897 DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1538, rom_bar_overlap_defect); 5898 + 5899 + #ifdef CONFIG_PCIEASPM 5900 + /* 5901 + * Several Intel DG2 graphics devices advertise that they can only tolerate 5902 + * 1us latency when transitioning from L1 to L0, which may prevent ASPM L1 5903 + * from being enabled. But in fact these devices can tolerate unlimited 5904 + * latency. Override their Device Capabilities value to allow ASPM L1 to 5905 + * be enabled. 5906 + */ 5907 + static void aspm_l1_acceptable_latency(struct pci_dev *dev) 5908 + { 5909 + u32 l1_lat = FIELD_GET(PCI_EXP_DEVCAP_L1, dev->devcap); 5910 + 5911 + if (l1_lat < 7) { 5912 + dev->devcap |= FIELD_PREP(PCI_EXP_DEVCAP_L1, 7); 5913 + pci_info(dev, "ASPM: overriding L1 acceptable latency from %#x to 0x7\n", 5914 + l1_lat); 5915 + } 5916 + } 5917 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f80, aspm_l1_acceptable_latency); 5918 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f81, aspm_l1_acceptable_latency); 5919 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f82, aspm_l1_acceptable_latency); 5920 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f83, aspm_l1_acceptable_latency); 5921 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f84, aspm_l1_acceptable_latency); 5922 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f85, aspm_l1_acceptable_latency); 5923 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f86, aspm_l1_acceptable_latency); 5924 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f87, aspm_l1_acceptable_latency); 5925 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4f88, aspm_l1_acceptable_latency); 5926 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5690, aspm_l1_acceptable_latency); 5927 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5691, aspm_l1_acceptable_latency); 5928 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5692, aspm_l1_acceptable_latency); 5929 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5693, aspm_l1_acceptable_latency); 5930 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5694, aspm_l1_acceptable_latency); 5931 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x5695, aspm_l1_acceptable_latency); 5932 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a0, aspm_l1_acceptable_latency); 5933 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a1, aspm_l1_acceptable_latency); 5934 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a2, aspm_l1_acceptable_latency); 5935 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a3, aspm_l1_acceptable_latency); 5936 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a4, aspm_l1_acceptable_latency); 5937 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a5, aspm_l1_acceptable_latency); 5938 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56a6, aspm_l1_acceptable_latency); 5939 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56b0, aspm_l1_acceptable_latency); 5940 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56b1, aspm_l1_acceptable_latency); 5941 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56c0, aspm_l1_acceptable_latency); 5942 + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x56c1, aspm_l1_acceptable_latency); 5943 + #endif
-4
include/linux/pci.h
··· 379 379 unsigned int mmio_always_on:1; /* Disallow turning off io/mem 380 380 decoding during BAR sizing */ 381 381 unsigned int wakeup_prepared:1; 382 - unsigned int runtime_d3cold:1; /* Whether go through runtime 383 - D3cold, not set for devices 384 - powered on/off by the 385 - corresponding bridge */ 386 382 unsigned int skip_bus_pm:1; /* Internal: Skip bus-level PM */ 387 383 unsigned int ignore_hotplug:1; /* Ignore hotplug events */ 388 384 unsigned int hotplug_user_indicators:1; /* SlotCtl indicators
+1
include/uapi/linux/pci_regs.h
··· 616 616 #define PCI_EXP_SLTCTL_PWR_OFF 0x0400 /* Power Off */ 617 617 #define PCI_EXP_SLTCTL_EIC 0x0800 /* Electromechanical Interlock Control */ 618 618 #define PCI_EXP_SLTCTL_DLLSCE 0x1000 /* Data Link Layer State Changed Enable */ 619 + #define PCI_EXP_SLTCTL_ASPL_DISABLE 0x2000 /* Auto Slot Power Limit Disable */ 619 620 #define PCI_EXP_SLTCTL_IBPD_DISABLE 0x4000 /* In-band PD disable */ 620 621 #define PCI_EXP_SLTSTA 0x1a /* Slot Status */ 621 622 #define PCI_EXP_SLTSTA_ABP 0x0001 /* Attention Button Pressed */