From: ohad@wizery.com (Ohad Ben-Cohen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] omap: add hwspinlock device
Date: Mon, 18 Oct 2010 09:44:35 +0200 [thread overview]
Message-ID: <1287387875-14168-4-git-send-email-ohad@wizery.com> (raw)
In-Reply-To: <1287387875-14168-1-git-send-email-ohad@wizery.com>
From: Simon Que <sque@ti.com>
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>
---
arch/arm/mach-omap2/Makefile | 1 +
arch/arm/mach-omap2/hwspinlock.c | 67 ++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/hwspinlock.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 7352412..e55d1c5 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -190,3 +190,4 @@ obj-y += $(smc91x-m) $(smc91x-y)
smsc911x-$(CONFIG_SMSC911X) := gpmc-smsc911x.o
obj-y += $(smsc911x-m) $(smsc911x-y)
+obj-$(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 0000000..641a6d4
--- /dev/null
+++ b/arch/arm/mach-omap2/hwspinlock.c
@@ -0,0 +1,67 @@
+/*
+ * OMAP hardware spinlock device initialization
+ *
+ * Copyright (C) 2010 Texas Instruments. All rights reserved.
+ *
+ * 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.
+ *
+ * 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/kernel.h>
+#include <linux/init.h>
+#include <linux/err.h>
+
+#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
+
+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,
+ }
+};
+
+int __init hwspinlocks_init(void)
+{
+ int retval = 0;
+ struct omap_hwmod *oh;
+ struct omap_device *od;
+ 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;
+
+ od = omap_device_build(dev_name, 0, oh, NULL, 0,
+ omap_spinlock_latency,
+ ARRAY_SIZE(omap_spinlock_latency), false);
+ if (IS_ERR(od)) {
+ pr_err("Can't build omap_device for %s:%s\n", dev_name,
+ oh_name);
+ retval = PTR_ERR(od);
+ }
+
+ return retval;
+}
+postcore_initcall(hwspinlocks_init);
--
1.7.0.4
next prev parent reply other threads:[~2010-10-18 7:44 UTC|newest]
Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-18 7:44 [PATCH 0/3] Add OMAP hardware spinlock misc driver Ohad Ben-Cohen
2010-10-18 7:44 ` [PATCH 1/3] drivers: misc: add omap_hwspinlock driver Ohad Ben-Cohen
2010-10-19 15:46 ` Greg KH
2010-10-19 20:18 ` Ohad Ben-Cohen
2010-10-19 16:58 ` Kevin Hilman
2010-10-19 20:21 ` Ohad Ben-Cohen
2010-10-19 17:01 ` Grant Likely
2010-10-19 20:43 ` Ohad Ben-Cohen
2010-10-19 20:58 ` Arnd Bergmann
2010-10-19 21:57 ` Ohad Ben-Cohen
2010-10-19 17:16 ` Kevin Hilman
2010-10-20 13:00 ` Ohad Ben-Cohen
2010-10-20 18:18 ` Kevin Hilman
2010-10-19 17:21 ` Arnd Bergmann
2010-10-19 20:51 ` Ohad Ben-Cohen
2010-10-19 21:08 ` Arnd Bergmann
2010-10-20 22:43 ` Ohad Ben-Cohen
2010-10-21 9:04 ` Arnd Bergmann
2010-10-21 10:13 ` Ohad Ben-Cohen
2010-10-21 12:02 ` Arnd Bergmann
2010-10-22 17:00 ` Tony Lindgren
2010-10-18 7:44 ` [PATCH 2/3] OMAP4: hwmod data: Add hwspinlock Ohad Ben-Cohen
2010-10-18 7:44 ` Ohad Ben-Cohen [this message]
2010-10-19 17:03 ` [PATCH 3/3] omap: add hwspinlock device Kevin Hilman
2010-10-19 17:05 ` Grant Likely
2010-10-19 21:02 ` Ohad Ben-Cohen
2010-10-19 23:12 ` Grant Likely
2010-10-20 14:09 ` Ohad Ben-Cohen
2010-10-20 15:51 ` Grant Likely
2010-10-19 23:53 ` Kevin Hilman
2010-10-20 1:20 ` Ryan Mallon
2010-10-20 14:38 ` Ohad Ben-Cohen
2010-10-20 15:55 ` Grant Likely
2010-10-20 18:37 ` Kevin Hilman
2010-10-20 19:21 ` Ohad Ben-Cohen
2010-10-20 23:58 ` Kevin Hilman
2010-10-21 6:11 ` Ohad Ben-Cohen
2010-10-21 8:36 ` Kamoolkar, Mugdha
2010-10-21 9:06 ` Ohad Ben-Cohen
2010-10-22 9:59 ` Kamoolkar, Mugdha
2010-10-22 11:16 ` Ohad Ben-Cohen
2010-10-21 12:26 ` Kanigeri, Hari
2010-10-22 10:14 ` Kamoolkar, Mugdha
2010-10-22 16:56 ` Tony Lindgren
2010-10-22 17:03 ` Grant Likely
2010-10-22 17:28 ` Tony Lindgren
2010-10-24 17:54 ` Ohad Ben-Cohen
2010-10-25 19:02 ` Tony Lindgren
2010-10-26 11:54 ` Ohad Ben-Cohen
2010-10-26 19:06 ` Tony Lindgren
2010-10-18 12:46 ` [PATCH 0/3] Add OMAP hardware spinlock misc driver Peter Zijlstra
2010-10-18 13:35 ` Russell King - ARM Linux
2010-10-18 13:43 ` Peter Zijlstra
2010-10-18 14:28 ` Ohad Ben-Cohen
2010-10-18 14:33 ` Peter Zijlstra
2010-10-18 14:39 ` Ohad Ben-Cohen
2010-10-18 15:27 ` Catalin Marinas
2010-10-18 15:32 ` Peter Zijlstra
2010-10-18 15:35 ` Ohad Ben-Cohen
2010-10-18 15:48 ` Peter Zijlstra
2010-10-18 15:51 ` Catalin Marinas
2010-10-18 15:58 ` Peter Zijlstra
2010-10-19 23:31 ` Daniel Walker
2010-10-20 6:13 ` Ohad Ben-Cohen
2010-10-20 10:00 ` Ohad Ben-Cohen
2010-10-20 22:29 ` Bryan Huntsman
2010-10-20 9:53 ` Russell King - ARM Linux
2010-10-20 22:15 ` Daniel Walker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1287387875-14168-4-git-send-email-ohad@wizery.com \
--to=ohad@wizery.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).