aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Que <sque@ti.com>2011-02-17 12:52:03 -0500
committerTony Lindgren <tony@atomide.com>2011-02-17 12:52:43 -0500
commit7bb412a64281c599dcf00af2eed61ea997b282c2 (patch)
tree416a67d6f6f39aa96fd92e2caa6a533df96ad11a
parent70ba4cc26b9f53859e863ec3b9a5f5fc0ce4d6a2 (diff)
omap: add hwspinlock device
Build and register an hwspinlock platform device. Although only OMAP4 supports the hardware spinlock module (for now), it is still safe to run this initcall on all omaps, because hwmod lookup will simply fail on hwspinlock-less platforms. Signed-off-by: Simon Que <sque@ti.com> Signed-off-by: Hari Kanigeri <h-kanigeri2@ti.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> Cc: Benoit Cousson <b-cousson@ti.com> Cc: Kevin Hilman <khilman@ti.com> Cc: Paul Walmsley <paul@pwsan.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/hwspinlock.c63
2 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index a9e3974d015f..ec24999eefea 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -243,3 +243,4 @@ obj-y += $(smc91x-m) $(smc91x-y)
243 243
244smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o 244smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
245obj-y += $(smsc911x-m) $(smsc911x-y) 245obj-y += $(smsc911x-m) $(smsc911x-y)
246obj-$(CONFIG_ARCH_OMAP4) += hwspinlock.o
diff --git a/arch/arm/mach-omap2/hwspinlock.c b/arch/arm/mach-omap2/hwspinlock.c
new file mode 100644
index 000000000000..06d4a80660a5
--- /dev/null
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -0,0 +1,63 @@
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
23#include <plat/omap_hwmod.h>
24#include <plat/omap_device.h>
25
26struct omap_device_pm_latency omap_spinlock_latency[] = {
27 {
28 .deactivate_func = omap_device_idle_hwmods,
29 .activate_func = omap_device_enable_hwmods,
30 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
31 }
32};
33
34int __init hwspinlocks_init(void)
35{
36 int retval = 0;
37 struct omap_hwmod *oh;
38 struct omap_device *od;
39 const char *oh_name = "spinlock";
40 const char *dev_name = "omap_hwspinlock";
41
42 /*
43 * Hwmod lookup will fail in case our platform doesn't support the
44 * hardware spinlock module, so it is safe to run this initcall
45 * on all omaps
46 */
47 oh = omap_hwmod_lookup(oh_name);
48 if (oh == NULL)
49 return -EINVAL;
50
51 od = omap_device_build(dev_name, 0, oh, NULL, 0,
52 omap_spinlock_latency,
53 ARRAY_SIZE(omap_spinlock_latency), false);
54 if (IS_ERR(od)) {
55 pr_err("Can't build omap_device for %s:%s\n", dev_name,
56 oh_name);
57 retval = PTR_ERR(od);
58 }
59
60 return retval;
61}
62/* early board code might need to reserve specific hwspinlock instances */
63postcore_initcall(hwspinlocks_init);