Commit Graph

28 Commits

Author SHA1 Message Date
Myron Stowe 5604488dd5 PCI: cadence: Set cdns_pcie_host_init() global
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: 063c938928dc80c2bfd66f34df48344db22e009b

commit 063c938928dc80c2bfd66f34df48344db22e009b
Author: Thomas Richard <thomas.richard@bootlin.com>
Date:   Wed Jun 19 12:15:10 2024 +0200

    PCI: cadence: Set cdns_pcie_host_init() global

    During the resume sequence of the host, cdns_pcie_host_init() needs to be
    called, so set it global.

    The dev function parameter is removed, as it isn't used.

    Link: https://lore.kernel.org/linux-pci/20240102-j7200-pcie-s2r-v7-2-a2f9156da6c3@bootlin.com
    Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-18 09:48:09 -07:00
Myron Stowe 4409af314c PCI: cadence: Extract link setup sequence from cdns_pcie_host_setup()
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: d1b6f2e2ce4d8b17d9f3558c98a1517b864bfd03

commit d1b6f2e2ce4d8b17d9f3558c98a1517b864bfd03
Author: Thomas Richard <thomas.richard@bootlin.com>
Date:   Wed Jun 19 12:15:09 2024 +0200

    PCI: cadence: Extract link setup sequence from cdns_pcie_host_setup()

    The function cdns_pcie_host_setup() mixes probe structure and link setup.

    The link setup must be done during the resume sequence. So extract it from
    cdns_pcie_host_setup() and create a dedicated function.

    Link: https://lore.kernel.org/linux-pci/20240102-j7200-pcie-s2r-v7-1-a2f9156da6c3@bootlin.com
    Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-18 09:48:09 -07:00
Myron Stowe 1a338c0ff7 PCI: cadence: Drop excess cdns_pcie_rc.dev kerneldoc description
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: c3d95aa93fd8549588097b0701b3835920fd8533

commit c3d95aa93fd8549588097b0701b3835920fd8533
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Tue Sep 3 15:31:33 2024 -0500

    PCI: cadence: Drop excess cdns_pcie_rc.dev kerneldoc description

    Struct cdns_pcie_rc once had a .dev member, but it was removed by
    bd22885aa1 ("PCI: cadence: Refactor driver to use as a core library").
    Drop the extra kerneldoc for it.

    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-18 09:48:09 -07:00
Myron Stowe 1bd9a763dc PCI: cadence: Clear the ARI Capability Next Function Number of the last function
JIRA: https://issues.redhat.com/browse/RHEL-33544
Upstream Status: 667a006d73fb7320fc6f414b6fe11a998fcf0c28

commit 667a006d73fb7320fc6f414b6fe11a998fcf0c28
Author: Jasko-EXT Wojciech <wojciech.jasko-EXT@continental-corporation.com>
Date:   Sat Dec 2 14:20:15 2023 +0530

    PCI: cadence: Clear the ARI Capability Next Function Number of the last function

    Next Function Number field in ARI Capability Register for last function
    must be zero by default as per the PCIe specification, indicating there
    is no next higher number function but that's not happening in our case,
    so this patch clears the Next Function Number field for last function
    used.

    [kwilczynski: white spaces update for one define]
    Link: https://lore.kernel.org/linux-pci/20231202085015.3048516-1-s-vadapalli@ti.com
    Signed-off-by: Jasko-EXT Wojciech <wojciech.jasko-EXT@continental-corporation.com>
    Signed-off-by: Achal Verma <a-verma1@ti.com>
    Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Vignesh Raghavendra <vigneshr@ti.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-05-13 15:56:48 -06:00
Myron Stowe c9546ea91e PCI: cadence: Use INTX instead of legacy
JIRA: https://issues.redhat.com/browse/RHEL-28627
Upstream Status: 570e8579761a68d80c29034c291b34cff732d76d

commit 570e8579761a68d80c29034c291b34cff732d76d
Author: Damien Le Moal <dlemoal@kernel.org>
Date:   Wed Nov 22 15:03:58 2023 +0900

    PCI: cadence: Use INTX instead of legacy

    In the Cadence endpoint controller driver, rename the function
    cdns_pcie_ep_send_legacy_irq() to cdns_pcie_ep_send_intx_irq() to match
    the macro PCI_IRQ_INTX name. Related comments and messages mentioning
    "legacy" are also changed to refer to "intx".

    Link: https://lore.kernel.org/r/20231122060406.14695-9-dlemoal@kernel.org
    Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Reviewed-by: Christoph Hellwig <hch@lst.de>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-03-30 14:55:37 -06:00
