Commit Graph

14 Commits

Author SHA1 Message Date
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 cafa88ee06 PCI: mt7621: Fix string truncation in mt7621_pcie_parse_port()
JIRA: https://issues.redhat.com/browse/RHEL-50255
Upstream Status: fd6eb49a84a85150d5e9ffbd85d3b102303f9470

commit fd6eb49a84a85150d5e9ffbd85d3b102303f9470
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Thu Jan 11 09:27:04 2024 +0100

    PCI: mt7621: Fix string truncation in mt7621_pcie_parse_port()

    The following warning appears when driver is compiled with W=1.

    CC      drivers/pci/controller/pcie-mt7621.o
    drivers/pci/controller/pcie-mt7621.c: In function ‘mt7621_pcie_probe’:
    drivers/pci/controller/pcie-mt7621.c:228:49: error: ‘snprintf’ output may
    be truncated before the last format character [-Werror=format-truncation=]
    228 |         snprintf(name, sizeof(name), "pcie-phy%d", slot);
        |                                                 ^
    drivers/pci/controller/pcie-mt7621.c:228:9: note: ‘snprintf’ output between
    10 and 11 bytes into a destination of size 10
    228 |         snprintf(name, sizeof(name), "pcie-phy%d", slot);
        |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Clean this up increasing destination buffer one byte.

    [kwilczynski: commit log]
    Closes: https://lore.kernel.org/linux-pci/20240110212302.GA2123146@bhelgaas/T/#t
    Link: https://lore.kernel.org/linux-pci/20240111082704.2259450-1-sergio.paracuellos@gmail.com
    Reported-by: Bjorn Helgaas <helgaas@kernel.org>
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2024-08-15 15:31:13 -06:00
Myron Stowe 1abd97e641 PCI: mt7621: Convert to platform remove callback returning void
JIRA: https://issues.redhat.com/browse/RHEL-2570
Upstream Status: 8c47ac2a66c4a8372ecee4a5f0cc7c03c14de353

commit 8c47ac2a66c4a8372ecee4a5f0cc7c03c14de353
Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date:   Tue Mar 21 20:32:04 2023 +0100

    PCI: mt7621: 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-12-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>
    Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-09-19 13:32:23 -06:00
Myron Stowe baacac4dbf PCI: mt7621: Use dev_info() to log PCIe card detection
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2228915
Upstream Status: 50233e105a0332ec0f3bc83180c416e6b200471e

commit 50233e105a0332ec0f3bc83180c416e6b200471e
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Fri Mar 24 08:37:33 2023 +0100

    PCI: mt7621: Use dev_info() to log PCIe card detection

    When there is no card plugged on a PCIe port a log reporting that
    the port will be disabled is flagged as an error (dev_err()).

    Since this is not an error at all, change the log level by using
    dev_info() instead.

    Link: https://lore.kernel.org/r/20230324073733.1596231-1-sergio.paracuellos@gmail.com
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-09-05 09:16:42 -06:00
Myron Stowe 71fca1da20 PCI: mt7621: Delay phy ports initialization
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2179137
Upstream Status: 0cb2a8f3456ff1cc51d571e287a48e8fddc98ec2

commit 0cb2a8f3456ff1cc51d571e287a48e8fddc98ec2
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Sat Dec 31 08:40:41 2022 +0100

    PCI: mt7621: Delay phy ports initialization

    Some devices like ZBT WE1326 and ZBT WF3526-P and some Netgear models need
    to delay phy port initialization after calling the mt7621_pcie_init_port()
    driver function to get into reliable boots for both warm and hard resets.

    The delay required to detect the ports seems to be in the range [75-100]
    milliseconds.

    If the ports are not detected the controller is not functional.

    There is no datasheet or something similar to really understand why this
    extra delay is needed only for these devices and it is not for most of
    the boards that are built on mt7621 SoC.

    This issue has been reported by openWRT community and the complete
    discussion is in [0]. The 100 milliseconds delay has been tested in all
    devices to validate it.

    Add the extra 100 milliseconds delay to fix the issue.

    [0]: https://github.com/openwrt/openwrt/pull/11220

    Link: https://lore.kernel.org/r/20221231074041.264738-1-sergio.paracuellos@gmail.com
    Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver")
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-03-29 08:56:54 -06:00
Myron Stowe afb7a42928 PCI: mt7621: Add sentinel to quirks table
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2166398
Upstream Status: 19098934f910b4d47cb30251dd39ffa57bef9523

