This source file includes following definitions.
- omap2_wd_timer_disable
- omap2_wd_timer_reset
1
2
3
4
5
6
7
8 #include <linux/kernel.h>
9 #include <linux/io.h>
10 #include <linux/err.h>
11
12 #include <linux/platform_data/omap-wd-timer.h>
13
14 #include "omap_hwmod.h"
15 #include "omap_device.h"
16 #include "wd_timer.h"
17 #include "common.h"
18 #include "prm.h"
19 #include "soc.h"
20
21
22
23
24
25
26
27
28 #define OMAP_WDT_WPS 0x34
29 #define OMAP_WDT_SPR 0x48
30
31 int omap2_wd_timer_disable(struct omap_hwmod *oh)
32 {
33 void __iomem *base;
34
35 if (!oh) {
36 pr_err("%s: Could not look up wdtimer_hwmod\n", __func__);
37 return -EINVAL;
38 }
39
40 base = omap_hwmod_get_mpu_rt_va(oh);
41 if (!base) {
42 pr_err("%s: Could not get the base address for %s\n",
43 oh->name, __func__);
44 return -EINVAL;
45 }
46
47
48 writel_relaxed(0xAAAA, base + OMAP_WDT_SPR);
49 while (readl_relaxed(base + OMAP_WDT_WPS) & 0x10)
50 cpu_relax();
51
52 writel_relaxed(0x5555, base + OMAP_WDT_SPR);
53 while (readl_relaxed(base + OMAP_WDT_WPS) & 0x10)
54 cpu_relax();
55
56 return 0;
57 }
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 int omap2_wd_timer_reset(struct omap_hwmod *oh)
76 {
77 int c = 0;
78
79
80 omap_hwmod_softreset(oh);
81
82
83 omap_test_timeout((omap_hwmod_read(oh,
84 oh->class->sysc->syss_offs)
85 & SYSS_RESETDONE_MASK),
86 MAX_MODULE_SOFTRESET_WAIT, c);
87
88 if (oh->class->sysc->srst_udelay)
89 udelay(oh->class->sysc->srst_udelay);
90
91 if (c == MAX_MODULE_SOFTRESET_WAIT)
92 pr_warn("%s: %s: softreset failed (waited %d usec)\n",
93 __func__, oh->name, MAX_MODULE_SOFTRESET_WAIT);
94 else
95 pr_debug("%s: %s: softreset in %d usec\n", __func__,
96 oh->name, c);
97
98 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
99 omap2_wd_timer_disable(oh);
100 }