Commit Graph

21 Commits

Author SHA1 Message Date
Myron Stowe 3466e87dd6 PCI: altera: Replace TLP_REQ_ID() with macro PCI_DEVID()
JIRA: https://issues.redhat.com/browse/RHEL-67693
Upstream Status: 8745aaab60a63ff57311e9a8dda5dfb0b3a33907

commit 8745aaab60a63ff57311e9a8dda5dfb0b3a33907
Author: Jinjie Ruan <ruanjinjie@huawei.com>
Date:   Wed Aug 28 18:42:02 2024 +0800

    PCI: altera: Replace TLP_REQ_ID() with macro PCI_DEVID()

    The TLP_REQ_ID's function is same as current PCI_DEVID()
    macro, replace it.

    No functional changes intended.

    Link: https://lore.kernel.org/linux-pci/20240828104202.3683491-1-ruanjinjie@huawei.com
    Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2025-02-18 09:48:09 -07:00
Myron Stowe 807fca8e7a PCI: controller: Add missing MODULE_DESCRIPTION() macros
JIRA: https://issues.redhat.com/browse/RHEL-59033
Upstream Status: 142a41da39d1467b7ff7dad64fc421249d06565d

Conflict(s):
  RHEL does not have the following files, thus their respective patch
  hunk was skipped:
    drivers/pci/controller/pcie-apple.c


commit 142a41da39d1467b7ff7dad64fc421249d06565d
Author: Jeff Johnson <quic_jjohnson@quicinc.com>
Date:   Wed Jun 26 10:07:01 2024 -0700

    PCI: controller: Add missing MODULE_DESCRIPTION() macros

    When ARCH=x86, make allmodconfig && make W=1 C=1 reports:

      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/dwc/pci-exynos.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pci-host-generic.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-altera-msi.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mediatek-gen3.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/vmd.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-apple.o
      WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/pci/controller/pcie-mt7621.o

    Add the missing MODULE_DESCRIPTION() macro.

    [kwilczynski: update MODULE_DESCRIPTION() text, commit log]
    Link: https://lore.kernel.org/linux-pci/20240626-md-drivers-pci-controller-v2-1-94c811db7a51@quicinc.com
    Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
    Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
    Acked-by: Nirmal Patel <nirmal.patel@linux.intel.com>
    Acked-by: Sergio Paracuellos <sergio.paracuellos@gmail.com> # MT7621

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-10-05 10:59:20 -06:00
Myron Stowe 06352c2e35 PCI: Explicitly include correct DT includes
JIRA: https://issues.redhat.com/browse/RHEL-15044
Upstream Status: c925cfaf0992f151c02f239e035ca9316224f224

commit c925cfaf0992f151c02f239e035ca9316224f224
Author: Rob Herring <robh@kernel.org>
Date:   Fri Jul 14 11:48:25 2023 -0600

    PCI: Explicitly include correct DT includes

    The DT of_device.h and of_platform.h date back to the separate
    of_platform_bus_type before it as merged into the regular platform bus.  As
    part of that merge prepping Arm DT support 13 years ago, they "temporarily"
    include each other. They also include platform_device.h and of.h. As a
    result, there's a pretty much random mix of those include files used
    throughout the tree. In order to detangle these headers and replace the
    implicit includes with struct declarations, users need to explicitly
    include the correct includes.

    Link: https://lore.kernel.org/r/20230714174827.4061572-1-robh@kernel.org
    Signed-off-by: Rob Herring <robh@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-12-15 16:22:28 -07:00
Myron Stowe e999996f5c PCI: altera: Convert to platform remove callback returning void
JIRA: https://issues.redhat.com/browse/RHEL-2570
Upstream Status: 3a610560aa4fc8f2afe606d3314aeb20c167ff26

commit 3a610560aa4fc8f2afe606d3314aeb20c167ff26
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Tue Mar 21 20:31:55 2023 +0100

    PCI: altera: Convert to platform remove callback returning void

    The .remove() callback for a platform driver returns an int which makes
    many driver authors wrongly assume it's possible to do error handling by
    returning an error code. However the value returned is (mostly) ignored
    and this typically results in resource leaks. To improve here there is a
    quest to make the remove callback return void. In the first step of this
    quest all drivers are converted to .remove_new() which already returns
    void.

    Trivially convert this driver from always returning zero in the remove
    callback to the void returning variant.

    Link: https://lore.kernel.org/linux-pci/20230321193208.366561-3-u.kleine-koenig@pengutronix.de
    Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-09-19 13:32:23 -06:00
Myron Stowe 4d00af7c11 PCI: altera: Prefer of_device_get_match_data()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: c31990dbeb78e435b541c27f6611134037f1f0ac

commit c31990dbeb78e435b541c27f6611134037f1f0ac
Author: Fan Fei <ffclaire1224@gmail.com>
Date:   Wed Dec 22 19:10:32 2021 -0600

    PCI: altera: Prefer of_device_get_match_data()

    The altera driver only needs the device data, not the whole struct
    of_device_id.  Use of_device_get_match_data() instead of of_match_device().
    No functional change intended.

    [bhelgaas: commit log]
    Link: https://lore.kernel.org/r/20211223011054.1227810-2-helgaas@kernel.org
    Signed-off-by: Fan Fei <ffclaire1224@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Cc: Joyce Ooi <joyce.ooi@intel.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:07 -06:00
