Commit 938ee203d6452181fbaf08c2de28c81fe21c4055
Exists in
ti-linux-3.12.y
and in
3 other branches
Merge branch 'platform-ti-linux-3.12.y' of git://git.ti.com/~rrnayak/ti-linux-ke…
…rnel/platform-linux-feature-tree into ti-linux-3.12.y TI-Feature: platform_base TI-Tree: git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree.git TI-Branch: platform-ti-linux-3.12.y * 'platform-ti-linux-3.12.y' of git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree: ARM: OMAP2+: omap_hwmod: Maintain legacy context loss count ARM: OMAP2+: omap_hwmod: Add context ops to am43xx soc_ops ARM: OMAP2+: am43xx: Use omap4 prm context ops Signed-off-by: Dan Murphy <DMurphy@ti.com>
Showing 4 changed files Side-by-side Diff
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/omap_hwmod.c
... | ... | @@ -182,6 +182,9 @@ |
182 | 182 | * device drivers. Until then, this should avoid huge blocks of cpu_is_*() |
183 | 183 | * conditionals in this code. |
184 | 184 | */ |
185 | + | |
186 | +#define SOC_HWMOD_CHECK_FOR_CONTEXT_FLAG (0x1 << 0) | |
187 | + | |
185 | 188 | struct omap_hwmod_soc_ops { |
186 | 189 | void (*enable_module)(struct omap_hwmod *oh); |
187 | 190 | int (*disable_module)(struct omap_hwmod *oh); |
... | ... | @@ -195,6 +198,7 @@ |
195 | 198 | int (*init_clkdm)(struct omap_hwmod *oh); |
196 | 199 | void (*update_context_lost)(struct omap_hwmod *oh); |
197 | 200 | int (*get_context_lost)(struct omap_hwmod *oh); |
201 | + u8 flags; | |
198 | 202 | }; |
199 | 203 | |
200 | 204 | /* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */ |
... | ... | @@ -2165,6 +2169,31 @@ |
2165 | 2169 | } |
2166 | 2170 | |
2167 | 2171 | /** |
2172 | + * _am437x_update_context_lost - increment hwmod context loss counter if | |
2173 | + * hwmod context was lost, and clear hardware context loss reg | |
2174 | + * @oh: hwmod to check for context loss | |
2175 | + * | |
2176 | + * If the PRCM indicates that the hwmod @oh lost context, increment | |
2177 | + * our in-memory context loss counter, and clear the RM_*_CONTEXT | |
2178 | + * bits. No return value. | |
2179 | + */ | |
2180 | +static void _am437x_update_context_lost(struct omap_hwmod *oh) | |
2181 | +{ | |
2182 | + if (!(oh->prcm.omap4.flags & HWMOD_AM437X_HAS_CONTEXT_LOSS_BIT)) | |
2183 | + return; | |
2184 | + | |
2185 | + if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition, | |
2186 | + oh->clkdm->pwrdm.ptr->prcm_offs, | |
2187 | + oh->prcm.omap4.context_offs)) | |
2188 | + return; | |
2189 | + | |
2190 | + oh->prcm.omap4.context_lost_counter++; | |
2191 | + prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition, | |
2192 | + oh->clkdm->pwrdm.ptr->prcm_offs, | |
2193 | + oh->prcm.omap4.context_offs); | |
2194 | +} | |
2195 | + | |
2196 | +/** | |
2168 | 2197 | * _omap4_get_context_lost - get context loss counter for a hwmod |
2169 | 2198 | * @oh: hwmod to get context loss counter for |
2170 | 2199 | * |
2171 | 2200 | |
2172 | 2201 | |
... | ... | @@ -4168,9 +4197,19 @@ |
4168 | 4197 | struct powerdomain *pwrdm; |
4169 | 4198 | int ret = 0; |
4170 | 4199 | |
4171 | - if (soc_ops.get_context_lost) | |
4200 | + if (soc_ops.get_context_lost) { | |
4201 | + /* | |
4202 | + * On SoCs like AM437x where we dont use hwmod to check context | |
4203 | + * loss on certain devices.. | |
4204 | + */ | |
4205 | + if ((soc_ops.flags & SOC_HWMOD_CHECK_FOR_CONTEXT_FLAG) && | |
4206 | + !(oh->prcm.omap4.flags & HWMOD_AM437X_HAS_CONTEXT_LOSS_BIT)) | |
4207 | + goto get_pwrdm_context_loss_count; | |
4208 | + | |
4172 | 4209 | return soc_ops.get_context_lost(oh); |
4210 | + } | |
4173 | 4211 | |
4212 | +get_pwrdm_context_loss_count: | |
4174 | 4213 | pwrdm = omap_hwmod_get_pwrdm(oh); |
4175 | 4214 | if (pwrdm) |
4176 | 4215 | ret = pwrdm_get_context_loss_count(pwrdm); |
... | ... | @@ -4296,6 +4335,9 @@ |
4296 | 4335 | soc_ops.deassert_hardreset = _omap4_deassert_hardreset; |
4297 | 4336 | soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; |
4298 | 4337 | soc_ops.init_clkdm = _init_clkdm; |
4338 | + soc_ops.update_context_lost = _am437x_update_context_lost; | |
4339 | + soc_ops.get_context_lost = _omap4_get_context_lost; | |
4340 | + soc_ops.flags = SOC_HWMOD_CHECK_FOR_CONTEXT_FLAG; | |
4299 | 4341 | } else if (soc_is_am33xx()) { |
4300 | 4342 | soc_ops.enable_module = _am33xx_enable_module; |
4301 | 4343 | soc_ops.disable_module = _am33xx_disable_module; |
arch/arm/mach-omap2/omap_hwmod.h
arch/arm/mach-omap2/prm44xx.c
... | ... | @@ -660,7 +660,8 @@ |
660 | 660 | |
661 | 661 | int __init omap44xx_prm_init(void) |
662 | 662 | { |
663 | - if (!cpu_is_omap44xx() && !soc_is_omap54xx() && !soc_is_dra7xx()) | |
663 | + if (!soc_is_am43xx() && !cpu_is_omap44xx() && | |
664 | + !soc_is_omap54xx() && !soc_is_dra7xx()) | |
664 | 665 | return 0; |
665 | 666 | |
666 | 667 | return prm_register(&omap44xx_prm_ll_data); |