diff options
author | Suman Anna <s-anna@ti.com> | 2015-03-04 21:01:16 -0500 |
---|---|---|
committer | Ohad Ben-Cohen <ohad@wizery.com> | 2015-05-02 03:05:10 -0400 |
commit | 65bd4341d61678494ea14994d0d7df73644ca014 (patch) | |
tree | 52a2e00dd0c3d79420a27933ab1d458fab07997d | |
parent | 67140ed1c9d518565e6e2b86ba761652eb9bf3c4 (diff) |
hwspinlock/omap: add support for dt nodes
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>
-rw-r--r-- | MAINTAINERS | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/hwspinlock.c | 60 | ||||
-rw-r--r-- | drivers/hwspinlock/omap_hwspinlock.c | 18 |
4 files changed, 14 insertions, 68 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 2e5bbc0d68b2..5fe8941ba12d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -7095,7 +7095,6 @@ M: Ohad Ben-Cohen <ohad@wizery.com> | |||
7095 | L: linux-omap@vger.kernel.org | 7095 | L: linux-omap@vger.kernel.org |
7096 | S: Maintained | 7096 | S: Maintained |
7097 | F: drivers/hwspinlock/omap_hwspinlock.c | 7097 | F: drivers/hwspinlock/omap_hwspinlock.c |
7098 | F: arch/arm/mach-omap2/hwspinlock.c | ||
7099 | 7098 | ||
7100 | OMAP MMC SUPPORT | 7099 | OMAP MMC SUPPORT |
7101 | M: Jarkko Lavinen <jarkko.lavinen@nokia.com> | 7100 | M: Jarkko Lavinen <jarkko.lavinen@nokia.com> |
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ec002bd4af77..9a2c88e56bae 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
@@ -277,8 +277,5 @@ obj-y += $(nand-m) $(nand-y) | |||
277 | 277 | ||
278 | smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o | 278 | smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o |
279 | obj-y += $(smsc911x-m) $(smsc911x-y) | 279 | obj-y += $(smsc911x-m) $(smsc911x-y) |
280 | ifneq ($(CONFIG_HWSPINLOCK_OMAP),) | ||
281 | obj-y += hwspinlock.o | ||
282 | endif | ||
283 | 280 | ||
284 | obj-y += common-board-devices.o twl-common.o dss-common.o | 281 | 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 index ef175acaeaa2..000000000000 --- a/arch/arm/mach-omap2/hwspinlock.c +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | /* | ||
2 | * OMAP hardware spinlock device initialization | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com | ||
5 | * | ||
6 | * Contact: Simon Que <sque@ti.com> | ||
7 | * Hari Kanigeri <h-kanigeri2@ti.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * version 2 as published by the Free Software Foundation. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, but | ||
14 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | * General Public License for more details. | ||
17 | */ | ||
18 | |||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/err.h> | ||
22 | #include <linux/hwspinlock.h> | ||
23 | |||
24 | #include "soc.h" | ||
25 | #include "omap_hwmod.h" | ||
26 | #include "omap_device.h" | ||
27 | |||
28 | static struct hwspinlock_pdata omap_hwspinlock_pdata __initdata = { | ||
29 | .base_id = 0, | ||
30 | }; | ||
31 | |||
32 | static int __init hwspinlocks_init(void) | ||
33 | { | ||
34 | int retval = 0; | ||
35 | struct omap_hwmod *oh; | ||
36 | struct platform_device *pdev; | ||
37 | const char *oh_name = "spinlock"; | ||
38 | const char *dev_name = "omap_hwspinlock"; | ||
39 | |||
40 | /* | ||
41 | * Hwmod lookup will fail in case our platform doesn't support the | ||
42 | * hardware spinlock module, so it is safe to run this initcall | ||
43 | * on all omaps | ||
44 | */ | ||
45 | oh = omap_hwmod_lookup(oh_name); | ||
46 | if (oh == NULL) | ||
47 | return -EINVAL; | ||
48 | |||
49 | pdev = omap_device_build(dev_name, 0, oh, &omap_hwspinlock_pdata, | ||
50 | sizeof(struct hwspinlock_pdata)); | ||
51 | if (IS_ERR(pdev)) { | ||
52 | pr_err("Can't build omap_device for %s:%s\n", dev_name, | ||
53 | oh_name); | ||
54 | retval = PTR_ERR(pdev); | ||
55 | } | ||
56 | |||
57 | return retval; | ||
58 | } | ||
59 | /* early board code might need to reserve specific hwspinlock instances */ | ||
60 | omap_postcore_initcall(hwspinlocks_init); | ||
diff --git a/drivers/hwspinlock/omap_hwspinlock.c b/drivers/hwspinlock/omap_hwspinlock.c index 47a275c6ece1..ad2f8cac8487 100644 --- a/drivers/hwspinlock/omap_hwspinlock.c +++ b/drivers/hwspinlock/omap_hwspinlock.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * OMAP hardware spinlock driver | 2 | * OMAP hardware spinlock driver |
3 | * | 3 | * |
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com | 4 | * Copyright (C) 2010-2015 Texas Instruments Incorporated - http://www.ti.com |
5 | * | 5 | * |
6 | * Contact: Simon Que <sque@ti.com> | 6 | * Contact: Simon Que <sque@ti.com> |
7 | * Hari Kanigeri <h-kanigeri2@ti.com> | 7 | * Hari Kanigeri <h-kanigeri2@ti.com> |
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/hwspinlock.h> | 29 | #include <linux/hwspinlock.h> |
30 | #include <linux/of.h> | ||
30 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
31 | 32 | ||
32 | #include "hwspinlock_internal.h" | 33 | #include "hwspinlock_internal.h" |
@@ -80,14 +81,16 @@ static const struct hwspinlock_ops omap_hwspinlock_ops = { | |||
80 | 81 | ||
81 | static int omap_hwspinlock_probe(struct platform_device *pdev) | 82 | static int omap_hwspinlock_probe(struct platform_device *pdev) |
82 | { | 83 | { |
83 | struct hwspinlock_pdata *pdata = pdev->dev.platform_data; | 84 | struct device_node *node = pdev->dev.of_node; |
84 | struct hwspinlock_device *bank; | 85 | struct hwspinlock_device *bank; |
85 | struct hwspinlock *hwlock; | 86 | struct hwspinlock *hwlock; |
86 | struct resource *res; | 87 | struct resource *res; |
87 | void __iomem *io_base; | 88 | void __iomem *io_base; |
88 | int num_locks, i, ret; | 89 | int num_locks, i, ret; |
90 | /* Only a single hwspinlock block device is supported */ | ||
91 | int base_id = 0; | ||
89 | 92 | ||
90 | if (!pdata) | 93 | if (!node) |
91 | return -ENODEV; | 94 | return -ENODEV; |
92 | 95 | ||
93 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 96 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -141,7 +144,7 @@ static int omap_hwspinlock_probe(struct platform_device *pdev) | |||
141 | hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; | 144 | hwlock->priv = io_base + LOCK_BASE_OFFSET + sizeof(u32) * i; |
142 | 145 | ||
143 | ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, | 146 | ret = hwspin_lock_register(bank, &pdev->dev, &omap_hwspinlock_ops, |
144 | pdata->base_id, num_locks); | 147 | base_id, num_locks); |
145 | if (ret) | 148 | if (ret) |
146 | goto reg_fail; | 149 | goto reg_fail; |
147 | 150 | ||
@@ -174,11 +177,18 @@ static int omap_hwspinlock_remove(struct platform_device *pdev) | |||
174 | return 0; | 177 | return 0; |
175 | } | 178 | } |
176 | 179 | ||
180 | static const struct of_device_id omap_hwspinlock_of_match[] = { | ||
181 | { .compatible = "ti,omap4-hwspinlock", }, | ||
182 | { /* end */ }, | ||
183 | }; | ||
184 | MODULE_DEVICE_TABLE(of, omap_hwspinlock_of_match); | ||
185 | |||
177 | static struct platform_driver omap_hwspinlock_driver = { | 186 | static struct platform_driver omap_hwspinlock_driver = { |
178 | .probe = omap_hwspinlock_probe, | 187 | .probe = omap_hwspinlock_probe, |
179 | .remove = omap_hwspinlock_remove, | 188 | .remove = omap_hwspinlock_remove, |
180 | .driver = { | 189 | .driver = { |
181 | .name = "omap_hwspinlock", | 190 | .name = "omap_hwspinlock", |
191 | .of_match_table = of_match_ptr(omap_hwspinlock_of_match), | ||
182 | }, | 192 | }, |
183 | }; | 193 | }; |
184 | 194 | ||