]>
Commit | Line | Data |
---|---|---|
8459293c KM |
1 | /* |
2 | * r8a7740 power management support | |
3 | * | |
4 | * Copyright (C) 2012 Renesas Solutions Corp. | |
5 | * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | |
6 | * | |
7 | * This file is subject to the terms and conditions of the GNU General Public | |
8 | * License. See the file "COPYING" in the main directory of this archive | |
9 | * for more details. | |
10 | */ | |
802a5639 | 11 | #include <linux/console.h> |
25717b85 | 12 | #include <linux/io.h> |
895d3b53 | 13 | #include <linux/suspend.h> |
25717b85 | 14 | |
fd44aa5e | 15 | #include "common.h" |
6b8b0cb4 | 16 | #include "pm-rmobile.h" |
8459293c | 17 | |
25717b85 GU |
18 | #define SYSC_BASE IOMEM(0xe6180000) |
19 | ||
c41215b7 | 20 | #if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM) |
dc4470e1 | 21 | static int r8a7740_pd_a3sm_suspend(void) |
8459293c KM |
22 | { |
23 | /* | |
dc4470e1 | 24 | * The A3SM domain contains the CPU core and therefore it should |
8237f9e5 | 25 | * only be turned off if the CPU is not in use. |
8459293c KM |
26 | */ |
27 | return -EBUSY; | |
28 | } | |
29 | ||
802a5639 KM |
30 | static int r8a7740_pd_a3sp_suspend(void) |
31 | { | |
32 | /* | |
33 | * Serial consoles make use of SCIF hardware located in A3SP, | |
34 | * keep such power domain on if "no_console_suspend" is set. | |
35 | */ | |
36 | return console_suspend_enabled ? 0 : -EBUSY; | |
37 | } | |
38 | ||
7e81f543 GU |
39 | static int r8a7740_pd_d4_suspend(void) |
40 | { | |
41 | /* | |
42 | * The D4 domain contains the Coresight-ETM hardware block and | |
43 | * therefore it should only be turned off if the debug module is | |
44 | * not in use. | |
45 | */ | |
46 | return -EBUSY; | |
47 | } | |
48 | ||
7b567407 RW |
49 | static struct rmobile_pm_domain r8a7740_pm_domains[] = { |
50 | { | |
75349099 | 51 | .genpd.name = "A4LC", |
25717b85 | 52 | .base = SYSC_BASE, |
75349099 | 53 | .bit_shift = 1, |
77192e1e GU |
54 | }, { |
55 | .genpd.name = "A4MP", | |
25717b85 | 56 | .base = SYSC_BASE, |
77192e1e | 57 | .bit_shift = 2, |
7e81f543 GU |
58 | }, { |
59 | .genpd.name = "D4", | |
25717b85 | 60 | .base = SYSC_BASE, |
7e81f543 GU |
61 | .bit_shift = 3, |
62 | .gov = &pm_domain_always_on_gov, | |
63 | .suspend = r8a7740_pd_d4_suspend, | |
1618a677 GU |
64 | }, { |
65 | .genpd.name = "A4R", | |
25717b85 | 66 | .base = SYSC_BASE, |
1618a677 | 67 | .bit_shift = 5, |
995d9250 GU |
68 | }, { |
69 | .genpd.name = "A3RV", | |
25717b85 | 70 | .base = SYSC_BASE, |
995d9250 | 71 | .bit_shift = 6, |
75349099 | 72 | }, { |
7b567407 | 73 | .genpd.name = "A4S", |
25717b85 | 74 | .base = SYSC_BASE, |
7b567407 | 75 | .bit_shift = 10, |
7b567407 | 76 | .no_debug = true, |
75349099 | 77 | }, { |
7b567407 | 78 | .genpd.name = "A3SP", |
25717b85 | 79 | .base = SYSC_BASE, |
7b567407 RW |
80 | .bit_shift = 11, |
81 | .gov = &pm_domain_always_on_gov, | |
82 | .no_debug = true, | |
83 | .suspend = r8a7740_pd_a3sp_suspend, | |
dc4470e1 GU |
84 | }, { |
85 | .genpd.name = "A3SM", | |
25717b85 | 86 | .base = SYSC_BASE, |
dc4470e1 GU |
87 | .bit_shift = 12, |
88 | .gov = &pm_domain_always_on_gov, | |
89 | .suspend = r8a7740_pd_a3sm_suspend, | |
92e88fd7 GU |
90 | }, { |
91 | .genpd.name = "A3SG", | |
25717b85 | 92 | .base = SYSC_BASE, |
92e88fd7 | 93 | .bit_shift = 13, |
4ee7830c GU |
94 | }, { |
95 | .genpd.name = "A4SU", | |
25717b85 | 96 | .base = SYSC_BASE, |
4ee7830c | 97 | .bit_shift = 20, |
7b567407 | 98 | }, |
802a5639 KM |
99 | }; |
100 | ||
7b567407 RW |
101 | void __init r8a7740_init_pm_domains(void) |
102 | { | |
103 | rmobile_init_domains(r8a7740_pm_domains, ARRAY_SIZE(r8a7740_pm_domains)); | |
1618a677 | 104 | pm_genpd_add_subdomain_names("A4R", "A3RV"); |
7b567407 | 105 | pm_genpd_add_subdomain_names("A4S", "A3SP"); |
dc4470e1 | 106 | pm_genpd_add_subdomain_names("A4S", "A3SM"); |
92e88fd7 | 107 | pm_genpd_add_subdomain_names("A4S", "A3SG"); |
7b567407 | 108 | } |
c41215b7 | 109 | #endif /* CONFIG_PM && !CONFIG_ARCH_MULTIPLATFORM */ |
895d3b53 BH |
110 | |
111 | #ifdef CONFIG_SUSPEND | |
112 | static int r8a7740_enter_suspend(suspend_state_t suspend_state) | |
113 | { | |
114 | cpu_do_idle(); | |
115 | return 0; | |
116 | } | |
117 | ||
118 | static void r8a7740_suspend_init(void) | |
119 | { | |
120 | shmobile_suspend_ops.enter = r8a7740_enter_suspend; | |
121 | } | |
122 | #else | |
123 | static void r8a7740_suspend_init(void) {} | |
124 | #endif | |
125 | ||
126 | void __init r8a7740_pm_init(void) | |
127 | { | |
128 | r8a7740_suspend_init(); | |
129 | } |