aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/hdq1w.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-06-21 21:40:38 -0600
committerPaul Walmsley <paul@pwsan.com>2012-06-21 21:40:38 -0600
commit96b1b29d37b0ca3ecd424a1fe301406cf525fc04 (patch)
tree92a1667b46d203e69f5cd008c85048be44e7e542 /arch/arm/mach-omap2/hdq1w.c
parentW1: OMAP HDQ1W: use 32-bit register accesses (diff)
downloadlinux-dev-96b1b29d37b0ca3ecd424a1fe301406cf525fc04.tar.xz
linux-dev-96b1b29d37b0ca3ecd424a1fe301406cf525fc04.zip
ARM: OMAP2+: HDQ1W: use omap_device
Convert the old-style device registration code for HDQ1W to use omap_device. This will allow the driver to be converted to use PM runtime and to take advantage of the OMAP IP block management infrastructure (hwmod, PM, etc.). A side benefit of this conversion is that it also makes the HDQ device available on OMAP2420. The previous code only enabled it on 2430 and 3430. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: NeilBrown <neilb@suse.de> Tested-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'arch/arm/mach-omap2/hdq1w.c')
-rw-r--r--arch/arm/mach-omap2/hdq1w.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
index 297ebe03f09c..cdd6dda03828 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -22,7 +22,13 @@
* 02110-1301 USA
*/
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+
#include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
#include <plat/hdq1w.h>
#include "common.h"
@@ -70,3 +76,23 @@ int omap_hdq1w_reset(struct omap_hwmod *oh)
return 0;
}
+
+static int __init omap_init_hdq(void)
+{
+ int id = -1;
+ struct platform_device *pdev;
+ struct omap_hwmod *oh;
+ char *oh_name = "hdq1w";
+ char *devname = "omap_hdq";
+
+ oh = omap_hwmod_lookup(oh_name);
+ if (!oh)
+ return 0;
+
+ pdev = omap_device_build(devname, id, oh, NULL, 0, NULL, 0, 0);
+ WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
+ devname, oh->name);
+
+ return 0;
+}
+arch_initcall(omap_init_hdq);