commit 19098934f910b4d47cb30251dd39ffa57bef9523
Author: John Thomson <git@johnthomson.fastmail.com.au>
Date:   Tue Dec 6 06:46:45 2022 +1000

    PCI: mt7621: Add sentinel to quirks table

    Current driver is missing a sentinel in the struct soc_device_attribute
    array, which causes an oops when assessed by the
    soc_device_match(mt7621_pcie_quirks_match) call.

    This was only exposed once the CONFIG_SOC_MT7621 mt7621 soc_dev_attr
    was fixed to register the SOC as a device, in:

    commit 7c18b64bba3b ("mips: ralink: mt7621: do not use kzalloc too early")

    Fix it by adding the required sentinel.

    Link: https://lore.kernel.org/lkml/26ebbed1-0fe9-4af9-8466-65f841d0b382@app.fastmail.com
    Link: https://lore.kernel.org/r/20221205204645.301301-1-git@johnthomson.fastmail.com.au
    Fixes: b483b4e4d3 ("staging: mt7621-pci: add quirks for 'E2' revision using 'soc_device_attribute'")
    Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Acked-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2023-03-07 18:02:03 -07:00
Myron Stowe aae9aaa547 PCI: mt7621: Use PCI_CONF1_EXT_ADDRESS() macro
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2135902
Upstream Status: 2301a3e1a5664cf8380d2b8ef051005dc90bc881

commit 2301a3e1a5664cf8380d2b8ef051005dc90bc881
Author: Pali Rohár <pali@kernel.org>
Date:   Sat Sep 24 11:24:04 2022 +0200

    PCI: mt7621: Use PCI_CONF1_EXT_ADDRESS() macro

    Simplify pcie-mt7621.c driver code and use new PCI_CONF1_EXT_ADDRESS()
    macro for accessing PCIe config space.

    Link: https://lore.kernel.org/r/20220924092404.31776-4-pali@kernel.org
    Signed-off-by: Pali Rohár <pali@kernel.org>
    Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
    Acked-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-11-06 10:12:09 -07:00
Myron Stowe 181c3f0e18 PCI: mt7621: Remove unused function pcie_rmw()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: c035366d9c9fe48d947ee6c43465ab43d42e20f2

commit c035366d9c9fe48d947ee6c43465ab43d42e20f2
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Mon Jan 24 12:30:03 2022 +0100

    PCI: mt7621: Remove unused function pcie_rmw()

    Function pcie_rmw() is not being used at all and can be deleted. Hence get
    rid of it, which fixes this warning:

      drivers/pci/controller/pcie-mt7621.c:112:20: warning: unused function 'pcie_rmw' [-Wunused-function]

    Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver")
    Link: https://lore.kernel.org/r/20220124113003.406224-3-sergio.paracuellos@gmail.com
    Link: https://lore.kernel.org/all/202201241754.igtHzgHv-lkp@intel.com/
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:52:12 -06:00
Myron Stowe 2068d6cf8e PCI: mt7621: Drop of_match_ptr() to avoid unused variable
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: 4b77e4abb32cddb9e666e2ac411b0b0d6b8331dd

commit 4b77e4abb32cddb9e666e2ac411b0b0d6b8331dd
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Mon Jan 24 12:30:02 2022 +0100

    PCI: mt7621: Drop of_match_ptr() to avoid unused variable

    We have stubs for most OF interfaces even when CONFIG_OF is not set, so we
    allow building of pcie-mt7621.c in that case for compile testing.

    When CONFIG_OF is not set, "of_match_ptr(mt7621_pcie_ids)" compiles to
    NULL, which leaves mt7621_pcie_ids unused:

      $ make W=1
      drivers/pci/controller/pcie-mt7621.c:549:34: warning: unused variable 'mt7621_pcie_ids' [-Wunused-const-variable]

    Drop of_match_ptr() to avoid the unused variable warning.

    [bhelgaas: commit log]
    Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver")
    Link: https://lore.kernel.org/r/20220124113003.406224-2-sergio.paracuellos@gmail.com
    Link: https://lore.kernel.org/r/202201241754.igtHzgHv-lkp@intel.com
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:51:45 -06:00
Myron Stowe d4116bb669 PCI: mt7621: Rename mt7621_pci_ to mt7621_pcie_
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: 4793895f597d42eb54a0f54711b61263b6a8dd03