Myron Stowe d9ae72882c PCI: Fix typos in docs and comments
JIRA: https://issues.redhat.com/browse/RHEL-15044
Upstream Status: 86b4ad7d67b26973838b7f1d4428aba9483cb5ce

commit 86b4ad7d67b26973838b7f1d4428aba9483cb5ce
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Thu Aug 24 11:44:32 2023 -0500

    PCI: Fix typos in docs and comments

    Fix typos in docs and comments.

    Link: https://lore.kernel.org/r/20230824193712.542167-11-helgaas@kernel.org
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-12-15 16:22:30 -07:00
Myron Stowe 61de0f6591 PCI: cadence: Clear FLR in device capabilities register
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2118429
Upstream Status: 95b00f68209e2bc9f2ee9126afcebab451e0e9d8

commit 95b00f68209e2bc9f2ee9126afcebab451e0e9d8
Author: Parshuram Thombare <pthombar@cadence.com>
Date:   Mon Oct 25 05:31:15 2021 -0700

    PCI: cadence: Clear FLR in device capabilities register

    Clear FLR (Function Level Reset) from device capabilities
    registers for all physical functions.

    During FLR, the Margining Lane Status and Margining Lane Control
    registers should not be reset, as per PCIe specification.
    However, the controller incorrectly resets these registers upon FLR.
    This causes PCISIG compliance FLR test to fail. Hence preventing
    all functions from advertising FLR support if flag quirk_disable_flr
    is set.

    Link: https://lore.kernel.org/r/1635165075-89864-1-git-send-email-pthombar@cadence.com
    Signed-off-by: Parshuram Thombare <pthombar@cadence.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-09-09 19:29:15 -06:00
Myron Stowe 95cf4209b3 PCI: cadence: Allow PTM Responder to be enabled
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2118429
Upstream Status: a1f67bc131c3935f325513cd153249fdbc22ac5b

commit a1f67bc131c3935f325513cd153249fdbc22ac5b
Author: Christian Gmeiner <christian.gmeiner@gmail.com>
Date:   Thu May 12 07:55:38 2022 +0200

    PCI: cadence: Allow PTM Responder to be enabled

    This enables the Controller [RP] to automatically respond with
    Response/ResponseD messages if CDNS_PCIE_LM_TPM_CTRL_PTMRSEN
    and PCI_PTM_CTRL_ENABLE bits are both set.

    Link: https://lore.kernel.org/r/20220512055539.1782437-1-christian.gmeiner@gmail.com
    Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-09-09 19:29:15 -06:00
Myron Stowe 7d77b763e1 PCI: Correct misspelled words
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: ccd36795be48956248dc308f4525c06c7f419d76

commit ccd36795be48956248dc308f4525c06c7f419d76
Author: Krzysztof Wilczyński <kw@linux.com>
Date:   Fri Jan 7 22:59:42 2022 +0000

    PCI: Correct misspelled words

    Fix a number of misspelled words, and while at it, correct two phrases used
    to indicate a status of an operation where words used have been cleverly
    truncated and thus always trigger a spellchecking error while performing a
    static code analysis over the PCI tree.

    [bhelgaas: reverse sense of quirk ternary]
    Link: https://lore.kernel.org/r/20220107225942.121484-1-kw@linux.com
    Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:03 -06:00
Myron Stowe d8c29373ce PCI: cadence: Add support to configure virtual functions
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2045254
Upstream Status: e19a0adf6e8bb0b93a546b8d4c7f8f6891115bbb

commit e19a0adf6e8bb0b93a546b8d4c7f8f6891115bbb
Author: Kishon Vijay Abraham I <kishon@ti.com>
Date:   Thu Aug 19 18:03:41 2021 +0530

    PCI: cadence: Add support to configure virtual functions

    Now that support for SR-IOV is added in PCIe endpoint core, add support
    to configure virtual functions in the Cadence PCIe EP driver.

    Link: https://lore.kernel.org/r/20210819123343.1951-7-kishon@ti.com
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-03-03 20:43:42 -07:00
Myron Stowe ab4111aac3 PCI: cadence: Simplify code to get register base address for configuring BAR
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2045254
Upstream Status: 0cf985d6119cc21fc39774b4b29dcf1e0148bf55

