aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-07-05 04:28:32 -0400
committerRafael J. Wysocki <rjw@sisk.pl>2012-07-06 14:53:38 -0400
commitb9299a72702adc6d4d52a7425689255784431daa (patch)
tree34a87868f69cf5dd4758556c0757a1a0725d3539 /arch/arm
parentde5c094a902d58eb9372aa648c6a7c22cff129fd (diff)
ARM: shmobile: sh7372: add pm-rmobile domain support
This patch adds pm-rmobile common API base PM domain. sh7372 CPU/platform will switch to using it from original implementation Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Magnus Damm <damm@opensource.se> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h11
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c84
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c41
3 files changed, 134 insertions, 2 deletions
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index 915d0093da08..a7620c1afceb 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -13,6 +13,7 @@
13 13
14#include <linux/sh_clk.h> 14#include <linux/sh_clk.h>
15#include <linux/pm_domain.h> 15#include <linux/pm_domain.h>
16#include <mach/pm-rmobile.h>
16 17
17/* 18/*
18 * Pin Function Controller: 19 * Pin Function Controller:
@@ -494,6 +495,16 @@ static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
494} 495}
495 496
496#ifdef CONFIG_PM 497#ifdef CONFIG_PM
498extern struct rmobile_pm_domain sh7372_pd_a4lc;
499extern struct rmobile_pm_domain sh7372_pd_a4mp;
500extern struct rmobile_pm_domain sh7372_pd_d4;
501extern struct rmobile_pm_domain sh7372_pd_a4r;
502extern struct rmobile_pm_domain sh7372_pd_a3rv;
503extern struct rmobile_pm_domain sh7372_pd_a3ri;
504extern struct rmobile_pm_domain sh7372_pd_a4s;
505extern struct rmobile_pm_domain sh7372_pd_a3sp;
506extern struct rmobile_pm_domain sh7372_pd_a3sg;
507
497extern struct sh7372_pm_domain sh7372_a4lc; 508extern struct sh7372_pm_domain sh7372_a4lc;
498extern struct sh7372_pm_domain sh7372_a4mp; 509extern struct sh7372_pm_domain sh7372_a4mp;
499extern struct sh7372_pm_domain sh7372_d4; 510extern struct sh7372_pm_domain sh7372_d4;
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index a38be7f06d6a..3b131c7a79d0 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -26,6 +26,7 @@
26#include <asm/suspend.h> 26#include <asm/suspend.h>
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/sh7372.h> 28#include <mach/sh7372.h>
29#include <mach/pm-rmobile.h>
29 30
30/* DBG */ 31/* DBG */
31#define DBGREG1 0xe6100020 32#define DBGREG1 0xe6100020
@@ -290,6 +291,85 @@ struct sh7372_pm_domain sh7372_a3sg = {
290 .genpd.name = "A3SG", 291 .genpd.name = "A3SG",
291 .bit_shift = 13, 292 .bit_shift = 13,
292}; 293};
294
295struct rmobile_pm_domain sh7372_pd_a4lc = {
296 .genpd.name = "A4LC",
297 .bit_shift = 1,
298};
299
300struct rmobile_pm_domain sh7372_pd_a4mp = {
301 .genpd.name = "A4MP",
302 .bit_shift = 2,
303};
304
305struct rmobile_pm_domain sh7372_pd_d4 = {
306 .genpd.name = "D4",
307 .bit_shift = 3,
308};
309
310static int sh7372_a4r_pd_suspend(void)
311{
312 sh7372_intcs_suspend();
313 __raw_writel(0x300fffff, WUPRMSK); /* avoid wakeup */
314 return 0;
315}
316
317struct rmobile_pm_domain sh7372_pd_a4r = {
318 .genpd.name = "A4R",
319 .bit_shift = 5,
320 .suspend = sh7372_a4r_pd_suspend,
321 .resume = sh7372_intcs_resume,
322};
323
324struct rmobile_pm_domain sh7372_pd_a3rv = {
325 .genpd.name = "A3RV",
326 .bit_shift = 6,
327};
328
329struct rmobile_pm_domain sh7372_pd_a3ri = {
330 .genpd.name = "A3RI",
331 .bit_shift = 8,
332};
333
334static int sh7372_pd_a4s_suspend(void)
335{
336 /*
337 * The A4S domain contains the CPU core and therefore it should
338 * only be turned off if the CPU is in use.
339 */
340 return -EBUSY;
341}
342
343struct rmobile_pm_domain sh7372_pd_a4s = {
344 .genpd.name = "A4S",
345 .bit_shift = 10,
346 .gov = &pm_domain_always_on_gov,
347 .no_debug = true,
348 .suspend = sh7372_pd_a4s_suspend,
349};
350
351static int sh7372_a3sp_pd_suspend(void)
352{
353 /*
354 * Serial consoles make use of SCIF hardware located in A3SP,
355 * keep such power domain on if "no_console_suspend" is set.
356 */
357 return console_suspend_enabled ? 0 : -EBUSY;
358}
359
360struct rmobile_pm_domain sh7372_pd_a3sp = {
361 .genpd.name = "A3SP",
362 .bit_shift = 11,
363 .gov = &pm_domain_always_on_gov,
364 .no_debug = true,
365 .suspend = sh7372_a3sp_pd_suspend,
366};
367
368struct rmobile_pm_domain sh7372_pd_a3sg = {
369 .genpd.name = "A3SG",
370 .bit_shift = 13,
371};
372
293#endif /* CONFIG_PM */ 373#endif /* CONFIG_PM */
294 374
295#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE) 375#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
@@ -531,7 +611,7 @@ static int sh7372_enter_suspend(suspend_state_t suspend_state)
531 /* check active clocks to determine potential wakeup sources */ 611 /* check active clocks to determine potential wakeup sources */
532 if (sh7372_sysc_valid(&msk, &msk2)) { 612 if (sh7372_sysc_valid(&msk, &msk2)) {
533 if (!console_suspend_enabled && 613 if (!console_suspend_enabled &&
534 sh7372_a4s.genpd.status == GPD_STATE_POWER_OFF) { 614 sh7372_pd_a4s.genpd.status == GPD_STATE_POWER_OFF) {
535 /* convert INTC mask/sense to SYSC mask/sense */ 615 /* convert INTC mask/sense to SYSC mask/sense */
536 sh7372_setup_sysc(msk, msk2); 616 sh7372_setup_sysc(msk, msk2);
537 617
@@ -565,7 +645,7 @@ static int sh7372_pm_notifier_fn(struct notifier_block *notifier,
565 * executed during system suspend and resume, respectively, so 645 * executed during system suspend and resume, respectively, so
566 * that those functions don't crash while accessing the INTCS. 646 * that those functions don't crash while accessing the INTCS.
567 */ 647 */
568 pm_genpd_poweron(&sh7372_a4r.genpd); 648 pm_genpd_poweron(&sh7372_pd_a4r.genpd);
569 break; 649 break;
570 case PM_POST_SUSPEND: 650 case PM_POST_SUSPEND:
571 pm_genpd_poweroff_unused(); 651 pm_genpd_poweroff_unused();
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 4f473320f921..3648b35c238b 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -1017,6 +1017,22 @@ void __init sh7372_add_standard_devices(void)
1017 sh7372_pm_add_subdomain(&sh7372_a4s, &sh7372_a3sg); 1017 sh7372_pm_add_subdomain(&sh7372_a4s, &sh7372_a3sg);
1018 sh7372_pm_add_subdomain(&sh7372_a4s, &sh7372_a3sp); 1018 sh7372_pm_add_subdomain(&sh7372_a4s, &sh7372_a3sp);
1019 1019
1020 rmobile_init_pm_domain(&sh7372_pd_a4lc);
1021 rmobile_init_pm_domain(&sh7372_pd_a4mp);
1022 rmobile_init_pm_domain(&sh7372_pd_d4);
1023 rmobile_init_pm_domain(&sh7372_pd_a4r);
1024 rmobile_init_pm_domain(&sh7372_pd_a3rv);
1025 rmobile_init_pm_domain(&sh7372_pd_a3ri);
1026 rmobile_init_pm_domain(&sh7372_pd_a4s);
1027 rmobile_init_pm_domain(&sh7372_pd_a3sp);
1028 rmobile_init_pm_domain(&sh7372_pd_a3sg);
1029
1030 rmobile_pm_add_subdomain(&sh7372_pd_a4lc, &sh7372_pd_a3rv);
1031 rmobile_pm_add_subdomain(&sh7372_pd_a4r, &sh7372_pd_a4lc);
1032
1033 rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sg);
1034 rmobile_pm_add_subdomain(&sh7372_pd_a4s, &sh7372_pd_a3sp);
1035
1020 platform_add_devices(sh7372_early_devices, 1036 platform_add_devices(sh7372_early_devices,
1021 ARRAY_SIZE(sh7372_early_devices)); 1037 ARRAY_SIZE(sh7372_early_devices));
1022 1038
@@ -1047,6 +1063,31 @@ void __init sh7372_add_standard_devices(void)
1047 sh7372_add_device_to_domain(&sh7372_a4r, &jpu_device); 1063 sh7372_add_device_to_domain(&sh7372_a4r, &jpu_device);
1048 sh7372_add_device_to_domain(&sh7372_a4r, &tmu00_device); 1064 sh7372_add_device_to_domain(&sh7372_a4r, &tmu00_device);
1049 sh7372_add_device_to_domain(&sh7372_a4r, &tmu01_device); 1065 sh7372_add_device_to_domain(&sh7372_a4r, &tmu01_device);
1066
1067 rmobile_add_device_to_domain(&sh7372_pd_a3rv, &vpu_device);
1068 rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu0_device);
1069 rmobile_add_device_to_domain(&sh7372_pd_a4mp, &spu1_device);
1070 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif0_device);
1071 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif1_device);
1072 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif2_device);
1073 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif3_device);
1074 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif4_device);
1075 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif5_device);
1076 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &scif6_device);
1077 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &iic1_device);
1078 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma0_device);
1079 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma1_device);
1080 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &dma2_device);
1081 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma0_device);
1082 rmobile_add_device_to_domain(&sh7372_pd_a3sp, &usb_dma1_device);
1083 rmobile_add_device_to_domain(&sh7372_pd_a4r, &iic0_device);
1084 rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu0_device);
1085 rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu1_device);
1086 rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu2_device);
1087 rmobile_add_device_to_domain(&sh7372_pd_a4r, &veu3_device);
1088 rmobile_add_device_to_domain(&sh7372_pd_a4r, &jpu_device);
1089 rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu00_device);
1090 rmobile_add_device_to_domain(&sh7372_pd_a4r, &tmu01_device);
1050} 1091}
1051 1092
1052static void __init sh7372_earlytimer_init(void) 1093static void __init sh7372_earlytimer_init(void)