Clint Sbisa
8c46d543aa
PCI: Update mmap-related #ifdef comments
...
f719582435
("PCI: Add pci_mmap_resource_range() and use it for ARM64")
changed the #ifdef condition around pci_create_resource_files(),
pci_remove_resource_files(), and related functions, but did not update
comments at the #else and #ifdef.
Update the comments to match the #ifdef.
[bhelgaas: commit log, drop #endif comment since it's close to the #else]
Link: https://lore.kernel.org/r/20200821155121.nzxjeeoze4h5pone@amazon.com
Signed-off-by: Clint Sbisa <csbisa@amazon.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
2020-09-17 12:40:25 -05:00
Dongdong Liu
7b6f224088
PCI/LINK: Print IRQ number used by port
...
Print the IRQ used by PCIe Link Bandwidth Notification services port as
AER, PME and DPC do. It provides convenience to track PCIe BW notification
interrupt counts of certain port from /proc/interrupts.
The dmesg log is as below:
pcieport 0000:00:00.0: bw_notification: enabled with IRQ 1166
Link: https://lore.kernel.org/r/1599737055-73624-1-git-send-email-liudongdong3@huawei.com
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
2020-09-17 12:40:25 -05:00
Liu Shixin
462bd2fdf5
PCI/IOV: Simplify pci-pf-stub with module_pci_driver()
...
Use the module_pci_driver() macro to make the code simpler by eliminating
module_init() and module_exit() calls.
Link: https://lore.kernel.org/r/20200917071042.1909191-1-liushixin2@huawei.com
Signed-off-by: Liu Shixin <liushixin2@huawei.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
Acked-by: Alexander Duyck <alexander.h.duyck@linux.intel.com >
2020-09-17 12:40:20 -05:00
Tuan Phan
877c1a5f79
PCI/ACPI: Add Ampere Altra SOC MCFG quirk
...
Ampere Altra SOC supports only 32-bit ECAM reads. Add an MCFG quirk for
the platform.
Link: https://lore.kernel.org/r/1596751055-12316-1-git-send-email-tuanphan@os.amperecomputing.com
Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
2020-09-17 12:27:43 -05:00
Jiang Biao
2ce02a864a
PCI: Add schedule point in pci_read_config()
...
The PCI sysfs "config" file allows large reads, and the resulting PCI
config reads can take several milliseconds to complete. Testing with the
cyclictest [1] benchmark showed 5ms+ latencies.
Add a schedule point in pci_read_config() to reduce the maximum latency.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/clrkwllms/rt-tests.git/
[bhelgaas: commit log]
Link: https://lore.kernel.org/r/20200824052025.48362-1-benbjiang@tencent.com
Reported-by: Bin Lai <robinlai@tencent.com >
Signed-off-by: Jiang Biao <benbjiang@tencent.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
2020-09-17 12:21:46 -05:00
Jim Quinlan
04356ac307
PCI: brcmstb: Add bcm7278 PERST# support
...
The PERST# bit was moved to a different register in 7278-type STB chips.
In addition, the polarity of the bit was also changed; for other chips
writing a 1 specified assert; for 7278-type chips, writing a 0 specifies
assert. Of course, PERST# is a PCIe asserted-low signal.
While we are here, also change the bridge_sw_init_set() functions so like
the perst_set() functions they are chip specific and we no longer rely on
data wrt chip specific field mask and shift values.
Link: https://lore.kernel.org/r/20200911175232.19016-6-james.quinlan@broadcom.com
Signed-off-by: Jim Quinlan <jquinlan@broadcom.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Reviewed-by: Rob Herring <robh@kernel.org >
Acked-by: Florian Fainelli <f.fainelli@gmail.com >
2020-09-17 12:30:38 +01:00
Jim Quinlan
8195b74170
PCI: brcmstb: Add suspend and resume pm_ops
...
Broadcom Set-top (BrcmSTB) boards typically support S2, S3, and S5 suspend
and resume. Now the PCIe driver may do so as well.
Link: https://lore.kernel.org/r/20200911175232.19016-5-james.quinlan@broadcom.com
Signed-off-by: Jim Quinlan <jquinlan@broadcom.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Reviewed-by: Rob Herring <robh@kernel.org >
Acked-by: Florian Fainelli <f.fainelli@gmail.com >
2020-09-17 12:30:38 +01:00
Jim Quinlan
1cf1b0a6dd
PCI: brcmstb: Add bcm7278 register info
...
Add in compatibility strings and code for three Broadcom STB chips. Some
of the register locations, shifts, and masks are different for certain
chips, requiring the use of different constants based on of_id.
We would like to add the following at this time to the match list but we
need to wait until the end of this patchset so that everything works.
{ .compatible = "brcm,bcm7211-pcie", .data = &generic_cfg },
{ .compatible = "brcm,bcm7278-pcie", .data = &bcm7278_cfg },
{ .compatible = "brcm,bcm7216-pcie", .data = &bcm7278_cfg },
{ .compatible = "brcm,bcm7445-pcie", .data = &generic_cfg },
Link: https://lore.kernel.org/r/20200911175232.19016-4-james.quinlan@broadcom.com
Signed-off-by: Jim Quinlan <jquinlan@broadcom.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Acked-by: Florian Fainelli <f.fainelli@gmail.com >
Acked-by: Rob Herring <robh@kernel.org >
2020-09-17 12:30:38 +01:00
Jim Quinlan
b927ad3405
PCI: brcmstb: PCIE_BRCMSTB depends on ARCH_BRCMSTB
...
Have PCIE_BRCMSTB depend on ARCH_BRCMSTB. Also set the default value to
ARCH_BRCMSTB.
Link: https://lore.kernel.org/r/20200911175232.19016-2-james.quinlan@broadcom.com
Signed-off-by: Jim Quinlan <jquinlan@broadcom.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Reviewed-by: Rob Herring <robh@kernel.org >
Acked-by: Florian Fainelli <f.fainelli@gmail.com >
2020-09-17 12:30:38 +01:00
Rajat Jain
76fc8e854e
PCI/ACS: Enable Translation Blocking for external devices
...
Translation Blocking is a required feature for Downstream Ports (Root
Ports or Switch Downstream Ports) that implement ACS. When enabled, the
Port checks the Address Type (AT) of each upstream Memory Request it
receives.
The default AT (00b) means "untranslated" and the IOMMU can decide whether
to treat the address as I/O virtual or physical.
If AT is not the default, i.e., if the Memory Request contains an
already-translated (physical) address, the Port blocks the request and
reports an ACS error.
When enabling ACS, enable Translation Blocking for external-facing ports
and untrusted (external) devices. This is to help prevent attacks from
external devices that initiate DMA with physical addresses that bypass the
IOMMU.
[bhelgaas: commit log, simplify setting bit and drop warning; TB is
required for Downstream Ports with ACS, so we should never see the warning]
Link: https://lore.kernel.org/r/20200707224604.3737893-4-rajatja@google.com
Signed-off-by: Rajat Jain <rajatja@google.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
2020-09-16 16:42:22 -05:00
Thomas Gleixner
077ee78e39
PCI/MSI: Make arch_.*_msi_irq[s] fallbacks selectable
...
The arch_.*_msi_irq[s] fallbacks are compiled in whether an architecture
requires them or not. Architectures which are fully utilizing hierarchical
irq domains should never call into that code.
It's not only architectures which depend on that by implementing one or
more of the weak functions, there is also a bunch of drivers which relies
on the weak functions which invoke msi_controller::setup_irq[s] and
msi_controller::teardown_irq.
Make the architectures and drivers which rely on them select them in Kconfig
and if not selected replace them by stub functions which emit a warning and
fail the PCI/MSI interrupt allocation.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Link: https://lore.kernel.org/r/20200826112333.992429909@linutronix.de
2020-09-16 16:52:37 +02:00
Thomas Gleixner
2fd602669e
PCI/MSI: Provide pci_dev_has_special_msi_domain() helper
...
Provide a helper function to check whether a PCI device is handled by a
non-standard PCI/MSI domain. This will be used to exclude such devices
which hang of a special bus, e.g. VMD, to be excluded from the irq domain
override in irq remapping.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Link: https://lore.kernel.org/r/20200826112333.139387358@linutronix.de
2020-09-16 16:52:36 +02:00
Thomas Gleixner
d7f954e540
PCI_vmd_Mark_VMD_irqdomain_with_DOMAIN_BUS_VMD_MSI
...
Devices on the VMD bus use their own MSI irq domain, but it is not
distinguishable from regular PCI/MSI irq domains. This is required
to exclude VMD devices from getting the irq domain pointer set by
interrupt remapping.
Override the default bus token.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Acked-by: Joerg Roedel <jroedel@suse.de >
Link: https://lore.kernel.org/r/20200826112333.047315047@linutronix.de
2020-09-16 16:52:36 +02:00
Thomas Gleixner
9006c133a4
x86/msi: Use generic MSI domain ops
...
pci_msi_get_hwirq() and pci_msi_set_desc are not longer special. Enable the
generic MSI domain ops in the core and PCI MSI code unconditionally and get
rid of the x86 specific implementations in the X86 MSI code and in the
hyperv PCI driver.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Reviewed-by: Marc Zyngier <maz@kernel.org >
Link: https://lore.kernel.org/r/20200826112332.564274859@linutronix.de
2020-09-16 16:52:35 +02:00
Thomas Gleixner
3b9c1d377d
x86/msi: Consolidate MSI allocation
...
Convert the interrupt remap drivers to retrieve the pci device from the msi
descriptor and use info::hwirq.
This is the first step to prepare x86 for using the generic MSI domain ops.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Wei Liu <wei.liu@kernel.org >
Acked-by: Joerg Roedel <jroedel@suse.de >
Link: https://lore.kernel.org/r/20200826112332.466405395@linutronix.de
2020-09-16 16:52:35 +02:00
Thomas Gleixner
dfb9eb7cf6
PCI/MSI: Rework pci_msi_domain_calc_hwirq()
...
Retrieve the PCI device from the msi descriptor instead of doing so at the
call sites.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
Acked-by: Marc Zyngier <maz@kernel.org >
Link: https://lore.kernel.org/r/20200826112332.352583299@linutronix.de
2020-09-16 16:52:34 +02:00
Thomas Gleixner
585dfe8abc
PCI: vmd: Dont abuse vector irqomain as parent
...
VMD has it's own PCI/MSI interrupt domain which is not in any way depending
on the x86 vector domain. PCI devices behind VMD share the VMD MSIX vector
entries via a VMD specific message translation to the actual VMD MSIX
vector. The VMD device interrupt handler for the VMD MSIX vectors invokes
all interrupt handlers of the devices which share a vector.
Making the x86 vector domain the actual parent of the VMD irq domain is
pointless and actually counterproductive. When a device interrupt is
requested then it will activate the interrupt which traverses down the
hierarchy and consumes an interrupt vector in the vector domain which is
never used.
The domain is self contained and has no parent dependencies, so just hand
in NULL for the parent and be done with it.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de >
Link: https://lore.kernel.org/r/20200826112330.928952181@linutronix.de
2020-09-16 16:52:28 +02:00
Yicong Yang
acb52897cc
PCI: hip: Add handling of HiSilicon HIP PCIe controller errors
...
The HiSilicon HIP PCIe controller is capable of handling errors
on root port and performing port reset separately at each root port.
Add error handling driver for HIP PCIe controller to log
and report recoverable errors. Perform root port reset and restore
link status after the recovery.
Following are some of the PCIe controller's recoverable errors
1. completion transmission timeout error.
2. CRS retry counter over the threshold error.
3. ECC 2 bit errors
4. AXI bresponse/rresponse errors etc.
The driver placed in the drivers/pci/controller/ because the
HIP PCIe controller does not use DWC IP.
Link: https://lore.kernel.org/r/20200903123456.1823-3-shiju.jose@huawei.com
Signed-off-by: Yicong Yang <yangyicong@hisilicon.com >
Signed-off-by: Shiju Jose <shiju.jose@huawei.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Acked-by: Bjorn Helgaas <bhelgaas@google.com >
2020-09-16 10:30:42 +01:00
Rob Herring
fdd056ff7a
PCI: dwc: Use DBI accessors
...
Convert the remaining cases of register accesses using dbi_base rather
than dw_pcie_(read|write)[bwl]_dbi accessors.
Link: https://lore.kernel.org/r/20200821035420.380495-41-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Pratyush Anand <pratyush.anand@gmail.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-tegra@vger.kernel.org
2020-09-10 16:50:53 +01:00
Rob Herring
aeaa0bfe89
PCI: dwc: Move N_FTS setup to common setup
...
The Designware controller has common registers to set number of fast
training sequence ordered sets. The Artpec6, Intel, and Tegra driver
initialize these register fields. Let's move the initialization to the
common setup code and drivers just have to provide the value.
There's a slight change in that the common clock mode N_FTS field is
now initialized. Previously only the Intel driver set this. It's not
clear from the code if common clock mode is used in the Artpec6 or Tegra
driver. It depends on the DWC configuration. Given the field is not
initialized while the others are, it seems unlikely common clock mode
is used.
Link: https://lore.kernel.org/r/20200821035420.380495-40-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jesper Nilsson <jesper.nilsson@axis.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-tegra@vger.kernel.org
2020-09-10 16:50:53 +01:00
Rob Herring
d439e7edd1
PCI: dwc/intel-gw: Drop unused max_width
...
'max_width' is read, but never used, so let's remove it.
Link: https://lore.kernel.org/r/20200821035420.380495-39-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Dilip Kota <eswara.kota@linux.intel.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-10 16:50:53 +01:00
Rob Herring
cf854be2d9
PCI: dwc/intel-gw: Move getting PCI_CAP_ID_EXP offset to intel_pcie_link_setup()
...
The PCI_CAP_ID_EXP offset is only needed by intel_pcie_link_setup(), so
let's retrieve it there and avoid storing the offset.
Link: https://lore.kernel.org/r/20200821035420.380495-38-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Dilip Kota <eswara.kota@linux.intel.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-10 16:50:53 +01:00
Rob Herring
b02b06a74b
PCI: dwc/intel-gw: Drop unnecessary checking of DT 'device_type' property
...
A driver doesn't need to check for DT 'device_type' property, so let's
remove the check.
Link: https://lore.kernel.org/r/20200821035420.380495-37-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Dilip Kota <eswara.kota@linux.intel.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-10 16:50:53 +01:00
Rob Herring
441e48fdf0
PCI: dwc: Set PORT_LINK_DLL_LINK_EN in common setup code
...
The Intel driver is the only one to set PORT_LINK_DLL_LINK_EN. The
default value is set and it seems pretty certain that enabling link
initialization is always required. Maybe it could just be dropped from
the Intel driver, but lets move setting it into the common code to be
sure.
Link: https://lore.kernel.org/r/20200821035420.380495-36-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Dilip Kota <eswara.kota@linux.intel.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-10 16:50:53 +01:00
Rob Herring
39bc500650
PCI: dwc: Centralize link gen setting
...
keystone would force gen2 if no DT property. Now it relies on the
PCI_EXP_LNKCAP value.
Link: https://lore.kernel.org/r/20200821035420.380495-35-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Kishon Vijay Abraham I <kishon@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Richard Zhu <hongxing.zhu@nxp.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Stanimir Varbanov <svarbanov@mm-sol.com >
Cc: Andy Gross <agross@kernel.org >
Cc: Bjorn Andersson <bjorn.andersson@linaro.org >
Cc: Pratyush Anand <pratyush.anand@gmail.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-tegra@vger.kernel.org
2020-09-10 16:50:54 +01:00
Lorenzo Pieralisi
e338eecf3f
PCI: rockchip: Fix bus checks in rockchip_pcie_valid_device()
...
The root bus checks rework in d84c572de1
("PCI: rockchip: Use
pci_is_root_bus() to check if bus is root bus") caused a regression whereby
in rockchip_pcie_valid_device() if the bus parameter is the root bus and
the dev value == 0, the function should return 1 (ie true) without checking
if the bus->parent pointer is a root bus because that triggers a NULL
pointer dereference.
Fix this by streamlining the root bus detection.
Fixes: d84c572de1
("PCI: rockchip: Use pci_is_root_bus() to check if bus is root bus")
Link: https://lore.kernel.org/r/20200904140904.944-1-lorenzo.pieralisi@arm.com
Reported-by: Samuel Dionne-Riel <samuel@dionne-riel.com >
Tested-by: Samuel Dionne-Riel <samuel@dionne-riel.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com >
Reviewed-by: Rob Herring <robh@kernel.org >
Cc: Shawn Lin <shawn.lin@rock-chips.com >
2020-09-08 16:52:42 -05:00
Mark Tomlinson
eb7eacaa5b
PCI: iproc: Set affinity mask on MSI interrupts
...
The core interrupt code expects the irq_set_affinity call to update the
effective affinity for the interrupt. This was not being done, so update
iproc_msi_irq_set_affinity() to do so.
Link: https://lore.kernel.org/r/20200803035241.7737-1-mark.tomlinson@alliedtelesis.co.nz
Fixes: 3bc2b23488
("PCI: iproc: Add iProc PCIe MSI support")
Signed-off-by: Mark Tomlinson <mark.tomlinson@alliedtelesis.co.nz >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Reviewed-by: Ray Jui <ray.jui@broadcom.com >
2020-09-08 22:04:27 +01:00
Lorenzo Pieralisi
d5071f086b
PCI: mvebu: Remove useless msi_controller pointer allocation
...
The mvebu host controller driver allocates an msi_controller structure
pointer without allocating the structure and initializing its methods,
which makes the pointer useless.
This means that the PCI IRQ MSI layer ignores it and that after all it
should not really be needed.
Remove it.
Link: https://lore.kernel.org/r/20200904142132.6054-1-lorenzo.pieralisi@arm.com
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Reviewed-by: Rob Herring <robh@kernel.org >
Cc: Rob Herring <robh@kernel.org >
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com >
2020-09-08 22:02:20 +01:00
Rob Herring
b04a6b9d39
PCI: dwc: Make ATU accessors private
...
The ATU registers are only accessed in pcie-designware.c and can be private
to it.
Link: https://lore.kernel.org/r/20200821035420.380495-34-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
903d69f83c
PCI: dwc: Remove read_dbi2 code
...
The DBI2 appears to be write-only and there's no read accesses in the code
anyways, so let's remove all the read_dbi2 related code.
Link: https://lore.kernel.org/r/20200821035420.380495-33-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
2020-09-08 16:37:02 +01:00
Rob Herring
84667a416d
PCI: dwc/tegra: Use common Designware port logic register definitions
...
The Tegra driver has its own defines for common Designware Port Logic
registers. Convert it to use the standard register definitions.
Link: https://lore.kernel.org/r/20200821035420.380495-32-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-tegra@vger.kernel.org
2020-09-08 16:37:02 +01:00
Rob Herring
fb76523271
PCI: dwc: Remove hardcoded PCI_CAP_ID_EXP offset
...
While the Designware controller appears to hard code the PCI_CAP_ID_EXP
capability register at 0x70, there's no need to hard code this in the
driver as it is discoverable.
Link: https://lore.kernel.org/r/20200821035420.380495-31-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Kishon Vijay Abraham I <kishon@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Pratyush Anand <pratyush.anand@gmail.com >
Cc: linux-omap@vger.kernel.org
2020-09-08 16:37:02 +01:00
Rob Herring
7b87ddc04b
PCI: dwc/qcom: Use common PCI register definitions
...
The QCom driver has its own defines for common PCI config space
registers. It also hard codes the capability register offsets which are
discoverable. Convert it to use the standard register definitions.
Link: https://lore.kernel.org/r/20200821035420.380495-30-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Stanimir Varbanov <svarbanov@mm-sol.com >
Cc: Andy Gross <agross@kernel.org >
Cc: Bjorn Andersson <bjorn.andersson@linaro.org >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: linux-arm-msm@vger.kernel.org
2020-09-08 16:37:02 +01:00
Rob Herring
201a8df899
PCI: dwc/imx6: Use common PCI register definitions
...
The i.MX6 driver has its own defines for common PCI config space
registers. It also hard codes the capability register offsets which are
discoverable. Convert it to use the standard register definitions.
Link: https://lore.kernel.org/r/20200821035420.380495-29-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Richard Zhu <hongxing.zhu@nxp.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
2020-09-08 16:37:02 +01:00
Rob Herring
2f2cea1ea7
PCI: dwc/meson: Rework PCI config and DW port logic register accesses
...
The meson 'elbi' registers are just the Designware 'dbi' space and all
the registers accessed are either standard PCI config space or DWC port
logic registers. Convert the accesses to use the common defines and
register accessors.
Link: https://lore.kernel.org/r/20200821035420.380495-28-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Yue Wang <yue.wang@Amlogic.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: linux-amlogic@lists.infradead.org
2020-09-08 16:37:02 +01:00
Rob Herring
15efab2b89
PCI: dwc/meson: Drop unnecessary RC config space initialization
...
The common Designware init already initializes the RC PCI_COMMAND, BAR0
and BAR1 registers.
The only difference here is the common code sets SERR. If clearing SERR
is what's desired, then the Meson driver should do that instead.
Link: https://lore.kernel.org/r/20200821035420.380495-27-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Yue Wang <yue.wang@Amlogic.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: linux-amlogic@lists.infradead.org
2020-09-08 16:37:02 +01:00
Rob Herring
244c40cc28
PCI: dwc/meson: Drop the duplicate number of lanes setup
...
The meson lanes initialization is the same DWC port logic registers as
in dw_pcie_setup(). We just need to initialize 'num_lanes' to 1 to do
the same init.
dw_pcie_setup_rc() sets the PORT_LOGIC_SPEED_CHANGE bit, so setting it
can be dropped.
Link: https://lore.kernel.org/r/20200821035420.380495-26-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Yue Wang <yue.wang@Amlogic.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: Neil Armstrong <narmstrong@baylibre.com >
Cc: Jerome Brunet <jbrunet@baylibre.com >
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com >
Cc: linux-amlogic@lists.infradead.org
2020-09-08 16:37:02 +01:00
Rob Herring
cff9244432
PCI: dwc: Ensure FAST_LINK_MODE is cleared
...
"Fast Link Mode" is a simulation environment speed up setting which should
never be set and the default is not set. However some Amlogic platforms
have it set (by firmware presumably). See commit 87dccf0932
("PCI:
amlogic: meson: Don't use FAST_LINK_MODE to set up link") for more
information. Let's clear it in core DWC code so we can drop some vendor
specific code.
Link: https://lore.kernel.org/r/20200821035420.380495-25-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
6ffc02d236
PCI: dwc: Add a 'num_lanes' field to struct dw_pcie
...
Add a 'num_lanes' field to allow drivers to provide a the number of lanes
if not in DT or using a custom DT property. A driver can provide a
non-zero value which is used if the DT doesn't have a 'num-lanes'
property.
Link: https://lore.kernel.org/r/20200821035420.380495-24-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:08 +01:00
Rob Herring
574523dcfc
PCI: dwc/imx6: Remove duplicate define PCIE_LINK_WIDTH_SPEED_CONTROL
...
PCIE_LINK_WIDTH_SPEED_CONTROL is already defined in pcie-designware.h,
so remove it from the i.MX6 driver.
Link: https://lore.kernel.org/r/20200821035420.380495-23-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Richard Zhu <hongxing.zhu@nxp.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
2020-09-08 16:37:02 +01:00
Rob Herring
cf627713e3
PCI: dwc: Check CONFIG_PCI_MSI inside dw_pcie_msi_init()
...
Move the IS_ENABLED(CONFIG_PCI_MSI) check into dw_pcie_msi_init()
instead of duplicating it in all the drivers.
Link: https://lore.kernel.org/r/20200821035420.380495-22-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Richard Zhu <hongxing.zhu@nxp.com >
Cc: Lucas Stach <l.stach@pengutronix.de >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Shawn Guo <shawnguo@kernel.org >
Cc: Sascha Hauer <s.hauer@pengutronix.de >
Cc: Pengutronix Kernel Team <kernel@pengutronix.de >
Cc: Fabio Estevam <festevam@gmail.com >
Cc: NXP Linux Team <linux-imx@nxp.com >
Cc: Yue Wang <yue.wang@Amlogic.com >
Cc: Kevin Hilman <khilman@baylibre.com >
Cc: Jesper Nilsson <jesper.nilsson@axis.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Xiaowei Song <songxiaowei@hisilicon.com >
Cc: Binghui Wang <wangbinghui@hisilicon.com >
Cc: Stanimir Varbanov <svarbanov@mm-sol.com >
Cc: Andy Gross <agross@kernel.org >
Cc: Bjorn Andersson <bjorn.andersson@linaro.org >
Cc: Kunihiko Hayashi <hayashi.kunihiko@socionext.com >
Cc: Masahiro Yamada <yamada.masahiro@socionext.com >
Cc: linux-amlogic@lists.infradead.org
Cc: linux-arm-kernel@axis.com
Cc: linux-arm-msm@vger.kernel.org
2020-09-08 16:37:02 +01:00
Rob Herring
421063efaf
PCI: dwc/keystone: Drop duplicated 'num-viewport'
...
The DWC core driver already parses and stores the 'num-viewport' DT
property, so there is no need for the Keystone driver to store it.
Link: https://lore.kernel.org/r/20200821035420.380495-21-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
2ef6b06a04
PCI: dwc: Simplify config space handling
...
The config space is divided in half for type 0 and type 1 accesses, but
this is pointless as there's only one iATU window which is
reconfigured on each access.
The only platform doing something custom is TI Keystone (surprise!).
It does its own mapping of the config space to avoid spliting the
config space and never actually uses va_cfg1_base as it has its own
config space accessors. With the splitting removed, Keystone can use the
default mapping of config space.
Link: https://lore.kernel.org/r/20200821035420.380495-20-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
2020-09-08 16:37:02 +01:00
Rob Herring
0f71c60ffd
PCI: dwc: Remove storing of PCI resources
...
The PCI bridge resources are stored in pci_host_bridge.windows, so
there's no need to store them in a DWC specific struct. There's also no
need to parse the resources and store them a 2nd time as they are mainly
used for one time setup of iATU windows.
Link: https://lore.kernel.org/r/20200821035420.380495-19-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Jonathan Chocron <jonnyc@amazon.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
2020-09-08 16:37:02 +01:00
Rob Herring
5808d43e7c
PCI: dwc: Remove root_bus pointer
...
The pci_host_bridge struct already has a pointer to its pci_bus, so
let's convert the one user to use the bridge struct and remove the
private 'root_bus' pointer.
Link: https://lore.kernel.org/r/20200821035420.380495-18-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
Cc: Thierry Reding <thierry.reding@gmail.com >
Cc: Jonathan Hunter <jonathanh@nvidia.com >
Cc: linux-tegra@vger.kernel.org
2020-09-08 16:37:02 +01:00
Rob Herring
1df7930548
PCI: dwc: Convert to use pci_host_probe()
...
Now that there are no more .scan_bus() callbacks, we can remove it and just
use pci_host_probe().
Link: https://lore.kernel.org/r/20200821035420.380495-17-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
6ab15b5e70
PCI: dwc: keystone: Convert .scan_bus() callback to use add_bus
...
TI keystone is the only Designware driver using .scan_bus(). This
function pointer is the only thing preventing the Designware driver from
using pci_host_probe(). Let's use the pci_ops.add_bus hook instead.
Link: https://lore.kernel.org/r/20200821035420.380495-16-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Murali Karicheri <m-karicheri2@ti.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
6e8e104d21
PCI: Also call .add_bus() callback for root bus
...
Similar to pcibios_add_bus(), call pci_ops.add_bus() when the root bus
is added. This allows host bridge drivers to do any setup requiring a
bus pointer.
There are currently no .add_bus() callbacks, so this is safe to do.
Link: https://lore.kernel.org/r/20200821035420.380495-15-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
c2b0c098fb
PCI: dwc: Use generic config accessors
...
Now that all the platforms with custom config access handling define
their own pci_ops, let's split the default config accessors to use
different pci_ops for root and child buses. With this, we can use the
generic config accessors. The child bus accesses mainly require a
.map_bus() hook to reconfigure the iATU on each config space access.
Link: https://lore.kernel.org/r/20200821035420.380495-14-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00
Rob Herring
7975c8cc8e
PCI: dwc: Remove dwc specific config accessor ops
...
Now that all the drivers needing custom config accessors have been
converted to define their own pci_ops, we can remove the DWC specific
function callbacks {rd,wr}_{own,other}_conf.
Link: https://lore.kernel.org/r/20200821035420.380495-13-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org >
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Jingoo Han <jingoohan1@gmail.com >
Cc: Gustavo Pimentel <gustavo.pimentel@synopsys.com >
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com >
Cc: Bjorn Helgaas <bhelgaas@google.com >
2020-09-08 16:37:02 +01:00