summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-02-10 17:05:29 +0100
committerLinus Walleij <linus.walleij@linaro.org>2019-04-23 16:02:15 +0200
commitbc4d7eafb7ad590f546b58c40cd7856990fbb303 (patch)
tree2538b36b5190f5ac7def7e62da0c004a24c99664
parentARM: ixp4xx: Move IXP4xx QMGR and NPE headers (diff)
downloadlinux-bc4d7eafb7ad590f546b58c40cd7856990fbb303.tar.xz
linux-bc4d7eafb7ad590f546b58c40cd7856990fbb303.zip
ARM: ixp4xx: Turn the NPE into a platform device
Instead of registering everything related to the NPE unconditionally in the module_init() call (which will never work with multiplatform) create a platform device and probe the NPE like any other device. Put the device first in the list of devices added for the platform so it is there when the dependent network and crypto drivers probe later on. This probe() path will not be taken unconditionally on device tree boots, so remove the DT guard. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r--arch/arm/mach-ixp4xx/common.c6
-rw-r--r--drivers/soc/ixp4xx/ixp4xx-npe.c23
2 files changed, 19 insertions, 10 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index fc4c9b21ca96..e7789d06c39b 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -150,7 +150,13 @@ static struct platform_device ixp4xx_udc_device = {
},
};
+static struct platform_device ixp4xx_npe_device = {
+ .name = "ixp4xx-npe",
+ .id = -1,
+};
+
static struct platform_device *ixp4xx_devices[] __initdata = {
+ &ixp4xx_npe_device,
&ixp4xx_gpio_device,
&ixp4xx_udc_device,
};
diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c
index 1f6e01369d54..e3294457b5de 100644
--- a/drivers/soc/ixp4xx/ixp4xx-npe.c
+++ b/drivers/soc/ixp4xx/ixp4xx-npe.c
@@ -21,6 +21,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/platform_device.h>
#include <linux/soc/ixp4xx/npe.h>
#define DEBUG_MSG 0
@@ -683,16 +684,10 @@ void npe_release(struct npe *npe)
module_put(THIS_MODULE);
}
-
-static int __init npe_init_module(void)
+static int ixp4xx_npe_probe(struct platform_device *pdev)
{
-
int i, found = 0;
- /* This driver does not work with device tree */
- if (of_have_populated_dt())
- return -ENODEV;
-
for (i = 0; i < NPE_COUNT; i++) {
struct npe *npe = &npe_tab[i];
if (!(ixp4xx_read_feature_bits() &
@@ -717,7 +712,7 @@ static int __init npe_init_module(void)
return 0;
}
-static void __exit npe_cleanup_module(void)
+static int ixp4xx_npe_remove(struct platform_device *pdev)
{
int i;
@@ -726,10 +721,18 @@ static void __exit npe_cleanup_module(void)
npe_reset(&npe_tab[i]);
release_resource(npe_tab[i].mem_res);
}
+
+ return 0;
}
-module_init(npe_init_module);
-module_exit(npe_cleanup_module);
+static struct platform_driver ixp4xx_npe_driver = {
+ .driver = {
+ .name = "ixp4xx-npe",
+ },
+ .probe = ixp4xx_npe_probe,
+ .remove = ixp4xx_npe_remove,
+};
+module_platform_driver(ixp4xx_npe_driver);
MODULE_AUTHOR("Krzysztof Halasa");
MODULE_LICENSE("GPL v2");