aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGeert Uytterhoeven <geert+renesas@glider.be>2014-12-03 08:41:44 -0500
committerSimon Horman <horms+renesas@verge.net.au>2015-01-12 19:33:19 -0500
commit25717b857360760755b83b4e606d61e1fc38552f (patch)
tree7c2a7926d8d2a380917c917985ab8c39db8a4cad /arch
parent4b9d62e02a0124d06fbbb9c4b01bd69f3c4dcd35 (diff)
ARM: shmobile: R-Mobile: Store SYSC base address in rmobile_pm_domain
Replace the hardcoded addresses for accessing the SYSC PM domain registers by register offsets, relative to the SYSC base address stored in struct rmobile_pm_domain. In the future, the SYSC base address will come from DT. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/pm-r8a7740.c14
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.c24
-rw-r--r--arch/arm/mach-shmobile/pm-rmobile.h1
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c11
4 files changed, 39 insertions, 11 deletions
diff --git a/arch/arm/mach-shmobile/pm-r8a7740.c b/arch/arm/mach-shmobile/pm-r8a7740.c
index ac2eecd6f5ea..34608fcf0648 100644
--- a/arch/arm/mach-shmobile/pm-r8a7740.c
+++ b/arch/arm/mach-shmobile/pm-r8a7740.c
@@ -9,10 +9,14 @@
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <linux/console.h> 11#include <linux/console.h>
12#include <linux/io.h>
12#include <linux/suspend.h> 13#include <linux/suspend.h>
14
13#include "common.h" 15#include "common.h"
14#include "pm-rmobile.h" 16#include "pm-rmobile.h"
15 17
18#define SYSC_BASE IOMEM(0xe6180000)
19
16#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM) 20#if defined(CONFIG_PM) && !defined(CONFIG_ARCH_MULTIPLATFORM)
17static int r8a7740_pd_a3sm_suspend(void) 21static int r8a7740_pd_a3sm_suspend(void)
18{ 22{
@@ -45,41 +49,51 @@ static int r8a7740_pd_d4_suspend(void)
45static struct rmobile_pm_domain r8a7740_pm_domains[] = { 49static struct rmobile_pm_domain r8a7740_pm_domains[] = {
46 { 50 {
47 .genpd.name = "A4LC", 51 .genpd.name = "A4LC",
52 .base = SYSC_BASE,
48 .bit_shift = 1, 53 .bit_shift = 1,
49 }, { 54 }, {
50 .genpd.name = "A4MP", 55 .genpd.name = "A4MP",
56 .base = SYSC_BASE,
51 .bit_shift = 2, 57 .bit_shift = 2,
52 }, { 58 }, {
53 .genpd.name = "D4", 59 .genpd.name = "D4",
60 .base = SYSC_BASE,
54 .bit_shift = 3, 61 .bit_shift = 3,
55 .gov = &pm_domain_always_on_gov, 62 .gov = &pm_domain_always_on_gov,
56 .suspend = r8a7740_pd_d4_suspend, 63 .suspend = r8a7740_pd_d4_suspend,
57 }, { 64 }, {
58 .genpd.name = "A4R", 65 .genpd.name = "A4R",
66 .base = SYSC_BASE,
59 .bit_shift = 5, 67 .bit_shift = 5,
60 }, { 68 }, {
61 .genpd.name = "A3RV", 69 .genpd.name = "A3RV",
70 .base = SYSC_BASE,
62 .bit_shift = 6, 71 .bit_shift = 6,
63 }, { 72 }, {
64 .genpd.name = "A4S", 73 .genpd.name = "A4S",
74 .base = SYSC_BASE,
65 .bit_shift = 10, 75 .bit_shift = 10,
66 .no_debug = true, 76 .no_debug = true,
67 }, { 77 }, {
68 .genpd.name = "A3SP", 78 .genpd.name = "A3SP",
79 .base = SYSC_BASE,
69 .bit_shift = 11, 80 .bit_shift = 11,
70 .gov = &pm_domain_always_on_gov, 81 .gov = &pm_domain_always_on_gov,
71 .no_debug = true, 82 .no_debug = true,
72 .suspend = r8a7740_pd_a3sp_suspend, 83 .suspend = r8a7740_pd_a3sp_suspend,
73 }, { 84 }, {
74 .genpd.name = "A3SM", 85 .genpd.name = "A3SM",
86 .base = SYSC_BASE,
75 .bit_shift = 12, 87 .bit_shift = 12,
76 .gov = &pm_domain_always_on_gov, 88 .gov = &pm_domain_always_on_gov,
77 .suspend = r8a7740_pd_a3sm_suspend, 89 .suspend = r8a7740_pd_a3sm_suspend,
78 }, { 90 }, {
79 .genpd.name = "A3SG", 91 .genpd.name = "A3SG",
92 .base = SYSC_BASE,
80 .bit_shift = 13, 93 .bit_shift = 13,
81 }, { 94 }, {
82 .genpd.name = "A4SU", 95 .genpd.name = "A4SU",
96 .base = SYSC_BASE,
83 .bit_shift = 20, 97 .bit_shift = 20,
84 }, 98 },
85}; 99};
diff --git a/arch/arm/mach-shmobile/pm-rmobile.c b/arch/arm/mach-shmobile/pm-rmobile.c
index 4ea458d268fb..a4fcd2cae718 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.c
+++ b/arch/arm/mach-shmobile/pm-rmobile.c
@@ -20,9 +20,9 @@
20#include "pm-rmobile.h" 20#include "pm-rmobile.h"
21 21
22/* SYSC */ 22/* SYSC */
23#define SPDCR IOMEM(0xe6180008) 23#define SPDCR 0x08 /* SYS Power Down Control Register */
24#define SWUCR IOMEM(0xe6180014) 24#define SWUCR 0x14 /* SYS Wakeup Control Register */
25#define PSTR IOMEM(0xe6180080) 25#define PSTR 0x80 /* Power Status Register */
26 26
27#define PSTR_RETRIES 100 27#define PSTR_RETRIES 100
28#define PSTR_DELAY_US 10 28#define PSTR_DELAY_US 10
@@ -39,12 +39,12 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
39 return ret; 39 return ret;
40 } 40 }
41 41
42 if (__raw_readl(PSTR) & mask) { 42 if (__raw_readl(rmobile_pd->base + PSTR) & mask) {
43 unsigned int retry_count; 43 unsigned int retry_count;
44 __raw_writel(mask, SPDCR); 44 __raw_writel(mask, rmobile_pd->base + SPDCR);
45 45
46 for (retry_count = PSTR_RETRIES; retry_count; retry_count--) { 46 for (retry_count = PSTR_RETRIES; retry_count; retry_count--) {
47 if (!(__raw_readl(SPDCR) & mask)) 47 if (!(__raw_readl(rmobile_pd->base + SPDCR) & mask))
48 break; 48 break;
49 cpu_relax(); 49 cpu_relax();
50 } 50 }
@@ -52,7 +52,8 @@ static int rmobile_pd_power_down(struct generic_pm_domain *genpd)
52 52
53 if (!rmobile_pd->no_debug) 53 if (!rmobile_pd->no_debug)
54 pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n", 54 pr_debug("%s: Power off, 0x%08x -> PSTR = 0x%08x\n",
55 genpd->name, mask, __raw_readl(PSTR)); 55 genpd->name, mask,
56 __raw_readl(rmobile_pd->base + PSTR));
56 57
57 return 0; 58 return 0;
58} 59}
@@ -64,13 +65,13 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
64 unsigned int retry_count; 65 unsigned int retry_count;
65 int ret = 0; 66 int ret = 0;
66 67
67 if (__raw_readl(PSTR) & mask) 68 if (__raw_readl(rmobile_pd->base + PSTR) & mask)
68 goto out; 69 goto out;
69 70
70 __raw_writel(mask, SWUCR); 71 __raw_writel(mask, rmobile_pd->base + SWUCR);
71 72
72 for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) { 73 for (retry_count = 2 * PSTR_RETRIES; retry_count; retry_count--) {
73 if (!(__raw_readl(SWUCR) & mask)) 74 if (!(__raw_readl(rmobile_pd->base + SWUCR) & mask))
74 break; 75 break;
75 if (retry_count > PSTR_RETRIES) 76 if (retry_count > PSTR_RETRIES)
76 udelay(PSTR_DELAY_US); 77 udelay(PSTR_DELAY_US);
@@ -82,7 +83,8 @@ static int __rmobile_pd_power_up(struct rmobile_pm_domain *rmobile_pd,
82 83
83 if (!rmobile_pd->no_debug) 84 if (!rmobile_pd->no_debug)
84 pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n", 85 pr_debug("%s: Power on, 0x%08x -> PSTR = 0x%08x\n",
85 rmobile_pd->genpd.name, mask, __raw_readl(PSTR)); 86 rmobile_pd->genpd.name, mask,
87 __raw_readl(rmobile_pd->base + PSTR));
86 88
87out: 89out:
88 if (ret == 0 && rmobile_pd->resume && do_resume) 90 if (ret == 0 && rmobile_pd->resume && do_resume)
diff --git a/arch/arm/mach-shmobile/pm-rmobile.h b/arch/arm/mach-shmobile/pm-rmobile.h
index 8f66b343162b..0602130bb260 100644
--- a/arch/arm/mach-shmobile/pm-rmobile.h
+++ b/arch/arm/mach-shmobile/pm-rmobile.h
@@ -21,6 +21,7 @@ struct rmobile_pm_domain {
21 struct dev_power_governor *gov; 21 struct dev_power_governor *gov;
22 int (*suspend)(void); 22 int (*suspend)(void);
23 void (*resume)(void); 23 void (*resume)(void);
24 void __iomem *base;
24 unsigned int bit_shift; 25 unsigned int bit_shift;
25 bool no_debug; 26 bool no_debug;
26}; 27};
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 0e37da654ed5..c0293ae4b013 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -45,6 +45,8 @@
45#define PLLC01STPCR IOMEM(0xe61500c8) 45#define PLLC01STPCR IOMEM(0xe61500c8)
46 46
47/* SYSC */ 47/* SYSC */
48#define SYSC_BASE IOMEM(0xe6180000)
49
48#define SBAR IOMEM(0xe6180020) 50#define SBAR IOMEM(0xe6180020)
49#define WUPRMSK IOMEM(0xe6180028) 51#define WUPRMSK IOMEM(0xe6180028)
50#define WUPSMSK IOMEM(0xe618002c) 52#define WUPSMSK IOMEM(0xe618002c)
@@ -118,24 +120,28 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
118 .genpd.name = "A4LC", 120 .genpd.name = "A4LC",
119 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 121 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
120 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 122 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
123 .base = SYSC_BASE,
121 .bit_shift = 1, 124 .bit_shift = 1,
122 }, 125 },
123 { 126 {
124 .genpd.name = "A4MP", 127 .genpd.name = "A4MP",
125 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 128 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
126 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 129 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
130 .base = SYSC_BASE,
127 .bit_shift = 2, 131 .bit_shift = 2,
128 }, 132 },
129 { 133 {
130 .genpd.name = "D4", 134 .genpd.name = "D4",
131 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 135 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
132 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 136 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
137 .base = SYSC_BASE,
133 .bit_shift = 3, 138 .bit_shift = 3,
134 }, 139 },
135 { 140 {
136 .genpd.name = "A4R", 141 .genpd.name = "A4R",
137 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 142 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
138 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 143 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
144 .base = SYSC_BASE,
139 .bit_shift = 5, 145 .bit_shift = 5,
140 .suspend = sh7372_a4r_pd_suspend, 146 .suspend = sh7372_a4r_pd_suspend,
141 .resume = sh7372_intcs_resume, 147 .resume = sh7372_intcs_resume,
@@ -144,18 +150,21 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
144 .genpd.name = "A3RV", 150 .genpd.name = "A3RV",
145 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 151 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
146 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 152 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
153 .base = SYSC_BASE,
147 .bit_shift = 6, 154 .bit_shift = 6,
148 }, 155 },
149 { 156 {
150 .genpd.name = "A3RI", 157 .genpd.name = "A3RI",
151 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 158 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
152 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 159 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
160 .base = SYSC_BASE,
153 .bit_shift = 8, 161 .bit_shift = 8,
154 }, 162 },
155 { 163 {
156 .genpd.name = "A4S", 164 .genpd.name = "A4S",
157 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 165 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
158 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 166 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
167 .base = SYSC_BASE,
159 .bit_shift = 10, 168 .bit_shift = 10,
160 .gov = &pm_domain_always_on_gov, 169 .gov = &pm_domain_always_on_gov,
161 .no_debug = true, 170 .no_debug = true,
@@ -166,6 +175,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
166 .genpd.name = "A3SP", 175 .genpd.name = "A3SP",
167 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 176 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
168 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 177 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
178 .base = SYSC_BASE,
169 .bit_shift = 11, 179 .bit_shift = 11,
170 .gov = &pm_domain_always_on_gov, 180 .gov = &pm_domain_always_on_gov,
171 .no_debug = true, 181 .no_debug = true,
@@ -175,6 +185,7 @@ static struct rmobile_pm_domain sh7372_pm_domains[] = {
175 .genpd.name = "A3SG", 185 .genpd.name = "A3SG",
176 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 186 .genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
177 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS, 187 .genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
188 .base = SYSC_BASE,
178 .bit_shift = 13, 189 .bit_shift = 13,
179 }, 190 },
180}; 191};