aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorSebastien Jan <s-jan@ti.com>2011-09-23 13:31:18 -0400
committerPaolo Pisati <paolo.pisati@canonical.com>2012-08-17 04:19:21 -0400
commit369bb0f389b27693a807702fad0691d1e24cd72c (patch)
tree45f9fe858b29a0a300f469b69628efaf2296c8ed /arch
parentcd2c4b2c14f9910d4ddc12fd27d1ca1809363635 (diff)
Revert "fix: remove duplicate hwspinlock source"
This reverts commit 9a84fc90be096d69e376a31f1c8cf15fde9b9299.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/Makefile1
-rw-r--r--arch/arm/mach-omap2/hwspinlocks.c82
2 files changed, 83 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 9da34c18f42..249f3a46f21 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -272,6 +272,7 @@ obj-y += $(nand-m) $(nand-y)
272 272
273smc91x-$(CONFIG_SMC91X) := gpmc-smc91x.o 273smc91x-$(CONFIG_SMC91X) := gpmc-smc91x.o
274obj-y += $(smc91x-m) $(smc91x-y) 274obj-y += $(smc91x-m) $(smc91x-y)
275obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o
275 276
276smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o 277smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
277obj-y += $(smsc911x-m) $(smsc911x-y) 278obj-y += $(smsc911x-m) $(smsc911x-y)
diff --git a/arch/arm/mach-omap2/hwspinlocks.c b/arch/arm/mach-omap2/hwspinlocks.c
new file mode 100644
index 00000000000..3c71b92a482
--- /dev/null
+++ b/arch/arm/mach-omap2/hwspinlocks.c
@@ -0,0 +1,82 @@
1/*
2 * OMAP hardware spinlock device initialization
3 *
4 * Copyright (C) 2010 Texas Instruments. All rights reserved.
5 *
6 * Contact: Simon Que <sque@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#include <linux/module.h>
25#include <linux/interrupt.h>
26#include <linux/device.h>
27#include <linux/delay.h>
28#include <linux/io.h>
29#include <linux/slab.h>
30
31#include <plat/hwspinlock.h>
32#include <plat/omap_device.h>
33#include <plat/omap_hwmod.h>
34
35/* Spinlock register offsets */
36#define REVISION_OFFSET 0x0000
37#define SYSCONFIG_OFFSET 0x0010
38#define SYSSTATUS_OFFSET 0x0014
39#define LOCK_BASE_OFFSET 0x0800
40#define LOCK_OFFSET(i) (LOCK_BASE_OFFSET + 0x4 * (i))
41
42struct omap_device_pm_latency omap_spinlock_latency[] = {
43 {
44 .deactivate_func = omap_device_idle_hwmods,
45 .activate_func = omap_device_enable_hwmods,
46 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
47 }
48};
49
50/* Initialization function */
51int __init hwspinlocks_init(void)
52{
53 int retval = 0;
54
55 struct hwspinlock_plat_info *pdata;
56 struct omap_hwmod *oh;
57 char *oh_name, *pdev_name;
58
59 if (!cpu_is_omap44xx())
60 return -EINVAL;
61
62 oh_name = "spinlock";
63 oh = omap_hwmod_lookup(oh_name);
64 if (WARN_ON(oh == NULL))
65 return -EINVAL;
66
67 pdev_name = "hwspinlock";
68
69 /* Pass data to device initialization */
70 pdata = kzalloc(sizeof(struct hwspinlock_plat_info), GFP_KERNEL);
71 if (WARN_ON(pdata == NULL))
72 return -ENOMEM;
73 pdata->sysstatus_offset = SYSSTATUS_OFFSET;
74 pdata->lock_base_offset = LOCK_BASE_OFFSET;
75
76 omap_device_build(pdev_name, 0, oh, pdata,
77 sizeof(struct hwspinlock_plat_info), omap_spinlock_latency,
78 ARRAY_SIZE(omap_spinlock_latency), false);
79
80 return retval;
81}
82postcore_initcall(hwspinlocks_init);