]> git.karo-electronics.de Git - linux-beck.git/commitdiff
hwspinlock/omap: add support for dt nodes
authorSuman Anna <s-anna@ti.com>
Thu, 5 Mar 2015 02:01:16 +0000 (20:01 -0600)
committerOhad Ben-Cohen <ohad@wizery.com>
Sat, 2 May 2015 07:05:10 +0000 (10:05 +0300)
HwSpinlock IP is present only on OMAP4 and other newer SoCs,
which are all device-tree boot only. This patch adds the
base support for parsing the DT nodes, and removes the code
dealing with the traditional platform device instantiation.

Signed-off-by: Suman Anna <s-anna@ti.com>
[tony@atomide.com: ack for legacy file removal]
Acked-by: Tony Lindgren <tony@atomide.com>
[comment on the imperfect always-zero base_id]
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
MAINTAINERS
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/hwspinlock.c [deleted file]
drivers/hwspinlock/omap_hwspinlock.c

index 2e5bbc0d68b26e188e2d7e8154cf80e47fabdda1..5fe8941ba12d6be11ad706dd4c1c13e33f049d2e 100644 (file)
@@ -7095,7 +7095,6 @@ M:        Ohad Ben-Cohen <ohad@wizery.com>
 L:     linux-omap@vger.kernel.org
 S:     Maintained
 F:     drivers/hwspinlock/omap_hwspinlock.c
-F:     arch/arm/mach-omap2/hwspinlock.c
 
 OMAP MMC SUPPORT
 M:     Jarkko Lavinen <jarkko.lavinen@nokia.com>
index ec002bd4af771508e712bf7b93ec373d18323620..9a2c88e56bae4fe8277ed3b3f0507f8116dfeb99 100644 (file)
@@ -277,8 +277,5 @@ obj-y                                       += $(nand-m) $(nand-y)
 
 smsc911x-$(CONFIG_SMSC911X)            := gpmc-smsc911x.o
 obj-y                                  += $(smsc911x-m) $(smsc911x-y)
-ifneq ($(CONFIG_HWSPINLOCK_OMAP),)
-obj-y                                  += hwspinlock.o
-endif
 
 obj-y                                  += common-board-devices.o twl-common.o dss-common.o
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
deleted file mode 100644 (file)
index ef175ac..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * OMAP hardware spinlock device initialization
- *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
- *
- * Contact: Simon Que <sque@ti.com>
- *          Hari Kanigeri <h-kanigeri2@ti.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- */
-
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/hwspinlock.h>
-
-#include "soc.h"
-#include "omap_hwmod.h"
-#include "omap_device.h"
-
-static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = {
-       .base_id = 0,
-};
-
-static int __init hwspinlocks_init(void)
-{
-       int retval = 0;
-       struct omap_hwmod *oh;
-       struct platform_device *pdev;
-       const char *oh_name = "spinlock";
-       const char *dev_name = "omap_hwspinlock";
-
-       /*
-        * Hwmod lookup will fail in case our platform doesn't support the
-        * hardware spinlock module, so it is safe to run this initcall
-        * on all omaps
-        */
-       oh = omap_hwmod_lookup(oh_name);
-       if (oh == NULL)
-               return -EINVAL;
-
-       pdev = omap_device_build(dev_name, 0, oh, &omap_hwspinlock_pdata,
-                               sizeof(struct hwspinlock_pdata));
-       if (IS_ERR(pdev)) {
-               pr_err("Can't build omap_device for %s:%s\n", dev_name,
-                                                               oh_name);
-               retval = PTR_ERR(pdev);
-       }
-
-       return retval;
-}
-/* early board code might need to reserve specific hwspinlock instances */
-omap_postcore_initcall(hwspinlocks_init);
index 47a275c6ece1d24487ca0f832f2913a597b8a87b..ad2f8cac8487c0a6edde5d6847dc57f97409210d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * OMAP hardware spinlock driver
  *
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com
  *
  * Contact: Simon Que <sque@ti.com>
  *          Hari Kanigeri <h-kanigeri2@ti.com>
@@ -27,6 +27,7 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/hwspinlock.h>
+#include <linux/of.h>
 #include <linux/platform_device.h>
 
 #include "hwspinlock_internal.h"
@@ -80,14 +81,16 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = {
 
 static int omap_hwspinlock_probe(struct platform_device *pdev)
 {
-       struct hwspinlock_pdata *pdata = pdev->dev.platform_data;
+       struct device_node *node = pdev->dev.of_node;
        struct hwspinlock_device *bank;
        struct hwspinlock *hwlock;
        struct resource *res;
        void __iomem *io_base;
        int num_locks, i, ret;
+       /* Only a single hwspinlock block device is supported */
+       int base_id = 0;
 
-       if (!pdata)
+       if (!node)
                return -ENODEV;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -141,7 +144,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
                hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i;
 
        ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops,
-                                               pdata->base_id, num_locks);
+                                               base_id, num_locks);
        if (ret)
                goto reg_fail;
 
@@ -174,11 +177,18 @@ static int omap_hwspinlock_remove(struct platform_device *pdev)
        return 0;
 }
 
+static const struct of_device_id omap_hwspinlock_of_match[] = {
+       { .compatible = "ti,omap4-hwspinlock", },
+       { /* end */ },
+};
+MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match);
+
 static struct platform_driver omap_hwspinlock_driver = {
        .probe          = omap_hwspinlock_probe,
        .remove         = omap_hwspinlock_remove,
        .driver         = {
                .name   = "omap_hwspinlock",
+               .of_match_table = of_match_ptr(omap_hwspinlock_of_match),
        },
 };