diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2015-01-14 07:11:22 -0500 |
---|---|---|
committer | Simon Horman <horms+renesas@verge.net.au> | 2015-01-15 21:02:42 -0500 |
commit | 1632ff162f305f38667632c465e4bfaab8ef87a2 (patch) | |
tree | f7868cba4754dff5b3584032290e2f717dec15bb /arch/arm/mach-shmobile | |
parent | 60e26435623001424f1c62dde26edb614b29d8ae (diff) |
ARM: shmobile: R-Mobile: Special-case PM domains with memory-controllers
Add a special case for PM domains containing a memory-controller.
Such a PM domain must not be turned off if memory is in use.
On sh73a0 PM domains A4BC0 and A4BC1 each contain an SDRAM Bus State
Controller (SBSC). On r8a73a4 PM domain A3BC contains two DDR Bus
Controllers (DBSC). In both cases, there are no other devices in these
PM domains, so they were eligible for power down, crashing the system.
On r8a7740 the DDR3 Bus State Controller (DBSC3) is located in A4S,
whose child domain A3SM contains the CPU core. Hence A4S is never turned
off, and no crash happened.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r-- | arch/arm/mach-shmobile/pm-rmobile.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c index e4c3f7de48e2..95018209ff0b 100644 --- a/arch/arm/mach-shmobile/pm-rmobile.c +++ b/arch/arm/mach-shmobile/pm-rmobile.c | |||
@@ -222,6 +222,7 @@ enum pd_types { | |||
222 | PD_CPU, | 222 | PD_CPU, |
223 | PD_CONSOLE, | 223 | PD_CONSOLE, |
224 | PD_DEBUG, | 224 | PD_DEBUG, |
225 | PD_MEMCTL, | ||
225 | }; | 226 | }; |
226 | 227 | ||
227 | #define MAX_NUM_SPECIAL_PDS 16 | 228 | #define MAX_NUM_SPECIAL_PDS 16 |
@@ -233,6 +234,14 @@ static struct special_pd { | |||
233 | 234 | ||
234 | static unsigned int num_special_pds __initdata; | 235 | static unsigned int num_special_pds __initdata; |
235 | 236 | ||
237 | static const struct of_device_id special_ids[] __initconst = { | ||
238 | { .compatible = "arm,coresight-etm3x", .data = (void *)PD_DEBUG }, | ||
239 | { .compatible = "renesas,dbsc-r8a73a4", .data = (void *)PD_MEMCTL, }, | ||
240 | { .compatible = "renesas,dbsc3-r8a7740", .data = (void *)PD_MEMCTL, }, | ||
241 | { .compatible = "renesas,sbsc-sh73a0", .data = (void *)PD_MEMCTL, }, | ||
242 | { /* sentinel */ }, | ||
243 | }; | ||
244 | |||
236 | static void __init add_special_pd(struct device_node *np, enum pd_types type) | 245 | static void __init add_special_pd(struct device_node *np, enum pd_types type) |
237 | { | 246 | { |
238 | unsigned int i; | 247 | unsigned int i; |
@@ -265,6 +274,7 @@ static void __init add_special_pd(struct device_node *np, enum pd_types type) | |||
265 | static void __init get_special_pds(void) | 274 | static void __init get_special_pds(void) |
266 | { | 275 | { |
267 | struct device_node *np; | 276 | struct device_node *np; |
277 | const struct of_device_id *id; | ||
268 | 278 | ||
269 | /* PM domains containing CPUs */ | 279 | /* PM domains containing CPUs */ |
270 | for_each_node_by_type(np, "cpu") | 280 | for_each_node_by_type(np, "cpu") |
@@ -274,12 +284,9 @@ static void __init get_special_pds(void) | |||
274 | if (of_stdout) | 284 | if (of_stdout) |
275 | add_special_pd(of_stdout, PD_CONSOLE); | 285 | add_special_pd(of_stdout, PD_CONSOLE); |
276 | 286 | ||
277 | /* PM domain containing Coresight-ETM */ | 287 | /* PM domains containing other special devices */ |
278 | np = of_find_compatible_node(NULL, NULL, "arm,coresight-etm3x"); | 288 | for_each_matching_node_and_match(np, special_ids, &id) |
279 | if (np) { | 289 | add_special_pd(np, (enum pd_types)id->data); |
280 | add_special_pd(np, PD_DEBUG); | ||
281 | of_node_put(np); | ||
282 | } | ||
283 | } | 290 | } |
284 | 291 | ||
285 | static void __init put_special_pds(void) | 292 | static void __init put_special_pds(void) |
@@ -334,6 +341,16 @@ static void __init rmobile_setup_pm_domain(struct device_node *np, | |||
334 | pd->suspend = rmobile_pd_suspend_busy; | 341 | pd->suspend = rmobile_pd_suspend_busy; |
335 | break; | 342 | break; |
336 | 343 | ||
344 | case PD_MEMCTL: | ||
345 | /* | ||
346 | * This domain contains a memory-controller and therefore it | ||
347 | * should only be turned off if memory is not in use. | ||
348 | */ | ||
349 | pr_debug("PM domain %s contains MEMCTL\n", name); | ||
350 | pd->gov = &pm_domain_always_on_gov; | ||
351 | pd->suspend = rmobile_pd_suspend_busy; | ||
352 | break; | ||
353 | |||
337 | case PD_NORMAL: | 354 | case PD_NORMAL: |
338 | break; | 355 | break; |
339 | } | 356 | } |