aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/wd_timer.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-10-29 22:49:44 -0400
committerPaul Walmsley <paul@pwsan.com>2012-10-29 22:49:44 -0400
commit37c67d03989eca60b28d67398d9388f653454c5d (patch)
treecd23dc86d705b85aad3983122b32b78d0b01b3cd /arch/arm/mach-omap2/wd_timer.c
parent508c0d47736023fdcb491fd55ad64f7e08f6f32f (diff)
ARM: OMAP2+: WDT: move init; add read_reset_sources pdata function pointer
The OMAP watchdog timer driver directly calls a function exported by code in arch/arm/mach-omap2. This is not good; it tightly couples this driver to the mach-omap2 integration code. Instead, add a temporary platform_data function pointer to abstract this function call. A subsequent patch will convert the watchdog driver to use this function pointer. This patch also moves the device creation code out of arch/arm/mach-omap2/devices.c and into arch/arm/mach-omap2/wd_timer.c. This is another step towards the removal of arch/arm/mach-omap2/devices.c. Cc: Wim Van Sebroeck <wim@iguana.be> Acked-by: Wim Van Sebroeck <wim@iguana.be> [paul@pwsan.com: skip wd_timer device creation when DT blob is present] Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/wd_timer.c')
-rw-r--r--arch/arm/mach-omap2/wd_timer.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index f6b6c37ac3f4..5a8629ff0ab0 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -11,10 +11,14 @@
11#include <linux/io.h> 11#include <linux/io.h>
12#include <linux/err.h> 12#include <linux/err.h>
13 13
14#include "omap_hwmod.h" 14#include <linux/platform_data/omap-wd-timer.h>
15 15
16#include "omap_hwmod.h"
17#include "omap_device.h"
16#include "wd_timer.h" 18#include "wd_timer.h"
17#include "common.h" 19#include "common.h"
20#include "prm.h"
21#include "soc.h"
18 22
19/* 23/*
20 * In order to avoid any assumptions from bootloader regarding WDT 24 * In order to avoid any assumptions from bootloader regarding WDT
@@ -99,3 +103,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
99 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 103 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
100 omap2_wd_timer_disable(oh); 104 omap2_wd_timer_disable(oh);
101} 105}
106
107static int __init omap_init_wdt(void)
108{
109 int id = -1;
110 struct platform_device *pdev;
111 struct omap_hwmod *oh;
112 char *oh_name = "wd_timer2";
113 char *dev_name = "omap_wdt";
114 struct omap_wd_timer_platform_data pdata;
115
116 if (!cpu_class_is_omap2() || of_have_populated_dt())
117 return 0;
118
119 oh = omap_hwmod_lookup(oh_name);
120 if (!oh) {
121 pr_err("Could not look up wd_timer%d hwmod\n", id);
122 return -EINVAL;
123 }
124
125 pdata.read_reset_sources = prm_read_reset_sources;
126
127 pdev = omap_device_build(dev_name, id, oh, &pdata,
128 sizeof(struct omap_wd_timer_platform_data),
129 NULL, 0, 0);
130 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
131 dev_name, oh->name);
132 return 0;
133}
134subsys_initcall(omap_init_wdt);