Myron Stowe e055daf81b PCI: altera: Drop error data fabrication when config read fails
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2066898
Upstream Status: 5f09342835ab8d8a811a27569170bbf35207bdff

commit 5f09342835ab8d8a811a27569170bbf35207bdff
Author: Naveen Naidu <naveennaidu479@gmail.com>
Date:   Thu Nov 18 19:33:23 2021 +0530

    PCI: altera: Drop error data fabrication when config read fails

    If config pci_ops.read() methods return failure, the PCI_OP_READ() and
    PCI_USER_READ_CONFIG() wrappers use PCI_SET_ERROR_RESPONSE() to set the
    data value, so there's no need to set it in the pci_ops.read() methods
    themselves.

    Drop the unnecessary data value fabrication when pci_ops.read() fails.

    Link: https://lore.kernel.org/r/ed5020e5b008b28c33a90c9c1670cef2393d3b7e.1637243717.git.naveennaidu479@gmail.com
    Signed-off-by: Naveen Naidu <naveennaidu479@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-20 10:14:05 -06:00
Myron Stowe cc06255630 PCI: Bulk conversion to generic_handle_domain_irq()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2045254
Upstream Status: d21faba11693c10072ce3b96b696445175f49be2

commit d21faba11693c10072ce3b96b696445175f49be2
Author: Marc Zyngier <maz@kernel.org>
Date:   Mon Aug 2 17:26:19 2021 +0100

    PCI: Bulk conversion to generic_handle_domain_irq()

    Wherever possible, replace constructs that match either
    generic_handle_irq(irq_find_mapping()) or
    generic_handle_irq(irq_linear_revmap()) to a single call to
    generic_handle_domain_irq().

    Link: https://lore.kernel.org/r/20210802162630.2219813-4-maz@kernel.org
    Signed-off-by: Marc Zyngier <maz@kernel.org>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-03-03 20:43:32 -07:00
Bjorn Helgaas 6f119ec8d9 Merge branch 'pci/irq-error'
- Remove redundant logging for platform_get_irq() errors (Krzysztof
  Wilczyński)

* pci/irq-error:
  PCI: Remove dev_err() when handing an error from platform_get_irq()
2020-08-05 18:24:22 -05:00
Rob Herring b64aa11eb2 PCI: Set bridge map_irq and swizzle_irq to default functions
The majority of DT based host drivers use the default .map_irq() and
.swizzle_irq() functions, so let's initialize the function pointers to
the default and drop setting them in the host drivers.

Drivers like iProc which don't support legacy interrupts need to set
.map_irq() back to NULL.

Link: https://lore.kernel.org/r/20200722022514.1283916-20-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: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-08-04 16:36:30 +01:00
Rob Herring 669cbc7081 PCI: Move DT resource setup into devm_pci_alloc_host_bridge()
Now that pci_parse_request_of_pci_ranges() callers just setup
pci_host_bridge.windows and dma_ranges directly and don't need the bus
range returned, we can just initialize them when allocating the
pci_host_bridge struct.

With this, pci_parse_request_of_pci_ranges() becomes a static function.

Link: https://lore.kernel.org/r/20200722022514.1283916-19-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: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-08-04 16:36:30 +01:00
Krzysztof Wilczyński caecb05c80 PCI: Remove dev_err() when handing an error from platform_get_irq()
There is no need to call the dev_err() function directly to print a
custom message when handling an error from either the platform_get_irq() or
platform_get_irq_byname() functions as both are going to display an
appropriate error message in case of a failure.

This change is as per suggestions from Coccinelle, e.g.,

  drivers/pci/controller/dwc/pcie-armada8k.c:252:2-9: line 252 is
  redundant because platform_get_irq() already prints an error

[bhelgaas: squashed into one commit]
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://lore.kernel.org/r/20200802142601.1635926-2-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-3-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-4-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-5-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-6-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-7-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-8-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-9-kw@linux.com
Link: https://lore.kernel.org/r/20200802142601.1635926-10-kw@linux.com
Link: https://lore.kernel.org/r/20200803071040.1663662-1-kw@linux.com
Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com> # altera
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> # dwc
2020-08-03 09:26:03 -05:00
Rob Herring 6a589900d0 PCI: Set default bridge parent device
The host bridge's parent device is always the platform device. As we
already have a pointer to it in the devres functions, let's initialize
the parent device. Drivers can still override the parent if desired.

Link: https://lore.kernel.org/r/20200722022514.1283916-3-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: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
2020-07-23 11:20:49 +01:00
Dejin Zheng e2dcd20b16 PCI: controller: Convert to devm_platform_ioremap_resource_byname()
Use devm_platform_ioremap_resource_byname() to simplify the code,
since it calls respectively platform_get_resource_byname() and
devm_ioremap_resource().

