[glsdk/meta-ti-glsdk.git] / recipes-kernel / linux / linux-3.0 / pm-wip / voltdm / 0032-OMAP2-hwmod-Do-not-write-the-enawakeup-bit-if-SYSC_H.patch
1 From f9a6193c656f30cfb8ec2933f2d309d599f668b0 Mon Sep 17 00:00:00 2001
2 From: Benoit Cousson <b-cousson@ti.com>
3 Date: Fri, 1 Jul 2011 22:54:03 +0200
4 Subject: [PATCH 032/149] OMAP2+: hwmod: Do not write the enawakeup bit if SYSC_HAS_ENAWAKEUP is not set
6 The Type 2 type of IPs will not have any enawakeup bit in their sysconfig.
7 Writing to that bit will instead trigger a softreset.
8 Check the flag to write this bit only if the module supports it.
10 Reported-by: Miguel Vadillo <vadillo@ti.com>
11 Signed-off-by: Benoit Cousson <b-cousson@ti.com>
12 Signed-off-by: Paul Walmsley <paul@pwsan.com>
13 ---
14 arch/arm/mach-omap2/omap_hwmod.c | 14 ++++----------
15 1 files changed, 4 insertions(+), 10 deletions(-)
17 diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
18 index cbc2a8a..3800084 100644
19 --- a/arch/arm/mach-omap2/omap_hwmod.c
20 +++ b/arch/arm/mach-omap2/omap_hwmod.c
21 @@ -387,8 +387,6 @@ static int _set_module_autoidle(struct omap_hwmod *oh, u8 autoidle,
22 */
23 static int _enable_wakeup(struct omap_hwmod *oh, u32 *v)
24 {
25 - u32 wakeup_mask;
26 -
27 if (!oh->class->sysc ||
28 !((oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP) ||
29 (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) ||
30 @@ -400,9 +398,8 @@ static int _enable_wakeup(struct omap_hwmod *oh, u32 *v)
31 return -EINVAL;
32 }
34 - wakeup_mask = (0x1 << oh->class->sysc->sysc_fields->enwkup_shift);
35 -
36 - *v |= wakeup_mask;
37 + if (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)
38 + *v |= 0x1 << oh->class->sysc->sysc_fields->enwkup_shift;
40 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP)
41 _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART_WKUP, v);
42 @@ -425,8 +422,6 @@ static int _enable_wakeup(struct omap_hwmod *oh, u32 *v)
43 */
44 static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
45 {
46 - u32 wakeup_mask;
47 -
48 if (!oh->class->sysc ||
49 !((oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP) ||
50 (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP) ||
51 @@ -438,9 +433,8 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
52 return -EINVAL;
53 }
55 - wakeup_mask = (0x1 << oh->class->sysc->sysc_fields->enwkup_shift);
56 -
57 - *v &= ~wakeup_mask;
58 + if (oh->class->sysc->sysc_flags & SYSC_HAS_ENAWAKEUP)
59 + *v &= ~(0x1 << oh->class->sysc->sysc_fields->enwkup_shift);
61 if (oh->class->sysc->idlemodes & SIDLE_SMART_WKUP)
62 _set_slave_idlemode(oh, HWMOD_IDLEMODE_SMART, v);
63 --
64 1.6.6.1