commit 0cf985d6119cc21fc39774b4b29dcf1e0148bf55
Author: Kishon Vijay Abraham I <kishon@ti.com>
Date:   Thu Aug 19 18:03:40 2021 +0530

    PCI: cadence: Simplify code to get register base address for configuring BAR

    No functional change. Simplify code to get register base address for
    configuring PCI BAR.

    Link: https://lore.kernel.org/r/20210819123343.1951-6-kishon@ti.com
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-03-03 20:43:42 -07:00
Myron Stowe ba12321d94 PCI: cadence: Add quirk flag to set minimum delay in LTSSM Detect.Quiet state
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2045254
Upstream Status: 09c24094b2e3a15ef3fc44f54a191b3db522fb11

commit 09c24094b2e3a15ef3fc44f54a191b3db522fb11
Author: Nadeem Athani <nadeem@cadence.com>
Date:   Wed Aug 11 18:03:33 2021 +0530

    PCI: cadence: Add quirk flag to set minimum delay in LTSSM Detect.Quiet state

    PCIe fails to link up if SERDES lanes not used by PCIe are assigned to
    another protocol. For example, link training fails if lanes 2 and 3 are
    assigned to another protocol while lanes 0 and 1 are used for PCIe to
    form a two lane link. This failure is due to an incorrect tie-off on an
    internal status signal indicating electrical idle.

    Status signals going from SERDES to PCIe Controller are tied-off when a
    lane is not assigned to PCIe. Signal indicating electrical idle is
    incorrectly tied-off to a state that indicates non-idle. As a result,
    PCIe sees unused lanes to be out of electrical idle and this causes
    LTSSM to exit Detect.Quiet state without waiting for 12ms timeout to
    occur. If a receiver is not detected on the first receiver detection
    attempt in Detect.Active state, LTSSM goes back to Detect.Quiet and
    again moves forward to Detect.Active state without waiting for 12ms as
    required by PCIe base specification. Since wait time in Detect.Quiet is
    skipped, multiple receiver detect operations are performed back-to-back
    without allowing time for capacitance on the transmit lines to
    discharge. This causes subsequent receiver detection to always fail even
    if a receiver gets connected eventually.

    Add a quirk flag "quirk_detect_quiet_flag" to program the minimum
    time the LTSSM should wait on entering Detect.Quiet state here.
    This has to be set for J7200 as it has an incorrect tie-off on unused
    lanes.

    Link: https://lore.kernel.org/r/20210811123336.31357-3-kishon@ti.com
    Signed-off-by: Nadeem Athani <nadeem@cadence.com>
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-03-03 20:43:37 -07:00
Myron Stowe fee0259c40 PCI: cadence: Use bitfield for *quirk_retrain_flag* instead of bool
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2045254
Upstream Status: f4455748b2126a9ba2bcc9cfb2fbcaa08de29bb2

commit f4455748b2126a9ba2bcc9cfb2fbcaa08de29bb2
Author: Kishon Vijay Abraham I <kishon@ti.com>
Date:   Wed Aug 11 18:03:32 2021 +0530

    PCI: cadence: Use bitfield for *quirk_retrain_flag* instead of bool

    No functional change. As we are intending to add additional 1-bit
    members in struct j721e_pcie_data/struct cdns_pcie_rc, use bitfields
    instead of bool since it takes less space. As discussed in [1],
    the preference is to use bitfileds instead of bool inside structures.

    [1] -> https://lore.kernel.org/linux-fsdevel/CA+55aFzKQ6Pj18TB8p4Yr0M4t+S+BsiHH=BJNmn=76-NcjTj-g@mail.gmail.com/

    Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
    Link: https://lore.kernel.org/r/20210811123336.31357-2-kishon@ti.com
    Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-03-03 20:43:36 -07:00
Krzysztof Wilczyński 347269c113 PCI: Fix kernel-doc formatting
Fix kernel-doc formatting throughout drivers/pci and related include files.
No change to functionality intended.

Check for warnings:

  $ find include drivers/pci -type f -path "*pci*.[ch]" | xargs scripts/kernel-doc -none

[bhelgaas: squashed to one commit]
Link: https://lore.kernel.org/r/20210509030237.368540-1-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-1-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-2-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-3-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-4-kw@linux.com
Link: https://lore.kernel.org/r/20210703151306.1922450-5-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2021-07-06 10:37:46 -05:00
Nadeem Athani 4740b969aa PCI: cadence: Retrain Link to work around Gen2 training defect
Cadence controller will not initiate autonomous speed change if strapped
as Gen2. The Retrain Link bit is set as quirk to enable this speed change.