Link: https://lore.kernel.org/r/20200602171601.17630-1-zhengdejin5@gmail.com
Signed-off-by: Dejin Zheng <zhengdejin5@gmail.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Gustavo Pimentel <gustavo.pimentel@synopsys.com>
2020-07-10 11:50:23 +01:00
Rob Herring c63aed7334 PCI: altera: Use pci_host_probe() to register host
The altera host driver does the same host registration and bus scanning
calls as pci_host_probe, so let's use it instead.

The only difference is pci_assign_unassigned_bus_resources() was called
instead of pci_bus_size_bridges() and pci_bus_assign_resources(). This
should be the same.

Link: https://lore.kernel.org/r/20200522234832.954484-11-robh@kernel.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: Ley Foon Tan <ley.foon.tan@intel.com>
Cc: rfi@lists.rocketboards.org
2020-07-10 11:50:23 +01:00
Colin Ian King c96efe2656 PCI: altera: Clean up indentation issue on a return statement
A return statment is indented incorrectly, remove extraneous space.

Link: https://lore.kernel.org/r/20200327134556.265411-1-colin.king@canonical.com
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2020-05-05 12:40:11 +01:00
Rob Herring 331f634571 PCI: of: Add inbound resource parsing to helpers
Extend devm_of_pci_get_host_bridge_resources() and
pci_parse_request_of_pci_ranges() helpers to also parse the inbound
addresses from DT 'dma-ranges' and populate a resource list with the
translated addresses. This will help ensure 'dma-ranges' is always
parsed in a consistent way.

Tested-by: Srinath Mannam <srinath.mannam@broadcom.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> # for AArdvark
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Srinath Mannam <srinath.mannam@broadcom.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Acked-by: Gustavo Pimentel <gustavo.pimentel@synopsys.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: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Will Deacon <will@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Toan Le <toan@os.amperecomputing.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Tom Joseph <tjoseph@cadence.com>
Cc: Ray Jui <rjui@broadcom.com>
Cc: Scott Branden <sbranden@broadcom.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: Ryder Lee <ryder.lee@mediatek.com>
Cc: Karthikeyan Mitran <m.karthikeyan@mobiveil.co.in>
Cc: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
Cc: Simon Horman <horms@verge.net.au>
Cc: Shawn Lin <shawn.lin@rock-chips.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Michal Simek <michal.simek@xilinx.com>
Cc: rfi@lists.rocketboards.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-renesas-soc@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
2019-11-20 16:59:58 +00:00
Rob Herring e634e3e0b7 PCI: altera: Use pci_parse_request_of_pci_ranges()
Convert altera host bridge to use the common
pci_parse_request_of_pci_ranges().

There's no need to assign the resources to a temporary list first. Just
use bridge->windows directly and remove all the temporary list handling.

If an I/O range is present, then it will now be mapped. It's expected
that h/w which doesn't support I/O range will not define one.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Reviewed-by: Andrew Murray <andrew.murray@arm.com>
Cc: Ley Foon Tan <lftan@altera.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: rfi@lists.rocketboards.org
2019-10-29 10:48:33 +00:00
Ley Foon Tan 7a28db0a25 PCI: altera: Fix configuration type based on secondary number
Stratix 10 PCIe controller does not support Type 1 to Type 0 conversion
as previous version (V1) does so the PCIe controller configuration
mechanism needs to send Type 0 config TLP if the target bus number
matches with the secondary bus number.

Implement a function to form a TLP header that depends on the PCIe
controller version, so that the header can be formed according to
specific host controller HW internals, fixing the type conversion issue.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
[lorenzo.pieralisi@arm.com: commit log]
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2019-06-17 12:22:25 +01:00
Ley Foon Tan ec15c4d0d5 PCI: altera: Allow building as module
Altera PCIe Rootport IP is a soft IP and is only available after
an FPGA image (whose design contains it) is programmed.

Make driver modulable to support use cases when FPGA image is
programmed after the kernel has booted, so that the driver
can be loaded upon request.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2019-05-30 15:28:01 +01:00
Ley Foon Tan 49fdbd7cfe PCI: altera: Add Stratix 10 PCIe support
Add PCIe Root Port support for Stratix 10 device.

Main differences compared to the PCIe Root Port IP on Cyclone V
and Arria 10 devices:

- HIP interface to access Root Port configuration register
- TLP programming flow:
  - One REG0 register
  - Don't need to check alignment

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
2019-03-04 12:22:03 +00:00
Shawn Lin 6e0832fa43 PCI: Collect all native drivers under drivers/pci/controller/
Native PCI drivers for root complex devices were originally all in
drivers/pci/host/.  Some of these devices can also be operated in endpoint
mode.  Drivers for endpoint mode didn't seem to fit in the "host"
directory, so we put both the root complex and endpoint drivers in
per-device directories, e.g., drivers/pci/dwc/, drivers/pci/cadence/, etc.

These per-device directories contain trivial Kconfig and Makefiles and
clutter drivers/pci/.  Make a new drivers/pci/controllers/ directory and
collect all the device-specific drivers there.

No functional change intended.

Link: https://lkml.kernel.org/r/1520304202-232891-1-git-send-email-shawn.lin@rock-chips.com
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
[bhelgaas: changelog]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2018-06-08 07:50:11 -05:00