aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-11-07 18:50:11 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-15 07:42:57 -0500
commit0f665deba9bc67a2af52e2e956a13e59ba1600f8 (patch)
tree40952a95955219f77d4f2f92f3dbe878bf6ebbc6
parentaa1c7b01c9c7f263a0eb91a543fb91078ab5a508 (diff)
ARM: OMAP5: Fix mpuss_early_init
commit 8a8be46afeaa47aed1debe7e9b18152f9826a6b7 upstream. We need to properly initialize mpuss also on omap5 like we do on omap4. Otherwise we run into similar kexec problems like we had on omap4 when trying to kexec from a kernel with PM initialized. Fixes: 0573b957fc21 ("ARM: OMAP4+: Prevent CPU1 related hang with kexec") Acked-by: Santosh Shilimkar <ssantosh@kernel.org> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--arch/arm/mach-omap2/common.h38
-rw-r--r--arch/arm/mach-omap2/io.c3
-rw-r--r--arch/arm/mach-omap2/omap-mpuss-lowpower.c32
-rw-r--r--arch/arm/mach-omap2/omap4-sar-layout.h2
4 files changed, 58 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index deed42e1dd9c..6dcca2957e23 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -262,8 +262,6 @@ extern void __iomem *omap4_get_sar_ram_base(void);
262extern void omap4_mpuss_early_init(void); 262extern void omap4_mpuss_early_init(void);
263extern void omap_do_wfi(void); 263extern void omap_do_wfi(void);
264 264
265extern void omap4_secondary_startup(void);
266extern void omap4460_secondary_startup(void);
267 265
268#ifdef CONFIG_SMP 266#ifdef CONFIG_SMP
269/* Needed for secondary core boot */ 267/* Needed for secondary core boot */
@@ -275,16 +273,11 @@ extern void omap4_cpu_die(unsigned int cpu);
275extern int omap4_cpu_kill(unsigned int cpu); 273extern int omap4_cpu_kill(unsigned int cpu);
276 274
277extern const struct smp_operations omap4_smp_ops; 275extern const struct smp_operations omap4_smp_ops;
278
279extern void omap5_secondary_startup(void);
280extern void omap5_secondary_hyp_startup(void);
281#endif 276#endif
282 277
283#if defined(CONFIG_SMP) && defined(CONFIG_PM) 278#if defined(CONFIG_SMP) && defined(CONFIG_PM)
284extern int omap4_mpuss_init(void); 279extern int omap4_mpuss_init(void);
285extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state); 280extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state);
286extern int omap4_finish_suspend(unsigned long cpu_state);
287extern void omap4_cpu_resume(void);
288extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state); 281extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state);
289#else 282#else
290static inline int omap4_enter_lowpower(unsigned int cpu, 283static inline int omap4_enter_lowpower(unsigned int cpu,
@@ -305,14 +298,41 @@ static inline int omap4_mpuss_init(void)
305 return 0; 298 return 0;
306} 299}
307 300
301#endif
302
303#ifdef CONFIG_ARCH_OMAP4
304void omap4_secondary_startup(void);
305void omap4460_secondary_startup(void);
306int omap4_finish_suspend(unsigned long cpu_state);
307void omap4_cpu_resume(void);
308#else
309static inline void omap4_secondary_startup(void)
310{
311}
312
313static inline void omap4460_secondary_startup(void)
314{
315}
308static inline int omap4_finish_suspend(unsigned long cpu_state) 316static inline int omap4_finish_suspend(unsigned long cpu_state)
309{ 317{
310 return 0; 318 return 0;
311} 319}
312
313static inline void omap4_cpu_resume(void) 320static inline void omap4_cpu_resume(void)
314{} 321{
322}
323#endif
315 324
325#if defined(CONFIG_SOC_OMAP5) || defined(CONFIG_SOC_DRA7XX)
326void omap5_secondary_startup(void);
327void omap5_secondary_hyp_startup(void);
328#else
329static inline void omap5_secondary_startup(void)
330{
331}
332
333static inline void omap5_secondary_hyp_startup(void)
334{
335}
316#endif 336#endif
317 337
318void pdata_quirks_init(const struct of_device_id *); 338void pdata_quirks_init(const struct of_device_id *);
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 0e9acdd95d70..f0da5259762a 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -717,10 +717,11 @@ void __init omap5_init_early(void)
717 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); 717 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
718 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); 718 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
719 omap2_control_base_init(); 719 omap2_control_base_init();
720 omap4_pm_init_early();
721 omap2_prcm_base_init(); 720 omap2_prcm_base_init();
722 omap5xxx_check_revision(); 721 omap5xxx_check_revision();
723 omap4_sar_ram_init(); 722 omap4_sar_ram_init();
723 omap4_mpuss_early_init();
724 omap4_pm_init_early();
724 omap54xx_voltagedomains_init(); 725 omap54xx_voltagedomains_init();
725 omap54xx_powerdomains_init(); 726 omap54xx_powerdomains_init();
726 omap54xx_clockdomains_init(); 727 omap54xx_clockdomains_init();
diff --git a/arch/arm/mach-omap2/omap-mpuss-lowpower.c b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
index ad982465efd0..94428b476d8f 100644
--- a/arch/arm/mach-omap2/omap-mpuss-lowpower.c
+++ b/arch/arm/mach-omap2/omap-mpuss-lowpower.c
@@ -48,6 +48,7 @@
48#include <asm/smp_scu.h> 48#include <asm/smp_scu.h>
49#include <asm/pgalloc.h> 49#include <asm/pgalloc.h>
50#include <asm/suspend.h> 50#include <asm/suspend.h>
51#include <asm/virt.h>
51#include <asm/hardware/cache-l2x0.h> 52#include <asm/hardware/cache-l2x0.h>
52 53
53#include "soc.h" 54#include "soc.h"
@@ -371,8 +372,12 @@ int __init omap4_mpuss_init(void)
371 pm_info = &per_cpu(omap4_pm_info, 0x0); 372 pm_info = &per_cpu(omap4_pm_info, 0x0);
372 if (sar_base) { 373 if (sar_base) {
373 pm_info->scu_sar_addr = sar_base + SCU_OFFSET0; 374 pm_info->scu_sar_addr = sar_base + SCU_OFFSET0;
374 pm_info->wkup_sar_addr = sar_base + 375 if (cpu_is_omap44xx())
375 CPU0_WAKEUP_NS_PA_ADDR_OFFSET; 376 pm_info->wkup_sar_addr = sar_base +
377 CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
378 else
379 pm_info->wkup_sar_addr = sar_base +
380 OMAP5_CPU0_WAKEUP_NS_PA_ADDR_OFFSET;
376 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0; 381 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET0;
377 } 382 }
378 pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm"); 383 pm_info->pwrdm = pwrdm_lookup("cpu0_pwrdm");
@@ -391,8 +396,12 @@ int __init omap4_mpuss_init(void)
391 pm_info = &per_cpu(omap4_pm_info, 0x1); 396 pm_info = &per_cpu(omap4_pm_info, 0x1);
392 if (sar_base) { 397 if (sar_base) {
393 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1; 398 pm_info->scu_sar_addr = sar_base + SCU_OFFSET1;
394 pm_info->wkup_sar_addr = sar_base + 399 if (cpu_is_omap44xx())
395 CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 400 pm_info->wkup_sar_addr = sar_base +
401 CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
402 else
403 pm_info->wkup_sar_addr = sar_base +
404 OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET;
396 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1; 405 pm_info->l2x0_sar_addr = sar_base + L2X0_SAVE_OFFSET1;
397 } 406 }
398 407
@@ -453,15 +462,24 @@ void __init omap4_mpuss_early_init(void)
453{ 462{
454 unsigned long startup_pa; 463 unsigned long startup_pa;
455 464
456 if (!cpu_is_omap44xx()) 465 if (!(cpu_is_omap44xx() || soc_is_omap54xx()))
457 return; 466 return;
458 467
459 sar_base = omap4_get_sar_ram_base(); 468 sar_base = omap4_get_sar_ram_base();
460 469
461 if (cpu_is_omap443x()) 470 if (cpu_is_omap443x())
462 startup_pa = virt_to_phys(omap4_secondary_startup); 471 startup_pa = virt_to_phys(omap4_secondary_startup);
463 else 472 else if (cpu_is_omap446x())
464 startup_pa = virt_to_phys(omap4460_secondary_startup); 473 startup_pa = virt_to_phys(omap4460_secondary_startup);
474 else if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE)
475 startup_pa = virt_to_phys(omap5_secondary_hyp_startup);
476 else
477 startup_pa = virt_to_phys(omap5_secondary_startup);
465 478
466 writel_relaxed(startup_pa, sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET); 479 if (cpu_is_omap44xx())
480 writel_relaxed(startup_pa, sar_base +
481 CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
482 else
483 writel_relaxed(startup_pa, sar_base +
484 OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET);
467} 485}
diff --git a/arch/arm/mach-omap2/omap4-sar-layout.h b/arch/arm/mach-omap2/omap4-sar-layout.h
index 792b1069f724..5b2966a0f733 100644
--- a/arch/arm/mach-omap2/omap4-sar-layout.h
+++ b/arch/arm/mach-omap2/omap4-sar-layout.h
@@ -31,6 +31,8 @@
31/* CPUx Wakeup Non-Secure Physical Address offsets in SAR_BANK3 */ 31/* CPUx Wakeup Non-Secure Physical Address offsets in SAR_BANK3 */
32#define CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xa04 32#define CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xa04
33#define CPU1_WAKEUP_NS_PA_ADDR_OFFSET 0xa08 33#define CPU1_WAKEUP_NS_PA_ADDR_OFFSET 0xa08
34#define OMAP5_CPU0_WAKEUP_NS_PA_ADDR_OFFSET 0xe00
35#define OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET 0xe04
34 36
35#define SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x500) 37#define SAR_BACKUP_STATUS_OFFSET (SAR_BANK3_OFFSET + 0x500)
36#define SAR_SECURE_RAM_SIZE_OFFSET (SAR_BANK3_OFFSET + 0x504) 38#define SAR_SECURE_RAM_SIZE_OFFSET (SAR_BANK3_OFFSET + 0x504)