Link: https://lore.kernel.org/r/20210209144622.26683-3-nadeem@cadence.com
Signed-off-by: Nadeem Athani <nadeem@cadence.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2021-02-10 12:48:45 +00:00
Kishon Vijay Abraham I e87d17ca6a PCI: cadence: Do not error if "cdns,max-outbound-regions" is not found
Now that "cdns,max-outbound-regions" is made an optional property, do
not error out if "cdns,max-outbound-regions" device tree property is
not found.

Link: http://lore.kernel.org/r/20201105165331.GA55814@bogus
Link: https://lore.kernel.org/r/20201106151107.3987-3-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2020-11-20 17:23:31 +00:00
Bjorn Helgaas 49e427e6bd Merge branch 'pci/host-probe-refactor'
- Use pci_host_bridge.windows list directly instead of splicing in a
  temporary list for cadence, mvebu, host-common (Rob Herring)

- Use pci_host_probe() instead of open-coding all the pieces for altera,
  brcmstb, iproc, mobiveil, rcar, rockchip, tegra, v3, versatile, xgene,
  xilinx, xilinx-nwl (Rob Herring)

- Convert to devm_platform_ioremap_resource_byname() instead of open-coding
  platform_get_resource_byname() and devm_ioremap_resource() for altera,
  cadence, mediatek, rockchip, tegra, xgene (Dejin Zheng)

- Convert to devm_platform_ioremap_resource() instead of open-coding
  platform_get_resource() and devm_ioremap_resource() for aardvark,
  brcmstb, exynos, ftpci100, versatile (Dejin Zheng)

- Remove redundant error messages from devm_pci_remap_cfg_resource()
  callers (Dejin Zheng)

- Drop useless PCI_ENABLE_PROC_DOMAINS from versatile driver (Rob Herring)

- Default host bridge parent device to the platform device (Rob Herring)

- Drop unnecessary zeroing of host bridge fields (Rob Herring)

- Use pci_is_root_bus() instead of tracking root bus number separately in
  aardvark, designware (imx6, keystone, designware-host), mobiveil,
  xilinx-nwl, xilinx, rockchip, rcar (Rob Herring)

- Set host bridge bus number in pci_scan_root_bus_bridge() instead of each
  driver for aardvark, designware-host, host-common, mediatek, rcar, tegra,
  v3-semi (Rob Herring)

- Use bridge resources instead of parsing DT 'ranges' again for cadence
  (Rob Herring)

- Remove private bus number and range from cadence (Rob Herring)

- Use devm_pci_alloc_host_bridge() to simplify rcar (Rob Herring)

- Use struct pci_host_bridge.windows list directly rather than a temporary
  (Rob Herring)

- Reduce OF "missing non-prefetchable window" from error to warning message
  (Rob Herring)

- Convert rcar-gen2 from old Arm-specific pci_common_init_dev() to new
  arch-independent interfaces (Rob Herring)

- Move DT resource setup into devm_pci_alloc_host_bridge() (Rob Herring)

- Set bridge map_irq and swizzle_irq to default functions; drivers that
  don't support legacy IRQs (iproc) need to undo this (Rob Herring)