commit 4793895f597d42eb54a0f54711b61263b6a8dd03
Author: Bjorn Helgaas <bhelgaas@google.com>
Date:   Wed Dec 22 19:10:48 2021 -0600

    PCI: mt7621: Rename mt7621_pci_ to mt7621_pcie_

    Rename mt7621_pci_* structs and functions to mt7621_pcie_* for consistency
    with the rest of the file.

    Link: https://lore.kernel.org/r/20211223011054.1227810-18-helgaas@kernel.org
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Cc: Matthias Brugger <matthias.bgg@gmail.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:51:14 -06:00
Myron Stowe 0d8aab4f05 PCI: mt7621: Add missing MODULE_LICENSE()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: e4b1cd02dc8d7967a79edccd510724831e5cdee8

commit e4b1cd02dc8d7967a79edccd510724831e5cdee8
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Tue Dec 7 11:49:23 2021 +0100

    PCI: mt7621: Add missing MODULE_LICENSE()

    The MT7621 PCIe host controller driver can be built as a module, but it
    lacks a MODULE_LICENSE(), which causes a build error:

      ERROR: modpost: missing MODULE_LICENSE() in drivers/pci/controller/pcie-mt7621.o

    Add MODULE_LICENSE() to the driver.

    Fixes: 2bdd5238e756 ("PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver")
    Link: https://lore.kernel.org/r/20211207104924.21327-5-sergio.paracuellos@gmail.com
    Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:51:05 -06:00
Myron Stowe 300ba28808 PCI: mt7621: Move MIPS setup to pcibios_root_bridge_prepare()
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: fe7498ef791710a8bb79008850ce7fcbd3903657

commit fe7498ef791710a8bb79008850ce7fcbd3903657
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Tue Dec 7 11:49:21 2021 +0100

    PCI: mt7621: Move MIPS setup to pcibios_root_bridge_prepare()

    On the MIPS ralink mt7621 platform, we need to set up I/O coherency units
    based on the host bridge apertures.

    To remove this arch dependency from the driver itself, move the coherency
    setup from the driver to pcibios_root_bridge_prepare().

    [bhelgaas: squash add/remove into one patch, commit log]
    Link: https://lore.kernel.org/r/20211207104924.21327-3-sergio.paracuellos@gmail.com
    Link: https://lore.kernel.org/r/20211207104924.21327-4-sergio.paracuellos@gmail.com
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Guenter Roeck <linux@roeck-us.net>             # arch/mips
    Acked-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>   # arch/mips

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:50:54 -06:00
Myron Stowe f35c61e8df PCI: mt7621: Declare mt7621_pci_ops static
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: da48157092e7dd25e8c0fa38e0ccd93219a66046

commit da48157092e7dd25e8c0fa38e0ccd93219a66046
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Wed Nov 17 16:29:52 2021 +0100

    PCI: mt7621: Declare mt7621_pci_ops static

    Sparse complains about mt7621_pci_ops symbol is not declared and asks if
    it should be declared as static instead. Sparse is right. Hence declare
    symbol as static.

    Link: https://lore.kernel.org/r/20211117152952.12271-1-sergio.paracuellos@gmail.com
    Reported-by: kernel test robot <lkp@intel.com>
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:50:44 -06:00
Myron Stowe c9147a895e PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2052155
Upstream Status: 2bdd5238e756aac3ecbffc7c22b884485e84062e

Conflict(s):
  Same conflicts that occurred upstream due to collisions between this
  commit and a prior commit.

  The resolution can be seen via the 'Merge branch' commit -
     83e168d607d6 Merge branch 'pci/host/mt7621'


commit 2bdd5238e756aac3ecbffc7c22b884485e84062e
Author: Sergio Paracuellos <sergio.paracuellos@gmail.com>
Date:   Wed Sep 22 07:00:34 2021 +0200

    PCI: mt7621: Add MediaTek MT7621 PCIe host controller driver

    Add driver for the PCIe controller of the MT7621 SoC.

    [bhelgaas: rename from pci-mt7621.c to pcie-mt7621.c; also rename Kconfig
    symbol from PCI_MT7621 to PCIE_MT7621]
    Link: https://lore.kernel.org/r/20210922050035.18162-3-sergio.paracuellos@gmail.com
    Signed-off-by: Sergio Paracuellos <sergio.paracuellos@gmail.com>
    Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Myron Stowe <mstowe@redhat.com>
2022-04-12 08:49:34 -06:00