| 1 | From: Benoit Cousson <b-cousson@ti.com> |
| 2 | Date: Sat, 17 Dec 2011 00:09:11 +0000 (-0800) |
| 3 | Subject: ARM: OMAP4: hwmod: Don't wait for the idle status if modulemode is not supported |
| 4 | X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git;a=commitdiff_plain;h=bfc141e3a515008d85e57af39c9faa4d2bbc65e0;hp=ddf536d0d7e1f0b63a681c970888730a4437414d |
| 5 | |
| 6 | ARM: OMAP4: hwmod: Don't wait for the idle status if modulemode is not supported |
| 7 | |
| 8 | If the module does not have any modulemode, the _disable_module function |
| 9 | will do nothing. There is then no point waiting for a idle status change. |
| 10 | |
| 11 | It will remove the following warnings. |
| 12 | |
| 13 | [ 0.331848] omap_hwmod: dmm: _wait_target_disable failed |
| 14 | [ 0.339935] omap_hwmod: emif_fw: _wait_target_disable failed |
| 15 | [ 0.348358] omap_hwmod: l3_main_1: _wait_target_disable failed |
| 16 | [ 0.356964] omap_hwmod: l3_main_2: _wait_target_disable failed |
| 17 | [ 0.365600] omap_hwmod: l4_abe: _wait_target_disable failed |
| 18 | [ 0.373931] omap_hwmod: l4_cfg: _wait_target_disable failed |
| 19 | [ 0.382263] omap_hwmod: l4_per: _wait_target_disable failed |
| 20 | [ 0.391113] omap_hwmod: l4_wkup: _wait_target_disable failed |
| 21 | [ 0.399536] omap_hwmod: dma_system: _wait_target_disable failed |
| 22 | [ 0.408325] omap_hwmod: dss_core: _wait_target_disable failed |
| 23 | [ 0.416839] omap_hwmod: dss_dispc: _wait_target_disable failed |
| 24 | [ 0.425445] omap_hwmod: dss_dsi1: _wait_target_disable failed |
| 25 | [ 0.433990] omap_hwmod: dss_dsi2: _wait_target_disable failed |
| 26 | [ 0.442504] omap_hwmod: dss_hdmi: _wait_target_disable failed |
| 27 | [ 0.451019] omap_hwmod: dss_rfbi: _wait_target_disable failed |
| 28 | [ 0.459564] omap_hwmod: dss_venc: _wait_target_disable failed |
| 29 | [ 0.489471] omap_hwmod: mailbox: _wait_target_disable failed |
| 30 | [ 0.505920] omap_hwmod: spinlock: _wait_target_disable failed |
| 31 | |
| 32 | Note: For such module, the state is managed automatically by HW according |
| 33 | to clock domain transition. It is then not possible to wait for idle even |
| 34 | later in the _idle function since the status will change at clock domain |
| 35 | boundary. |
| 36 | |
| 37 | Signed-off-by: Benoit Cousson <b-cousson@ti.com> |
| 38 | Cc: Paul Walmsley <paul@pwsan.com> |
| 39 | Cc: Rajendra Nayak <rnayak@ti.com> |
| 40 | [paul@pwsan.com: renamed fns to indicate that they are OMAP4-only; moved |
| 41 | _wait_target_disable() into _disable_module(), removing duplicate code] |
| 42 | Signed-off-by: Paul Walmsley <paul@pwsan.com> |
| 43 | Signed-off-by: Tony Lindgren <tony@atomide.com> |
| 44 | --- |
| 45 | |
| 46 | --- a/arch/arm/mach-omap2/omap_hwmod.c |
| 47 | +++ b/arch/arm/mach-omap2/omap_hwmod.c |
| 48 | @@ -706,27 +706,65 @@ static void _enable_module(struct omap_h |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | - * _disable_module - enable CLKCTRL modulemode on OMAP4 |
| 53 | + * _omap4_wait_target_disable - wait for a module to be disabled on OMAP4 |
| 54 | + * @oh: struct omap_hwmod * |
| 55 | + * |
| 56 | + * Wait for a module @oh to enter slave idle. Returns 0 if the module |
| 57 | + * does not have an IDLEST bit or if the module successfully enters |
| 58 | + * slave idle; otherwise, pass along the return value of the |
| 59 | + * appropriate *_cm*_wait_module_idle() function. |
| 60 | + */ |
| 61 | +static int _omap4_wait_target_disable(struct omap_hwmod *oh) |
| 62 | +{ |
| 63 | + if (!cpu_is_omap44xx()) |
| 64 | + return 0; |
| 65 | + |
| 66 | + if (!oh) |
| 67 | + return -EINVAL; |
| 68 | + |
| 69 | + if (oh->_int_flags & _HWMOD_NO_MPU_PORT) |
| 70 | + return 0; |
| 71 | + |
| 72 | + if (oh->flags & HWMOD_NO_IDLEST) |
| 73 | + return 0; |
| 74 | + |
| 75 | + return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition, |
| 76 | + oh->clkdm->cm_inst, |
| 77 | + oh->clkdm->clkdm_offs, |
| 78 | + oh->prcm.omap4.clkctrl_offs); |
| 79 | +} |
| 80 | + |
| 81 | +/** |
| 82 | + * _omap4_disable_module - enable CLKCTRL modulemode on OMAP4 |
| 83 | * @oh: struct omap_hwmod * |
| 84 | * |
| 85 | * Disable the PRCM module mode related to the hwmod @oh. |
| 86 | - * No return value. |
| 87 | + * Return EINVAL if the modulemode is not supported and 0 in case of success. |
| 88 | */ |
| 89 | -static void _disable_module(struct omap_hwmod *oh) |
| 90 | +static int _omap4_disable_module(struct omap_hwmod *oh) |
| 91 | { |
| 92 | + int v; |
| 93 | + |
| 94 | /* The module mode does not exist prior OMAP4 */ |
| 95 | - if (cpu_is_omap24xx() || cpu_is_omap34xx()) |
| 96 | - return; |
| 97 | + if (!cpu_is_omap44xx()) |
| 98 | + return -EINVAL; |
| 99 | |
| 100 | if (!oh->clkdm || !oh->prcm.omap4.modulemode) |
| 101 | - return; |
| 102 | + return -EINVAL; |
| 103 | |
| 104 | - pr_debug("omap_hwmod: %s: _disable_module\n", oh->name); |
| 105 | + pr_debug("omap_hwmod: %s: %s\n", oh->name, __func__); |
| 106 | |
| 107 | omap4_cminst_module_disable(oh->clkdm->prcm_partition, |
| 108 | oh->clkdm->cm_inst, |
| 109 | oh->clkdm->clkdm_offs, |
| 110 | oh->prcm.omap4.clkctrl_offs); |
| 111 | + |
| 112 | + v = _omap4_wait_target_disable(oh); |
| 113 | + if (v) |
| 114 | + pr_warn("omap_hwmod: %s: _wait_target_disable failed\n", |
| 115 | + oh->name); |
| 116 | + |
| 117 | + return 0; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | @@ -1153,36 +1191,6 @@ static int _wait_target_ready(struct oma |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | - * _wait_target_disable - wait for a module to be disabled |
| 126 | - * @oh: struct omap_hwmod * |
| 127 | - * |
| 128 | - * Wait for a module @oh to enter slave idle. Returns 0 if the module |
| 129 | - * does not have an IDLEST bit or if the module successfully enters |
| 130 | - * slave idle; otherwise, pass along the return value of the |
| 131 | - * appropriate *_cm*_wait_module_idle() function. |
| 132 | - */ |
| 133 | -static int _wait_target_disable(struct omap_hwmod *oh) |
| 134 | -{ |
| 135 | - /* TODO: For now just handle OMAP4+ */ |
| 136 | - if (cpu_is_omap24xx() || cpu_is_omap34xx()) |
| 137 | - return 0; |
| 138 | - |
| 139 | - if (!oh) |
| 140 | - return -EINVAL; |
| 141 | - |
| 142 | - if (oh->_int_flags & _HWMOD_NO_MPU_PORT) |
| 143 | - return 0; |
| 144 | - |
| 145 | - if (oh->flags & HWMOD_NO_IDLEST) |
| 146 | - return 0; |
| 147 | - |
| 148 | - return omap4_cminst_wait_module_idle(oh->clkdm->prcm_partition, |
| 149 | - oh->clkdm->cm_inst, |
| 150 | - oh->clkdm->clkdm_offs, |
| 151 | - oh->prcm.omap4.clkctrl_offs); |
| 152 | -} |
| 153 | - |
| 154 | -/** |
| 155 | * _lookup_hardreset - fill register bit info for this hwmod/reset line |
| 156 | * @oh: struct omap_hwmod * |
| 157 | * @name: name of the reset line in the context of this hwmod |
| 158 | @@ -1524,8 +1532,6 @@ static int _enable(struct omap_hwmod *oh |
| 159 | */ |
| 160 | static int _idle(struct omap_hwmod *oh) |
| 161 | { |
| 162 | - int ret; |
| 163 | - |
| 164 | pr_debug("omap_hwmod: %s: idling\n", oh->name); |
| 165 | |
| 166 | if (oh->_state != _HWMOD_STATE_ENABLED) { |
| 167 | @@ -1537,11 +1543,9 @@ static int _idle(struct omap_hwmod *oh) |
| 168 | if (oh->class->sysc) |
| 169 | _idle_sysc(oh); |
| 170 | _del_initiator_dep(oh, mpu_oh); |
| 171 | - _disable_module(oh); |
| 172 | - ret = _wait_target_disable(oh); |
| 173 | - if (ret) |
| 174 | - pr_warn("omap_hwmod: %s: _wait_target_disable failed\n", |
| 175 | - oh->name); |
| 176 | + |
| 177 | + _omap4_disable_module(oh); |
| 178 | + |
| 179 | /* |
| 180 | * The module must be in idle mode before disabling any parents |
| 181 | * clocks. Otherwise, the parent clock might be disabled before |
| 182 | @@ -1642,11 +1646,7 @@ static int _shutdown(struct omap_hwmod * |
| 183 | if (oh->_state == _HWMOD_STATE_ENABLED) { |
| 184 | _del_initiator_dep(oh, mpu_oh); |
| 185 | /* XXX what about the other system initiators here? dma, dsp */ |
| 186 | - _disable_module(oh); |
| 187 | - ret = _wait_target_disable(oh); |
| 188 | - if (ret) |
| 189 | - pr_warn("omap_hwmod: %s: _wait_target_disable failed\n", |
| 190 | - oh->name); |
| 191 | + _omap4_disable_module(oh); |
| 192 | _disable_clocks(oh); |
| 193 | if (oh->clkdm) |
| 194 | clkdm_hwmod_disable(oh->clkdm, oh); |
| 195 | |