* pci/host-probe-refactor:
  PCI: Set bridge map_irq and swizzle_irq to default functions
  PCI: Move DT resource setup into devm_pci_alloc_host_bridge()
  PCI: rcar-gen2: Convert to use modern host bridge probe functions
  PCI: of: Reduce missing non-prefetchable memory region to a warning
  PCI: rcar: Use struct pci_host_bridge.windows list directly
  PCI: rcar: Use devm_pci_alloc_host_bridge()
  PCI: cadence: Remove private bus number and range storage
  PCI: cadence: Use bridge resources for outbound window setup
  PCI: Move setting pci_host_bridge.busnr out of host drivers
  PCI: rcar: Use pci_is_root_bus() to check if bus is root bus
  PCI: rockchip: Use pci_is_root_bus() to check if bus is root bus
  PCI: xilinx: Use pci_is_root_bus() to check if bus is root bus
  PCI: xilinx-nwl: Use pci_is_root_bus() to check if bus is root bus
  PCI: mobiveil: Use pci_is_root_bus() to check if bus is root bus
  PCI: designware: Use pci_is_root_bus() to check if bus is root bus
  PCI: aardvark: Use pci_is_root_bus() to check if bus is root bus
  PCI: Drop unnecessary zeroing of bridge fields
  PCI: Set default bridge parent device
  PCI: versatile: Drop flag PCI_ENABLE_PROC_DOMAINS
  PCI: controller: Remove duplicate error message
  PCI: controller: Convert to devm_platform_ioremap_resource()
  PCI: controller: Convert to devm_platform_ioremap_resource_byname()
  PCI: xilinx: Use pci_host_probe() to register host
  PCI: xilinx-nwl: Use pci_host_probe() to register host
  PCI: rockchip: Use pci_host_probe() to register host
  PCI: rcar: Use pci_host_probe() to register host
  PCI: iproc: Use pci_host_probe() to register host
  PCI: altera: Use pci_host_probe() to register host
  PCI: xgene: Use pci_host_probe() to register host
  PCI: versatile: Use pci_host_probe() to register host
  PCI: v3: Use pci_host_probe() to register host
  PCI: tegra: Use pci_host_probe() to register host
  PCI: mobiveil: Use pci_host_probe() to register host
  PCI: brcmstb: Use pci_host_probe() to register host
  PCI: host-common: Use struct pci_host_bridge.windows list directly
  PCI: mvebu: Use struct pci_host_bridge.windows list directly
  PCI: cadence: Use struct pci_host_bridge.windows list directly

# Conflicts:
#	drivers/pci/controller/cadence/pcie-cadence-host.c
2020-08-05 18:24:21 -05:00
Kishon Vijay Abraham I f3e25911a4 PCI: j721e: Add TI J721E PCIe driver
Add support for PCIe controller in J721E SoC. The controller uses the
Cadence PCIe core programmed by pcie-cadence*.c. The PCIe controller
will work in both host mode and device mode.
Some of the features of the controller are:
  *) Supports both RC mode and EP mode
  *) Supports MSI and MSI-X support
  *) Supports upto GEN3 speed mode
  *) Supports SR-IOV capability
  *) Ability to route all transactions via SMMU (support will be added
     in a later patch).

Link: https://lore.kernel.org/r/20200722110317.4744-14-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2020-08-03 14:49:55 +01:00
Alan Douglas 3ef5d16f50 PCI: cadence: Add MSI-X support to Endpoint driver
Implement ->set_msix() and ->get_msix() callback functions in order
to configure MSIX capability in the PCIe endpoint controller.

Add cdns_pcie_ep_send_msix_irq() to send MSIX interrupts to Host.
cdns_pcie_ep_send_msix_irq() gets the MSIX table address (virtual
address) from "struct cdns_pcie_epf" that gets initialized in
->set_bar() call back function.

[kishon@ti.com: Re-implement MSIX support in accordance with the
 re-designed core MSI-X interfaces]
Link: https://lore.kernel.org/r/20200722110317.4744-11-kishon@ti.com
Signed-off-by: Alan Douglas <adouglas@cadence.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2020-07-28 11:31:18 +01:00
Kishon Vijay Abraham I d07701a17a PCI: cadence: Add new *ops* for CPU addr fixup
Cadence driver uses "mem" memory resource to obtain the offset of
configuration space address region, memory space address region and
message space address region. The obtained offset is used to program
the Address Translation Unit (ATU). However certain platforms like TI's
J721E SoC require the absolute address to be programmed in the ATU and
not just the offset. Add new *ops* for CPU addr fixup for the platform
drivers to provide the correct address to be programmed in the ATU.

Link: https://lore.kernel.org/r/20200722110317.4744-9-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2020-07-27 15:46:16 +01:00
Kishon Vijay Abraham I 40d957e6f9 PCI: cadence: Add support to start link and verify link status
Add cdns_pcie_ops to start link and verify link status. The registers
to start link and to check link status is in Platform specific PCIe
wrapper. Add support for platform specific drivers to add callback
functions for the PCIe Cadence core to start link and verify link status.

Link: https://lore.kernel.org/r/20200722110317.4744-6-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2020-07-27 15:46:16 +01:00
Kishon Vijay Abraham I a8b661eb50 PCI: cadence: Convert all r/w accessors to perform only 32-bit accesses
Certain platforms like TI's J721E using Cadence PCIe IP can perform only
32-bit accesses for reading or writing to Cadence registers. Convert all
read and write accesses to 32-bit in Cadence PCIe driver in preparation
for adding PCIe support in TI's J721E SoC.

