2
2
* Author: Andy Fleming <[email protected] >
3
3
4
4
*
5
- * Copyright 2006-2008, 2011-2012 Freescale Semiconductor Inc.
5
+ * Copyright 2006-2008, 2011-2012, 2015 Freescale Semiconductor Inc.
6
6
*
7
7
* This program is free software; you can redistribute it and/or modify it
8
8
* under the terms of the GNU General Public License as published by the
15
15
#include <linux/init.h>
16
16
#include <linux/delay.h>
17
17
#include <linux/of.h>
18
- #include <linux/of_address.h>
19
18
#include <linux/kexec.h>
20
19
#include <linux/highmem.h>
21
20
#include <linux/cpu.h>
29
28
#include <asm/dbell.h>
30
29
#include <asm/code-patching.h>
31
30
#include <asm/cputhreads.h>
31
+ #include <asm/fsl_pm.h>
32
32
33
33
#include <sysdev/fsl_soc.h>
34
34
#include <sysdev/mpic.h>
@@ -43,24 +43,11 @@ struct epapr_spin_table {
43
43
u32 pir ;
44
44
};
45
45
46
- static struct ccsr_guts __iomem * guts ;
46
+ #ifdef CONFIG_HOTPLUG_CPU
47
47
static u64 timebase ;
48
48
static int tb_req ;
49
49
static int tb_valid ;
50
50
51
- static void mpc85xx_timebase_freeze (int freeze )
52
- {
53
- uint32_t mask ;
54
-
55
- mask = CCSR_GUTS_DEVDISR_TB0 | CCSR_GUTS_DEVDISR_TB1 ;
56
- if (freeze )
57
- setbits32 (& guts -> devdisr , mask );
58
- else
59
- clrbits32 (& guts -> devdisr , mask );
60
-
61
- in_be32 (& guts -> devdisr );
62
- }
63
-
64
51
static void mpc85xx_give_timebase (void )
65
52
{
66
53
unsigned long flags ;
@@ -71,7 +58,7 @@ static void mpc85xx_give_timebase(void)
71
58
barrier ();
72
59
tb_req = 0 ;
73
60
74
- mpc85xx_timebase_freeze ( 1 );
61
+ qoriq_pm_ops -> freeze_time_base (true );
75
62
#ifdef CONFIG_PPC64
76
63
/*
77
64
* e5500/e6500 have a workaround for erratum A-006958 in place
@@ -104,7 +91,7 @@ static void mpc85xx_give_timebase(void)
104
91
while (tb_valid )
105
92
barrier ();
106
93
107
- mpc85xx_timebase_freeze ( 0 );
94
+ qoriq_pm_ops -> freeze_time_base (false );
108
95
109
96
local_irq_restore (flags );
110
97
}
@@ -126,31 +113,25 @@ static void mpc85xx_take_timebase(void)
126
113
local_irq_restore (flags );
127
114
}
128
115
129
- #ifdef CONFIG_HOTPLUG_CPU
130
116
static void smp_85xx_mach_cpu_die (void )
131
117
{
132
118
unsigned int cpu = smp_processor_id ();
133
- u32 tmp ;
134
119
135
120
local_irq_disable ();
121
+ hard_irq_disable ();
122
+ /* mask all irqs to prevent cpu wakeup */
123
+ qoriq_pm_ops -> irq_mask (cpu );
124
+
136
125
idle_task_exit ();
137
- generic_set_cpu_dead (cpu );
138
- mb ();
139
126
140
127
mtspr (SPRN_TCR , 0 );
128
+ mtspr (SPRN_TSR , mfspr (SPRN_TSR ));
141
129
142
- cur_cpu_spec -> cpu_down_flush ( );
130
+ generic_set_cpu_dead ( cpu );
143
131
144
- tmp = (mfspr (SPRN_HID0 ) & ~(HID0_DOZE |HID0_SLEEP )) | HID0_NAP ;
145
- mtspr (SPRN_HID0 , tmp );
146
- isync ();
132
+ cur_cpu_spec -> cpu_down_flush ();
147
133
148
- /* Enter NAP mode. */
149
- tmp = mfmsr ();
150
- tmp |= MSR_WE ;
151
- mb ();
152
- mtmsr (tmp );
153
- isync ();
134
+ qoriq_pm_ops -> cpu_die (cpu );
154
135
155
136
while (1 )
156
137
;
@@ -468,16 +449,6 @@ static void smp_85xx_setup_cpu(int cpu_nr)
468
449
smp_85xx_basic_setup (cpu_nr );
469
450
}
470
451
471
- static const struct of_device_id mpc85xx_smp_guts_ids [] = {
472
- { .compatible = "fsl,mpc8572-guts" , },
473
- { .compatible = "fsl,p1020-guts" , },
474
- { .compatible = "fsl,p1021-guts" , },
475
- { .compatible = "fsl,p1022-guts" , },
476
- { .compatible = "fsl,p1023-guts" , },
477
- { .compatible = "fsl,p2020-guts" , },
478
- {},
479
- };
480
-
481
452
void __init mpc85xx_smp_init (void )
482
453
{
483
454
struct device_node * np ;
@@ -501,22 +472,16 @@ void __init mpc85xx_smp_init(void)
501
472
smp_85xx_ops .probe = NULL ;
502
473
}
503
474
504
- np = of_find_matching_node (NULL , mpc85xx_smp_guts_ids );
505
- if (np ) {
506
- guts = of_iomap (np , 0 );
507
- of_node_put (np );
508
- if (!guts ) {
509
- pr_err ("%s: Could not map guts node address\n" ,
510
- __func__ );
511
- return ;
512
- }
475
+ #ifdef CONFIG_HOTPLUG_CPU
476
+ #ifdef CONFIG_FSL_PMC
477
+ mpc85xx_setup_pmc ();
478
+ #endif
479
+ if (qoriq_pm_ops ) {
513
480
smp_85xx_ops .give_timebase = mpc85xx_give_timebase ;
514
481
smp_85xx_ops .take_timebase = mpc85xx_take_timebase ;
515
- #ifdef CONFIG_HOTPLUG_CPU
516
482
ppc_md .cpu_die = smp_85xx_mach_cpu_die ;
517
- #endif
518
483
}
519
-
484
+ #endif
520
485
smp_ops = & smp_85xx_ops ;
521
486
522
487
#ifdef CONFIG_KEXEC
0 commit comments