]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PCI: layerscape: Allow to compile as module
authorSascha Hauer <s.hauer@pengutronix.de>
Mon, 12 Jan 2026 19:17:11 +0000 (20:17 +0100)
committerManivannan Sadhasivam <mani@kernel.org>
Thu, 26 Feb 2026 06:03:43 +0000 (11:33 +0530)
The layerscape pcie host controller could also be compiled as module.
Add the necessary infrastructure to allow building as module instead of
only as builtin driver.

Since the driver doesn't expose an irqchip controller, it is also safe to
be removed during runtime.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
[mani: added a note about driver removability]
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Acked-by: Roy Zang <Roy.Zang@nxp.com>
Link: https://patch.msgid.link/20260112-v6-19-topic-layerscape-pcie-v1-1-1cd863fce50e@pengutronix.de
drivers/pci/controller/dwc/Kconfig
drivers/pci/controller/dwc/pci-layerscape.c

index d0aa031397fab1451b33aa3d6f2749de3ee05df4..1a69b38c2a281547ae49f34b735b50815f1a5bcc 100644 (file)
@@ -121,7 +121,7 @@ config PCI_IMX6_EP
          DesignWare core functions to implement the driver.
 
 config PCI_LAYERSCAPE
-       bool "Freescale Layerscape PCIe controller (host mode)"
+       tristate "Freescale Layerscape PCIe controller (host mode)"
        depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST)
        depends on PCI_MSI
        select PCIE_DW_HOST
index a44b5c256d6e2a0913b6d1a0b59066612866991f..14d6ac4fc53fdca728e0665d51bf80d14b5ab7fc 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/iopoll.h>
+#include <linux/module.h>
 #include <linux/of_pci.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
@@ -403,8 +404,16 @@ static const struct dev_pm_ops ls_pcie_pm_ops = {
        NOIRQ_SYSTEM_SLEEP_PM_OPS(ls_pcie_suspend_noirq, ls_pcie_resume_noirq)
 };
 
+static void ls_pcie_remove(struct platform_device *pdev)
+{
+       struct ls_pcie *pcie = platform_get_drvdata(pdev);
+
+       dw_pcie_host_deinit(&pcie->pci->pp);
+}
+
 static struct platform_driver ls_pcie_driver = {
        .probe = ls_pcie_probe,
+       .remove = ls_pcie_remove,
        .driver = {
                .name = "layerscape-pcie",
                .of_match_table = ls_pcie_of_match,
@@ -412,4 +421,9 @@ static struct platform_driver ls_pcie_driver = {
                .pm = &ls_pcie_pm_ops,
        },
 };
-builtin_platform_driver(ls_pcie_driver);
+module_platform_driver(ls_pcie_driver);
+
+MODULE_AUTHOR("Minghuan Lian <Minghuan.Lian@freescale.com>");
+MODULE_DESCRIPTION("Layerscape PCIe host controller driver");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, ls_pcie_of_match);