aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-02-10 11:14:10 -0500
committerLinus Walleij <linus.walleij@linaro.org>2019-04-23 10:02:15 -0400
commit81bca32fcc75ededc51274d11f593a22a027236c (patch)
tree4c47b83517e323ee3b70a9f6ae4d7f4c8b6dc998
parentbc4d7eafb7ad590f546b58c40cd7856990fbb303 (diff)
ARM: ixp4xx: Turn the QMGR into a platform device
Instead of registering everything related to the QMGR unconditionally in the module_init() call (which will never work with multiplatform) create a platform device and probe the QMGR like any other device. Put the device second 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-qmgr.c21
2 files changed, 19 insertions, 8 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index e7789d06c39b..cdcd6d6b6d3d 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -155,8 +155,14 @@ static struct platform_device ixp4xx_npe_device = {
155 .id = -1, 155 .id = -1,
156}; 156};
157 157
158static struct platform_device ixp4xx_qmgr_device = {
159 .name = "ixp4xx-qmgr",
160 .id = -1,
161};
162
158static struct platform_device *ixp4xx_devices[] __initdata = { 163static struct platform_device *ixp4xx_devices[] __initdata = {
159 &ixp4xx_npe_device, 164 &ixp4xx_npe_device,
165 &ixp4xx_qmgr_device,
160 &ixp4xx_gpio_device, 166 &ixp4xx_gpio_device,
161 &ixp4xx_udc_device, 167 &ixp4xx_udc_device,
162}; 168};
diff --git a/drivers/soc/ixp4xx/ixp4xx-qmgr.c b/drivers/soc/ixp4xx/ixp4xx-qmgr.c
index 1bed048924bb..133914e99aeb 100644
--- a/drivers/soc/ixp4xx/ixp4xx-qmgr.c
+++ b/drivers/soc/ixp4xx/ixp4xx-qmgr.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/platform_device.h>
16#include <linux/soc/ixp4xx/qmgr.h> 17#include <linux/soc/ixp4xx/qmgr.h>
17 18
18/* FIXME: get rid of these static assigments */ 19/* FIXME: get rid of these static assigments */
@@ -288,15 +289,11 @@ void qmgr_release_queue(unsigned int queue)
288 module_put(THIS_MODULE); 289 module_put(THIS_MODULE);
289} 290}
290 291
291static int qmgr_init(void) 292static int ixp4xx_qmgr_probe(struct platform_device *pdev)
292{ 293{
293 int i, err; 294 int i, err;
294 irq_handler_t handler1, handler2; 295 irq_handler_t handler1, handler2;
295 296
296 /* This driver does not work with device tree */
297 if (of_have_populated_dt())
298 return -ENODEV;
299
300 mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS, 297 mem_res = request_mem_region(IXP4XX_QMGR_BASE_PHYS,
301 IXP4XX_QMGR_REGION_SIZE, 298 IXP4XX_QMGR_REGION_SIZE,
302 "IXP4xx Queue Manager"); 299 "IXP4xx Queue Manager");
@@ -355,17 +352,25 @@ error_irq:
355 return err; 352 return err;
356} 353}
357 354
358static void qmgr_remove(void) 355static int ixp4xx_qmgr_remove(struct platform_device *pdev)
359{ 356{
360 free_irq(IRQ_IXP4XX_QM1, NULL); 357 free_irq(IRQ_IXP4XX_QM1, NULL);
361 free_irq(IRQ_IXP4XX_QM2, NULL); 358 free_irq(IRQ_IXP4XX_QM2, NULL);
362 synchronize_irq(IRQ_IXP4XX_QM1); 359 synchronize_irq(IRQ_IXP4XX_QM1);
363 synchronize_irq(IRQ_IXP4XX_QM2); 360 synchronize_irq(IRQ_IXP4XX_QM2);
364 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); 361 release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);
362
363 return 0;
365} 364}
366 365
367module_init(qmgr_init); 366static struct platform_driver ixp4xx_qmgr_driver = {
368module_exit(qmgr_remove); 367 .driver = {
368 .name = "ixp4xx-qmgr",
369 },
370 .probe = ixp4xx_qmgr_probe,
371 .remove = ixp4xx_qmgr_remove,
372};
373module_platform_driver(ixp4xx_qmgr_driver);
369 374
370MODULE_LICENSE("GPL v2"); 375MODULE_LICENSE("GPL v2");
371MODULE_AUTHOR("Krzysztof Halasa"); 376MODULE_AUTHOR("Krzysztof Halasa");