diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/common.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/io.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-mpuss-lowpower.c | 102 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-secure.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-wakeupgen.c | 20 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap-wakeupgen.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pdata-quirks.c | 10 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm44xx.c | 48 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm3xxx.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prm44xx.c | 90 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prminst44xx.c | 40 | ||||
-rw-r--r-- | arch/arm/mach-omap2/prminst44xx.h | 3 |
13 files changed, 275 insertions, 64 deletions
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index dc571f1d3b8a..5bb15920f73a 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
@@ -60,7 +60,7 @@ static inline int omap3_pm_init(void) | |||
60 | } | 60 | } |
61 | #endif | 61 | #endif |
62 | 62 | ||
63 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) | 63 | #if defined(CONFIG_PM) && (defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)) |
64 | int omap4_pm_init(void); | 64 | int omap4_pm_init(void); |
65 | int omap4_pm_init_early(void); | 65 | int omap4_pm_init_early(void); |
66 | #else | 66 | #else |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 5d0667c119f6..2890c2df09f6 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -667,6 +667,7 @@ void __init omap5_init_early(void) | |||
667 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE), | 667 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE), |
668 | OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE)); | 668 | OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE)); |
669 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); | 669 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); |
670 | omap4_pm_init_early(); | ||
670 | omap_prm_base_init(); | 671 | omap_prm_base_init(); |
671 | omap_cm_base_init(); | 672 | omap_cm_base_init(); |
672 | omap44xx_prm_init(); | 673 | omap44xx_prm_init(); |
@@ -682,6 +683,8 @@ void __init omap5_init_early(void) | |||
682 | void __init omap5_init_late(void) | 683 | void __init omap5_init_late(void) |
683 | { | 684 | { |
684 | omap_common_late_init(); | 685 | omap_common_late_init(); |
686 | omap4_pm_init(); | ||
687 | omap2_clk_enable_autoidle_all(); | ||
685 | } | 688 | } |
686 | #endif | 689 | #endif |
687 | 690 | ||
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c index e9cdacfe1923..6944ae3674e8 100644 --- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c +++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c | |||
@@ -56,6 +56,7 @@ | |||
56 | #include "omap4-sar-layout.h" | 56 | #include "omap4-sar-layout.h" |
57 | #include "pm.h" | 57 | #include "pm.h" |
58 | #include "prcm_mpu44xx.h" | 58 | #include "prcm_mpu44xx.h" |
59 | #include "prcm_mpu54xx.h" | ||
59 | #include "prminst44xx.h" | 60 | #include "prminst44xx.h" |
60 | #include "prcm44xx.h" | 61 | #include "prcm44xx.h" |
61 | #include "prm44xx.h" | 62 | #include "prm44xx.h" |
@@ -68,7 +69,6 @@ struct omap4_cpu_pm_info { | |||
68 | void __iomem *scu_sar_addr; | 69 | void __iomem *scu_sar_addr; |
69 | void __iomem *wkup_sar_addr; | 70 | void __iomem *wkup_sar_addr; |
70 | void __iomem *l2x0_sar_addr; | 71 | void __iomem *l2x0_sar_addr; |
71 | void (*secondary_startup)(void); | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | /** | 74 | /** |
@@ -76,6 +76,7 @@ struct omap4_cpu_pm_info { | |||
76 | * @finish_suspend: CPU suspend finisher function pointer | 76 | * @finish_suspend: CPU suspend finisher function pointer |
77 | * @resume: CPU resume function pointer | 77 | * @resume: CPU resume function pointer |
78 | * @scu_prepare: CPU Snoop Control program function pointer | 78 | * @scu_prepare: CPU Snoop Control program function pointer |
79 | * @hotplug_restart: CPU restart function pointer | ||
79 | * | 80 | * |
80 | * Structure holds functions pointer for CPU low power operations like | 81 | * Structure holds functions pointer for CPU low power operations like |
81 | * suspend, resume and scu programming. | 82 | * suspend, resume and scu programming. |
@@ -84,11 +85,13 @@ struct cpu_pm_ops { | |||
84 | int (*finish_suspend)(unsigned long cpu_state); | 85 | int (*finish_suspend)(unsigned long cpu_state); |
85 | void (*resume)(void); | 86 | void (*resume)(void); |
86 | void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state); | 87 | void (*scu_prepare)(unsigned int cpu_id, unsigned int cpu_state); |
88 | void (*hotplug_restart)(void); | ||
87 | }; | 89 | }; |
88 | 90 | ||
89 | static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); | 91 | static DEFINE_PER_CPU(struct omap4_cpu_pm_info, omap4_pm_info); |
90 | static struct powerdomain *mpuss_pd; | 92 | static struct powerdomain *mpuss_pd; |
91 | static void __iomem *sar_base; | 93 | static void __iomem *sar_base; |
94 | static u32 cpu_context_offset; | ||
92 | 95 | ||
93 | static int default_finish_suspend(unsigned long cpu_state) | 96 | static int default_finish_suspend(unsigned long cpu_state) |
94 | { | 97 | { |
@@ -106,6 +109,7 @@ struct cpu_pm_ops omap_pm_ops = { | |||
106 | .finish_suspend = default_finish_suspend, | 109 | .finish_suspend = default_finish_suspend, |
107 | .resume = dummy_cpu_resume, | 110 | .resume = dummy_cpu_resume, |
108 | .scu_prepare = dummy_scu_prepare, | 111 | .scu_prepare = dummy_scu_prepare, |
112 | .hotplug_restart = dummy_cpu_resume, | ||
109 | }; | 113 | }; |
110 | 114 | ||
111 | /* | 115 | /* |
@@ -116,7 +120,8 @@ static inline void set_cpu_wakeup_addr(unsigned int cpu_id, u32 addr) | |||
116 | { | 120 | { |
117 | struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); | 121 | struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); |
118 | 122 | ||
119 | writel_relaxed(addr, pm_info->wkup_sar_addr); | 123 | if (pm_info->wkup_sar_addr) |
124 | writel_relaxed(addr, pm_info->wkup_sar_addr); | ||
120 | } | 125 | } |
121 | 126 | ||
122 | /* | 127 | /* |
@@ -141,7 +146,8 @@ static void scu_pwrst_prepare(unsigned int cpu_id, unsigned int cpu_state) | |||
141 | break; | 146 | break; |
142 | } | 147 | } |
143 | 148 | ||
144 | writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr); | 149 | if (pm_info->scu_sar_addr) |
150 | writel_relaxed(scu_pwr_st, pm_info->scu_sar_addr); | ||
145 | } | 151 | } |
146 | 152 | ||
147 | /* Helper functions for MPUSS OSWR */ | 153 | /* Helper functions for MPUSS OSWR */ |
@@ -161,14 +167,14 @@ static inline void cpu_clear_prev_logic_pwrst(unsigned int cpu_id) | |||
161 | 167 | ||
162 | if (cpu_id) { | 168 | if (cpu_id) { |
163 | reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU1_INST, | 169 | reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU1_INST, |
164 | OMAP4_RM_CPU1_CPU1_CONTEXT_OFFSET); | 170 | cpu_context_offset); |
165 | omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU1_INST, | 171 | omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU1_INST, |
166 | OMAP4_RM_CPU1_CPU1_CONTEXT_OFFSET); | 172 | cpu_context_offset); |
167 | } else { | 173 | } else { |
168 | reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU0_INST, | 174 | reg = omap4_prcm_mpu_read_inst_reg(OMAP4430_PRCM_MPU_CPU0_INST, |
169 | OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET); | 175 | cpu_context_offset); |
170 | omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU0_INST, | 176 | omap4_prcm_mpu_write_inst_reg(reg, OMAP4430_PRCM_MPU_CPU0_INST, |
171 | OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET); | 177 | cpu_context_offset); |
172 | } | 178 | } |
173 | } | 179 | } |
174 | 180 | ||
@@ -179,7 +185,8 @@ static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state) | |||
179 | { | 185 | { |
180 | struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); | 186 | struct omap4_cpu_pm_info *pm_info = &per_cpu(omap4_pm_info, cpu_id); |
181 | 187 | ||
182 | writel_relaxed(save_state, pm_info->l2x0_sar_addr); | 188 | if (pm_info->l2x0_sar_addr) |
189 | writel_relaxed(save_state, pm_info->l2x0_sar_addr); | ||
183 | } | 190 | } |
184 | 191 | ||
185 | /* | 192 | /* |
@@ -189,10 +196,14 @@ static void l2x0_pwrst_prepare(unsigned int cpu_id, unsigned int save_state) | |||
189 | #ifdef CONFIG_CACHE_L2X0 | 196 | #ifdef CONFIG_CACHE_L2X0 |
190 | static void __init save_l2x0_context(void) | 197 | static void __init save_l2x0_context(void) |
191 | { | 198 | { |
192 | writel_relaxed(l2x0_saved_regs.aux_ctrl, | 199 | void __iomem *l2x0_base = omap4_get_l2cache_base(); |
193 | sar_base + L2X0_AUXCTRL_OFFSET); | 200 | |
194 | writel_relaxed(l2x0_saved_regs.prefetch_ctrl, | 201 | if (l2x0_base && sar_base) { |
195 | sar_base + L2X0_PREFETCH_CTRL_OFFSET); | 202 | writel_relaxed(l2x0_saved_regs.aux_ctrl, |
203 | sar_base + L2X0_AUXCTRL_OFFSET); | ||
204 | writel_relaxed(l2x0_saved_regs.prefetch_ctrl, | ||
205 | sar_base + L2X0_PREFETCH_CTRL_OFFSET); | ||
206 | } | ||
196 | } | 207 | } |
197 | #else | 208 | #else |
198 | static void __init save_l2x0_context(void) | 209 | static void __init save_l2x0_context(void) |
@@ -231,6 +242,10 @@ int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state) | |||
231 | save_state = 1; | 242 | save_state = 1; |
232 | break; | 243 | break; |
233 | case PWRDM_POWER_RET: | 244 | case PWRDM_POWER_RET: |
245 | if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) { | ||
246 | save_state = 0; | ||
247 | break; | ||
248 | } | ||
234 | default: | 249 | default: |
235 | /* | 250 | /* |
236 | * CPUx CSWR is invalid hardware state. Also CPUx OSWR | 251 | * CPUx CSWR is invalid hardware state. Also CPUx OSWR |
@@ -307,7 +322,7 @@ int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) | |||
307 | 322 | ||
308 | pwrdm_clear_all_prev_pwrst(pm_info->pwrdm); | 323 | pwrdm_clear_all_prev_pwrst(pm_info->pwrdm); |
309 | pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); | 324 | pwrdm_set_next_pwrst(pm_info->pwrdm, power_state); |
310 | set_cpu_wakeup_addr(cpu, virt_to_phys(pm_info->secondary_startup)); | 325 | set_cpu_wakeup_addr(cpu, virt_to_phys(omap_pm_ops.hotplug_restart)); |
311 | omap_pm_ops.scu_prepare(cpu, power_state); | 326 | omap_pm_ops.scu_prepare(cpu, power_state); |
312 | 327 | ||
313 | /* | 328 | /* |
@@ -323,6 +338,21 @@ int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state) | |||
323 | 338 | ||
324 | 339 | ||
325 | /* | 340 | /* |
341 | * Enable Mercury Fast HG retention mode by default. | ||
342 | */ | ||
343 | static void enable_mercury_retention_mode(void) | ||
344 | { | ||
345 | u32 reg; | ||
346 | |||
347 | reg = omap4_prcm_mpu_read_inst_reg(OMAP54XX_PRCM_MPU_DEVICE_INST, | ||
348 | OMAP54XX_PRCM_MPU_PRM_PSCON_COUNT_OFFSET); | ||
349 | /* Enable HG_EN, HG_RAMPUP = fast mode */ | ||
350 | reg |= BIT(24) | BIT(25); | ||
351 | omap4_prcm_mpu_write_inst_reg(reg, OMAP54XX_PRCM_MPU_DEVICE_INST, | ||
352 | OMAP54XX_PRCM_MPU_PRM_PSCON_COUNT_OFFSET); | ||
353 | } | ||
354 | |||
355 | /* | ||
326 | * Initialise OMAP4 MPUSS | 356 | * Initialise OMAP4 MPUSS |
327 | */ | 357 | */ |
328 | int __init omap4_mpuss_init(void) | 358 | int __init omap4_mpuss_init(void) |
@@ -334,13 +364,17 @@ int __init omap4_mpuss_init(void) | |||
334 | return -ENODEV; | 364 | return -ENODEV; |
335 | } | 365 | } |
336 | 366 | ||
337 | sar_base = omap4_get_sar_ram_base(); | 367 | if (cpu_is_omap44xx()) |
368 | sar_base = omap4_get_sar_ram_base(); | ||
338 | 369 | ||
339 | /* Initilaise per CPU PM information */ | 370 | /* Initilaise per CPU PM information */ |
340 | pm_info = &per_cpu(omap4_pm_info, 0x0); | 371 | pm_info = &per_cpu(omap4_pm_info, 0x0); |
341 | pm_info->scu_sar_addr = sar_base + SCU_OFFSET0; | 372 | if (sar_base) { |
342 | pm_info->wkup_sar_addr = sar_base + CPU0_WAKEUP_NS_PA_ADDR_OFFSET; | 373 | pm_info->scu_sar_addr = sar_base + SCU_OFFSET0; |
343 | pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0; | 374 | pm_info->wkup_sar_addr = sar_base + |
375 | CPU0_WAKEUP_NS_PA_ADDR_OFFSET; | ||
376 | pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0; | ||
377 | } | ||
344 | pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm"); | 378 | pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm"); |
345 | if (!pm_info->pwrdm) { | 379 | if (!pm_info->pwrdm) { |
346 | pr_err("Lookup failed for CPU0 pwrdm\n"); | 380 | pr_err("Lookup failed for CPU0 pwrdm\n"); |
@@ -355,13 +389,12 @@ int __init omap4_mpuss_init(void) | |||
355 | pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON); | 389 | pwrdm_set_next_pwrst(pm_info->pwrdm, PWRDM_POWER_ON); |
356 | 390 | ||
357 | pm_info = &per_cpu(omap4_pm_info, 0x1); | 391 | pm_info = &per_cpu(omap4_pm_info, 0x1); |
358 | pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; | 392 | if (sar_base) { |
359 | pm_info->wkup_sar_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; | 393 | pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; |
360 | pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; | 394 | pm_info->wkup_sar_addr = sar_base + |
361 | if (cpu_is_omap446x()) | 395 | CPU1_WAKEUP_NS_PA_ADDR_OFFSET; |
362 | pm_info->secondary_startup = omap4460_secondary_startup; | 396 | pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; |
363 | else | 397 | } |
364 | pm_info->secondary_startup = omap4_secondary_startup; | ||
365 | 398 | ||
366 | pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); | 399 | pm_info->pwrdm = pwrdm_lookup("cpu1_pwrdm"); |
367 | if (!pm_info->pwrdm) { | 400 | if (!pm_info->pwrdm) { |
@@ -384,20 +417,27 @@ int __init omap4_mpuss_init(void) | |||
384 | pwrdm_clear_all_prev_pwrst(mpuss_pd); | 417 | pwrdm_clear_all_prev_pwrst(mpuss_pd); |
385 | mpuss_clear_prev_logic_pwrst(); | 418 | mpuss_clear_prev_logic_pwrst(); |
386 | 419 | ||
387 | /* Save device type on scratchpad for low level code to use */ | 420 | if (sar_base) { |
388 | if (omap_type() != OMAP2_DEVICE_TYPE_GP) | 421 | /* Save device type on scratchpad for low level code to use */ |
389 | writel_relaxed(1, sar_base + OMAP_TYPE_OFFSET); | 422 | writel_relaxed((omap_type() != OMAP2_DEVICE_TYPE_GP) ? 1 : 0, |
390 | else | 423 | sar_base + OMAP_TYPE_OFFSET); |
391 | writel_relaxed(0, sar_base + OMAP_TYPE_OFFSET); | 424 | save_l2x0_context(); |
392 | 425 | } | |
393 | save_l2x0_context(); | ||
394 | 426 | ||
395 | if (cpu_is_omap44xx()) { | 427 | if (cpu_is_omap44xx()) { |
396 | omap_pm_ops.finish_suspend = omap4_finish_suspend; | 428 | omap_pm_ops.finish_suspend = omap4_finish_suspend; |
397 | omap_pm_ops.resume = omap4_cpu_resume; | 429 | omap_pm_ops.resume = omap4_cpu_resume; |
398 | omap_pm_ops.scu_prepare = scu_pwrst_prepare; | 430 | omap_pm_ops.scu_prepare = scu_pwrst_prepare; |
431 | omap_pm_ops.hotplug_restart = omap4_secondary_startup; | ||
432 | cpu_context_offset = OMAP4_RM_CPU0_CPU0_CONTEXT_OFFSET; | ||
433 | } else if (soc_is_omap54xx() || soc_is_dra7xx()) { | ||
434 | cpu_context_offset = OMAP54XX_RM_CPU0_CPU0_CONTEXT_OFFSET; | ||
435 | enable_mercury_retention_mode(); | ||
399 | } | 436 | } |
400 | 437 | ||
438 | if (cpu_is_omap446x()) | ||
439 | omap_pm_ops.hotplug_restart = omap4460_secondary_startup; | ||
440 | |||
401 | return 0; | 441 | return 0; |
402 | } | 442 | } |
403 | 443 | ||
diff --git a/arch/arm/mach-omap2/omap-secure.h b/arch/arm/mach-omap2/omap-secure.h index 3e97c6c8ecf1..dec2b05d184b 100644 --- a/arch/arm/mach-omap2/omap-secure.h +++ b/arch/arm/mach-omap2/omap-secure.h | |||
@@ -45,6 +45,7 @@ | |||
45 | #define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 | 45 | #define OMAP4_MON_L2X0_PREFETCH_INDEX 0x113 |
46 | 46 | ||
47 | #define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109 | 47 | #define OMAP5_DRA7_MON_SET_CNTFRQ_INDEX 0x109 |
48 | #define OMAP5_MON_AMBA_IF_INDEX 0x108 | ||
48 | 49 | ||
49 | /* Secure PPA(Primary Protected Application) APIs */ | 50 | /* Secure PPA(Primary Protected Application) APIs */ |
50 | #define OMAP4_PPA_L2_POR_INDEX 0x23 | 51 | #define OMAP4_PPA_L2_POR_INDEX 0x23 |
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.c b/arch/arm/mach-omap2/omap-wakeupgen.c index 37843a7d3639..f961c46453b9 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.c +++ b/arch/arm/mach-omap2/omap-wakeupgen.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "soc.h" | 32 | #include "soc.h" |
33 | #include "omap4-sar-layout.h" | 33 | #include "omap4-sar-layout.h" |
34 | #include "common.h" | 34 | #include "common.h" |
35 | #include "pm.h" | ||
35 | 36 | ||
36 | #define AM43XX_NR_REG_BANKS 7 | 37 | #define AM43XX_NR_REG_BANKS 7 |
37 | #define AM43XX_IRQS 224 | 38 | #define AM43XX_IRQS 224 |
@@ -381,7 +382,7 @@ static struct notifier_block irq_notifier_block = { | |||
381 | static void __init irq_pm_init(void) | 382 | static void __init irq_pm_init(void) |
382 | { | 383 | { |
383 | /* FIXME: Remove this when MPU OSWR support is added */ | 384 | /* FIXME: Remove this when MPU OSWR support is added */ |
384 | if (!soc_is_omap54xx()) | 385 | if (!IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) |
385 | cpu_pm_register_notifier(&irq_notifier_block); | 386 | cpu_pm_register_notifier(&irq_notifier_block); |
386 | } | 387 | } |
387 | #else | 388 | #else |
@@ -406,6 +407,7 @@ int __init omap_wakeupgen_init(void) | |||
406 | { | 407 | { |
407 | int i; | 408 | int i; |
408 | unsigned int boot_cpu = smp_processor_id(); | 409 | unsigned int boot_cpu = smp_processor_id(); |
410 | u32 val; | ||
409 | 411 | ||
410 | /* Not supported on OMAP4 ES1.0 silicon */ | 412 | /* Not supported on OMAP4 ES1.0 silicon */ |
411 | if (omap_rev() == OMAP4430_REV_ES1_0) { | 413 | if (omap_rev() == OMAP4430_REV_ES1_0) { |
@@ -451,6 +453,22 @@ int __init omap_wakeupgen_init(void) | |||
451 | for (i = 0; i < max_irqs; i++) | 453 | for (i = 0; i < max_irqs; i++) |
452 | irq_target_cpu[i] = boot_cpu; | 454 | irq_target_cpu[i] = boot_cpu; |
453 | 455 | ||
456 | /* | ||
457 | * Enables OMAP5 ES2 PM Mode using ES2_PM_MODE in AMBA_IF_MODE | ||
458 | * 0x0: ES1 behavior, CPU cores would enter and exit OFF mode together. | ||
459 | * 0x1: ES2 behavior, CPU cores are allowed to enter/exit OFF mode | ||
460 | * independently. | ||
461 | * This needs to be set one time thanks to always ON domain. | ||
462 | * | ||
463 | * We do not support ES1 behavior anymore. OMAP5 is assumed to be | ||
464 | * ES2.0, and the same is applicable for DRA7. | ||
465 | */ | ||
466 | if (soc_is_omap54xx() || soc_is_dra7xx()) { | ||
467 | val = __raw_readl(wakeupgen_base + OMAP_AMBA_IF_MODE); | ||
468 | val |= BIT(5); | ||
469 | omap_smc1(OMAP5_MON_AMBA_IF_INDEX, val); | ||
470 | } | ||
471 | |||
454 | irq_hotplug_init(); | 472 | irq_hotplug_init(); |
455 | irq_pm_init(); | 473 | irq_pm_init(); |
456 | 474 | ||
diff --git a/arch/arm/mach-omap2/omap-wakeupgen.h b/arch/arm/mach-omap2/omap-wakeupgen.h index b0fd16f5c391..b3c8eccfae79 100644 --- a/arch/arm/mach-omap2/omap-wakeupgen.h +++ b/arch/arm/mach-omap2/omap-wakeupgen.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define OMAP_WKG_ENB_E_1 0x420 | 27 | #define OMAP_WKG_ENB_E_1 0x420 |
28 | #define OMAP_AUX_CORE_BOOT_0 0x800 | 28 | #define OMAP_AUX_CORE_BOOT_0 0x800 |
29 | #define OMAP_AUX_CORE_BOOT_1 0x804 | 29 | #define OMAP_AUX_CORE_BOOT_1 0x804 |
30 | #define OMAP_AMBA_IF_MODE 0x80c | ||
30 | #define OMAP_PTMSYNCREQ_MASK 0xc00 | 31 | #define OMAP_PTMSYNCREQ_MASK 0xc00 |
31 | #define OMAP_PTMSYNCREQ_EN 0xc04 | 32 | #define OMAP_PTMSYNCREQ_EN 0xc04 |
32 | #define OMAP_TIMESTAMPCYCLELO 0xc08 | 33 | #define OMAP_TIMESTAMPCYCLELO 0xc08 |
diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 90c88d498485..5fea34edb607 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c | |||
@@ -352,6 +352,16 @@ struct of_dev_auxdata omap_auxdata_lookup[] __initdata = { | |||
352 | OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata), | 352 | OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a100040, "4a100040.pinmux", &pcs_pdata), |
353 | OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata), | 353 | OF_DEV_AUXDATA("ti,omap4-padconf", 0x4a31e040, "4a31e040.pinmux", &pcs_pdata), |
354 | #endif | 354 | #endif |
355 | #ifdef CONFIG_SOC_OMAP5 | ||
356 | OF_DEV_AUXDATA("ti,omap5-padconf", 0x4a002840, "4a002840.pinmux", &pcs_pdata), | ||
357 | OF_DEV_AUXDATA("ti,omap5-padconf", 0x4ae0c840, "4ae0c840.pinmux", &pcs_pdata), | ||
358 | #endif | ||
359 | #ifdef CONFIG_SOC_DRA7XX | ||
360 | OF_DEV_AUXDATA("ti,dra7-padconf", 0x4a003400, "4a003400.pinmux", &pcs_pdata), | ||
361 | #endif | ||
362 | #ifdef CONFIG_SOC_AM43XX | ||
363 | OF_DEV_AUXDATA("ti,am437-padconf", 0x44e10800, "44e10800.pinmux", &pcs_pdata), | ||
364 | #endif | ||
355 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) | 365 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) |
356 | OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu", | 366 | OF_DEV_AUXDATA("ti,omap4-iommu", 0x4a066000, "4a066000.mmu", |
357 | &omap4_iommu_pdata), | 367 | &omap4_iommu_pdata), |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index e150102d6c06..425bfcd67db6 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h | |||
@@ -101,6 +101,7 @@ static inline void enable_omap3630_toggle_l2_on_restore(void) { } | |||
101 | #endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ | 101 | #endif /* defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) */ |
102 | 102 | ||
103 | #define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0) | 103 | #define PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD (1 << 0) |
104 | #define PM_OMAP4_CPU_OSWR_DISABLE (1 << 1) | ||
104 | 105 | ||
105 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) | 106 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP4) |
106 | extern u16 pm44xx_errata; | 107 | extern u16 pm44xx_errata; |
diff --git a/arch/arm/mach-omap2/pm44xx.c b/arch/arm/mach-omap2/pm44xx.c index 0bfce38a744a..503097c72b82 100644 --- a/arch/arm/mach-omap2/pm44xx.c +++ b/arch/arm/mach-omap2/pm44xx.c | |||
@@ -37,6 +37,8 @@ struct power_state { | |||
37 | struct list_head node; | 37 | struct list_head node; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static u32 cpu_suspend_state = PWRDM_POWER_OFF; | ||
41 | |||
40 | static LIST_HEAD(pwrst_list); | 42 | static LIST_HEAD(pwrst_list); |
41 | 43 | ||
42 | #ifdef CONFIG_SUSPEND | 44 | #ifdef CONFIG_SUSPEND |
@@ -67,7 +69,7 @@ static int omap4_pm_suspend(void) | |||
67 | * domain CSWR is not supported by hardware. | 69 | * domain CSWR is not supported by hardware. |
68 | * More details can be found in OMAP4430 TRM section 4.3.4.2. | 70 | * More details can be found in OMAP4430 TRM section 4.3.4.2. |
69 | */ | 71 | */ |
70 | omap4_enter_lowpower(cpu_id, PWRDM_POWER_OFF); | 72 | omap4_enter_lowpower(cpu_id, cpu_suspend_state); |
71 | 73 | ||
72 | /* Restore next powerdomain state */ | 74 | /* Restore next powerdomain state */ |
73 | list_for_each_entry(pwrst, &pwrst_list, node) { | 75 | list_for_each_entry(pwrst, &pwrst_list, node) { |
@@ -113,8 +115,11 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | |||
113 | * through hotplug path and CPU0 explicitly programmed | 115 | * through hotplug path and CPU0 explicitly programmed |
114 | * further down in the code path | 116 | * further down in the code path |
115 | */ | 117 | */ |
116 | if (!strncmp(pwrdm->name, "cpu", 3)) | 118 | if (!strncmp(pwrdm->name, "cpu", 3)) { |
119 | if (IS_PM44XX_ERRATUM(PM_OMAP4_CPU_OSWR_DISABLE)) | ||
120 | cpu_suspend_state = PWRDM_POWER_RET; | ||
117 | return 0; | 121 | return 0; |
122 | } | ||
118 | 123 | ||
119 | pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); | 124 | pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); |
120 | if (!pwrst) | 125 | if (!pwrst) |
@@ -208,6 +213,32 @@ static inline int omap4_init_static_deps(void) | |||
208 | } | 213 | } |
209 | 214 | ||
210 | /** | 215 | /** |
216 | * omap5_dra7_init_static_deps - Init static clkdm dependencies on OMAP5 and | ||
217 | * DRA7 | ||
218 | * | ||
219 | * The dynamic dependency between MPUSS -> EMIF is broken and has | ||
220 | * not worked as expected. The hardware recommendation is to | ||
221 | * enable static dependencies for these to avoid system | ||
222 | * lock ups or random crashes. | ||
223 | */ | ||
224 | static inline int omap5_dra7_init_static_deps(void) | ||
225 | { | ||
226 | struct clockdomain *mpuss_clkdm, *emif_clkdm; | ||
227 | int ret; | ||
228 | |||
229 | mpuss_clkdm = clkdm_lookup("mpu_clkdm"); | ||
230 | emif_clkdm = clkdm_lookup("emif_clkdm"); | ||
231 | if (!mpuss_clkdm || !emif_clkdm) | ||
232 | return -EINVAL; | ||
233 | |||
234 | ret = clkdm_add_wkdep(mpuss_clkdm, emif_clkdm); | ||
235 | if (ret) | ||
236 | pr_err("Failed to add MPUSS -> EMIF wakeup dependency\n"); | ||
237 | |||
238 | return ret; | ||
239 | } | ||
240 | |||
241 | /** | ||
211 | * omap4_pm_init_early - Does early initialization necessary for OMAP4+ devices | 242 | * omap4_pm_init_early - Does early initialization necessary for OMAP4+ devices |
212 | * | 243 | * |
213 | * Initializes basic stuff for power management functionality. | 244 | * Initializes basic stuff for power management functionality. |
@@ -217,6 +248,9 @@ int __init omap4_pm_init_early(void) | |||
217 | if (cpu_is_omap446x()) | 248 | if (cpu_is_omap446x()) |
218 | pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD; | 249 | pm44xx_errata |= PM_OMAP4_ROM_SMP_BOOT_ERRATUM_GICD; |
219 | 250 | ||
251 | if (soc_is_omap54xx() || soc_is_dra7xx()) | ||
252 | pm44xx_errata |= PM_OMAP4_CPU_OSWR_DISABLE; | ||
253 | |||
220 | return 0; | 254 | return 0; |
221 | } | 255 | } |
222 | 256 | ||
@@ -244,10 +278,14 @@ int __init omap4_pm_init(void) | |||
244 | goto err2; | 278 | goto err2; |
245 | } | 279 | } |
246 | 280 | ||
247 | if (cpu_is_omap44xx()) { | 281 | if (cpu_is_omap44xx()) |
248 | ret = omap4_init_static_deps(); | 282 | ret = omap4_init_static_deps(); |
249 | if (ret) | 283 | else if (soc_is_omap54xx() || soc_is_dra7xx()) |
250 | goto err2; | 284 | ret = omap5_dra7_init_static_deps(); |
285 | |||
286 | if (ret) { | ||
287 | pr_err("Failed to initialise static dependencies.\n"); | ||
288 | goto err2; | ||
251 | } | 289 | } |
252 | 290 | ||
253 | ret = omap4_mpuss_init(); | 291 | ret = omap4_mpuss_init(); |
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 2458be6fc67b..e0088e0508f8 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/err.h> | 17 | #include <linux/err.h> |
18 | #include <linux/io.h> | 18 | #include <linux/io.h> |
19 | #include <linux/irq.h> | 19 | #include <linux/irq.h> |
20 | #include <linux/of_irq.h> | ||
20 | 21 | ||
21 | #include "soc.h" | 22 | #include "soc.h" |
22 | #include "common.h" | 23 | #include "common.h" |
@@ -649,6 +650,11 @@ int __init omap3xxx_prm_init(void) | |||
649 | return prm_register(&omap3xxx_prm_ll_data); | 650 | return prm_register(&omap3xxx_prm_ll_data); |
650 | } | 651 | } |
651 | 652 | ||
653 | static struct of_device_id omap3_prm_dt_match_table[] = { | ||
654 | { .compatible = "ti,omap3-prm" }, | ||
655 | { } | ||
656 | }; | ||
657 | |||
652 | static int omap3xxx_prm_late_init(void) | 658 | static int omap3xxx_prm_late_init(void) |
653 | { | 659 | { |
654 | int ret; | 660 | int ret; |
@@ -656,6 +662,18 @@ static int omap3xxx_prm_late_init(void) | |||
656 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) | 662 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) |
657 | return 0; | 663 | return 0; |
658 | 664 | ||
665 | if (of_have_populated_dt()) { | ||
666 | struct device_node *np; | ||
667 | int irq_num; | ||
668 | |||
669 | np = of_find_matching_node(NULL, omap3_prm_dt_match_table); | ||
670 | if (np) { | ||
671 | irq_num = of_irq_get(np, 0); | ||
672 | if (irq_num >= 0) | ||
673 | omap3_prcm_irq_setup.irq = irq_num; | ||
674 | } | ||
675 | } | ||
676 | |||
659 | omap3xxx_prm_enable_io_wakeup(); | 677 | omap3xxx_prm_enable_io_wakeup(); |
660 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); | 678 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); |
661 | if (!ret) | 679 | if (!ret) |
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index a7f6ea27180a..0958d070d3db 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/of_irq.h> | ||
20 | 21 | ||
21 | 22 | ||
22 | #include "soc.h" | 23 | #include "soc.h" |
@@ -32,7 +33,6 @@ | |||
32 | /* Static data */ | 33 | /* Static data */ |
33 | 34 | ||
34 | static const struct omap_prcm_irq omap4_prcm_irqs[] = { | 35 | static const struct omap_prcm_irq omap4_prcm_irqs[] = { |
35 | OMAP_PRCM_IRQ("wkup", 0, 0), | ||
36 | OMAP_PRCM_IRQ("io", 9, 1), | 36 | OMAP_PRCM_IRQ("io", 9, 1), |
37 | }; | 37 | }; |
38 | 38 | ||
@@ -154,21 +154,36 @@ void omap4_prm_vp_clear_txdone(u8 vp_id) | |||
154 | 154 | ||
155 | u32 omap4_prm_vcvp_read(u8 offset) | 155 | u32 omap4_prm_vcvp_read(u8 offset) |
156 | { | 156 | { |
157 | s32 inst = omap4_prmst_get_prm_dev_inst(); | ||
158 | |||
159 | if (inst == PRM_INSTANCE_UNKNOWN) | ||
160 | return 0; | ||
161 | |||
157 | return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, | 162 | return omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, |
158 | OMAP4430_PRM_DEVICE_INST, offset); | 163 | inst, offset); |
159 | } | 164 | } |
160 | 165 | ||
161 | void omap4_prm_vcvp_write(u32 val, u8 offset) | 166 | void omap4_prm_vcvp_write(u32 val, u8 offset) |
162 | { | 167 | { |
168 | s32 inst = omap4_prmst_get_prm_dev_inst(); | ||
169 | |||
170 | if (inst == PRM_INSTANCE_UNKNOWN) | ||
171 | return; | ||
172 | |||
163 | omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, | 173 | omap4_prminst_write_inst_reg(val, OMAP4430_PRM_PARTITION, |
164 | OMAP4430_PRM_DEVICE_INST, offset); | 174 | inst, offset); |
165 | } | 175 | } |
166 | 176 | ||
167 | u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) | 177 | u32 omap4_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) |
168 | { | 178 | { |
179 | s32 inst = omap4_prmst_get_prm_dev_inst(); | ||
180 | |||
181 | if (inst == PRM_INSTANCE_UNKNOWN) | ||
182 | return 0; | ||
183 | |||
169 | return omap4_prminst_rmw_inst_reg_bits(mask, bits, | 184 | return omap4_prminst_rmw_inst_reg_bits(mask, bits, |
170 | OMAP4430_PRM_PARTITION, | 185 | OMAP4430_PRM_PARTITION, |
171 | OMAP4430_PRM_DEVICE_INST, | 186 | inst, |
172 | offset); | 187 | offset); |
173 | } | 188 | } |
174 | 189 | ||
@@ -275,14 +290,18 @@ void omap44xx_prm_restore_irqen(u32 *saved_mask) | |||
275 | void omap44xx_prm_reconfigure_io_chain(void) | 290 | void omap44xx_prm_reconfigure_io_chain(void) |
276 | { | 291 | { |
277 | int i = 0; | 292 | int i = 0; |
293 | s32 inst = omap4_prmst_get_prm_dev_inst(); | ||
294 | |||
295 | if (inst == PRM_INSTANCE_UNKNOWN) | ||
296 | return; | ||
278 | 297 | ||
279 | /* Trigger WUCLKIN enable */ | 298 | /* Trigger WUCLKIN enable */ |
280 | omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, | 299 | omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, |
281 | OMAP4430_WUCLK_CTRL_MASK, | 300 | OMAP4430_WUCLK_CTRL_MASK, |
282 | OMAP4430_PRM_DEVICE_INST, | 301 | inst, |
283 | OMAP4_PRM_IO_PMCTRL_OFFSET); | 302 | OMAP4_PRM_IO_PMCTRL_OFFSET); |
284 | omap_test_timeout( | 303 | omap_test_timeout( |
285 | (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 304 | (((omap4_prm_read_inst_reg(inst, |
286 | OMAP4_PRM_IO_PMCTRL_OFFSET) & | 305 | OMAP4_PRM_IO_PMCTRL_OFFSET) & |
287 | OMAP4430_WUCLK_STATUS_MASK) >> | 306 | OMAP4430_WUCLK_STATUS_MASK) >> |
288 | OMAP4430_WUCLK_STATUS_SHIFT) == 1), | 307 | OMAP4430_WUCLK_STATUS_SHIFT) == 1), |
@@ -292,10 +311,10 @@ void omap44xx_prm_reconfigure_io_chain(void) | |||
292 | 311 | ||
293 | /* Trigger WUCLKIN disable */ | 312 | /* Trigger WUCLKIN disable */ |
294 | omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0, | 313 | omap4_prm_rmw_inst_reg_bits(OMAP4430_WUCLK_CTRL_MASK, 0x0, |
295 | OMAP4430_PRM_DEVICE_INST, | 314 | inst, |
296 | OMAP4_PRM_IO_PMCTRL_OFFSET); | 315 | OMAP4_PRM_IO_PMCTRL_OFFSET); |
297 | omap_test_timeout( | 316 | omap_test_timeout( |
298 | (((omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 317 | (((omap4_prm_read_inst_reg(inst, |
299 | OMAP4_PRM_IO_PMCTRL_OFFSET) & | 318 | OMAP4_PRM_IO_PMCTRL_OFFSET) & |
300 | OMAP4430_WUCLK_STATUS_MASK) >> | 319 | OMAP4430_WUCLK_STATUS_MASK) >> |
301 | OMAP4430_WUCLK_STATUS_SHIFT) == 0), | 320 | OMAP4430_WUCLK_STATUS_SHIFT) == 0), |
@@ -316,9 +335,14 @@ void omap44xx_prm_reconfigure_io_chain(void) | |||
316 | */ | 335 | */ |
317 | static void __init omap44xx_prm_enable_io_wakeup(void) | 336 | static void __init omap44xx_prm_enable_io_wakeup(void) |
318 | { | 337 | { |
338 | s32 inst = omap4_prmst_get_prm_dev_inst(); | ||
339 | |||
340 | if (inst == PRM_INSTANCE_UNKNOWN) | ||
341 | return; | ||
342 | |||
319 | omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK, | 343 | omap4_prm_rmw_inst_reg_bits(OMAP4430_GLOBAL_WUEN_MASK, |
320 | OMAP4430_GLOBAL_WUEN_MASK, | 344 | OMAP4430_GLOBAL_WUEN_MASK, |
321 | OMAP4430_PRM_DEVICE_INST, | 345 | inst, |
322 | OMAP4_PRM_IO_PMCTRL_OFFSET); | 346 | OMAP4_PRM_IO_PMCTRL_OFFSET); |
323 | } | 347 | } |
324 | 348 | ||
@@ -333,8 +357,13 @@ static u32 omap44xx_prm_read_reset_sources(void) | |||
333 | struct prm_reset_src_map *p; | 357 | struct prm_reset_src_map *p; |
334 | u32 r = 0; | 358 | u32 r = 0; |
335 | u32 v; | 359 | u32 v; |
360 | s32 inst = omap4_prmst_get_prm_dev_inst(); | ||
336 | 361 | ||
337 | v = omap4_prm_read_inst_reg(OMAP4430_PRM_DEVICE_INST, | 362 | if (inst == PRM_INSTANCE_UNKNOWN) |
363 | return 0; | ||
364 | |||
365 | |||
366 | v = omap4_prm_read_inst_reg(inst, | ||
338 | OMAP4_RM_RSTST); | 367 | OMAP4_RM_RSTST); |
339 | 368 | ||
340 | p = omap44xx_prm_reset_src_map; | 369 | p = omap44xx_prm_reset_src_map; |
@@ -664,17 +693,56 @@ static struct prm_ll_data omap44xx_prm_ll_data = { | |||
664 | 693 | ||
665 | int __init omap44xx_prm_init(void) | 694 | int __init omap44xx_prm_init(void) |
666 | { | 695 | { |
667 | if (cpu_is_omap44xx()) | 696 | if (cpu_is_omap44xx() || soc_is_omap54xx() || soc_is_dra7xx()) |
668 | prm_features |= PRM_HAS_IO_WAKEUP; | 697 | prm_features |= PRM_HAS_IO_WAKEUP; |
669 | 698 | ||
670 | return prm_register(&omap44xx_prm_ll_data); | 699 | return prm_register(&omap44xx_prm_ll_data); |
671 | } | 700 | } |
672 | 701 | ||
702 | static struct of_device_id omap_prm_dt_match_table[] = { | ||
703 | { .compatible = "ti,omap4-prm" }, | ||
704 | { .compatible = "ti,omap5-prm" }, | ||
705 | { .compatible = "ti,dra7-prm" }, | ||
706 | { } | ||
707 | }; | ||
708 | |||
673 | static int omap44xx_prm_late_init(void) | 709 | static int omap44xx_prm_late_init(void) |
674 | { | 710 | { |
711 | struct device_node *np; | ||
712 | int irq_num; | ||
713 | |||
675 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) | 714 | if (!(prm_features & PRM_HAS_IO_WAKEUP)) |
676 | return 0; | 715 | return 0; |
677 | 716 | ||
717 | /* OMAP4+ is DT only now */ | ||
718 | if (!of_have_populated_dt()) | ||
719 | return 0; | ||
720 | |||
721 | np = of_find_matching_node(NULL, omap_prm_dt_match_table); | ||
722 | |||
723 | if (!np) { | ||
724 | /* Default loaded up with OMAP4 values */ | ||
725 | if (!cpu_is_omap44xx()) | ||
726 | return 0; | ||
727 | } else { | ||
728 | irq_num = of_irq_get(np, 0); | ||
729 | /* | ||
730 | * Already have OMAP4 IRQ num. For all other platforms, we need | ||
731 | * IRQ numbers from DT | ||
732 | */ | ||
733 | if (irq_num < 0 && !cpu_is_omap44xx()) { | ||
734 | if (irq_num == -EPROBE_DEFER) | ||
735 | return irq_num; | ||
736 | |||
737 | /* Have nothing to do */ | ||
738 | return 0; | ||
739 | } | ||
740 | |||
741 | /* Once OMAP4 DT is filled as well */ | ||
742 | if (irq_num >= 0) | ||
743 | omap4_prcm_irq_setup.irq = irq_num; | ||
744 | } | ||
745 | |||
678 | omap44xx_prm_enable_io_wakeup(); | 746 | omap44xx_prm_enable_io_wakeup(); |
679 | 747 | ||
680 | return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); | 748 | return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); |
diff --git a/arch/arm/mach-omap2/prminst44xx.c b/arch/arm/mach-omap2/prminst44xx.c index 69f0dd08629c..225e0258d76d 100644 --- a/arch/arm/mach-omap2/prminst44xx.c +++ b/arch/arm/mach-omap2/prminst44xx.c | |||
@@ -31,6 +31,8 @@ | |||
31 | 31 | ||
32 | static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS]; | 32 | static void __iomem *_prm_bases[OMAP4_MAX_PRCM_PARTITIONS]; |
33 | 33 | ||
34 | static s32 prm_dev_inst = PRM_INSTANCE_UNKNOWN; | ||
35 | |||
34 | /** | 36 | /** |
35 | * omap_prm_base_init - Populates the prm partitions | 37 | * omap_prm_base_init - Populates the prm partitions |
36 | * | 38 | * |
@@ -43,6 +45,24 @@ void omap_prm_base_init(void) | |||
43 | _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base; | 45 | _prm_bases[OMAP4430_PRCM_MPU_PARTITION] = prcm_mpu_base; |
44 | } | 46 | } |
45 | 47 | ||
48 | s32 omap4_prmst_get_prm_dev_inst(void) | ||
49 | { | ||
50 | if (prm_dev_inst != PRM_INSTANCE_UNKNOWN) | ||
51 | return prm_dev_inst; | ||
52 | |||
53 | /* This cannot be done way early at boot.. as things are not setup */ | ||
54 | if (cpu_is_omap44xx()) | ||
55 | prm_dev_inst = OMAP4430_PRM_DEVICE_INST; | ||
56 | else if (soc_is_omap54xx()) | ||
57 | prm_dev_inst = OMAP54XX_PRM_DEVICE_INST; | ||
58 | else if (soc_is_dra7xx()) | ||
59 | prm_dev_inst = DRA7XX_PRM_DEVICE_INST; | ||
60 | else if (soc_is_am43xx()) | ||
61 | prm_dev_inst = AM43XX_PRM_DEVICE_INST; | ||
62 | |||
63 | return prm_dev_inst; | ||
64 | } | ||
65 | |||
46 | /* Read a register in a PRM instance */ | 66 | /* Read a register in a PRM instance */ |
47 | u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) | 67 | u32 omap4_prminst_read_inst_reg(u8 part, s16 inst, u16 idx) |
48 | { | 68 | { |
@@ -169,28 +189,18 @@ int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, | |||
169 | void omap4_prminst_global_warm_sw_reset(void) | 189 | void omap4_prminst_global_warm_sw_reset(void) |
170 | { | 190 | { |
171 | u32 v; | 191 | u32 v; |
172 | s16 dev_inst; | 192 | s32 inst = omap4_prmst_get_prm_dev_inst(); |
173 | 193 | ||
174 | if (cpu_is_omap44xx()) | 194 | if (inst == PRM_INSTANCE_UNKNOWN) |
175 | dev_inst = OMAP4430_PRM_DEVICE_INST; | ||
176 | else if (soc_is_omap54xx()) | ||
177 | dev_inst = OMAP54XX_PRM_DEVICE_INST; | ||
178 | else if (soc_is_dra7xx()) | ||
179 | dev_inst = DRA7XX_PRM_DEVICE_INST; | ||
180 | else if (soc_is_am43xx()) | ||
181 | dev_inst = AM43XX_PRM_DEVICE_INST; | ||
182 | else | ||
183 | return; | 195 | return; |
184 | 196 | ||
185 | v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, dev_inst, | 197 | v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, inst, |
186 | OMAP4_PRM_RSTCTRL_OFFSET); | 198 | OMAP4_PRM_RSTCTRL_OFFSET); |
187 | v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; | 199 | v |= OMAP4430_RST_GLOBAL_WARM_SW_MASK; |
188 | omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, | 200 | omap4_prminst_write_inst_reg(v, OMAP4430_PRM_PARTITION, |
189 | dev_inst, | 201 | inst, OMAP4_PRM_RSTCTRL_OFFSET); |
190 | OMAP4_PRM_RSTCTRL_OFFSET); | ||
191 | 202 | ||
192 | /* OCP barrier */ | 203 | /* OCP barrier */ |
193 | v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, | 204 | v = omap4_prminst_read_inst_reg(OMAP4430_PRM_PARTITION, |
194 | dev_inst, | 205 | inst, OMAP4_PRM_RSTCTRL_OFFSET); |
195 | OMAP4_PRM_RSTCTRL_OFFSET); | ||
196 | } | 206 | } |
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h index a2ede2d65481..583aa3774571 100644 --- a/arch/arm/mach-omap2/prminst44xx.h +++ b/arch/arm/mach-omap2/prminst44xx.h | |||
@@ -12,6 +12,9 @@ | |||
12 | #ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H | 12 | #ifndef __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H |
13 | #define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H | 13 | #define __ARCH_ASM_MACH_OMAP2_PRMINST44XX_H |
14 | 14 | ||
15 | #define PRM_INSTANCE_UNKNOWN -1 | ||
16 | extern s32 omap4_prmst_get_prm_dev_inst(void); | ||
17 | |||
15 | /* | 18 | /* |
16 | * In an ideal world, we would not export these low-level functions, | 19 | * In an ideal world, we would not export these low-level functions, |
17 | * but this will probably take some time to fix properly | 20 | * but this will probably take some time to fix properly |