Skip to content

Commit e36262c

Browse files
saschahauerMani-Sadhasivam
authored andcommitted
PCI: layerscape: Allow to compile as module
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
1 parent 6de23f8 commit e36262c

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

drivers/pci/controller/dwc/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ config PCI_IMX6_EP
121121
DesignWare core functions to implement the driver.
122122

123123
config PCI_LAYERSCAPE
124-
bool "Freescale Layerscape PCIe controller (host mode)"
124+
tristate "Freescale Layerscape PCIe controller (host mode)"
125125
depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST)
126126
depends on PCI_MSI
127127
select PCIE_DW_HOST

drivers/pci/controller/dwc/pci-layerscape.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/interrupt.h>
1414
#include <linux/init.h>
1515
#include <linux/iopoll.h>
16+
#include <linux/module.h>
1617
#include <linux/of_pci.h>
1718
#include <linux/of_platform.h>
1819
#include <linux/of_address.h>
@@ -403,13 +404,26 @@ static const struct dev_pm_ops ls_pcie_pm_ops = {
403404
NOIRQ_SYSTEM_SLEEP_PM_OPS(ls_pcie_suspend_noirq, ls_pcie_resume_noirq)
404405
};
405406

407+
static void ls_pcie_remove(struct platform_device *pdev)
408+
{
409+
struct ls_pcie *pcie = platform_get_drvdata(pdev);
410+
411+
dw_pcie_host_deinit(&pcie->pci->pp);
412+
}
413+
406414
static struct platform_driver ls_pcie_driver = {
407415
.probe = ls_pcie_probe,
416+
.remove = ls_pcie_remove,
408417
.driver = {
409418
.name = "layerscape-pcie",
410419
.of_match_table = ls_pcie_of_match,
411420
.suppress_bind_attrs = true,
412421
.pm = &ls_pcie_pm_ops,
413422
},
414423
};
415-
builtin_platform_driver(ls_pcie_driver);
424+
module_platform_driver(ls_pcie_driver);
425+
426+
MODULE_AUTHOR("Minghuan Lian <Minghuan.Lian@freescale.com>");
427+
MODULE_DESCRIPTION("Layerscape PCIe host controller driver");
428+
MODULE_LICENSE("GPL");
429+
MODULE_DEVICE_TABLE(of, ls_pcie_of_match);

0 commit comments

Comments
 (0)