summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Jan <s-jan@ti.com>2011-10-25 10:51:48 +0800
committerAndy Green <andy.green@linaro.org>2011-10-25 10:51:48 +0800
commitd6a3cdaa31fe859c539d4ba02f6366dcf96fd172 (patch)
tree81818802f92719e3c44ff5334872ef1e1ab4d5d4
parent4083af199f41e4897507d0c3b052a438ce561b82 (diff)
Revert "fix: remove duplicate hwspinlock source"
This reverts commit 9a84fc90be096d69e376a31f1c8cf15fde9b9299.
-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 b546e1a1bc8..9dcae9dde7c 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -289,6 +289,7 @@ obj-y += $(nand-m) $(nand-y)
smc91x-$(CONFIG_SMC91X) := gpmc-smc91x.o
obj-y += $(smc91x-m) $(smc91x-y)
+obj-$(CONFIG_ARCH_OMAP4) += hwspinlocks.o
smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
obj-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 @@
+/*
+ * OMAP hardware spinlock device initialization
+ *
+ * Copyright (C) 2010 Texas Instruments. All rights reserved.
+ *
+ * Contact: Simon Que <sque@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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/interrupt.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/slab.h>
+
+#include <plat/hwspinlock.h>
+#include <plat/omap_device.h>
+#include <plat/omap_hwmod.h>
+
+/* Spinlock register offsets */
+#define REVISION_OFFSET 0x0000
+#define SYSCONFIG_OFFSET 0x0010
+#define SYSSTATUS_OFFSET 0x0014
+#define LOCK_BASE_OFFSET 0x0800
+#define LOCK_OFFSET(i) (LOCK_BASE_OFFSET + 0x4 * (i))
+
+struct omap_device_pm_latency omap_spinlock_latency[] = {
+ {
+ .deactivate_func = omap_device_idle_hwmods,
+ .activate_func = omap_device_enable_hwmods,
+ .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
+ }
+};
+
+/* Initialization function */
+int __init hwspinlocks_init(void)
+{
+ int retval = 0;
+
+ struct hwspinlock_plat_info *pdata;
+ struct omap_hwmod *oh;
+ char *oh_name, *pdev_name;
+
+ if (!cpu_is_omap44xx())
+ return -EINVAL;
+
+ oh_name = "spinlock";
+ oh = omap_hwmod_lookup(oh_name);
+ if (WARN_ON(oh == NULL))
+ return -EINVAL;
+
+ pdev_name = "hwspinlock";
+
+ /* Pass data to device initialization */
+ pdata = kzalloc(sizeof(struct hwspinlock_plat_info), GFP_KERNEL);
+ if (WARN_ON(pdata == NULL))
+ return -ENOMEM;
+ pdata->sysstatus_offset = SYSSTATUS_OFFSET;
+ pdata->lock_base_offset = LOCK_BASE_OFFSET;
+
+ omap_device_build(pdev_name, 0, oh, pdata,
+ sizeof(struct hwspinlock_plat_info), omap_spinlock_latency,
+ ARRAY_SIZE(omap_spinlock_latency), false);
+
+ return retval;
+}
+postcore_initcall(hwspinlocks_init);