aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Erb <djerb@us.ibm.com>2006-10-24 12:31:20 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-25 00:20:21 -0400
commit22b8c9f5baeb440a716ea760ff05290221565b4c (patch)
tree11d5d0c6218da965fbe2921df6f411a0417e90da
parent099814bb1f9bd9081d7c85867f8eb8c049abc1b9 (diff)
[POWERPC] cell: update Cell BE register definitions
There are a few definitions that are required by subsequent patches, so add them here. The original patch is from David Erb, but is significantly cleaned up by Kevon Corry. Cc: Kevin Corry <kevcorry@us.ibm.com> Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.c44
-rw-r--r--arch/powerpc/platforms/cell/cbe_regs.h161
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c6
3 files changed, 170 insertions, 41 deletions
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c
index 2f194ba29899..5e3e0e925e4e 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.c
+++ b/arch/powerpc/platforms/cell/cbe_regs.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/percpu.h> 9#include <linux/percpu.h>
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/module.h>
11 12
12#include <asm/io.h> 13#include <asm/io.h>
13#include <asm/pgtable.h> 14#include <asm/pgtable.h>
@@ -16,8 +17,6 @@
16 17
17#include "cbe_regs.h" 18#include "cbe_regs.h"
18 19
19#define MAX_CBE 2
20
21/* 20/*
22 * Current implementation uses "cpu" nodes. We build our own mapping 21 * Current implementation uses "cpu" nodes. We build our own mapping
23 * array of cpu numbers to cpu nodes locally for now to allow interrupt 22 * array of cpu numbers to cpu nodes locally for now to allow interrupt
@@ -30,6 +29,7 @@ static struct cbe_regs_map
30 struct device_node *cpu_node; 29 struct device_node *cpu_node;
31 struct cbe_pmd_regs __iomem *pmd_regs; 30 struct cbe_pmd_regs __iomem *pmd_regs;
32 struct cbe_iic_regs __iomem *iic_regs; 31 struct cbe_iic_regs __iomem *iic_regs;
32 struct cbe_mic_tm_regs __iomem *mic_tm_regs;
33} cbe_regs_maps[MAX_CBE]; 33} cbe_regs_maps[MAX_CBE];
34static int cbe_regs_map_count; 34static int cbe_regs_map_count;
35 35
@@ -42,6 +42,19 @@ static struct cbe_thread_map
42static struct cbe_regs_map *cbe_find_map(struct device_node *np) 42static struct cbe_regs_map *cbe_find_map(struct device_node *np)
43{ 43{
44 int i; 44 int i;
45 struct device_node *tmp_np;
46
47 if (strcasecmp(np->type, "spe") == 0) {
48 if (np->data == NULL) {
49 /* walk up path until cpu node was found */
50 tmp_np = np->parent;
51 while (tmp_np != NULL && strcasecmp(tmp_np->type, "cpu") != 0)
52 tmp_np = tmp_np->parent;
53
54 np->data = cbe_find_map(tmp_np);
55 }
56 return np->data;
57 }
45 58
46 for (i = 0; i < cbe_regs_map_count; i++) 59 for (i = 0; i < cbe_regs_map_count; i++)
47 if (cbe_regs_maps[i].cpu_node == np) 60 if (cbe_regs_maps[i].cpu_node == np)
@@ -56,6 +69,7 @@ struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np)
56 return NULL; 69 return NULL;
57 return map->pmd_regs; 70 return map->pmd_regs;
58} 71}
72EXPORT_SYMBOL_GPL(cbe_get_pmd_regs);
59 73
60struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu) 74struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu)
61{ 75{
@@ -64,7 +78,7 @@ struct cbe_pmd_regs __iomem *cbe_get_cpu_pmd_regs(int cpu)
64 return NULL; 78 return NULL;
65 return map->pmd_regs; 79 return map->pmd_regs;
66} 80}
67 81EXPORT_SYMBOL_GPL(cbe_get_cpu_pmd_regs);
68 82
69struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np) 83struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np)
70{ 84{
@@ -73,6 +87,7 @@ struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np)
73 return NULL; 87 return NULL;
74 return map->iic_regs; 88 return map->iic_regs;
75} 89}
90
76struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu) 91struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu)
77{ 92{
78 struct cbe_regs_map *map = cbe_thread_map[cpu].regs; 93 struct cbe_regs_map *map = cbe_thread_map[cpu].regs;
@@ -81,6 +96,24 @@ struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu)
81 return map->iic_regs; 96 return map->iic_regs;
82} 97}
83 98
99struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np)
100{
101 struct cbe_regs_map *map = cbe_find_map(np);
102 if (map == NULL)
103 return NULL;
104 return map->mic_tm_regs;
105}
106
107struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu)
108{
109 struct cbe_regs_map *map = cbe_thread_map[cpu].regs;
110 if (map == NULL)
111 return NULL;
112 return map->mic_tm_regs;
113}
114EXPORT_SYMBOL_GPL(cbe_get_cpu_mic_tm_regs);
115
116
84void __init cbe_regs_init(void) 117void __init cbe_regs_init(void)
85{ 118{
86 int i; 119 int i;
@@ -119,6 +152,11 @@ void __init cbe_regs_init(void)
119 prop = get_property(cpu, "iic", NULL); 152 prop = get_property(cpu, "iic", NULL);
120 if (prop != NULL) 153 if (prop != NULL)
121 map->iic_regs = ioremap(prop->address, prop->len); 154 map->iic_regs = ioremap(prop->address, prop->len);
155
156 prop = (struct address_prop *)get_property(cpu, "mic-tm",
157 NULL);
158 if (prop != NULL)
159 map->mic_tm_regs = ioremap(prop->address, prop->len);
122 } 160 }
123} 161}
124 162
diff --git a/arch/powerpc/platforms/cell/cbe_regs.h b/arch/powerpc/platforms/cell/cbe_regs.h
index e76e4a6af5bc..02bdbc1cd6e7 100644
--- a/arch/powerpc/platforms/cell/cbe_regs.h
+++ b/arch/powerpc/platforms/cell/cbe_regs.h
@@ -4,6 +4,11 @@
4 * This file is intended to hold the various register definitions for CBE 4 * This file is intended to hold the various register definitions for CBE
5 * on-chip system devices (memory controller, IO controller, etc...) 5 * on-chip system devices (memory controller, IO controller, etc...)
6 * 6 *
7 * (C) Copyright IBM Corporation 2001,2006
8 *
9 * Authors: Maximino Aguilar (maguilar@us.ibm.com)
10 * David J. Erb (djerb@us.ibm.com)
11 *
7 * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp. 12 * (c) 2006 Benjamin Herrenschmidt <benh@kernel.crashing.org>, IBM Corp.
8 */ 13 */
9 14
@@ -22,6 +27,7 @@
22#define HID0_CBE_THERM_INT_EN 0x0000000400000000ul 27#define HID0_CBE_THERM_INT_EN 0x0000000400000000ul
23#define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul 28#define HID0_CBE_SYSERR_INT_EN 0x0000000200000000ul
24 29
30#define MAX_CBE 2
25 31
26/* 32/*
27 * 33 *
@@ -29,45 +35,86 @@
29 * 35 *
30 */ 36 */
31 37
38union spe_reg {
39 u64 val;
40 u8 spe[8];
41};
42
43union ppe_spe_reg {
44 u64 val;
45 struct {
46 u32 ppe;
47 u32 spe;
48 };
49};
50
51
32struct cbe_pmd_regs { 52struct cbe_pmd_regs {
33 u8 pad_0x0000_0x0800[0x0800 - 0x0000]; /* 0x0000 */ 53 /* Debug Bus Control */
54 u64 pad_0x0000; /* 0x0000 */
55
56 u64 group_control; /* 0x0008 */
57
58 u8 pad_0x0010_0x00a8 [0x00a8 - 0x0010]; /* 0x0010 */
59
60 u64 debug_bus_control; /* 0x00a8 */
61
62 u8 pad_0x00b0_0x0100 [0x0100 - 0x00b0]; /* 0x00b0 */
63
64 u64 trace_aux_data; /* 0x0100 */
65 u64 trace_buffer_0_63; /* 0x0108 */
66 u64 trace_buffer_64_127; /* 0x0110 */
67 u64 trace_address; /* 0x0118 */
68 u64 ext_tr_timer; /* 0x0120 */
69
70 u8 pad_0x0128_0x0400 [0x0400 - 0x0128]; /* 0x0128 */
71
72 /* Performance Monitor */
73 u64 pm_status; /* 0x0400 */
74 u64 pm_control; /* 0x0408 */
75 u64 pm_interval; /* 0x0410 */
76 u64 pm_ctr[4]; /* 0x0418 */
77 u64 pm_start_stop; /* 0x0438 */
78 u64 pm07_control[8]; /* 0x0440 */
79
80 u8 pad_0x0480_0x0800 [0x0800 - 0x0480]; /* 0x0480 */
34 81
35 /* Thermal Sensor Registers */ 82 /* Thermal Sensor Registers */
36 u64 ts_ctsr1; /* 0x0800 */ 83 union spe_reg ts_ctsr1; /* 0x0800 */
37 u64 ts_ctsr2; /* 0x0808 */ 84 u64 ts_ctsr2; /* 0x0808 */
38 u64 ts_mtsr1; /* 0x0810 */ 85 union spe_reg ts_mtsr1; /* 0x0810 */
39 u64 ts_mtsr2; /* 0x0818 */ 86 u64 ts_mtsr2; /* 0x0818 */
40 u64 ts_itr1; /* 0x0820 */ 87 union spe_reg ts_itr1; /* 0x0820 */
41 u64 ts_itr2; /* 0x0828 */ 88 u64 ts_itr2; /* 0x0828 */
42 u64 ts_gitr; /* 0x0830 */ 89 u64 ts_gitr; /* 0x0830 */
43 u64 ts_isr; /* 0x0838 */ 90 u64 ts_isr; /* 0x0838 */
44 u64 ts_imr; /* 0x0840 */ 91 u64 ts_imr; /* 0x0840 */
45 u64 tm_cr1; /* 0x0848 */ 92 union spe_reg tm_cr1; /* 0x0848 */
46 u64 tm_cr2; /* 0x0850 */ 93 u64 tm_cr2; /* 0x0850 */
47 u64 tm_simr; /* 0x0858 */ 94 u64 tm_simr; /* 0x0858 */
48 u64 tm_tpr; /* 0x0860 */ 95 union ppe_spe_reg tm_tpr; /* 0x0860 */
49 u64 tm_str1; /* 0x0868 */ 96 union spe_reg tm_str1; /* 0x0868 */
50 u64 tm_str2; /* 0x0870 */ 97 u64 tm_str2; /* 0x0870 */
51 u64 tm_tsr; /* 0x0878 */ 98 union ppe_spe_reg tm_tsr; /* 0x0878 */
52 99
53 /* Power Management */ 100 /* Power Management */
54 u64 pm_control; /* 0x0880 */ 101 u64 pmcr; /* 0x0880 */
55#define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000 102#define CBE_PMD_PAUSE_ZERO_CONTROL 0x10000
56 u64 pm_status; /* 0x0888 */ 103 u64 pmsr; /* 0x0888 */
57 104
58 /* Time Base Register */ 105 /* Time Base Register */
59 u64 tbr; /* 0x0890 */ 106 u64 tbr; /* 0x0890 */
60 107
61 u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */ 108 u8 pad_0x0898_0x0c00 [0x0c00 - 0x0898]; /* 0x0898 */
62 109
63 /* Fault Isolation Registers */ 110 /* Fault Isolation Registers */
64 u64 checkstop_fir; /* 0x0c00 */ 111 u64 checkstop_fir; /* 0x0c00 */
65 u64 recoverable_fir; 112 u64 recoverable_fir; /* 0x0c08 */
66 u64 spec_att_mchk_fir; 113 u64 spec_att_mchk_fir; /* 0x0c10 */
67 u64 fir_mode_reg; 114 u64 fir_mode_reg; /* 0x0c18 */
68 u64 fir_enable_mask; 115 u64 fir_enable_mask; /* 0x0c20 */
69 116
70 u8 pad_0x0c28_0x1000 [0x1000 - 0x0c28]; /* 0x0c28 */ 117 u8 pad_0x0c28_0x1000 [0x1000 - 0x0c28]; /* 0x0c28 */
71}; 118};
72 119
73extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np); 120extern struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np);
@@ -102,18 +149,20 @@ struct cbe_iic_regs {
102 149
103 /* IIC interrupt registers */ 150 /* IIC interrupt registers */
104 struct cbe_iic_thread_regs thread[2]; /* 0x0400 */ 151 struct cbe_iic_thread_regs thread[2]; /* 0x0400 */
105 u64 iic_ir; /* 0x0440 */ 152
106 u64 iic_is; /* 0x0448 */ 153 u64 iic_ir; /* 0x0440 */
154 u64 iic_is; /* 0x0448 */
155#define CBE_IIC_IS_PMI 0x2
107 156
108 u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */ 157 u8 pad_0x0450_0x0500[0x0500 - 0x0450]; /* 0x0450 */
109 158
110 /* IOC FIR */ 159 /* IOC FIR */
111 u64 ioc_fir_reset; /* 0x0500 */ 160 u64 ioc_fir_reset; /* 0x0500 */
112 u64 ioc_fir_set; 161 u64 ioc_fir_set; /* 0x0508 */
113 u64 ioc_checkstop_enable; 162 u64 ioc_checkstop_enable; /* 0x0510 */
114 u64 ioc_fir_error_mask; 163 u64 ioc_fir_error_mask; /* 0x0518 */
115 u64 ioc_syserr_enable; 164 u64 ioc_syserr_enable; /* 0x0520 */
116 u64 ioc_fir; 165 u64 ioc_fir; /* 0x0528 */
117 166
118 u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */ 167 u8 pad_0x0530_0x1000[0x1000 - 0x0530]; /* 0x0530 */
119}; 168};
@@ -122,6 +171,48 @@ extern struct cbe_iic_regs __iomem *cbe_get_iic_regs(struct device_node *np);
122extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu); 171extern struct cbe_iic_regs __iomem *cbe_get_cpu_iic_regs(int cpu);
123 172
124 173
174struct cbe_mic_tm_regs {
175 u8 pad_0x0000_0x0040[0x0040 - 0x0000]; /* 0x0000 */
176
177 u64 mic_ctl_cnfg2; /* 0x0040 */
178#define CBE_MIC_ENABLE_AUX_TRC 0x8000000000000000LL
179#define CBE_MIC_DISABLE_PWR_SAV_2 0x0200000000000000LL
180#define CBE_MIC_DISABLE_AUX_TRC_WRAP 0x0100000000000000LL
181#define CBE_MIC_ENABLE_AUX_TRC_INT 0x0080000000000000LL
182
183 u64 pad_0x0048; /* 0x0048 */
184
185 u64 mic_aux_trc_base; /* 0x0050 */
186 u64 mic_aux_trc_max_addr; /* 0x0058 */
187 u64 mic_aux_trc_cur_addr; /* 0x0060 */
188 u64 mic_aux_trc_grf_addr; /* 0x0068 */
189 u64 mic_aux_trc_grf_data; /* 0x0070 */
190
191 u64 pad_0x0078; /* 0x0078 */
192
193 u64 mic_ctl_cnfg_0; /* 0x0080 */
194#define CBE_MIC_DISABLE_PWR_SAV_0 0x8000000000000000LL
195
196 u64 pad_0x0088; /* 0x0088 */
197
198 u64 slow_fast_timer_0; /* 0x0090 */
199 u64 slow_next_timer_0; /* 0x0098 */
200
201 u8 pad_0x00a0_0x01c0[0x01c0 - 0x0a0]; /* 0x00a0 */
202
203 u64 mic_ctl_cnfg_1; /* 0x01c0 */
204#define CBE_MIC_DISABLE_PWR_SAV_1 0x8000000000000000LL
205 u64 pad_0x01c8; /* 0x01c8 */
206
207 u64 slow_fast_timer_1; /* 0x01d0 */
208 u64 slow_next_timer_1; /* 0x01d8 */
209
210 u8 pad_0x01e0_0x1000[0x1000 - 0x01e0]; /* 0x01e0 */
211};
212
213extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np);
214extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu);
215
125/* Init this module early */ 216/* Init this module early */
126extern void cbe_regs_init(void); 217extern void cbe_regs_init(void);
127 218
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index 9f2e4ed20a57..fdcd89e99f1b 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -54,9 +54,9 @@ static void __init cbe_enable_pause_zero(void)
54 pr_debug("Power Management: CPU %d\n", smp_processor_id()); 54 pr_debug("Power Management: CPU %d\n", smp_processor_id());
55 55
56 /* Enable Pause(0) control bit */ 56 /* Enable Pause(0) control bit */
57 temp_register = in_be64(&pregs->pm_control); 57 temp_register = in_be64(&pregs->pmcr);
58 58
59 out_be64(&pregs->pm_control, 59 out_be64(&pregs->pmcr,
60 temp_register | CBE_PMD_PAUSE_ZERO_CONTROL); 60 temp_register | CBE_PMD_PAUSE_ZERO_CONTROL);
61 61
62 /* Enable DEC and EE interrupt request */ 62 /* Enable DEC and EE interrupt request */
@@ -87,7 +87,7 @@ static void cbe_idle(void)
87 unsigned long ctrl; 87 unsigned long ctrl;
88 88
89 /* Why do we do that on every idle ? Couldn't that be done once for 89 /* Why do we do that on every idle ? Couldn't that be done once for
90 * all or do we lose the state some way ? Also, the pm_control 90 * all or do we lose the state some way ? Also, the pmcr
91 * register setting, that can't be set once at boot ? We really want 91 * register setting, that can't be set once at boot ? We really want
92 * to move that away in order to implement a simple powersave 92 * to move that away in order to implement a simple powersave
93 */ 93 */