Also add spin lock to disable interrupts while modifying PCI_STATUS
register while raising legacy interrupt since PCI_STATUS is accessible
by both remote RC and EP and time between read and write should be
minimized.

Link: https://lore.kernel.org/r/20200722110317.4744-5-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2020-07-27 15:46:16 +01:00
Kishon Vijay Abraham I 5d3d063abb PCI: cadence: Use "dma-ranges" instead of "cdns,no-bar-match-nbits" property
Cadence PCIe core driver (host mode) uses "cdns,no-bar-match-nbits"
property to configure the number of bits passed through from PCIe
address to internal address in Inbound Address Translation register.
This only used the NO MATCH BAR.

However standard PCI dt-binding already defines "dma-ranges" to
describe the address ranges accessible by PCIe controller. Add support
in Cadence PCIe host driver to parse dma-ranges and configure the
inbound regions for BAR0, BAR1 and NO MATCH BAR. Cadence IP specifies
maximum size for BAR0 as 256GB, maximum size for BAR1 as 2 GB.

This adds support to take the next biggest region in "dma-ranges" and
find the smallest BAR that each of the regions fit in and if there is
no BAR big enough to hold the region, split the region to see if it can
be fitted using multiple BARs.

"dma-ranges" of J721E will be
dma-ranges = <0x02000000 0x0 0x0 0x0 0x0 0x10000 0x0>;
Since there is no BAR which can hold 2^48 size, NO_MATCH_BAR will be
used here.

Legacy device tree binding compatibility is maintained by retaining
support for "cdns,no-bar-match-nbits".

Link: https://lore.kernel.org/r/20200722110317.4744-2-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
2020-07-27 15:46:02 +01:00
Rob Herring ec64e27959 PCI: cadence: Remove private bus number and range storage
There's no need to store the bus number or range resource as the driver
only needs the bus number which is already in the pci_host_bridge.

For endpoint mode, the bus number is always 0.

Link: https://lore.kernel.org/r/20200722022514.1283916-14-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Tom Joseph <tjoseph@cadence.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-07-23 17:13:13 +01:00
Kishon Vijay Abraham I 7fb39bf2a1 PCI: cadence: Fix to read 32-bit Vendor ID/Device ID property from DT
The PCI Bus Binding specification (IEEE Std 1275-1994 Revision 2.1 [1])
defines both Vendor ID and Device ID to be 32-bits. Fix
pcie-cadence-host.c driver to read 32-bit Vendor ID and Device ID
properties from device tree.

[1] -> https://www.devicetree.org/open-firmware/bindings/pci/pci2_1.pdf

Link: https://lore.kernel.org/r/20200508130646.23939-4-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Tom Joseph <tjoseph@cadence.com>
2020-05-18 15:52:34 +01:00
Kishon Vijay Abraham I 9e2618c3f1 PCI: cadence: Remove "cdns,max-outbound-regions" DT property
"cdns,max-outbound-regions" device tree property provides the
maximum number of outbound regions supported by the Host PCIe
controller. However the outbound regions are configured based
on what is populated in the "ranges" DT property.

Avoid using two properties for configuring outbound regions and
use only "ranges" property instead.

Link: https://lore.kernel.org/r/20200508130646.23939-3-kishon@ti.com
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Acked-by: Rob Herring <robh@kernel.org>
Acked-by: Tom Joseph <tjoseph@cadence.com>
2020-05-18 15:52:33 +01:00
Bjorn Helgaas ba7e87c5dd Merge branch 'remotes/lorenzo/pci/cadence'
- Refactor Cadence PCIe host controller to use as a library for both host
    and endpoint (Tom Joseph)

* remotes/lorenzo/pci/cadence:
  PCI: cadence: Move all files to per-device cadence directory
  PCI: cadence: Refactor driver to use as a core library
2019-11-28 08:54:40 -06:00
Tom Joseph de80f95ccb PCI: cadence: Move all files to per-device cadence directory
Cadence core library files may be used by various platform drivers.
Add a new directory "cadence" to group all the Cadence core library files
and the platforms using Cadence core library.

Signed-off-by: Tom Joseph <tjoseph@cadence.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
2019-11-11 14:57:02 +00:00