summaryrefslogtreecommitdiffstats
path: root/drivers/pci/host/pcie-altera.c
Commit message (Collapse)AuthorAgeFilesLines
* PCI: altera: Fix TLP_CFG_DW0 for TLP writeLey Foon Tan2017-02-281-3/+7
| | | | | | | | | | | eb5767122feb ("PCI: altera: Simplify TLB_CFG_DW0 usage") used TLP_FMTTYPE_CFGRD* (instead of TLP_FMTTYPE_CFGWR*) for TLP writes, which causes writing to configuration space to fail. Fix it by using correct FMTTYPE for write operation. Fixes: eb5767122feb ("PCI: altera: Simplify TLB_CFG_DW0 usage") Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: stable@vger.kernel.org # v4.9+
* PCI: altera: Extract TLP completion status correctlyYadi Hu2017-02-171-1/+1
| | | | | | | | Previously we extracted 'Completion Status' from b14:12, but it is actually b15:13. Extract it from the correct bits. Signed-off-by: Hu Yadi<yadi.hu@windriver.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Ley Foon Tan <ley.foon.tan@intel.com>
* PCI: altera: Remove redundant error message in altera_pcie_parse_dt()Wei Yongjun2016-11-111-3/+1
| | | | | | | | There is an error message from devm_ioremap_resource() already, so remove the dev_err() call to avoid redundant error messages. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Ley Foon Tan <lftan@altera.com>
* PCI: altera: Use builtin_platform_driver() to simplify the codeWei Yongjun2016-11-111-5/+1
| | | | | | Use the builtin_platform_driver() macro to make the code simpler. Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Simplify TLP_CFG_DW1 usageBjorn Helgaas2016-10-111-7/+6
| | | | | | | TLP_CFG_DW1() was only used with altera->root_bus_nr and RP_DEVFN, so encode that directly into the macro so we don't have to clutter the uses with the TLP_REQ_ID() usage. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Simplify TLB_CFG_DW0 usageBjorn Helgaas2016-10-111-11/+6
| | | | | | | All TLP_CFG_DW0() uses follow the same pattern based on the root bus number, so pull that into the macro itself to declutter the users. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Rename altera_pcie_valid_config() to altera_pcie_valid_device()Bjorn Helgaas2016-10-111-3/+3
| | | | | | Rename altera_pcie_valid_config() to altera_pcie_valid_device(). No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Remove redundant platform_get_resource() return value checkBjorn Helgaas2016-10-111-6/+1
| | | | | | | devm_ioremap_resource() fails gracefully when given a NULL resource pointer, so we don't need to check separately for failure from platform_get_resource_byname(). Remove the redundant check. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Remove unused platform dataBjorn Helgaas2016-10-111-2/+0
| | | | | | The altera driver never uses the platform drvdata pointer, so don't bother setting it. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Add local struct device pointersBjorn Helgaas2016-10-111-16/+18
| | | | | | Use a local "struct device *dev" for brevity and consistency with other drivers. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
*-. Merge branches 'pci/host-aardvark', 'pci/host-altera', 'pci/host-artpec', ↵Bjorn Helgaas2016-10-051-56/+134
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'pci/host-designware', 'pci/host-hv', 'pci/host-keystone', 'pci/host-rcar', 'pci/host-rockchip', 'pci/host-tegra' and 'pci/host-xilinx' into next * pci/host-aardvark: PCI: aardvark: Remove redundant dev_err call in advk_pcie_probe() * pci/host-altera: PCI: altera: Remove redundant platform_get_resource() return value check PCI: altera: Move retrain from fixup to altera_pcie_host_init() PCI: altera: Rework config accessors for use without a struct pci_bus PCI: altera: Poll for link training status after retraining the link * pci/host-artpec: PCI: artpec6: Drop __init from artpec6_add_pcie_port() * pci/host-designware: PCI: designware: Remove redundant platform_get_resource() return value check PCI: designware: Exchange viewport of `MEMORYs' and `CFGs/IOs' PCI: designware: Keep viewport fixed for IO transaction if num_viewport > 2 PCI: designware: Check LTSSM training bit before deciding link is up PCI: designware: Add iATU Unroll feature PCI: designware: Wait for iATU enable PCI: designware: Move link wait definitions to .c file PCI: designware: Return data directly from dw_pcie_readl_rc() * pci/host-hv: PCI: hv: Handle hv_pci_generic_compl() error case PCI: hv: Handle vmbus_sendpacket() failure in hv_compose_msi_msg() PCI: hv: Remove the unused 'wrk' in struct hv_pcibus_device PCI: hv: Use pci_function_description[0] in struct definitions PCI: hv: Use zero-length array in struct pci_packet PCI: hv: Use list_move_tail() instead of list_del() + list_add_tail() * pci/host-keystone: PCI: keystone: Propagate request_irq() failure * pci/host-rcar: PCI: rcar: Try increasing PCIe link speed to 5 GT/s at boot PCI: rcar: Fix some checkpatch warnings PCI: rcar: Add multi-MSI support PCI: rcar: Don't disable/unprepare clocks on prepare/enable failure PCI: rcar: Consolidate register space lookup and ioremap * pci/host-rockchip: PCI: rockchip: Fix wrong transmitted FTS count PCI: rockchip: Improve the deassert sequence of four reset pins PCI: rockchip: Increase the Max Credit update interval PCI: rockchip: Add Rockchip PCIe controller support dt-bindings: PCI: rockchip: Add DT bindings for Rockchip PCIe controller * pci/host-tegra: PCI: tegra: Use of_device_get_match_data() PCI: tegra: Remove redundant _data suffix * pci/host-xilinx: microblaze/PCI: Add multidomain support for procfs PCI: xilinx: Dispose of MSI virtual IRQ PCI: xilinx: Clear correct MSI set bit PCI: xilinx: Clear interrupt register for invalid interrupt PCI: xilinx: Keep both legacy and MSI interrupt domain references PCI: xilinx-nwl: Enable all MSI interrupts using MSI mask PCI: xilinx-nwl: Expand error logging Conflicts: drivers/pci/host/pcie-xilinx.c
| | * PCI: altera: Move retrain from fixup to altera_pcie_host_init()Ley Foon Tan2016-09-121-60/+91
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we used a PCI early fixup to initiate a link retrain on Altera devices. But Altera PCIe IP can be configured as either a Root Port or an Endpoint, and they might have same vendor ID, so the fixup would be run for both. We only want to initiate a link retrain for Altera Root Port devices, not for Endpoints, so move the link retrain functionality from the fixup to altera_pcie_host_init(). [bhelgaas: changelog] Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
| | * PCI: altera: Rework config accessors for use without a struct pci_busLey Foon Tan2016-08-261-23/+41
| | | | | | | | | | | | | | | | | | | | | Rework configs accessors so a future patch can use them in _probe() with struct altera_pcie instead of struct pci_bus. Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
| | * PCI: altera: Poll for link training status after retraining the linkLey Foon Tan2016-08-181-8/+37
| |/ | | | | | | | | | | | | | | Poll for link training status is cleared before poll for link up status. This can help to get the reliable link up status, especially when PCIe is in Gen 3 speed. Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* | Merge branch 'pci/virtualization' into nextBjorn Helgaas2016-10-031-7/+0
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * pci/virtualization: PCI: xilinx: Relax device number checking to allow SR-IOV PCI: designware: Relax device number checking to allow SR-IOV PCI: altera: Relax device number checking to allow SR-IOV PCI: Check for pci_setup_device() failure in pci_iov_add_virtfn() PCI: Mark Atheros AR9580 to avoid bus reset
| * | PCI: altera: Relax device number checking to allow SR-IOVPo Liu2016-09-121-7/+0
| |/ | | | | | | | | | | | | | | | | | | | | Previously we only allowed device 0 to be directly attached to the root port. But SR-IOV devices may use non-zero device numbers for VFs. Remove the restriction that only device 0 may be attached to a root port. [bhelgaas: changelog] Signed-off-by: Po Liu <po.liu@nxp.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Ley Foon Tan <lftan@altera.com>
* | PCI: altera: Make explicitly non-modularPaul Gortmaker2016-08-231-7/+5
|/ | | | | | | | | | | | | | | | | | This code is not being built as a module by anyone: drivers/pci/host/Kconfig:config PCIE_ALTERA drivers/pci/host/Kconfig: bool "Altera PCIe controller" Remove uses of MODULE_DESCRIPTION(), MODULE_AUTHOR(), MODULE_LICENSE(), etc., so that when reading the driver there is no doubt it is builtin-only. The information is preserved in comments at the top of the file. Note that for non-modular code, MODULE_DEVICE_TABLE is a no-op and module_init() translates to device_initcall(). [bhelgaas: changelog] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> CC: Ley Foon Tan <lftan@altera.com>
*-. Merge branches 'pci/host-aardvark', 'pci/host-altera', 'pci/host-dra7xx', ↵Bjorn Helgaas2016-08-011-17/+31
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'pci/host-hv', 'pci/host-vmd' and 'pci/host-xilinx' into next * pci/host-aardvark: arm64: dts: marvell: Add Aardvark PCIe support for Armada 3700 PCI: aardvark: Add Aardvark PCI host controller driver dt-bindings: add DT binding for the Aardvark PCIe controller * pci/host-altera: PCI: altera: Poll for link up status after retraining the link PCI: altera: Check link status before retrain link PCI: altera: Reorder read/write functions * pci/host-dra7xx: PCI: dra7xx: Fix return value in case of error * pci/host-hv: PCI: hv: Fix interrupt cleanup path PCI: hv: Handle all pending messages in hv_pci_onchannelcallback() PCI: hv: Don't leak buffer in hv_pci_onchannelcallback() * pci/host-vmd: x86/PCI: VMD: Separate MSI and MSI-X vector sharing x86/PCI: VMD: Use x86_vector_domain as parent domain x86/PCI: VMD: Use lock save/restore in interrupt enable path x86/PCI: VMD: Initialize list item in IRQ disable x86/PCI: VMD: Select device dma ops to override * pci/host-xilinx: PCI: xilinx: Fix return value in case of error Manually apply changes from pci/demodularize-hosts and pci/host-request-windows to drivers/pci/host/pci-aardvark.c
| | * PCI: altera: Poll for link up status after retraining the linkLey Foon Tan2016-07-221-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some PCIe devices take a long time to reach link up state after retrain. Poll for link up status after retraining the link. This is to make sure the link is up before we access configuration space. [bhelgaas: changelog] Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
| | * PCI: altera: Check link status before retrain linkLey Foon Tan2016-07-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Check the link status before retraining. If the link is not up, don't bother trying to retrain it. [bhelgaas: split code move to separate patch, changelog] Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
| | * PCI: altera: Reorder read/write functionsBjorn Helgaas2016-07-221-16/+16
| |/ | | | | | | | | | | | | Move cra_writel(), cra_readl(), and altera_pcie_link_is_up() so a future patch can use them in altera_pcie_retrain(). No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* | PCI: altera: Simplify host bridge window iterationBjorn Helgaas2016-06-201-18/+6
| | | | | | | | | | | | | | | | | | | | The switch is the only statement in the resource_list_for_each_entry() loop, so remove unnecessary "continue" statements in the switch. Simplify checking for the required non-prefetchable memory aperture. Inline altera_pcie_release_of_pci_ranges(), which is only called once. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* | PCI: altera: Request host bridge window resources with core functionBjorn Helgaas2016-06-201-6/+5
|/ | | | | | | | Use devm_request_pci_bus_resources() to request host bridge window resources instead of doing it by hand in the driver. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Fix altera_pcie_link_is_up()Ley Foon Tan2016-03-111-1/+2
| | | | | | | | | Originally altera_pcie_link_is_up() decided the link was up if any of the low four bits of the LTSSM register were set. But the link is only up if the LTSSM state is L0, so check for that exact value. [bhelgaas: changelog] Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Fix error when INTx is 4Ley Foon Tan2015-12-041-1/+1
| | | | | | | | | | | | | | | | PCI interrupt lines start at 1, not at 0. So, creates additional one interrupt when register for irq domain. Error when PCIe devices have 4 INTx: WARNING: CPU: 1 PID: 1 at kernel/irq/irqdomain.c:280 irq_domain_associate+0x17c/0x1cc() error: hwirq 0x4 is too large for dummy Tested on Ethernet adapter card with multi-functions. Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Check TLP completion statusLey Foon Tan2015-12-041-2/+10
| | | | | | | | | | | | | Check TLP packet successful completion status. This fix the issue when accessing multi-function devices in enumeration process, TLP will return error when accessing non-exist function number. Returns PCI error code instead of generic errno. Tested on Ethernet adapter card with multi-functions. [bhelgaas: simplify completion status checking code] Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Fix Requester ID for config accessesLey Foon Tan2015-12-041-2/+3
| | | | | | | | | | | | | | | The Requester ID should use the Root Port devfn and it should be always 0. Previously we constructed the Requester ID using the *Completer* devfn, i.e., the devfn of the Function we expect to respond to the config access. This causes issues when accessing configuration space for devices other than the Root Port. Build the Requester ID using the Root Port devfn. Tested on Ethernet adapter card with multi-functions. Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
* PCI: altera: Fix loop in tlp_read_packet()Dan Carpenter2015-12-041-2/+2
| | | | | | | | | | | | | | TLP_LOOP is 500 and the "loop" variable was a u8 so "loop < TLP_LOOP" is always true. We only need this condition to work if there is a problem so it would have been easy to miss this in testing. Make it a normal for loop with "int i" instead of over thinking things and making it complicated. Fixes: 6bb4dd154ae8 ("PCI: altera: Add Altera PCIe host controller driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Ley Foon Tan <lftan@altera.com>
* PCI: altera: Add Altera PCIe host controller driverLey Foon Tan2015-10-231-0/+579
Add the Altera PCIe host controller driver. [bhelgaas: whitespace, fold in DT and maintainer updates, OF_PCI dependency from Arnd] Signed-off-by: Ley Foon Tan <lftan@altera.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Marc Zyngier <marc.zyngier@arm.com> Acked-by: Rob Herring <robh@kernel.org> (DT binding)
OpenPOWER on IntegriCloud