diff options
Diffstat (limited to 'arch/powerpc/platforms')
125 files changed, 3361 insertions, 1835 deletions
diff --git a/arch/powerpc/platforms/4xx/Kconfig b/arch/powerpc/platforms/4xx/Kconfig index 2f2a13ed7667..ded357c17414 100644 --- a/arch/powerpc/platforms/4xx/Kconfig +++ b/arch/powerpc/platforms/4xx/Kconfig | |||
@@ -3,278 +3,206 @@ config 4xx | |||
3 | depends on 40x || 44x | 3 | depends on 40x || 44x |
4 | default y | 4 | default y |
5 | 5 | ||
6 | config WANT_EARLY_SERIAL | 6 | config BOOKE |
7 | bool | 7 | bool |
8 | select SERIAL_8250 | ||
9 | default n | ||
10 | |||
11 | menu "AMCC 4xx options" | ||
12 | depends on 4xx | ||
13 | |||
14 | choice | ||
15 | prompt "Machine Type" | ||
16 | depends on 40x | ||
17 | default WALNUT | ||
18 | |||
19 | config BUBINGA | ||
20 | bool "Bubinga" | ||
21 | select WANT_EARLY_SERIAL | ||
22 | help | ||
23 | This option enables support for the IBM 405EP evaluation board. | ||
24 | |||
25 | config CPCI405 | ||
26 | bool "CPCI405" | ||
27 | help | ||
28 | This option enables support for the CPCI405 board. | ||
29 | |||
30 | config EP405 | ||
31 | bool "EP405/EP405PC" | ||
32 | help | ||
33 | This option enables support for the EP405/EP405PC boards. | ||
34 | |||
35 | config REDWOOD_5 | ||
36 | bool "Redwood-5" | ||
37 | help | ||
38 | This option enables support for the IBM STB04 evaluation board. | ||
39 | |||
40 | config REDWOOD_6 | ||
41 | bool "Redwood-6" | ||
42 | help | ||
43 | This option enables support for the IBM STBx25xx evaluation board. | ||
44 | |||
45 | config SYCAMORE | ||
46 | bool "Sycamore" | ||
47 | help | ||
48 | This option enables support for the IBM PPC405GPr evaluation board. | ||
49 | |||
50 | config WALNUT | ||
51 | bool "Walnut" | ||
52 | help | ||
53 | This option enables support for the IBM PPC405GP evaluation board. | ||
54 | |||
55 | config XILINX_ML300 | ||
56 | bool "Xilinx-ML300" | ||
57 | help | ||
58 | This option enables support for the Xilinx ML300 evaluation board. | ||
59 | |||
60 | endchoice | ||
61 | |||
62 | choice | ||
63 | prompt "Machine Type" | ||
64 | depends on 44x | 8 | depends on 44x |
65 | default EBONY | 9 | default y |
66 | |||
67 | config BAMBOO | ||
68 | bool "Bamboo" | ||
69 | select WANT_EARLY_SERIAL | ||
70 | help | ||
71 | This option enables support for the IBM PPC440EP evaluation board. | ||
72 | |||
73 | config EBONY | ||
74 | bool "Ebony" | ||
75 | select WANT_EARLY_SERIAL | ||
76 | help | ||
77 | This option enables support for the IBM PPC440GP evaluation board. | ||
78 | |||
79 | config LUAN | ||
80 | bool "Luan" | ||
81 | select WANT_EARLY_SERIAL | ||
82 | help | ||
83 | This option enables support for the IBM PPC440SP evaluation board. | ||
84 | |||
85 | config OCOTEA | ||
86 | bool "Ocotea" | ||
87 | select WANT_EARLY_SERIAL | ||
88 | help | ||
89 | This option enables support for the IBM PPC440GX evaluation board. | ||
90 | 10 | ||
91 | endchoice | 11 | menu "AMCC 40x options" |
12 | depends on 40x | ||
92 | 13 | ||
93 | config EP405PC | 14 | #config BUBINGA |
94 | bool "EP405PC Support" | 15 | # bool "Bubinga" |
95 | depends on EP405 | 16 | # depends on 40x |
17 | # default n | ||
18 | # select 405EP | ||
19 | # help | ||
20 | # This option enables support for the IBM 405EP evaluation board. | ||
21 | |||
22 | #config CPCI405 | ||
23 | # bool "CPCI405" | ||
24 | # depends on 40x | ||
25 | # default n | ||
26 | # select 405GP | ||
27 | # help | ||
28 | # This option enables support for the CPCI405 board. | ||
29 | |||
30 | #config EP405 | ||
31 | # bool "EP405/EP405PC" | ||
32 | # depends on 40x | ||
33 | # default n | ||
34 | # select 405GP | ||
35 | # help | ||
36 | # This option enables support for the EP405/EP405PC boards. | ||
37 | |||
38 | #config EP405PC | ||
39 | # bool "EP405PC Support" | ||
40 | # depends on EP405 | ||
41 | # default y | ||
42 | # help | ||
43 | # This option enables support for the extra features of the EP405PC board. | ||
44 | |||
45 | #config REDWOOD_5 | ||
46 | # bool "Redwood-5" | ||
47 | # depends on 40x | ||
48 | # default n | ||
49 | # select STB03xxx | ||
50 | # help | ||
51 | # This option enables support for the IBM STB04 evaluation board. | ||
52 | |||
53 | #config REDWOOD_6 | ||
54 | # bool "Redwood-6" | ||
55 | # depends on 40x | ||
56 | # default n | ||
57 | # select STB03xxx | ||
58 | # help | ||
59 | # This option enables support for the IBM STBx25xx evaluation board. | ||
60 | |||
61 | #config SYCAMORE | ||
62 | # bool "Sycamore" | ||
63 | # depends on 40x | ||
64 | # default n | ||
65 | # select 405GPR | ||
66 | # help | ||
67 | # This option enables support for the IBM PPC405GPr evaluation board. | ||
68 | |||
69 | #config WALNUT | ||
70 | # bool "Walnut" | ||
71 | # depends on 40x | ||
72 | # default y | ||
73 | # select 405GP | ||
74 | # help | ||
75 | # This option enables support for the IBM PPC405GP evaluation board. | ||
76 | |||
77 | #config XILINX_ML300 | ||
78 | # bool "Xilinx-ML300" | ||
79 | # depends on 40x | ||
80 | # default y | ||
81 | # select VIRTEX_II_PRO | ||
82 | # help | ||
83 | # This option enables support for the Xilinx ML300 evaluation board. | ||
96 | 84 | ||
85 | endmenu | ||
97 | 86 | ||
98 | # It's often necessary to know the specific 4xx processor type. | 87 | # 40x specific CPU modules, selected based on the board above. |
99 | # Fortunately, it is impled (so far) from the board type, so we | ||
100 | # don't need to ask more redundant questions. | ||
101 | config NP405H | 88 | config NP405H |
102 | bool | 89 | bool |
103 | depends on ASH | 90 | #depends on ASH |
104 | default y | ||
105 | 91 | ||
106 | config 440EP | 92 | # OAK doesn't exist but wanted to keep this around for any future 403GCX boards |
93 | config 403GCX | ||
107 | bool | 94 | bool |
108 | depends on BAMBOO | 95 | #depends on OAK |
109 | select PPC_FPU | 96 | select IBM405_ERR51 |
110 | default y | ||
111 | 97 | ||
112 | config 440GP | 98 | config 405GP |
113 | bool | 99 | bool |
114 | depends on EBONY | 100 | select IBM405_ERR77 |
115 | default y | 101 | select IBM405_ERR51 |
116 | 102 | ||
117 | config 440GX | 103 | config 405EP |
118 | bool | 104 | bool |
119 | depends on OCOTEA | ||
120 | default y | ||
121 | 105 | ||
122 | config 440SP | 106 | config 405GPR |
123 | bool | 107 | bool |
124 | depends on LUAN | ||
125 | default y | ||
126 | 108 | ||
127 | config 440 | 109 | config VIRTEX_II_PRO |
128 | bool | 110 | bool |
129 | depends on 440GP || 440SP || 440EP | 111 | select IBM405_ERR77 |
130 | default y | 112 | select IBM405_ERR51 |
131 | 113 | ||
132 | config 440A | 114 | config STB03xxx |
133 | bool | 115 | bool |
134 | depends on 440GX | 116 | select IBM405_ERR77 |
135 | default y | 117 | select IBM405_ERR51 |
136 | 118 | ||
137 | config IBM440EP_ERR42 | 119 | # 40x errata/workaround config symbols, selected by the CPU models above |
138 | bool | ||
139 | depends on 440EP | ||
140 | default y | ||
141 | 120 | ||
142 | # All 405-based cores up until the 405GPR and 405EP have this errata. | 121 | # All 405-based cores up until the 405GPR and 405EP have this errata. |
143 | config IBM405_ERR77 | 122 | config IBM405_ERR77 |
144 | bool | 123 | bool |
145 | depends on 40x && !403GCX && !405GPR && !405EP | ||
146 | default y | ||
147 | 124 | ||
148 | # All 40x-based cores, up until the 405GPR and 405EP have this errata. | 125 | # All 40x-based cores, up until the 405GPR and 405EP have this errata. |
149 | config IBM405_ERR51 | 126 | config IBM405_ERR51 |
150 | bool | 127 | bool |
151 | depends on 40x && !405GPR && !405EP | ||
152 | default y | ||
153 | 128 | ||
154 | config BOOKE | 129 | menu "AMCC 44x options" |
155 | bool | ||
156 | depends on 44x | 130 | depends on 44x |
157 | default y | ||
158 | |||
159 | config IBM_OCP | ||
160 | bool | ||
161 | depends on ASH || BAMBOO || BUBINGA || CPCI405 || EBONY || EP405 || LUAN || OCOTEA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT | ||
162 | default y | ||
163 | 131 | ||
164 | config XILINX_OCP | 132 | #config BAMBOO |
165 | bool | 133 | # bool "Bamboo" |
166 | depends on XILINX_ML300 | 134 | # depends on 44x |
167 | default y | 135 | # default n |
136 | # select 440EP | ||
137 | # help | ||
138 | # This option enables support for the IBM PPC440EP evaluation board. | ||
168 | 139 | ||
169 | config IBM_EMAC4 | 140 | config EBONY |
170 | bool | 141 | bool "Ebony" |
171 | depends on 440GX || 440SP | 142 | depends on 44x |
172 | default y | ||
173 | |||
174 | config BIOS_FIXUP | ||
175 | bool | ||
176 | depends on BUBINGA || EP405 || SYCAMORE || WALNUT | ||
177 | default y | ||
178 | |||
179 | # OAK doesn't exist but wanted to keep this around for any future 403GCX boards | ||
180 | config 403GCX | ||
181 | bool | ||
182 | depends on OAK | ||
183 | default y | ||
184 | |||
185 | config 405EP | ||
186 | bool | ||
187 | depends on BUBINGA | ||
188 | default y | ||
189 | |||
190 | config 405GP | ||
191 | bool | ||
192 | depends on CPCI405 || EP405 || WALNUT | ||
193 | default y | ||
194 | |||
195 | config 405GPR | ||
196 | bool | ||
197 | depends on SYCAMORE | ||
198 | default y | 143 | default y |
144 | select 440GP | ||
145 | help | ||
146 | This option enables support for the IBM PPC440GP evaluation board. | ||
199 | 147 | ||
200 | config VIRTEX_II_PRO | 148 | #config LUAN |
201 | bool | 149 | # bool "Luan" |
202 | depends on XILINX_ML300 | 150 | # depends on 44x |
203 | default y | 151 | # default n |
152 | # select 440SP | ||
153 | # help | ||
154 | # This option enables support for the IBM PPC440SP evaluation board. | ||
155 | |||
156 | #config OCOTEA | ||
157 | # bool "Ocotea" | ||
158 | # depends on 44x | ||
159 | # default n | ||
160 | # select 440GX | ||
161 | # help | ||
162 | # This option enables support for the IBM PPC440GX evaluation board. | ||
204 | 163 | ||
205 | config STB03xxx | 164 | endmenu |
206 | bool | ||
207 | depends on REDWOOD_5 || REDWOOD_6 | ||
208 | default y | ||
209 | 165 | ||
210 | config EMBEDDEDBOOT | 166 | # 44x specific CPU modules, selected based on the board above. |
167 | config 440EP | ||
211 | bool | 168 | bool |
212 | depends on EP405 || XILINX_ML300 | 169 | select PPC_FPU |
213 | default y | 170 | select IBM440EP_ERR42 |
214 | 171 | ||
215 | config IBM_OPENBIOS | 172 | config 440GP |
216 | bool | 173 | bool |
217 | depends on ASH || BUBINGA || REDWOOD_5 || REDWOOD_6 || SYCAMORE || WALNUT | 174 | select IBM_NEW_EMAC_ZMII |
218 | default y | ||
219 | 175 | ||
220 | config PPC4xx_DMA | 176 | config 440GX |
221 | bool "PPC4xx DMA controller support" | ||
222 | depends on 4xx | ||
223 | |||
224 | config PPC4xx_EDMA | ||
225 | bool | 177 | bool |
226 | depends on !STB03xxx && PPC4xx_DMA | ||
227 | default y | ||
228 | 178 | ||
229 | config PPC_GEN550 | 179 | config 440SP |
230 | bool | 180 | bool |
231 | depends on 4xx | ||
232 | default y | ||
233 | |||
234 | choice | ||
235 | prompt "TTYS0 device and default console" | ||
236 | depends on 40x | ||
237 | default UART0_TTYS0 | ||
238 | |||
239 | config UART0_TTYS0 | ||
240 | bool "UART0" | ||
241 | 181 | ||
242 | config UART0_TTYS1 | 182 | config 440A |
243 | bool "UART1" | ||
244 | |||
245 | endchoice | ||
246 | |||
247 | config SERIAL_SICC | ||
248 | bool "SICC Serial port support" | ||
249 | depends on STB03xxx | ||
250 | |||
251 | config UART1_DFLT_CONSOLE | ||
252 | bool | 183 | bool |
253 | depends on SERIAL_SICC && UART0_TTYS1 | 184 | depends on 440GX |
254 | default y | 185 | default y |
255 | 186 | ||
256 | config SERIAL_SICC_CONSOLE | 187 | # 44x errata/workaround config symbols, selected by the CPU models above |
188 | config IBM440EP_ERR42 | ||
257 | bool | 189 | bool |
258 | depends on SERIAL_SICC && UART0_TTYS1 | ||
259 | default y | ||
260 | endmenu | ||
261 | 190 | ||
191 | #config XILINX_OCP | ||
192 | # bool | ||
193 | # depends on XILINX_ML300 | ||
194 | # default y | ||
262 | 195 | ||
263 | menu "IBM 40x options" | 196 | #config BIOS_FIXUP |
264 | depends on 40x | 197 | # bool |
265 | 198 | # depends on BUBINGA || EP405 || SYCAMORE || WALNUT | |
266 | config SERIAL_SICC | 199 | # default y |
267 | bool "SICC Serial port" | ||
268 | depends on STB03xxx | ||
269 | |||
270 | config UART1_DFLT_CONSOLE | ||
271 | bool | ||
272 | depends on SERIAL_SICC && UART0_TTYS1 | ||
273 | default y | ||
274 | 200 | ||
275 | config SERIAL_SICC_CONSOLE | 201 | #config PPC4xx_DMA |
276 | bool | 202 | # bool "PPC4xx DMA controller support" |
277 | depends on SERIAL_SICC && UART0_TTYS1 | 203 | # depends on 4xx |
278 | default y | ||
279 | 204 | ||
280 | endmenu | 205 | #config PPC4xx_EDMA |
206 | # bool | ||
207 | # depends on !STB03xxx && PPC4xx_DMA | ||
208 | # default y | ||
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig new file mode 100644 index 000000000000..bc4aa4a80a12 --- /dev/null +++ b/arch/powerpc/platforms/52xx/Kconfig | |||
@@ -0,0 +1,35 @@ | |||
1 | config PPC_MPC52xx | ||
2 | bool | ||
3 | default n | ||
4 | |||
5 | config PPC_MPC5200 | ||
6 | bool | ||
7 | select PPC_MPC52xx | ||
8 | default n | ||
9 | |||
10 | config PPC_MPC5200_BUGFIX | ||
11 | bool "MPC5200 (L25R) bugfix support" | ||
12 | depends on PPC_MPC5200 | ||
13 | default n | ||
14 | help | ||
15 | Enable workarounds for original MPC5200 errata. This is not required | ||
16 | for MPC5200B based boards. | ||
17 | |||
18 | It is safe to say 'Y' here | ||
19 | |||
20 | config PPC_EFIKA | ||
21 | bool "bPlan Efika 5k2. MPC5200B based computer" | ||
22 | depends on PPC_MULTIPLATFORM && PPC32 | ||
23 | select PPC_RTAS | ||
24 | select RTAS_PROC | ||
25 | select PPC_MPC52xx | ||
26 | select PPC_NATIVE | ||
27 | default n | ||
28 | |||
29 | config PPC_LITE5200 | ||
30 | bool "Freescale Lite5200 Eval Board" | ||
31 | depends on PPC_MULTIPLATFORM && PPC32 | ||
32 | select PPC_MPC5200 | ||
33 | default n | ||
34 | |||
35 | |||
diff --git a/arch/powerpc/platforms/52xx/efika.c b/arch/powerpc/platforms/52xx/efika.c index 8de034116681..a6bba97314eb 100644 --- a/arch/powerpc/platforms/52xx/efika.c +++ b/arch/powerpc/platforms/52xx/efika.c | |||
@@ -112,7 +112,7 @@ void __init efika_pcisetup(void) | |||
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | 114 | ||
115 | bus_range = get_property(pcictrl, "bus-range", &len); | 115 | bus_range = of_get_property(pcictrl, "bus-range", &len); |
116 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 116 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
117 | printk(KERN_WARNING EFIKA_PLATFORM_NAME | 117 | printk(KERN_WARNING EFIKA_PLATFORM_NAME |
118 | ": Can't get bus-range for %s\n", pcictrl->full_name); | 118 | ": Can't get bus-range for %s\n", pcictrl->full_name); |
@@ -158,18 +158,17 @@ void __init efika_pcisetup(void) | |||
158 | static void efika_show_cpuinfo(struct seq_file *m) | 158 | static void efika_show_cpuinfo(struct seq_file *m) |
159 | { | 159 | { |
160 | struct device_node *root; | 160 | struct device_node *root; |
161 | const char *revision = NULL; | 161 | const char *revision; |
162 | const char *codegendescription = NULL; | 162 | const char *codegendescription; |
163 | const char *codegenvendor = NULL; | 163 | const char *codegenvendor; |
164 | 164 | ||
165 | root = of_find_node_by_path("/"); | 165 | root = of_find_node_by_path("/"); |
166 | if (!root) | 166 | if (!root) |
167 | return; | 167 | return; |
168 | 168 | ||
169 | revision = get_property(root, "revision", NULL); | 169 | revision = of_get_property(root, "revision", NULL); |
170 | codegendescription = | 170 | codegendescription = of_get_property(root, "CODEGEN,description", NULL); |
171 | get_property(root, "CODEGEN,description", NULL); | 171 | codegenvendor = of_get_property(root, "CODEGEN,vendor", NULL); |
172 | codegenvendor = get_property(root, "CODEGEN,vendor", NULL); | ||
173 | 172 | ||
174 | if (codegendescription) | 173 | if (codegendescription) |
175 | seq_printf(m, "machine\t\t: %s\n", codegendescription); | 174 | seq_printf(m, "machine\t\t: %s\n", codegendescription); |
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c index cc3b40de21dd..8e2646ac417b 100644 --- a/arch/powerpc/platforms/52xx/lite5200.c +++ b/arch/powerpc/platforms/52xx/lite5200.c | |||
@@ -94,8 +94,8 @@ static void __init lite5200_setup_arch(void) | |||
94 | 94 | ||
95 | np = of_find_node_by_type(NULL, "cpu"); | 95 | np = of_find_node_by_type(NULL, "cpu"); |
96 | if (np) { | 96 | if (np) { |
97 | unsigned int *fp = | 97 | const unsigned int *fp = |
98 | (int *)get_property(np, "clock-frequency", NULL); | 98 | of_get_property(np, "clock-frequency", NULL); |
99 | if (fp != 0) | 99 | if (fp != 0) |
100 | loops_per_jiffy = *fp / HZ; | 100 | loops_per_jiffy = *fp / HZ; |
101 | else | 101 | else |
@@ -108,9 +108,11 @@ static void __init lite5200_setup_arch(void) | |||
108 | lite5200_setup_cpu(); /* Platorm specific */ | 108 | lite5200_setup_cpu(); /* Platorm specific */ |
109 | 109 | ||
110 | #ifdef CONFIG_PCI | 110 | #ifdef CONFIG_PCI |
111 | np = of_find_node_by_type(np, "pci"); | 111 | np = of_find_node_by_type(NULL, "pci"); |
112 | if (np) | 112 | if (np) { |
113 | mpc52xx_add_bridge(np); | 113 | mpc52xx_add_bridge(np); |
114 | of_node_put(np); | ||
115 | } | ||
114 | #endif | 116 | #endif |
115 | 117 | ||
116 | #ifdef CONFIG_BLK_DEV_INITRD | 118 | #ifdef CONFIG_BLK_DEV_INITRD |
@@ -132,7 +134,7 @@ void lite5200_show_cpuinfo(struct seq_file *m) | |||
132 | const char *model = NULL; | 134 | const char *model = NULL; |
133 | 135 | ||
134 | if (np) | 136 | if (np) |
135 | model = get_property(np, "model", NULL); | 137 | model = of_get_property(np, "model", NULL); |
136 | 138 | ||
137 | seq_printf(m, "vendor\t\t: Freescale Semiconductor\n"); | 139 | seq_printf(m, "vendor\t\t: Freescale Semiconductor\n"); |
138 | seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown"); | 140 | seq_printf(m, "machine\t\t: %s\n", model ? model : "unknown"); |
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c index ed0cb694aea8..2dd415ff55a9 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_common.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c | |||
@@ -60,7 +60,7 @@ mpc52xx_find_ipb_freq(struct device_node *node) | |||
60 | 60 | ||
61 | of_node_get(node); | 61 | of_node_get(node); |
62 | while (node) { | 62 | while (node) { |
63 | p_ipb_freq = get_property(node, "bus-frequency", NULL); | 63 | p_ipb_freq = of_get_property(node, "bus-frequency", NULL); |
64 | if (p_ipb_freq) | 64 | if (p_ipb_freq) |
65 | break; | 65 | break; |
66 | 66 | ||
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pci.c b/arch/powerpc/platforms/52xx/mpc52xx_pci.c index faf161bdbc1c..34d34a26d305 100644 --- a/arch/powerpc/platforms/52xx/mpc52xx_pci.c +++ b/arch/powerpc/platforms/52xx/mpc52xx_pci.c | |||
@@ -370,7 +370,7 @@ mpc52xx_add_bridge(struct device_node *node) | |||
370 | return -EINVAL; | 370 | return -EINVAL; |
371 | } | 371 | } |
372 | 372 | ||
373 | bus_range = get_property(node, "bus-range", &len); | 373 | bus_range = of_get_property(node, "bus-range", &len); |
374 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 374 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
375 | printk(KERN_WARNING "Can't get %s bus-range, assume bus 0\n", | 375 | printk(KERN_WARNING "Can't get %s bus-range, assume bus 0\n", |
376 | node->full_name); | 376 | node->full_name); |
diff --git a/arch/powerpc/platforms/82xx/Kconfig b/arch/powerpc/platforms/82xx/Kconfig index 47d841ecf2e2..de7fce9cb6eb 100644 --- a/arch/powerpc/platforms/82xx/Kconfig +++ b/arch/powerpc/platforms/82xx/Kconfig | |||
@@ -1,21 +1,36 @@ | |||
1 | menu "Platform support" | ||
2 | depends on PPC_82xx | ||
3 | |||
4 | choice | 1 | choice |
5 | prompt "Machine Type" | 2 | prompt "Machine Type" |
6 | default MPC82xx_ADS | 3 | depends on PPC_82xx |
4 | default MPC82xx_ADS | ||
7 | 5 | ||
8 | config MPC82xx_ADS | 6 | config MPC82xx_ADS |
9 | bool "Freescale MPC82xx ADS" | 7 | bool "Freescale MPC82xx ADS" |
10 | select DEFAULT_UIMAGE | 8 | select DEFAULT_UIMAGE |
11 | select PQ2ADS | 9 | select PQ2ADS |
12 | select 8272 | 10 | select 8272 |
13 | select 8260 | 11 | select 8260 |
14 | select CPM2 | 12 | select FSL_SOC |
15 | select FSL_SOC | 13 | help |
16 | help | 14 | This option enables support for the MPC8272 ADS board |
17 | This option enables support for the MPC8272 ADS board | ||
18 | 15 | ||
19 | endchoice | 16 | endchoice |
20 | 17 | ||
21 | endmenu | 18 | config PQ2ADS |
19 | bool | ||
20 | default n | ||
21 | |||
22 | config 8260 | ||
23 | bool | ||
24 | depends on 6xx | ||
25 | select CPM2 | ||
26 | help | ||
27 | The MPC8260 is a typical embedded CPU made by Freescale. Selecting | ||
28 | this option means that you wish to build a kernel for a machine with | ||
29 | an 8260 class CPU. | ||
30 | |||
31 | config 8272 | ||
32 | bool | ||
33 | select 8260 | ||
34 | help | ||
35 | The MPC8272 CPM has a different internal dpram setup than other CPM2 | ||
36 | devices | ||
diff --git a/arch/powerpc/platforms/82xx/mpc82xx.c b/arch/powerpc/platforms/82xx/mpc82xx.c index 74e7892cdfcf..cc9900d2e5ee 100644 --- a/arch/powerpc/platforms/82xx/mpc82xx.c +++ b/arch/powerpc/platforms/82xx/mpc82xx.c | |||
@@ -55,17 +55,17 @@ | |||
55 | static int __init get_freq(char *name, unsigned long *val) | 55 | static int __init get_freq(char *name, unsigned long *val) |
56 | { | 56 | { |
57 | struct device_node *cpu; | 57 | struct device_node *cpu; |
58 | unsigned int *fp; | 58 | const unsigned int *fp; |
59 | int found = 0; | 59 | int found = 0; |
60 | 60 | ||
61 | /* The cpu node should have timebase and clock frequency properties */ | 61 | /* The cpu node should have timebase and clock frequency properties */ |
62 | cpu = of_find_node_by_type(NULL, "cpu"); | 62 | cpu = of_find_node_by_type(NULL, "cpu"); |
63 | 63 | ||
64 | if (cpu) { | 64 | if (cpu) { |
65 | fp = (unsigned int *)get_property(cpu, name, NULL); | 65 | fp = of_get_property(cpu, name, NULL); |
66 | if (fp) { | 66 | if (fp) { |
67 | found = 1; | 67 | found = 1; |
68 | *val = *fp++; | 68 | *val = *fp; |
69 | } | 69 | } |
70 | 70 | ||
71 | of_node_put(cpu); | 71 | of_node_put(cpu); |
diff --git a/arch/powerpc/platforms/82xx/mpc82xx_ads.c b/arch/powerpc/platforms/82xx/mpc82xx_ads.c index 7334c1a15b90..47cb09f08052 100644 --- a/arch/powerpc/platforms/82xx/mpc82xx_ads.c +++ b/arch/powerpc/platforms/82xx/mpc82xx_ads.c | |||
@@ -456,7 +456,7 @@ void m82xx_pci_init_irq(void) | |||
456 | iounmap(immap); | 456 | iounmap(immap); |
457 | return; | 457 | return; |
458 | } | 458 | } |
459 | irq_map = get_property(np, "interrupt-map", &size); | 459 | irq_map = of_get_property(np, "interrupt-map", &size); |
460 | if ((!irq_map) || (size <= 7)) { | 460 | if ((!irq_map) || (size <= 7)) { |
461 | printk(KERN_INFO "No interrupt-map property of pci node\n"); | 461 | printk(KERN_INFO "No interrupt-map property of pci node\n"); |
462 | iounmap(immap); | 462 | iounmap(immap); |
@@ -481,7 +481,7 @@ void m82xx_pci_init_irq(void) | |||
481 | } | 481 | } |
482 | pci_pic_node = of_node_get(np); | 482 | pci_pic_node = of_node_get(np); |
483 | /* PCI interrupt controller registers: status and mask */ | 483 | /* PCI interrupt controller registers: status and mask */ |
484 | regs = get_property(np, "reg", &size); | 484 | regs = of_get_property(np, "reg", &size); |
485 | if ((!regs) || (size <= 2)) { | 485 | if ((!regs) || (size <= 2)) { |
486 | printk(KERN_INFO "No reg property in pci pic node\n"); | 486 | printk(KERN_INFO "No reg property in pci pic node\n"); |
487 | iounmap(immap); | 487 | iounmap(immap); |
@@ -521,20 +521,20 @@ void __init add_bridge(struct device_node *np) | |||
521 | struct pci_controller *hose; | 521 | struct pci_controller *hose; |
522 | struct resource r; | 522 | struct resource r; |
523 | const int *bus_range; | 523 | const int *bus_range; |
524 | const void *ptr; | 524 | const uint *ptr; |
525 | 525 | ||
526 | memset(&r, 0, sizeof(r)); | 526 | memset(&r, 0, sizeof(r)); |
527 | if (of_address_to_resource(np, 0, &r)) { | 527 | if (of_address_to_resource(np, 0, &r)) { |
528 | printk(KERN_INFO "No PCI reg property in device tree\n"); | 528 | printk(KERN_INFO "No PCI reg property in device tree\n"); |
529 | return; | 529 | return; |
530 | } | 530 | } |
531 | if (!(ptr = get_property(np, "clock-frequency", NULL))) { | 531 | if (!(ptr = of_get_property(np, "clock-frequency", NULL))) { |
532 | printk(KERN_INFO "No clock-frequency property in PCI node"); | 532 | printk(KERN_INFO "No clock-frequency property in PCI node"); |
533 | return; | 533 | return; |
534 | } | 534 | } |
535 | pci_clk_frq = *(uint *) ptr; | 535 | pci_clk_frq = *ptr; |
536 | of_node_put(np); | 536 | of_node_put(np); |
537 | bus_range = get_property(np, "bus-range", &len); | 537 | bus_range = of_get_property(np, "bus-range", &len); |
538 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 538 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
539 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 539 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
540 | " bus 0\n", np->full_name); | 540 | " bus 0\n", np->full_name); |
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig index 713b31a16ce9..19cafdf6df93 100644 --- a/arch/powerpc/platforms/83xx/Kconfig +++ b/arch/powerpc/platforms/83xx/Kconfig | |||
@@ -1,8 +1,6 @@ | |||
1 | menu "Platform support" | ||
2 | depends on PPC_83xx | ||
3 | |||
4 | choice | 1 | choice |
5 | prompt "Machine Type" | 2 | prompt "Machine Type" |
3 | depends on PPC_83xx | ||
6 | default MPC834x_MDS | 4 | default MPC834x_MDS |
7 | 5 | ||
8 | config MPC8313_RDB | 6 | config MPC8313_RDB |
@@ -18,6 +16,13 @@ config MPC832x_MDS | |||
18 | help | 16 | help |
19 | This option enables support for the MPC832x MDS evaluation board. | 17 | This option enables support for the MPC832x MDS evaluation board. |
20 | 18 | ||
19 | config MPC832x_RDB | ||
20 | bool "Freescale MPC832x RDB" | ||
21 | select DEFAULT_UIMAGE | ||
22 | select QUICC_ENGINE | ||
23 | help | ||
24 | This option enables support for the MPC8323 RDB board. | ||
25 | |||
21 | config MPC834x_MDS | 26 | config MPC834x_MDS |
22 | bool "Freescale MPC834x MDS" | 27 | bool "Freescale MPC834x MDS" |
23 | select DEFAULT_UIMAGE | 28 | select DEFAULT_UIMAGE |
@@ -57,7 +62,7 @@ config PPC_MPC832x | |||
57 | bool | 62 | bool |
58 | select PPC_UDBG_16550 | 63 | select PPC_UDBG_16550 |
59 | select PPC_INDIRECT_PCI | 64 | select PPC_INDIRECT_PCI |
60 | default y if MPC832x_MDS | 65 | default y if MPC832x_MDS || MPC832x_RDB |
61 | 66 | ||
62 | config MPC834x | 67 | config MPC834x |
63 | bool | 68 | bool |
@@ -70,5 +75,3 @@ config PPC_MPC836x | |||
70 | select PPC_UDBG_16550 | 75 | select PPC_UDBG_16550 |
71 | select PPC_INDIRECT_PCI | 76 | select PPC_INDIRECT_PCI |
72 | default y if MPC836x_MDS | 77 | default y if MPC836x_MDS |
73 | |||
74 | endmenu | ||
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile index dfc970d0df10..31a91b53f528 100644 --- a/arch/powerpc/platforms/83xx/Makefile +++ b/arch/powerpc/platforms/83xx/Makefile | |||
@@ -4,6 +4,7 @@ | |||
4 | obj-y := misc.o | 4 | obj-y := misc.o |
5 | obj-$(CONFIG_PCI) += pci.o | 5 | obj-$(CONFIG_PCI) += pci.o |
6 | obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o | 6 | obj-$(CONFIG_MPC8313_RDB) += mpc8313_rdb.o |
7 | obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o | ||
7 | obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o | 8 | obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o |
8 | obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o | 9 | obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o |
9 | obj-$(CONFIG_MPC836x_MDS) += mpc836x_mds.o | 10 | obj-$(CONFIG_MPC836x_MDS) += mpc836x_mds.o |
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c index 17e3a3c6d8b4..fff09f5d6edf 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include <asm/qe_ic.h> | 41 | #include <asm/qe_ic.h> |
42 | 42 | ||
43 | #include "mpc83xx.h" | 43 | #include "mpc83xx.h" |
44 | #include "mpc832x_mds.h" | ||
45 | 44 | ||
46 | #undef DEBUG | 45 | #undef DEBUG |
47 | #ifdef DEBUG | 46 | #ifdef DEBUG |
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.h b/arch/powerpc/platforms/83xx/mpc832x_mds.h deleted file mode 100644 index a49588904f8a..000000000000 --- a/arch/powerpc/platforms/83xx/mpc832x_mds.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved. | ||
3 | * | ||
4 | * Description: | ||
5 | * MPC832x MDS board specific header. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef __MACH_MPC832x_MDS_H__ | ||
15 | #define __MACH_MPC832x_MDS_H__ | ||
16 | |||
17 | extern u8 *get_bcsr(void); | ||
18 | |||
19 | #endif /* __MACH_MPC832x_MDS_H__ */ | ||
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c new file mode 100644 index 000000000000..6b71e9ffb11a --- /dev/null +++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | * arch/powerpc/platforms/83xx/mpc832x_rdb.c | ||
3 | * | ||
4 | * Copyright (C) Freescale Semiconductor, Inc. 2007. All rights reserved. | ||
5 | * | ||
6 | * Description: | ||
7 | * MPC832x RDB board specific routines. | ||
8 | * This file is based on mpc832x_mds.c and mpc8313_rdb.c | ||
9 | * Author: Michael Barkowski <michael.barkowski@freescale.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | */ | ||
16 | |||
17 | #include <linux/pci.h> | ||
18 | |||
19 | #include <asm/of_platform.h> | ||
20 | #include <asm/time.h> | ||
21 | #include <asm/ipic.h> | ||
22 | #include <asm/udbg.h> | ||
23 | #include <asm/qe.h> | ||
24 | #include <asm/qe_ic.h> | ||
25 | |||
26 | #include "mpc83xx.h" | ||
27 | |||
28 | #undef DEBUG | ||
29 | #ifdef DEBUG | ||
30 | #define DBG(fmt...) udbg_printf(fmt) | ||
31 | #else | ||
32 | #define DBG(fmt...) | ||
33 | #endif | ||
34 | |||
35 | #ifndef CONFIG_PCI | ||
36 | unsigned long isa_io_base = 0; | ||
37 | unsigned long isa_mem_base = 0; | ||
38 | #endif | ||
39 | |||
40 | /* ************************************************************************ | ||
41 | * | ||
42 | * Setup the architecture | ||
43 | * | ||
44 | */ | ||
45 | static void __init mpc832x_rdb_setup_arch(void) | ||
46 | { | ||
47 | struct device_node *np; | ||
48 | |||
49 | if (ppc_md.progress) | ||
50 | ppc_md.progress("mpc832x_rdb_setup_arch()", 0); | ||
51 | |||
52 | #ifdef CONFIG_PCI | ||
53 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) | ||
54 | add_bridge(np); | ||
55 | |||
56 | ppc_md.pci_exclude_device = mpc83xx_exclude_device; | ||
57 | #endif | ||
58 | |||
59 | #ifdef CONFIG_QUICC_ENGINE | ||
60 | qe_reset(); | ||
61 | |||
62 | if ((np = of_find_node_by_name(np, "par_io")) != NULL) { | ||
63 | par_io_init(np); | ||
64 | of_node_put(np); | ||
65 | |||
66 | for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;) | ||
67 | par_io_of_config(np); | ||
68 | } | ||
69 | #endif /* CONFIG_QUICC_ENGINE */ | ||
70 | } | ||
71 | |||
72 | static struct of_device_id mpc832x_ids[] = { | ||
73 | { .type = "soc", }, | ||
74 | { .compatible = "soc", }, | ||
75 | { .type = "qe", }, | ||
76 | {}, | ||
77 | }; | ||
78 | |||
79 | static int __init mpc832x_declare_of_platform_devices(void) | ||
80 | { | ||
81 | if (!machine_is(mpc832x_rdb)) | ||
82 | return 0; | ||
83 | |||
84 | /* Publish the QE devices */ | ||
85 | of_platform_bus_probe(NULL, mpc832x_ids, NULL); | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | device_initcall(mpc832x_declare_of_platform_devices); | ||
90 | |||
91 | void __init mpc832x_rdb_init_IRQ(void) | ||
92 | { | ||
93 | |||
94 | struct device_node *np; | ||
95 | |||
96 | np = of_find_node_by_type(NULL, "ipic"); | ||
97 | if (!np) | ||
98 | return; | ||
99 | |||
100 | ipic_init(np, 0); | ||
101 | |||
102 | /* Initialize the default interrupt mapping priorities, | ||
103 | * in case the boot rom changed something on us. | ||
104 | */ | ||
105 | ipic_set_default_priority(); | ||
106 | of_node_put(np); | ||
107 | |||
108 | #ifdef CONFIG_QUICC_ENGINE | ||
109 | np = of_find_node_by_type(NULL, "qeic"); | ||
110 | if (!np) | ||
111 | return; | ||
112 | |||
113 | qe_ic_init(np, 0); | ||
114 | of_node_put(np); | ||
115 | #endif /* CONFIG_QUICC_ENGINE */ | ||
116 | } | ||
117 | |||
118 | /* | ||
119 | * Called very early, MMU is off, device-tree isn't unflattened | ||
120 | */ | ||
121 | static int __init mpc832x_rdb_probe(void) | ||
122 | { | ||
123 | unsigned long root = of_get_flat_dt_root(); | ||
124 | |||
125 | return of_flat_dt_is_compatible(root, "MPC832xRDB"); | ||
126 | } | ||
127 | |||
128 | define_machine(mpc832x_rdb) { | ||
129 | .name = "MPC832x RDB", | ||
130 | .probe = mpc832x_rdb_probe, | ||
131 | .setup_arch = mpc832x_rdb_setup_arch, | ||
132 | .init_IRQ = mpc832x_rdb_init_IRQ, | ||
133 | .get_irq = ipic_get_irq, | ||
134 | .restart = mpc83xx_restart, | ||
135 | .time_init = mpc83xx_time_init, | ||
136 | .calibrate_decr = generic_calibrate_decr, | ||
137 | .progress = udbg_progress, | ||
138 | }; | ||
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.h b/arch/powerpc/platforms/83xx/mpc834x_itx.h deleted file mode 100644 index 174ca4ef55f3..000000000000 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * arch/powerpc/platforms/83xx/mpc834x_itx.h | ||
3 | * | ||
4 | * MPC834X ITX common board definitions | ||
5 | * | ||
6 | * Maintainer: Kumar Gala <galak@kernel.crashing.org> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef __MACH_MPC83XX_ITX_H__ | ||
16 | #define __MACH_MPC83XX_ITX_H__ | ||
17 | |||
18 | #define PIRQA MPC83xx_IRQ_EXT4 | ||
19 | #define PIRQB MPC83xx_IRQ_EXT5 | ||
20 | #define PIRQC MPC83xx_IRQ_EXT6 | ||
21 | #define PIRQD MPC83xx_IRQ_EXT7 | ||
22 | |||
23 | #endif /* __MACH_MPC83XX_ITX_H__ */ | ||
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c index 9c3650555144..774457d09e94 100644 --- a/arch/powerpc/platforms/83xx/pci.c +++ b/arch/powerpc/platforms/83xx/pci.c | |||
@@ -60,7 +60,7 @@ int __init add_bridge(struct device_node *dev) | |||
60 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 60 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
61 | 61 | ||
62 | /* Get bus range if any */ | 62 | /* Get bus range if any */ |
63 | bus_range = get_property(dev, "bus-range", &len); | 63 | bus_range = of_get_property(dev, "bus-range", &len); |
64 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 64 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
65 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 65 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
66 | " bus 0\n", dev->full_name); | 66 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index e764c0aced88..629926e01e90 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
@@ -1,8 +1,6 @@ | |||
1 | menu "Platform support" | ||
2 | depends on PPC_85xx | ||
3 | |||
4 | choice | 1 | choice |
5 | prompt "Machine Type" | 2 | prompt "Machine Type" |
3 | depends on PPC_85xx | ||
6 | default MPC8540_ADS | 4 | default MPC8540_ADS |
7 | 5 | ||
8 | config MPC8540_ADS | 6 | config MPC8540_ADS |
@@ -30,6 +28,12 @@ config MPC85xx_MDS | |||
30 | help | 28 | help |
31 | This option enables support for the MPC85xx MDS board | 29 | This option enables support for the MPC85xx MDS board |
32 | 30 | ||
31 | config MPC8544_DS | ||
32 | bool "Freescale MPC8544 DS" | ||
33 | select DEFAULT_UIMAGE | ||
34 | help | ||
35 | This option enables support for the MPC8544 DS board | ||
36 | |||
33 | endchoice | 37 | endchoice |
34 | 38 | ||
35 | config MPC8540 | 39 | config MPC8540 |
@@ -40,33 +44,15 @@ config MPC8540 | |||
40 | 44 | ||
41 | config MPC8560 | 45 | config MPC8560 |
42 | bool | 46 | bool |
43 | select PPC_INDIRECT_PCI | 47 | select CPM2 |
44 | default y if MPC8560_ADS | 48 | default y if MPC8560_ADS |
45 | 49 | ||
46 | config MPC85xx | 50 | config MPC85xx |
47 | bool | 51 | bool |
48 | select PPC_UDBG_16550 | 52 | select PPC_UDBG_16550 |
49 | select PPC_INDIRECT_PCI | 53 | select PPC_INDIRECT_PCI |
54 | select PPC_INDIRECT_PCI_BE | ||
55 | select MPIC | ||
50 | select SERIAL_8250_SHARE_IRQ if SERIAL_8250 | 56 | select SERIAL_8250_SHARE_IRQ if SERIAL_8250 |
51 | default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS || MPC85xx_MDS | 57 | default y if MPC8540_ADS || MPC85xx_CDS || MPC8560_ADS \ |
52 | 58 | || MPC85xx_MDS || MPC8544_DS | |
53 | config PPC_INDIRECT_PCI_BE | ||
54 | bool | ||
55 | depends on PPC_85xx | ||
56 | default y | ||
57 | |||
58 | config MPIC | ||
59 | bool | ||
60 | default y | ||
61 | |||
62 | config CPM2 | ||
63 | bool | ||
64 | depends on MPC8560 | ||
65 | default y | ||
66 | help | ||
67 | The CPM2 (Communications Processor Module) is a coprocessor on | ||
68 | embedded CPUs made by Motorola. Selecting this option means that | ||
69 | you wish to build a kernel for a machine with a CPM2 coprocessor | ||
70 | on it. | ||
71 | |||
72 | endmenu | ||
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile index 4e63917ada9d..4e02cbb14cf7 100644 --- a/arch/powerpc/platforms/85xx/Makefile +++ b/arch/powerpc/platforms/85xx/Makefile | |||
@@ -5,4 +5,5 @@ obj-$(CONFIG_PPC_85xx) += misc.o pci.o | |||
5 | obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o | 5 | obj-$(CONFIG_MPC8540_ADS) += mpc85xx_ads.o |
6 | obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o | 6 | obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads.o |
7 | obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o | 7 | obj-$(CONFIG_MPC85xx_CDS) += mpc85xx_cds.o |
8 | obj-$(CONFIG_MPC8544_DS) += mpc8544_ds.o | ||
8 | obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o | 9 | obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o |
diff --git a/arch/powerpc/platforms/85xx/mpc8544_ds.c b/arch/powerpc/platforms/85xx/mpc8544_ds.c new file mode 100644 index 000000000000..2867f85e6325 --- /dev/null +++ b/arch/powerpc/platforms/85xx/mpc8544_ds.c | |||
@@ -0,0 +1,144 @@ | |||
1 | /* | ||
2 | * MPC8544 DS Board Setup | ||
3 | * | ||
4 | * Author Xianghua Xiao (x.xiao@freescale.com) | ||
5 | * Copyright 2007 Freescale Semiconductor Inc. | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify it | ||
8 | * under the terms of the GNU General Public License as published by the | ||
9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
10 | * option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <linux/stddef.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/kdev_t.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/seq_file.h> | ||
18 | |||
19 | #include <asm/system.h> | ||
20 | #include <asm/time.h> | ||
21 | #include <asm/machdep.h> | ||
22 | #include <asm/mpc85xx.h> | ||
23 | #include <mm/mmu_decl.h> | ||
24 | #include <asm/prom.h> | ||
25 | #include <asm/udbg.h> | ||
26 | #include <asm/mpic.h> | ||
27 | #include <asm/i8259.h> | ||
28 | |||
29 | #include <sysdev/fsl_soc.h> | ||
30 | #include "mpc85xx.h" | ||
31 | |||
32 | #undef DEBUG | ||
33 | |||
34 | #ifdef DEBUG | ||
35 | #define DBG(fmt, args...) printk(KERN_ERR "%s: " fmt, __FUNCTION__, ## args) | ||
36 | #else | ||
37 | #define DBG(fmt, args...) | ||
38 | #endif | ||
39 | |||
40 | |||
41 | void __init mpc8544_ds_pic_init(void) | ||
42 | { | ||
43 | struct mpic *mpic; | ||
44 | struct resource r; | ||
45 | struct device_node *np = NULL; | ||
46 | #ifdef CONFIG_PPC_I8259 | ||
47 | struct device_node *cascade_node = NULL; | ||
48 | int cascade_irq; | ||
49 | #endif | ||
50 | |||
51 | np = of_find_node_by_type(np, "open-pic"); | ||
52 | |||
53 | if (np == NULL) { | ||
54 | printk(KERN_ERR "Could not find open-pic node\n"); | ||
55 | return; | ||
56 | } | ||
57 | |||
58 | if (of_address_to_resource(np, 0, &r)) { | ||
59 | printk(KERN_ERR "Failed to map mpic register space\n"); | ||
60 | of_node_put(np); | ||
61 | return; | ||
62 | } | ||
63 | |||
64 | /* Alloc mpic structure and per isu has 16 INT entries. */ | ||
65 | mpic = mpic_alloc(np, r.start, | ||
66 | MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN, | ||
67 | 16, 64, " OPENPIC "); | ||
68 | BUG_ON(mpic == NULL); | ||
69 | |||
70 | /* | ||
71 | * 48 Internal Interrupts | ||
72 | */ | ||
73 | mpic_assign_isu(mpic, 0, r.start + 0x10200); | ||
74 | mpic_assign_isu(mpic, 1, r.start + 0x10400); | ||
75 | mpic_assign_isu(mpic, 2, r.start + 0x10600); | ||
76 | |||
77 | /* | ||
78 | * 16 External interrupts | ||
79 | */ | ||
80 | mpic_assign_isu(mpic, 3, r.start + 0x10000); | ||
81 | |||
82 | mpic_init(mpic); | ||
83 | |||
84 | #ifdef CONFIG_PPC_I8259 | ||
85 | /* Initialize the i8259 controller */ | ||
86 | for_each_node_by_type(np, "interrupt-controller") | ||
87 | if (device_is_compatible(np, "chrp,iic")) { | ||
88 | cascade_node = np; | ||
89 | break; | ||
90 | } | ||
91 | |||
92 | if (cascade_node == NULL) { | ||
93 | printk(KERN_DEBUG "Could not find i8259 PIC\n"); | ||
94 | return; | ||
95 | } | ||
96 | |||
97 | cascade_irq = irq_of_parse_and_map(cascade_node, 0); | ||
98 | if (cascade_irq == NO_IRQ) { | ||
99 | printk(KERN_ERR "Failed to map cascade interrupt\n"); | ||
100 | return; | ||
101 | } | ||
102 | |||
103 | DBG("mpc8544ds: cascade mapped to irq %d\n", cascade_irq); | ||
104 | |||
105 | i8259_init(cascade_node, 0); | ||
106 | of_node_put(cascade_node); | ||
107 | |||
108 | set_irq_chained_handler(cascade_irq, mpc8544_8259_cascade); | ||
109 | #endif /* CONFIG_PPC_I8259 */ | ||
110 | } | ||
111 | |||
112 | |||
113 | /* | ||
114 | * Setup the architecture | ||
115 | */ | ||
116 | static void __init mpc8544_ds_setup_arch(void) | ||
117 | { | ||
118 | if (ppc_md.progress) | ||
119 | ppc_md.progress("mpc8544_ds_setup_arch()", 0); | ||
120 | |||
121 | printk("MPC8544 DS board from Freescale Semiconductor\n"); | ||
122 | } | ||
123 | |||
124 | |||
125 | /* | ||
126 | * Called very early, device-tree isn't unflattened | ||
127 | */ | ||
128 | static int __init mpc8544_ds_probe(void) | ||
129 | { | ||
130 | unsigned long root = of_get_flat_dt_root(); | ||
131 | |||
132 | return of_flat_dt_is_compatible(root, "MPC8544DS"); | ||
133 | } | ||
134 | |||
135 | define_machine(mpc8544_ds) { | ||
136 | .name = "MPC8544 DS", | ||
137 | .probe = mpc8544_ds_probe, | ||
138 | .setup_arch = mpc8544_ds_setup_arch, | ||
139 | .init_IRQ = mpc8544_ds_pic_init, | ||
140 | .get_irq = mpic_get_irq, | ||
141 | .restart = mpc85xx_restart, | ||
142 | .calibrate_decr = generic_calibrate_decr, | ||
143 | .progress = udbg_progress, | ||
144 | }; | ||
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ads.c b/arch/powerpc/platforms/85xx/mpc85xx_ads.c index 8ed034aeca5f..5d27621f0927 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ads.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ads.c | |||
@@ -227,7 +227,7 @@ static void __init mpc85xx_ads_setup_arch(void) | |||
227 | if (cpu != 0) { | 227 | if (cpu != 0) { |
228 | const unsigned int *fp; | 228 | const unsigned int *fp; |
229 | 229 | ||
230 | fp = get_property(cpu, "clock-frequency", NULL); | 230 | fp = of_get_property(cpu, "clock-frequency", NULL); |
231 | if (fp != 0) | 231 | if (fp != 0) |
232 | loops_per_jiffy = *fp / HZ; | 232 | loops_per_jiffy = *fp / HZ; |
233 | else | 233 | else |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_cds.c b/arch/powerpc/platforms/85xx/mpc85xx_cds.c index 4232686be441..7e71636f9098 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_cds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_cds.c | |||
@@ -237,7 +237,7 @@ static void __init mpc85xx_cds_setup_arch(void) | |||
237 | if (cpu != 0) { | 237 | if (cpu != 0) { |
238 | const unsigned int *fp; | 238 | const unsigned int *fp; |
239 | 239 | ||
240 | fp = get_property(cpu, "clock-frequency", NULL); | 240 | fp = of_get_property(cpu, "clock-frequency", NULL); |
241 | if (fp != 0) | 241 | if (fp != 0) |
242 | loops_per_jiffy = *fp / HZ; | 242 | loops_per_jiffy = *fp / HZ; |
243 | else | 243 | else |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index 81144d2ae455..54db41689954 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c | |||
@@ -80,7 +80,7 @@ static void __init mpc85xx_mds_setup_arch(void) | |||
80 | np = of_find_node_by_type(NULL, "cpu"); | 80 | np = of_find_node_by_type(NULL, "cpu"); |
81 | if (np != NULL) { | 81 | if (np != NULL) { |
82 | const unsigned int *fp = | 82 | const unsigned int *fp = |
83 | get_property(np, "clock-frequency", NULL); | 83 | of_get_property(np, "clock-frequency", NULL); |
84 | if (fp != NULL) | 84 | if (fp != NULL) |
85 | loops_per_jiffy = *fp / HZ; | 85 | loops_per_jiffy = *fp / HZ; |
86 | else | 86 | else |
diff --git a/arch/powerpc/platforms/85xx/pci.c b/arch/powerpc/platforms/85xx/pci.c index 05930eeb6e7f..48f17e23d771 100644 --- a/arch/powerpc/platforms/85xx/pci.c +++ b/arch/powerpc/platforms/85xx/pci.c | |||
@@ -51,7 +51,7 @@ int __init add_bridge(struct device_node *dev) | |||
51 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 51 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
52 | 52 | ||
53 | /* Get bus range if any */ | 53 | /* Get bus range if any */ |
54 | bus_range = get_property(dev, "bus-range", &len); | 54 | bus_range = of_get_property(dev, "bus-range", &len); |
55 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 55 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
56 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 56 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
57 | " bus 0\n", dev->full_name); | 57 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index 0c70944d0e37..d1bcff500464 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig | |||
@@ -1,8 +1,6 @@ | |||
1 | menu "Platform Support" | ||
2 | depends on PPC_86xx | ||
3 | |||
4 | choice | 1 | choice |
5 | prompt "Machine Type" | 2 | prompt "Machine Type" |
3 | depends on PPC_86xx | ||
6 | default MPC8641_HPCN | 4 | default MPC8641_HPCN |
7 | 5 | ||
8 | config MPC8641_HPCN | 6 | config MPC8641_HPCN |
@@ -14,20 +12,10 @@ config MPC8641_HPCN | |||
14 | 12 | ||
15 | endchoice | 13 | endchoice |
16 | 14 | ||
17 | |||
18 | config MPC8641 | 15 | config MPC8641 |
19 | bool | 16 | bool |
20 | select PPC_INDIRECT_PCI | 17 | select PPC_INDIRECT_PCI |
18 | select PPC_INDIRECT_PCI_BE | ||
21 | select PPC_UDBG_16550 | 19 | select PPC_UDBG_16550 |
20 | select MPIC | ||
22 | default y if MPC8641_HPCN | 21 | default y if MPC8641_HPCN |
23 | |||
24 | config MPIC | ||
25 | bool | ||
26 | default y | ||
27 | |||
28 | config PPC_INDIRECT_PCI_BE | ||
29 | bool | ||
30 | depends on PPC_86xx | ||
31 | default y | ||
32 | |||
33 | endmenu | ||
diff --git a/arch/powerpc/platforms/86xx/Makefile b/arch/powerpc/platforms/86xx/Makefile index 476a6eeee710..418fd8f4d268 100644 --- a/arch/powerpc/platforms/86xx/Makefile +++ b/arch/powerpc/platforms/86xx/Makefile | |||
@@ -4,4 +4,4 @@ | |||
4 | 4 | ||
5 | obj-$(CONFIG_SMP) += mpc86xx_smp.o | 5 | obj-$(CONFIG_SMP) += mpc86xx_smp.o |
6 | obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o | 6 | obj-$(CONFIG_MPC8641_HPCN) += mpc86xx_hpcn.o |
7 | obj-$(CONFIG_PCI) += pci.o mpc86xx_pcie.o | 7 | obj-$(CONFIG_PCI) += pci.o |
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index f42f801cf84e..3d3d98f5bd4a 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | |||
@@ -349,7 +349,7 @@ mpc86xx_hpcn_setup_arch(void) | |||
349 | if (np != 0) { | 349 | if (np != 0) { |
350 | const unsigned int *fp; | 350 | const unsigned int *fp; |
351 | 351 | ||
352 | fp = get_property(np, "clock-frequency", NULL); | 352 | fp = of_get_property(np, "clock-frequency", NULL); |
353 | if (fp != 0) | 353 | if (fp != 0) |
354 | loops_per_jiffy = *fp / HZ; | 354 | loops_per_jiffy = *fp / HZ; |
355 | else | 355 | else |
@@ -384,7 +384,7 @@ mpc86xx_hpcn_show_cpuinfo(struct seq_file *m) | |||
384 | 384 | ||
385 | root = of_find_node_by_path("/"); | 385 | root = of_find_node_by_path("/"); |
386 | if (root) | 386 | if (root) |
387 | model = get_property(root, "model", NULL); | 387 | model = of_get_property(root, "model", NULL); |
388 | seq_printf(m, "Machine\t\t: %s\n", model); | 388 | seq_printf(m, "Machine\t\t: %s\n", model); |
389 | of_node_put(root); | 389 | of_node_put(root); |
390 | 390 | ||
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_pcie.c b/arch/powerpc/platforms/86xx/mpc86xx_pcie.c deleted file mode 100644 index a2f4f730213e..000000000000 --- a/arch/powerpc/platforms/86xx/mpc86xx_pcie.c +++ /dev/null | |||
@@ -1,173 +0,0 @@ | |||
1 | /* | ||
2 | * Support for indirect PCI bridges. | ||
3 | * | ||
4 | * Copyright (C) 1998 Gabriel Paubert. | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * "Temporary" MPC8548 Errata file - | ||
12 | * The standard indirect_pci code should work with future silicon versions. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/pci.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/string.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/bootmem.h> | ||
21 | |||
22 | #include <asm/io.h> | ||
23 | #include <asm/prom.h> | ||
24 | #include <asm/pci-bridge.h> | ||
25 | #include <asm/machdep.h> | ||
26 | |||
27 | #include "mpc86xx.h" | ||
28 | |||
29 | #define PCI_CFG_OUT out_be32 | ||
30 | |||
31 | /* ERRATA PCI-Ex 14 PCIE Controller timeout */ | ||
32 | #define PCIE_FIX out_be32(hose->cfg_addr+0x4, 0x0400ffff) | ||
33 | |||
34 | |||
35 | static int | ||
36 | indirect_read_config_pcie(struct pci_bus *bus, unsigned int devfn, int offset, | ||
37 | int len, u32 *val) | ||
38 | { | ||
39 | struct pci_controller *hose = bus->sysdata; | ||
40 | volatile void __iomem *cfg_data; | ||
41 | u32 temp; | ||
42 | |||
43 | if (ppc_md.pci_exclude_device) | ||
44 | if (ppc_md.pci_exclude_device(bus->number, devfn)) | ||
45 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
46 | |||
47 | /* Possible artifact of CDCpp50937 needs further investigation */ | ||
48 | if (devfn != 0x0 && bus->number == 0xff) | ||
49 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
50 | |||
51 | PCIE_FIX; | ||
52 | if (bus->number == 0xff) { | ||
53 | PCI_CFG_OUT(hose->cfg_addr, | ||
54 | (0x80000000 | ((offset & 0xf00) << 16) | | ||
55 | ((bus->number - hose->bus_offset) << 16) | ||
56 | | (devfn << 8) | ((offset & 0xfc) ))); | ||
57 | } else { | ||
58 | PCI_CFG_OUT(hose->cfg_addr, | ||
59 | (0x80000001 | ((offset & 0xf00) << 16) | | ||
60 | ((bus->number - hose->bus_offset) << 16) | ||
61 | | (devfn << 8) | ((offset & 0xfc) ))); | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * Note: the caller has already checked that offset is | ||
66 | * suitably aligned and that len is 1, 2 or 4. | ||
67 | */ | ||
68 | /* ERRATA PCI-Ex 12 - Configuration Address/Data Alignment */ | ||
69 | cfg_data = hose->cfg_data; | ||
70 | PCIE_FIX; | ||
71 | temp = in_le32(cfg_data); | ||
72 | switch (len) { | ||
73 | case 1: | ||
74 | *val = (temp >> (((offset & 3))*8)) & 0xff; | ||
75 | break; | ||
76 | case 2: | ||
77 | *val = (temp >> (((offset & 3))*8)) & 0xffff; | ||
78 | break; | ||
79 | default: | ||
80 | *val = temp; | ||
81 | break; | ||
82 | } | ||
83 | return PCIBIOS_SUCCESSFUL; | ||
84 | } | ||
85 | |||
86 | static int | ||
87 | indirect_write_config_pcie(struct pci_bus *bus, unsigned int devfn, int offset, | ||
88 | int len, u32 val) | ||
89 | { | ||
90 | struct pci_controller *hose = bus->sysdata; | ||
91 | volatile void __iomem *cfg_data; | ||
92 | u32 temp; | ||
93 | |||
94 | if (ppc_md.pci_exclude_device) | ||
95 | if (ppc_md.pci_exclude_device(bus->number, devfn)) | ||
96 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
97 | |||
98 | /* Possible artifact of CDCpp50937 needs further investigation */ | ||
99 | if (devfn != 0x0 && bus->number == 0xff) | ||
100 | return PCIBIOS_DEVICE_NOT_FOUND; | ||
101 | |||
102 | PCIE_FIX; | ||
103 | if (bus->number == 0xff) { | ||
104 | PCI_CFG_OUT(hose->cfg_addr, | ||
105 | (0x80000000 | ((offset & 0xf00) << 16) | | ||
106 | ((bus->number - hose->bus_offset) << 16) | ||
107 | | (devfn << 8) | ((offset & 0xfc) ))); | ||
108 | } else { | ||
109 | PCI_CFG_OUT(hose->cfg_addr, | ||
110 | (0x80000001 | ((offset & 0xf00) << 16) | | ||
111 | ((bus->number - hose->bus_offset) << 16) | ||
112 | | (devfn << 8) | ((offset & 0xfc) ))); | ||
113 | } | ||
114 | |||
115 | /* | ||
116 | * Note: the caller has already checked that offset is | ||
117 | * suitably aligned and that len is 1, 2 or 4. | ||
118 | */ | ||
119 | /* ERRATA PCI-Ex 12 - Configuration Address/Data Alignment */ | ||
120 | cfg_data = hose->cfg_data; | ||
121 | switch (len) { | ||
122 | case 1: | ||
123 | PCIE_FIX; | ||
124 | temp = in_le32(cfg_data); | ||
125 | temp = (temp & ~(0xff << ((offset & 3) * 8))) | | ||
126 | (val << ((offset & 3) * 8)); | ||
127 | PCIE_FIX; | ||
128 | out_le32(cfg_data, temp); | ||
129 | break; | ||
130 | case 2: | ||
131 | PCIE_FIX; | ||
132 | temp = in_le32(cfg_data); | ||
133 | temp = (temp & ~(0xffff << ((offset & 3) * 8))); | ||
134 | temp |= (val << ((offset & 3) * 8)) ; | ||
135 | PCIE_FIX; | ||
136 | out_le32(cfg_data, temp); | ||
137 | break; | ||
138 | default: | ||
139 | PCIE_FIX; | ||
140 | out_le32(cfg_data, val); | ||
141 | break; | ||
142 | } | ||
143 | PCIE_FIX; | ||
144 | return PCIBIOS_SUCCESSFUL; | ||
145 | } | ||
146 | |||
147 | static struct pci_ops indirect_pcie_ops = { | ||
148 | indirect_read_config_pcie, | ||
149 | indirect_write_config_pcie | ||
150 | }; | ||
151 | |||
152 | void __init | ||
153 | setup_indirect_pcie_nomap(struct pci_controller* hose, void __iomem * cfg_addr, | ||
154 | void __iomem * cfg_data) | ||
155 | { | ||
156 | hose->cfg_addr = cfg_addr; | ||
157 | hose->cfg_data = cfg_data; | ||
158 | hose->ops = &indirect_pcie_ops; | ||
159 | } | ||
160 | |||
161 | void __init | ||
162 | setup_indirect_pcie(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) | ||
163 | { | ||
164 | unsigned long base = cfg_addr & PAGE_MASK; | ||
165 | void __iomem *mbase, *addr, *data; | ||
166 | |||
167 | mbase = ioremap(base, PAGE_SIZE); | ||
168 | addr = mbase + (cfg_addr & ~PAGE_MASK); | ||
169 | if ((cfg_data & PAGE_MASK) != base) | ||
170 | mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE); | ||
171 | data = mbase + (cfg_data & ~PAGE_MASK); | ||
172 | setup_indirect_pcie_nomap(hose, addr, data); | ||
173 | } | ||
diff --git a/arch/powerpc/platforms/86xx/pci.c b/arch/powerpc/platforms/86xx/pci.c index 481e18ed5be9..8235c562661f 100644 --- a/arch/powerpc/platforms/86xx/pci.c +++ b/arch/powerpc/platforms/86xx/pci.c | |||
@@ -22,9 +22,9 @@ | |||
22 | #include <asm/atomic.h> | 22 | #include <asm/atomic.h> |
23 | #include <asm/io.h> | 23 | #include <asm/io.h> |
24 | #include <asm/prom.h> | 24 | #include <asm/prom.h> |
25 | #include <asm/immap_86xx.h> | ||
26 | #include <asm/pci-bridge.h> | 25 | #include <asm/pci-bridge.h> |
27 | #include <sysdev/fsl_soc.h> | 26 | #include <sysdev/fsl_soc.h> |
27 | #include <sysdev/fsl_pcie.h> | ||
28 | 28 | ||
29 | #include "mpc86xx.h" | 29 | #include "mpc86xx.h" |
30 | 30 | ||
@@ -163,7 +163,7 @@ int __init add_bridge(struct device_node *dev) | |||
163 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 163 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
164 | 164 | ||
165 | /* Get bus range if any */ | 165 | /* Get bus range if any */ |
166 | bus_range = get_property(dev, "bus-range", &len); | 166 | bus_range = of_get_property(dev, "bus-range", &len); |
167 | if (bus_range == NULL || len < 2 * sizeof(int)) | 167 | if (bus_range == NULL || len < 2 * sizeof(int)) |
168 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 168 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
169 | " bus 0\n", dev->full_name); | 169 | " bus 0\n", dev->full_name); |
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig index beea6834bb7e..39bb8c5ebe70 100644 --- a/arch/powerpc/platforms/8xx/Kconfig +++ b/arch/powerpc/platforms/8xx/Kconfig | |||
@@ -1,6 +1,3 @@ | |||
1 | menu "Platform support" | ||
2 | depends on PPC_8xx | ||
3 | |||
4 | config FADS | 1 | config FADS |
5 | bool | 2 | bool |
6 | 3 | ||
@@ -9,6 +6,7 @@ config CPM1 | |||
9 | 6 | ||
10 | choice | 7 | choice |
11 | prompt "8xx Machine Type" | 8 | prompt "8xx Machine Type" |
9 | depends on PPC_8xx | ||
12 | depends on 8xx | 10 | depends on 8xx |
13 | default MPC885ADS | 11 | default MPC885ADS |
14 | 12 | ||
@@ -36,38 +34,36 @@ config MPC885ADS | |||
36 | endchoice | 34 | endchoice |
37 | 35 | ||
38 | menu "Freescale Ethernet driver platform-specific options" | 36 | menu "Freescale Ethernet driver platform-specific options" |
39 | depends on (FS_ENET && MPC885ADS) | 37 | depends on (FS_ENET && MPC885ADS) |
40 | |||
41 | config MPC8xx_SECOND_ETH | ||
42 | bool "Second Ethernet channel" | ||
43 | depends on MPC885ADS | ||
44 | default y | ||
45 | help | ||
46 | This enables support for second Ethernet on MPC885ADS and MPC86xADS boards. | ||
47 | The latter will use SCC1, for 885ADS you can select it below. | ||
48 | |||
49 | choice | ||
50 | prompt "Second Ethernet channel" | ||
51 | depends on MPC8xx_SECOND_ETH | ||
52 | default MPC8xx_SECOND_ETH_FEC2 | ||
53 | |||
54 | config MPC8xx_SECOND_ETH_FEC2 | ||
55 | bool "FEC2" | ||
56 | depends on MPC885ADS | ||
57 | help | ||
58 | Enable FEC2 to serve as 2-nd Ethernet channel. Note that SMC2 | ||
59 | (often 2-nd UART) will not work if this is enabled. | ||
60 | |||
61 | config MPC8xx_SECOND_ETH_SCC3 | ||
62 | bool "SCC3" | ||
63 | depends on MPC885ADS | ||
64 | help | ||
65 | Enable SCC3 to serve as 2-nd Ethernet channel. Note that SMC1 | ||
66 | (often 1-nd UART) will not work if this is enabled. | ||
67 | |||
68 | endchoice | ||
69 | 38 | ||
70 | endmenu | 39 | config MPC8xx_SECOND_ETH |
40 | bool "Second Ethernet channel" | ||
41 | depends on MPC885ADS | ||
42 | default y | ||
43 | help | ||
44 | This enables support for second Ethernet on MPC885ADS and MPC86xADS boards. | ||
45 | The latter will use SCC1, for 885ADS you can select it below. | ||
46 | |||
47 | choice | ||
48 | prompt "Second Ethernet channel" | ||
49 | depends on MPC8xx_SECOND_ETH | ||
50 | default MPC8xx_SECOND_ETH_FEC2 | ||
51 | |||
52 | config MPC8xx_SECOND_ETH_FEC2 | ||
53 | bool "FEC2" | ||
54 | depends on MPC885ADS | ||
55 | help | ||
56 | Enable FEC2 to serve as 2-nd Ethernet channel. Note that SMC2 | ||
57 | (often 2-nd UART) will not work if this is enabled. | ||
58 | |||
59 | config MPC8xx_SECOND_ETH_SCC3 | ||
60 | bool "SCC3" | ||
61 | depends on MPC885ADS | ||
62 | help | ||
63 | Enable SCC3 to serve as 2-nd Ethernet channel. Note that SMC1 | ||
64 | (often 1-nd UART) will not work if this is enabled. | ||
65 | |||
66 | endchoice | ||
71 | 67 | ||
72 | endmenu | 68 | endmenu |
73 | 69 | ||
@@ -98,7 +94,7 @@ config 8xx_CPU6 | |||
98 | require workarounds for Linux (and most other OSes to work). If you | 94 | require workarounds for Linux (and most other OSes to work). If you |
99 | get a BUG() very early in boot, this might fix the problem. For | 95 | get a BUG() very early in boot, this might fix the problem. For |
100 | more details read the document entitled "MPC860 Family Device Errata | 96 | more details read the document entitled "MPC860 Family Device Errata |
101 | Reference" on Motorola's website. This option also incurs a | 97 | Reference" on Freescale's website. This option also incurs a |
102 | performance hit. | 98 | performance hit. |
103 | 99 | ||
104 | If in doubt, say N here. | 100 | If in doubt, say N here. |
@@ -135,4 +131,3 @@ config UCODE_PATCH | |||
135 | depends on !NO_UCODE_PATCH | 131 | depends on !NO_UCODE_PATCH |
136 | 132 | ||
137 | endmenu | 133 | endmenu |
138 | |||
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c index 9ed7125f0150..0901dbada350 100644 --- a/arch/powerpc/platforms/8xx/m8xx_setup.c +++ b/arch/powerpc/platforms/8xx/m8xx_setup.c | |||
@@ -85,17 +85,17 @@ init_internal_rtc(void) | |||
85 | static int __init get_freq(char *name, unsigned long *val) | 85 | static int __init get_freq(char *name, unsigned long *val) |
86 | { | 86 | { |
87 | struct device_node *cpu; | 87 | struct device_node *cpu; |
88 | unsigned int *fp; | 88 | const unsigned int *fp; |
89 | int found = 0; | 89 | int found = 0; |
90 | 90 | ||
91 | /* The cpu node should have timebase and clock frequency properties */ | 91 | /* The cpu node should have timebase and clock frequency properties */ |
92 | cpu = of_find_node_by_type(NULL, "cpu"); | 92 | cpu = of_find_node_by_type(NULL, "cpu"); |
93 | 93 | ||
94 | if (cpu) { | 94 | if (cpu) { |
95 | fp = (unsigned int *)get_property(cpu, name, NULL); | 95 | fp = of_get_property(cpu, name, NULL); |
96 | if (fp) { | 96 | if (fp) { |
97 | found = 1; | 97 | found = 1; |
98 | *val = *fp++; | 98 | *val = *fp; |
99 | } | 99 | } |
100 | 100 | ||
101 | of_node_put(cpu); | 101 | of_node_put(cpu); |
@@ -262,7 +262,7 @@ void mpc8xx_show_cpuinfo(struct seq_file *m) | |||
262 | 262 | ||
263 | root = of_find_node_by_path("/"); | 263 | root = of_find_node_by_path("/"); |
264 | if (root) | 264 | if (root) |
265 | model = get_property(root, "model", NULL); | 265 | model = of_get_property(root, "model", NULL); |
266 | seq_printf(m, "Machine\t\t: %s\n", model); | 266 | seq_printf(m, "Machine\t\t: %s\n", model); |
267 | of_node_put(root); | 267 | of_node_put(root); |
268 | 268 | ||
diff --git a/arch/powerpc/platforms/8xx/mpc86xads.h b/arch/powerpc/platforms/8xx/mpc86xads.h index b5d19dd0619c..59bad2f9ae51 100644 --- a/arch/powerpc/platforms/8xx/mpc86xads.h +++ b/arch/powerpc/platforms/8xx/mpc86xads.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET) | 37 | #define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET) |
38 | #define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver | 38 | #define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver |
39 | 39 | ||
40 | #define PCMCIA_MEM_ADDR (uint)0xff020000) | 40 | #define PCMCIA_MEM_ADDR ((uint)0xff020000) |
41 | #define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) | 41 | #define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) |
42 | 42 | ||
43 | /* Bits of interest in the BCSRs. | 43 | /* Bits of interest in the BCSRs. |
diff --git a/arch/powerpc/platforms/8xx/mpc86xads_setup.c b/arch/powerpc/platforms/8xx/mpc86xads_setup.c index ef52ce701b0e..a35315af5c53 100644 --- a/arch/powerpc/platforms/8xx/mpc86xads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc86xads_setup.c | |||
@@ -247,7 +247,7 @@ void init_smc_ioports(struct fs_uart_platform_info *data) | |||
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | int platform_device_skip(char *model, int id) | 250 | int platform_device_skip(const char *model, int id) |
251 | { | 251 | { |
252 | return 0; | 252 | return 0; |
253 | } | 253 | } |
@@ -260,7 +260,7 @@ static void __init mpc86xads_setup_arch(void) | |||
260 | if (cpu != 0) { | 260 | if (cpu != 0) { |
261 | const unsigned int *fp; | 261 | const unsigned int *fp; |
262 | 262 | ||
263 | fp = get_property(cpu, "clock-frequency", NULL); | 263 | fp = of_get_property(cpu, "clock-frequency", NULL); |
264 | if (fp != 0) | 264 | if (fp != 0) |
265 | loops_per_jiffy = *fp / HZ; | 265 | loops_per_jiffy = *fp / HZ; |
266 | else | 266 | else |
diff --git a/arch/powerpc/platforms/8xx/mpc885ads.h b/arch/powerpc/platforms/8xx/mpc885ads.h index 30cbebfe84c5..7c31aec284c2 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads.h +++ b/arch/powerpc/platforms/8xx/mpc885ads.h | |||
@@ -37,7 +37,7 @@ | |||
37 | #define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET) | 37 | #define CPM_MAP_ADDR (get_immrbase() + MPC8xx_CPM_OFFSET) |
38 | #define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver | 38 | #define CPM_IRQ_OFFSET 16 // for compability with cpm_uart driver |
39 | 39 | ||
40 | #define PCMCIA_MEM_ADDR (uint)0xff020000) | 40 | #define PCMCIA_MEM_ADDR ((uint)0xff020000) |
41 | #define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) | 41 | #define PCMCIA_MEM_SIZE ((uint)(64 * 1024)) |
42 | 42 | ||
43 | /* Bits of interest in the BCSRs. | 43 | /* Bits of interest in the BCSRs. |
diff --git a/arch/powerpc/platforms/8xx/mpc885ads_setup.c b/arch/powerpc/platforms/8xx/mpc885ads_setup.c index c5fefdf66c0a..a57b57785acd 100644 --- a/arch/powerpc/platforms/8xx/mpc885ads_setup.c +++ b/arch/powerpc/platforms/8xx/mpc885ads_setup.c | |||
@@ -322,7 +322,7 @@ void init_smc_ioports(struct fs_uart_platform_info *data) | |||
322 | } | 322 | } |
323 | } | 323 | } |
324 | 324 | ||
325 | int platform_device_skip(char *model, int id) | 325 | int platform_device_skip(const char *model, int id) |
326 | { | 326 | { |
327 | #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 | 327 | #ifdef CONFIG_MPC8xx_SECOND_ETH_SCC3 |
328 | const char *dev = "FEC"; | 328 | const char *dev = "FEC"; |
@@ -346,7 +346,7 @@ static void __init mpc885ads_setup_arch(void) | |||
346 | if (cpu != 0) { | 346 | if (cpu != 0) { |
347 | const unsigned int *fp; | 347 | const unsigned int *fp; |
348 | 348 | ||
349 | fp = get_property(cpu, "clock-frequency", NULL); | 349 | fp = of_get_property(cpu, "clock-frequency", NULL); |
350 | if (fp != 0) | 350 | if (fp != 0) |
351 | loops_per_jiffy = *fp / HZ; | 351 | loops_per_jiffy = *fp / HZ; |
352 | else | 352 | else |
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig new file mode 100644 index 000000000000..51e33347c147 --- /dev/null +++ b/arch/powerpc/platforms/Kconfig | |||
@@ -0,0 +1,259 @@ | |||
1 | menu "Platform support" | ||
2 | |||
3 | choice | ||
4 | prompt "Machine type" | ||
5 | depends on PPC64 || CLASSIC32 | ||
6 | default PPC_MULTIPLATFORM | ||
7 | |||
8 | config PPC_MULTIPLATFORM | ||
9 | bool "Generic desktop/server/laptop" | ||
10 | help | ||
11 | Select this option if configuring for an IBM pSeries or | ||
12 | RS/6000 machine, an Apple machine, or a PReP, CHRP, | ||
13 | Maple or Cell-based machine. | ||
14 | |||
15 | config EMBEDDED6xx | ||
16 | bool "Embedded 6xx/7xx/7xxx-based board" | ||
17 | depends on PPC32 && (BROKEN||BROKEN_ON_SMP) | ||
18 | |||
19 | config APUS | ||
20 | bool "Amiga-APUS" | ||
21 | depends on PPC32 && BROKEN | ||
22 | help | ||
23 | Select APUS if configuring for a PowerUP Amiga. | ||
24 | More information is available at: | ||
25 | <http://linux-apus.sourceforge.net/>. | ||
26 | endchoice | ||
27 | |||
28 | source "arch/powerpc/platforms/pseries/Kconfig" | ||
29 | source "arch/powerpc/platforms/iseries/Kconfig" | ||
30 | source "arch/powerpc/platforms/chrp/Kconfig" | ||
31 | source "arch/powerpc/platforms/52xx/Kconfig" | ||
32 | source "arch/powerpc/platforms/powermac/Kconfig" | ||
33 | source "arch/powerpc/platforms/prep/Kconfig" | ||
34 | source "arch/powerpc/platforms/maple/Kconfig" | ||
35 | source "arch/powerpc/platforms/pasemi/Kconfig" | ||
36 | source "arch/powerpc/platforms/celleb/Kconfig" | ||
37 | source "arch/powerpc/platforms/ps3/Kconfig" | ||
38 | source "arch/powerpc/platforms/cell/Kconfig" | ||
39 | source "arch/powerpc/platforms/8xx/Kconfig" | ||
40 | source "arch/powerpc/platforms/82xx/Kconfig" | ||
41 | source "arch/powerpc/platforms/83xx/Kconfig" | ||
42 | source "arch/powerpc/platforms/85xx/Kconfig" | ||
43 | source "arch/powerpc/platforms/86xx/Kconfig" | ||
44 | source "arch/powerpc/platforms/embedded6xx/Kconfig" | ||
45 | #source "arch/powerpc/platforms/4xx/Kconfig | ||
46 | |||
47 | config PPC_NATIVE | ||
48 | bool | ||
49 | depends on PPC_MULTIPLATFORM | ||
50 | help | ||
51 | Support for running natively on the hardware, i.e. without | ||
52 | a hypervisor. This option is not user-selectable but should | ||
53 | be selected by all platforms that need it. | ||
54 | |||
55 | config UDBG_RTAS_CONSOLE | ||
56 | bool "RTAS based debug console" | ||
57 | depends on PPC_RTAS | ||
58 | default n | ||
59 | |||
60 | config PPC_UDBG_BEAT | ||
61 | bool "BEAT based debug console" | ||
62 | depends on PPC_CELLEB | ||
63 | default n | ||
64 | |||
65 | config XICS | ||
66 | depends on PPC_PSERIES | ||
67 | bool | ||
68 | default y | ||
69 | |||
70 | config MPIC | ||
71 | bool | ||
72 | default n | ||
73 | |||
74 | config MPIC_WEIRD | ||
75 | bool | ||
76 | default n | ||
77 | |||
78 | config PPC_I8259 | ||
79 | bool | ||
80 | default n | ||
81 | |||
82 | config U3_DART | ||
83 | bool | ||
84 | depends on PPC_MULTIPLATFORM && PPC64 | ||
85 | default n | ||
86 | |||
87 | config PPC_RTAS | ||
88 | bool | ||
89 | default n | ||
90 | |||
91 | config RTAS_ERROR_LOGGING | ||
92 | bool | ||
93 | depends on PPC_RTAS | ||
94 | default n | ||
95 | |||
96 | config RTAS_PROC | ||
97 | bool "Proc interface to RTAS" | ||
98 | depends on PPC_RTAS | ||
99 | default y | ||
100 | |||
101 | config RTAS_FLASH | ||
102 | tristate "Firmware flash interface" | ||
103 | depends on PPC64 && RTAS_PROC | ||
104 | |||
105 | config PPC_PMI | ||
106 | tristate "Support for PMI" | ||
107 | depends PPC_IBM_CELL_BLADE | ||
108 | help | ||
109 | PMI (Platform Management Interrupt) is a way to | ||
110 | communicate with the BMC (Baseboard Mangement Controller). | ||
111 | It is used in some IBM Cell blades. | ||
112 | default m | ||
113 | |||
114 | config MMIO_NVRAM | ||
115 | bool | ||
116 | default n | ||
117 | |||
118 | config MPIC_U3_HT_IRQS | ||
119 | bool | ||
120 | depends on PPC_MAPLE | ||
121 | default y | ||
122 | |||
123 | config IBMVIO | ||
124 | depends on PPC_PSERIES || PPC_ISERIES | ||
125 | bool | ||
126 | default y | ||
127 | |||
128 | config IBMEBUS | ||
129 | depends on PPC_PSERIES | ||
130 | bool "Support for GX bus based adapters" | ||
131 | help | ||
132 | Bus device driver for GX bus based adapters. | ||
133 | |||
134 | config PPC_MPC106 | ||
135 | bool | ||
136 | default n | ||
137 | |||
138 | config PPC_970_NAP | ||
139 | bool | ||
140 | default n | ||
141 | |||
142 | config PPC_INDIRECT_IO | ||
143 | bool | ||
144 | select GENERIC_IOMAP | ||
145 | default n | ||
146 | |||
147 | config GENERIC_IOMAP | ||
148 | bool | ||
149 | default n | ||
150 | |||
151 | source "drivers/cpufreq/Kconfig" | ||
152 | |||
153 | menu "CPU Frequency drivers" | ||
154 | depends on CPU_FREQ | ||
155 | |||
156 | config CPU_FREQ_PMAC | ||
157 | bool "Support for Apple PowerBooks" | ||
158 | depends on ADB_PMU && PPC32 | ||
159 | select CPU_FREQ_TABLE | ||
160 | help | ||
161 | This adds support for frequency switching on Apple PowerBooks, | ||
162 | this currently includes some models of iBook & Titanium | ||
163 | PowerBook. | ||
164 | |||
165 | config CPU_FREQ_PMAC64 | ||
166 | bool "Support for some Apple G5s" | ||
167 | depends on PPC_PMAC && PPC64 | ||
168 | select CPU_FREQ_TABLE | ||
169 | help | ||
170 | This adds support for frequency switching on Apple iMac G5, | ||
171 | and some of the more recent desktop G5 machines as well. | ||
172 | |||
173 | config PPC_PASEMI_CPUFREQ | ||
174 | bool "Support for PA Semi PWRficient" | ||
175 | depends on PPC_PASEMI | ||
176 | default y | ||
177 | select CPU_FREQ_TABLE | ||
178 | help | ||
179 | This adds the support for frequency switching on PA Semi | ||
180 | PWRficient processors. | ||
181 | |||
182 | endmenu | ||
183 | |||
184 | config PPC601_SYNC_FIX | ||
185 | bool "Workarounds for PPC601 bugs" | ||
186 | depends on 6xx && (PPC_PREP || PPC_PMAC) | ||
187 | help | ||
188 | Some versions of the PPC601 (the first PowerPC chip) have bugs which | ||
189 | mean that extra synchronization instructions are required near | ||
190 | certain instructions, typically those that make major changes to the | ||
191 | CPU state. These extra instructions reduce performance slightly. | ||
192 | If you say N here, these extra instructions will not be included, | ||
193 | resulting in a kernel which will run faster but may not run at all | ||
194 | on some systems with the PPC601 chip. | ||
195 | |||
196 | If in doubt, say Y here. | ||
197 | |||
198 | config TAU | ||
199 | bool "On-chip CPU temperature sensor support" | ||
200 | depends on CLASSIC32 | ||
201 | help | ||
202 | G3 and G4 processors have an on-chip temperature sensor called the | ||
203 | 'Thermal Assist Unit (TAU)', which, in theory, can measure the on-die | ||
204 | temperature within 2-4 degrees Celsius. This option shows the current | ||
205 | on-die temperature in /proc/cpuinfo if the cpu supports it. | ||
206 | |||
207 | Unfortunately, on some chip revisions, this sensor is very inaccurate | ||
208 | and in many cases, does not work at all, so don't assume the cpu | ||
209 | temp is actually what /proc/cpuinfo says it is. | ||
210 | |||
211 | config TAU_INT | ||
212 | bool "Interrupt driven TAU driver (DANGEROUS)" | ||
213 | depends on TAU | ||
214 | ---help--- | ||
215 | The TAU supports an interrupt driven mode which causes an interrupt | ||
216 | whenever the temperature goes out of range. This is the fastest way | ||
217 | to get notified the temp has exceeded a range. With this option off, | ||
218 | a timer is used to re-check the temperature periodically. | ||
219 | |||
220 | However, on some cpus it appears that the TAU interrupt hardware | ||
221 | is buggy and can cause a situation which would lead unexplained hard | ||
222 | lockups. | ||
223 | |||
224 | Unless you are extending the TAU driver, or enjoy kernel/hardware | ||
225 | debugging, leave this option off. | ||
226 | |||
227 | config TAU_AVERAGE | ||
228 | bool "Average high and low temp" | ||
229 | depends on TAU | ||
230 | ---help--- | ||
231 | The TAU hardware can compare the temperature to an upper and lower | ||
232 | bound. The default behavior is to show both the upper and lower | ||
233 | bound in /proc/cpuinfo. If the range is large, the temperature is | ||
234 | either changing a lot, or the TAU hardware is broken (likely on some | ||
235 | G4's). If the range is small (around 4 degrees), the temperature is | ||
236 | relatively stable. If you say Y here, a single temperature value, | ||
237 | halfway between the upper and lower bounds, will be reported in | ||
238 | /proc/cpuinfo. | ||
239 | |||
240 | If in doubt, say N here. | ||
241 | |||
242 | config QUICC_ENGINE | ||
243 | bool | ||
244 | help | ||
245 | The QUICC Engine (QE) is a new generation of communications | ||
246 | coprocessors on Freescale embedded CPUs (akin to CPM in older chips). | ||
247 | Selecting this option means that you wish to build a kernel | ||
248 | for a machine with a QE coprocessor. | ||
249 | |||
250 | config CPM2 | ||
251 | bool | ||
252 | default n | ||
253 | help | ||
254 | The CPM2 (Communications Processor Module) is a coprocessor on | ||
255 | embedded CPUs made by Freescale. Selecting this option means that | ||
256 | you wish to build a kernel for a machine with a CPM2 coprocessor | ||
257 | on it (826x, 827x, 8560). | ||
258 | |||
259 | endmenu | ||
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig index 06a85b704331..82551770917c 100644 --- a/arch/powerpc/platforms/cell/Kconfig +++ b/arch/powerpc/platforms/cell/Kconfig | |||
@@ -1,3 +1,26 @@ | |||
1 | config PPC_CELL | ||
2 | bool | ||
3 | default n | ||
4 | |||
5 | config PPC_CELL_NATIVE | ||
6 | bool | ||
7 | select PPC_CELL | ||
8 | select PPC_DCR_MMIO | ||
9 | select PPC_OF_PLATFORM_PCI | ||
10 | select PPC_INDIRECT_IO | ||
11 | select PPC_NATIVE | ||
12 | select MPIC | ||
13 | default n | ||
14 | |||
15 | config PPC_IBM_CELL_BLADE | ||
16 | bool "IBM Cell Blade" | ||
17 | depends on PPC_MULTIPLATFORM && PPC64 | ||
18 | select PPC_CELL_NATIVE | ||
19 | select PPC_RTAS | ||
20 | select MMIO_NVRAM | ||
21 | select PPC_UDBG_16550 | ||
22 | select UDBG_RTAS_CONSOLE | ||
23 | |||
1 | menu "Cell Broadband Engine options" | 24 | menu "Cell Broadband Engine options" |
2 | depends on PPC_CELL | 25 | depends on PPC_CELL |
3 | 26 | ||
@@ -18,6 +41,7 @@ config SPU_BASE | |||
18 | 41 | ||
19 | config CBE_RAS | 42 | config CBE_RAS |
20 | bool "RAS features for bare metal Cell BE" | 43 | bool "RAS features for bare metal Cell BE" |
44 | depends on PPC_CELL_NATIVE | ||
21 | default y | 45 | default y |
22 | 46 | ||
23 | config CBE_THERM | 47 | config CBE_THERM |
diff --git a/arch/powerpc/platforms/cell/cbe_cpufreq.c b/arch/powerpc/platforms/cell/cbe_cpufreq.c index a3850fd1e94c..f9ac3fe3be97 100644 --- a/arch/powerpc/platforms/cell/cbe_cpufreq.c +++ b/arch/powerpc/platforms/cell/cbe_cpufreq.c | |||
@@ -25,9 +25,12 @@ | |||
25 | 25 | ||
26 | #include <asm/hw_irq.h> | 26 | #include <asm/hw_irq.h> |
27 | #include <asm/io.h> | 27 | #include <asm/io.h> |
28 | #include <asm/machdep.h> | ||
28 | #include <asm/processor.h> | 29 | #include <asm/processor.h> |
29 | #include <asm/prom.h> | 30 | #include <asm/prom.h> |
30 | #include <asm/time.h> | 31 | #include <asm/time.h> |
32 | #include <asm/pmi.h> | ||
33 | #include <asm/of_platform.h> | ||
31 | 34 | ||
32 | #include "cbe_regs.h" | 35 | #include "cbe_regs.h" |
33 | 36 | ||
@@ -68,6 +71,38 @@ static u64 MIC_Slow_Next_Timer_table[] = { | |||
68 | * hardware specific functions | 71 | * hardware specific functions |
69 | */ | 72 | */ |
70 | 73 | ||
74 | static struct of_device *pmi_dev; | ||
75 | |||
76 | static int set_pmode_pmi(int cpu, unsigned int pmode) | ||
77 | { | ||
78 | int ret; | ||
79 | pmi_message_t pmi_msg; | ||
80 | #ifdef DEBUG | ||
81 | u64 time; | ||
82 | #endif | ||
83 | |||
84 | pmi_msg.type = PMI_TYPE_FREQ_CHANGE; | ||
85 | pmi_msg.data1 = cbe_cpu_to_node(cpu); | ||
86 | pmi_msg.data2 = pmode; | ||
87 | |||
88 | #ifdef DEBUG | ||
89 | time = (u64) get_cycles(); | ||
90 | #endif | ||
91 | |||
92 | pmi_send_message(pmi_dev, pmi_msg); | ||
93 | ret = pmi_msg.data2; | ||
94 | |||
95 | pr_debug("PMI returned slow mode %d\n", ret); | ||
96 | |||
97 | #ifdef DEBUG | ||
98 | time = (u64) get_cycles() - time; /* actual cycles (not cpu cycles!) */ | ||
99 | time = 1000000000 * time / CLOCK_TICK_RATE; /* time in ns (10^-9) */ | ||
100 | pr_debug("had to wait %lu ns for a transition\n", time); | ||
101 | #endif | ||
102 | return ret; | ||
103 | } | ||
104 | |||
105 | |||
71 | static int get_pmode(int cpu) | 106 | static int get_pmode(int cpu) |
72 | { | 107 | { |
73 | int ret; | 108 | int ret; |
@@ -79,7 +114,7 @@ static int get_pmode(int cpu) | |||
79 | return ret; | 114 | return ret; |
80 | } | 115 | } |
81 | 116 | ||
82 | static int set_pmode(int cpu, unsigned int pmode) | 117 | static int set_pmode_reg(int cpu, unsigned int pmode) |
83 | { | 118 | { |
84 | struct cbe_pmd_regs __iomem *pmd_regs; | 119 | struct cbe_pmd_regs __iomem *pmd_regs; |
85 | struct cbe_mic_tm_regs __iomem *mic_tm_regs; | 120 | struct cbe_mic_tm_regs __iomem *mic_tm_regs; |
@@ -120,37 +155,71 @@ static int set_pmode(int cpu, unsigned int pmode) | |||
120 | return 0; | 155 | return 0; |
121 | } | 156 | } |
122 | 157 | ||
158 | static int set_pmode(int cpu, unsigned int slow_mode) { | ||
159 | if (pmi_dev) | ||
160 | return set_pmode_pmi(cpu, slow_mode); | ||
161 | else | ||
162 | return set_pmode_reg(cpu, slow_mode); | ||
163 | } | ||
164 | |||
165 | static void cbe_cpufreq_handle_pmi(struct of_device *dev, pmi_message_t pmi_msg) | ||
166 | { | ||
167 | struct cpufreq_policy policy; | ||
168 | u8 cpu; | ||
169 | u8 cbe_pmode_new; | ||
170 | |||
171 | BUG_ON(pmi_msg.type != PMI_TYPE_FREQ_CHANGE); | ||
172 | |||
173 | cpu = cbe_node_to_cpu(pmi_msg.data1); | ||
174 | cbe_pmode_new = pmi_msg.data2; | ||
175 | |||
176 | cpufreq_get_policy(&policy, cpu); | ||
177 | |||
178 | policy.max = min(policy.max, cbe_freqs[cbe_pmode_new].frequency); | ||
179 | policy.min = min(policy.min, policy.max); | ||
180 | |||
181 | pr_debug("cbe_handle_pmi: new policy.min=%d policy.max=%d\n", policy.min, policy.max); | ||
182 | cpufreq_set_policy(&policy); | ||
183 | } | ||
184 | |||
185 | static struct pmi_handler cbe_pmi_handler = { | ||
186 | .type = PMI_TYPE_FREQ_CHANGE, | ||
187 | .handle_pmi_message = cbe_cpufreq_handle_pmi, | ||
188 | }; | ||
189 | |||
190 | |||
123 | /* | 191 | /* |
124 | * cpufreq functions | 192 | * cpufreq functions |
125 | */ | 193 | */ |
126 | 194 | ||
127 | static int cbe_cpufreq_cpu_init (struct cpufreq_policy *policy) | 195 | static int cbe_cpufreq_cpu_init(struct cpufreq_policy *policy) |
128 | { | 196 | { |
129 | u32 *max_freq; | 197 | const u32 *max_freqp; |
198 | u32 max_freq; | ||
130 | int i, cur_pmode; | 199 | int i, cur_pmode; |
131 | struct device_node *cpu; | 200 | struct device_node *cpu; |
132 | 201 | ||
133 | cpu = of_get_cpu_node(policy->cpu, NULL); | 202 | cpu = of_get_cpu_node(policy->cpu, NULL); |
134 | 203 | ||
135 | if(!cpu) | 204 | if (!cpu) |
136 | return -ENODEV; | 205 | return -ENODEV; |
137 | 206 | ||
138 | pr_debug("init cpufreq on CPU %d\n", policy->cpu); | 207 | pr_debug("init cpufreq on CPU %d\n", policy->cpu); |
139 | 208 | ||
140 | max_freq = (u32*) get_property(cpu, "clock-frequency", NULL); | 209 | max_freqp = of_get_property(cpu, "clock-frequency", NULL); |
141 | 210 | ||
142 | if(!max_freq) | 211 | if (!max_freqp) |
143 | return -EINVAL; | 212 | return -EINVAL; |
144 | 213 | ||
145 | // we need the freq in kHz | 214 | /* we need the freq in kHz */ |
146 | *max_freq /= 1000; | 215 | max_freq = *max_freqp / 1000; |
147 | 216 | ||
148 | pr_debug("max clock-frequency is at %u kHz\n", *max_freq); | 217 | pr_debug("max clock-frequency is at %u kHz\n", max_freq); |
149 | pr_debug("initializing frequency table\n"); | 218 | pr_debug("initializing frequency table\n"); |
150 | 219 | ||
151 | // initialize frequency table | 220 | /* initialize frequency table */ |
152 | for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) { | 221 | for (i=0; cbe_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) { |
153 | cbe_freqs[i].frequency = *max_freq / cbe_freqs[i].index; | 222 | cbe_freqs[i].frequency = max_freq / cbe_freqs[i].index; |
154 | pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); | 223 | pr_debug("%d: %d\n", i, cbe_freqs[i].frequency); |
155 | } | 224 | } |
156 | 225 | ||
@@ -167,10 +236,10 @@ static int cbe_cpufreq_cpu_init (struct cpufreq_policy *policy) | |||
167 | policy->cpus = cpu_sibling_map[policy->cpu]; | 236 | policy->cpus = cpu_sibling_map[policy->cpu]; |
168 | #endif | 237 | #endif |
169 | 238 | ||
170 | cpufreq_frequency_table_get_attr (cbe_freqs, policy->cpu); | 239 | cpufreq_frequency_table_get_attr(cbe_freqs, policy->cpu); |
171 | 240 | ||
172 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ | 241 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max are set correctly */ |
173 | return cpufreq_frequency_table_cpuinfo (policy, cbe_freqs); | 242 | return cpufreq_frequency_table_cpuinfo(policy, cbe_freqs); |
174 | } | 243 | } |
175 | 244 | ||
176 | static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) | 245 | static int cbe_cpufreq_cpu_exit(struct cpufreq_policy *policy) |
@@ -202,7 +271,7 @@ static int cbe_cpufreq_target(struct cpufreq_policy *policy, unsigned int target | |||
202 | freqs.new = cbe_freqs[cbe_pmode_new].frequency; | 271 | freqs.new = cbe_freqs[cbe_pmode_new].frequency; |
203 | freqs.cpu = policy->cpu; | 272 | freqs.cpu = policy->cpu; |
204 | 273 | ||
205 | mutex_lock (&cbe_switch_mutex); | 274 | mutex_lock(&cbe_switch_mutex); |
206 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | 275 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); |
207 | 276 | ||
208 | pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", | 277 | pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", |
@@ -233,11 +302,26 @@ static struct cpufreq_driver cbe_cpufreq_driver = { | |||
233 | 302 | ||
234 | static int __init cbe_cpufreq_init(void) | 303 | static int __init cbe_cpufreq_init(void) |
235 | { | 304 | { |
305 | struct device_node *np; | ||
306 | |||
307 | if (!machine_is(cell)) | ||
308 | return -ENODEV; | ||
309 | |||
310 | np = of_find_node_by_type(NULL, "ibm,pmi"); | ||
311 | |||
312 | pmi_dev = of_find_device_by_node(np); | ||
313 | |||
314 | if (pmi_dev) | ||
315 | pmi_register_handler(pmi_dev, &cbe_pmi_handler); | ||
316 | |||
236 | return cpufreq_register_driver(&cbe_cpufreq_driver); | 317 | return cpufreq_register_driver(&cbe_cpufreq_driver); |
237 | } | 318 | } |
238 | 319 | ||
239 | static void __exit cbe_cpufreq_exit(void) | 320 | static void __exit cbe_cpufreq_exit(void) |
240 | { | 321 | { |
322 | if (pmi_dev) | ||
323 | pmi_unregister_handler(pmi_dev, &cbe_pmi_handler); | ||
324 | |||
241 | cpufreq_unregister_driver(&cbe_cpufreq_driver); | 325 | cpufreq_unregister_driver(&cbe_cpufreq_driver); |
242 | } | 326 | } |
243 | 327 | ||
diff --git a/arch/powerpc/platforms/cell/cbe_regs.c b/arch/powerpc/platforms/cell/cbe_regs.c index 9a0ee62691d5..12c9674b4b1f 100644 --- a/arch/powerpc/platforms/cell/cbe_regs.c +++ b/arch/powerpc/platforms/cell/cbe_regs.c | |||
@@ -14,6 +14,8 @@ | |||
14 | #include <asm/pgtable.h> | 14 | #include <asm/pgtable.h> |
15 | #include <asm/prom.h> | 15 | #include <asm/prom.h> |
16 | #include <asm/ptrace.h> | 16 | #include <asm/ptrace.h> |
17 | #include <asm/of_device.h> | ||
18 | #include <asm/of_platform.h> | ||
17 | 19 | ||
18 | #include "cbe_regs.h" | 20 | #include "cbe_regs.h" |
19 | 21 | ||
@@ -27,6 +29,7 @@ | |||
27 | static struct cbe_regs_map | 29 | static struct cbe_regs_map |
28 | { | 30 | { |
29 | struct device_node *cpu_node; | 31 | struct device_node *cpu_node; |
32 | struct device_node *be_node; | ||
30 | struct cbe_pmd_regs __iomem *pmd_regs; | 33 | struct cbe_pmd_regs __iomem *pmd_regs; |
31 | struct cbe_iic_regs __iomem *iic_regs; | 34 | struct cbe_iic_regs __iomem *iic_regs; |
32 | struct cbe_mic_tm_regs __iomem *mic_tm_regs; | 35 | struct cbe_mic_tm_regs __iomem *mic_tm_regs; |
@@ -37,30 +40,43 @@ static int cbe_regs_map_count; | |||
37 | static struct cbe_thread_map | 40 | static struct cbe_thread_map |
38 | { | 41 | { |
39 | struct device_node *cpu_node; | 42 | struct device_node *cpu_node; |
43 | struct device_node *be_node; | ||
40 | struct cbe_regs_map *regs; | 44 | struct cbe_regs_map *regs; |
45 | unsigned int thread_id; | ||
46 | unsigned int cbe_id; | ||
41 | } cbe_thread_map[NR_CPUS]; | 47 | } cbe_thread_map[NR_CPUS]; |
42 | 48 | ||
49 | static cpumask_t cbe_local_mask[MAX_CBE] = { [0 ... MAX_CBE-1] = CPU_MASK_NONE }; | ||
50 | static cpumask_t cbe_first_online_cpu = CPU_MASK_NONE; | ||
51 | |||
43 | static struct cbe_regs_map *cbe_find_map(struct device_node *np) | 52 | static struct cbe_regs_map *cbe_find_map(struct device_node *np) |
44 | { | 53 | { |
45 | int i; | 54 | int i; |
46 | struct device_node *tmp_np; | 55 | struct device_node *tmp_np; |
47 | 56 | ||
48 | if (strcasecmp(np->type, "spe") == 0) { | 57 | if (strcasecmp(np->type, "spe")) { |
49 | if (np->data == NULL) { | 58 | for (i = 0; i < cbe_regs_map_count; i++) |
50 | /* walk up path until cpu node was found */ | 59 | if (cbe_regs_maps[i].cpu_node == np || |
51 | tmp_np = np->parent; | 60 | cbe_regs_maps[i].be_node == np) |
52 | while (tmp_np != NULL && strcasecmp(tmp_np->type, "cpu") != 0) | 61 | return &cbe_regs_maps[i]; |
53 | tmp_np = tmp_np->parent; | 62 | return NULL; |
63 | } | ||
54 | 64 | ||
55 | np->data = cbe_find_map(tmp_np); | 65 | if (np->data) |
56 | } | ||
57 | return np->data; | 66 | return np->data; |
58 | } | ||
59 | 67 | ||
60 | for (i = 0; i < cbe_regs_map_count; i++) | 68 | /* walk up path until cpu or be node was found */ |
61 | if (cbe_regs_maps[i].cpu_node == np) | 69 | tmp_np = np; |
62 | return &cbe_regs_maps[i]; | 70 | do { |
63 | return NULL; | 71 | tmp_np = tmp_np->parent; |
72 | /* on a correct devicetree we wont get up to root */ | ||
73 | BUG_ON(!tmp_np); | ||
74 | } while (strcasecmp(tmp_np->type, "cpu") && | ||
75 | strcasecmp(tmp_np->type, "be")); | ||
76 | |||
77 | np->data = cbe_find_map(tmp_np); | ||
78 | |||
79 | return np->data; | ||
64 | } | 80 | } |
65 | 81 | ||
66 | struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np) | 82 | struct cbe_pmd_regs __iomem *cbe_get_pmd_regs(struct device_node *np) |
@@ -130,38 +146,105 @@ struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu) | |||
130 | } | 146 | } |
131 | EXPORT_SYMBOL_GPL(cbe_get_cpu_mic_tm_regs); | 147 | EXPORT_SYMBOL_GPL(cbe_get_cpu_mic_tm_regs); |
132 | 148 | ||
133 | /* FIXME | ||
134 | * This is little more than a stub at the moment. It should be | ||
135 | * fleshed out so that it works for both SMT and non-SMT, no | ||
136 | * matter if the passed cpu is odd or even. | ||
137 | * For SMT enabled, returns 0 for even-numbered cpu; otherwise 1. | ||
138 | * For SMT disabled, returns 0 for all cpus. | ||
139 | */ | ||
140 | u32 cbe_get_hw_thread_id(int cpu) | 149 | u32 cbe_get_hw_thread_id(int cpu) |
141 | { | 150 | { |
142 | return (cpu & 1); | 151 | return cbe_thread_map[cpu].thread_id; |
143 | } | 152 | } |
144 | EXPORT_SYMBOL_GPL(cbe_get_hw_thread_id); | 153 | EXPORT_SYMBOL_GPL(cbe_get_hw_thread_id); |
145 | 154 | ||
146 | void __init cbe_regs_init(void) | 155 | u32 cbe_cpu_to_node(int cpu) |
147 | { | 156 | { |
148 | int i; | 157 | return cbe_thread_map[cpu].cbe_id; |
149 | struct device_node *cpu; | 158 | } |
159 | EXPORT_SYMBOL_GPL(cbe_cpu_to_node); | ||
150 | 160 | ||
151 | /* Build local fast map of CPUs */ | 161 | u32 cbe_node_to_cpu(int node) |
152 | for_each_possible_cpu(i) | 162 | { |
153 | cbe_thread_map[i].cpu_node = of_get_cpu_node(i, NULL); | 163 | return find_first_bit( (unsigned long *) &cbe_local_mask[node], sizeof(cpumask_t)); |
164 | } | ||
165 | EXPORT_SYMBOL_GPL(cbe_node_to_cpu); | ||
154 | 166 | ||
155 | /* Find maps for each device tree CPU */ | 167 | static struct device_node *cbe_get_be_node(int cpu_id) |
156 | for_each_node_by_type(cpu, "cpu") { | 168 | { |
157 | struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++]; | 169 | struct device_node *np; |
170 | |||
171 | for_each_node_by_type (np, "be") { | ||
172 | int len,i; | ||
173 | const phandle *cpu_handle; | ||
174 | |||
175 | cpu_handle = of_get_property(np, "cpus", &len); | ||
176 | |||
177 | for (i=0; i<len; i++) | ||
178 | if (of_find_node_by_phandle(cpu_handle[i]) == of_get_cpu_node(cpu_id, NULL)) | ||
179 | return np; | ||
180 | } | ||
181 | |||
182 | return NULL; | ||
183 | } | ||
184 | |||
185 | void __init cbe_fill_regs_map(struct cbe_regs_map *map) | ||
186 | { | ||
187 | if(map->be_node) { | ||
188 | struct device_node *be, *np; | ||
189 | |||
190 | be = map->be_node; | ||
191 | |||
192 | for_each_node_by_type(np, "pervasive") | ||
193 | if (of_get_parent(np) == be) | ||
194 | map->pmd_regs = of_iomap(np, 0); | ||
195 | |||
196 | for_each_node_by_type(np, "CBEA-Internal-Interrupt-Controller") | ||
197 | if (of_get_parent(np) == be) | ||
198 | map->iic_regs = of_iomap(np, 2); | ||
158 | 199 | ||
200 | for_each_node_by_type(np, "mic-tm") | ||
201 | if (of_get_parent(np) == be) | ||
202 | map->mic_tm_regs = of_iomap(np, 0); | ||
203 | } else { | ||
204 | struct device_node *cpu; | ||
159 | /* That hack must die die die ! */ | 205 | /* That hack must die die die ! */ |
160 | const struct address_prop { | 206 | const struct address_prop { |
161 | unsigned long address; | 207 | unsigned long address; |
162 | unsigned int len; | 208 | unsigned int len; |
163 | } __attribute__((packed)) *prop; | 209 | } __attribute__((packed)) *prop; |
164 | 210 | ||
211 | cpu = map->cpu_node; | ||
212 | |||
213 | prop = of_get_property(cpu, "pervasive", NULL); | ||
214 | if (prop != NULL) | ||
215 | map->pmd_regs = ioremap(prop->address, prop->len); | ||
216 | |||
217 | prop = of_get_property(cpu, "iic", NULL); | ||
218 | if (prop != NULL) | ||
219 | map->iic_regs = ioremap(prop->address, prop->len); | ||
220 | |||
221 | prop = of_get_property(cpu, "mic-tm", NULL); | ||
222 | if (prop != NULL) | ||
223 | map->mic_tm_regs = ioremap(prop->address, prop->len); | ||
224 | } | ||
225 | } | ||
226 | |||
227 | |||
228 | void __init cbe_regs_init(void) | ||
229 | { | ||
230 | int i; | ||
231 | unsigned int thread_id; | ||
232 | struct device_node *cpu; | ||
233 | |||
234 | /* Build local fast map of CPUs */ | ||
235 | for_each_possible_cpu(i) { | ||
236 | cbe_thread_map[i].cpu_node = of_get_cpu_node(i, &thread_id); | ||
237 | cbe_thread_map[i].be_node = cbe_get_be_node(i); | ||
238 | cbe_thread_map[i].thread_id = thread_id; | ||
239 | } | ||
240 | |||
241 | /* Find maps for each device tree CPU */ | ||
242 | for_each_node_by_type(cpu, "cpu") { | ||
243 | struct cbe_regs_map *map; | ||
244 | unsigned int cbe_id; | ||
245 | |||
246 | cbe_id = cbe_regs_map_count++; | ||
247 | map = &cbe_regs_maps[cbe_id]; | ||
165 | 248 | ||
166 | if (cbe_regs_map_count > MAX_CBE) { | 249 | if (cbe_regs_map_count > MAX_CBE) { |
167 | printk(KERN_ERR "cbe_regs: More BE chips than supported" | 250 | printk(KERN_ERR "cbe_regs: More BE chips than supported" |
@@ -170,22 +253,21 @@ void __init cbe_regs_init(void) | |||
170 | return; | 253 | return; |
171 | } | 254 | } |
172 | map->cpu_node = cpu; | 255 | map->cpu_node = cpu; |
173 | for_each_possible_cpu(i) | ||
174 | if (cbe_thread_map[i].cpu_node == cpu) | ||
175 | cbe_thread_map[i].regs = map; | ||
176 | 256 | ||
177 | prop = get_property(cpu, "pervasive", NULL); | 257 | for_each_possible_cpu(i) { |
178 | if (prop != NULL) | 258 | struct cbe_thread_map *thread = &cbe_thread_map[i]; |
179 | map->pmd_regs = ioremap(prop->address, prop->len); | ||
180 | 259 | ||
181 | prop = get_property(cpu, "iic", NULL); | 260 | if (thread->cpu_node == cpu) { |
182 | if (prop != NULL) | 261 | thread->regs = map; |
183 | map->iic_regs = ioremap(prop->address, prop->len); | 262 | thread->cbe_id = cbe_id; |
263 | map->be_node = thread->be_node; | ||
264 | cpu_set(i, cbe_local_mask[cbe_id]); | ||
265 | if(thread->thread_id == 0) | ||
266 | cpu_set(i, cbe_first_online_cpu); | ||
267 | } | ||
268 | } | ||
184 | 269 | ||
185 | prop = (struct address_prop *)get_property(cpu, "mic-tm", | 270 | cbe_fill_regs_map(map); |
186 | NULL); | ||
187 | if (prop != NULL) | ||
188 | map->mic_tm_regs = ioremap(prop->address, prop->len); | ||
189 | } | 271 | } |
190 | } | 272 | } |
191 | 273 | ||
diff --git a/arch/powerpc/platforms/cell/cbe_regs.h b/arch/powerpc/platforms/cell/cbe_regs.h index 440a7ecc66ea..17d597144877 100644 --- a/arch/powerpc/platforms/cell/cbe_regs.h +++ b/arch/powerpc/platforms/cell/cbe_regs.h | |||
@@ -255,6 +255,11 @@ struct cbe_mic_tm_regs { | |||
255 | extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np); | 255 | extern struct cbe_mic_tm_regs __iomem *cbe_get_mic_tm_regs(struct device_node *np); |
256 | extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu); | 256 | extern struct cbe_mic_tm_regs __iomem *cbe_get_cpu_mic_tm_regs(int cpu); |
257 | 257 | ||
258 | /* some utility functions to deal with SMT */ | ||
259 | extern u32 cbe_get_hw_thread_id(int cpu); | ||
260 | extern u32 cbe_cpu_to_node(int cpu); | ||
261 | extern u32 cbe_node_to_cpu(int node); | ||
262 | |||
258 | /* Init this module early */ | 263 | /* Init this module early */ |
259 | extern void cbe_regs_init(void); | 264 | extern void cbe_regs_init(void); |
260 | 265 | ||
diff --git a/arch/powerpc/platforms/cell/cbe_thermal.c b/arch/powerpc/platforms/cell/cbe_thermal.c index 70e0d968d30f..f370f0fa6f4c 100644 --- a/arch/powerpc/platforms/cell/cbe_thermal.c +++ b/arch/powerpc/platforms/cell/cbe_thermal.c | |||
@@ -1,6 +1,31 @@ | |||
1 | /* | 1 | /* |
2 | * thermal support for the cell processor | 2 | * thermal support for the cell processor |
3 | * | 3 | * |
4 | * This module adds some sysfs attributes to cpu and spu nodes. | ||
5 | * Base for measurements are the digital thermal sensors (DTS) | ||
6 | * located on the chip. | ||
7 | * The accuracy is 2 degrees, starting from 65 up to 125 degrees celsius | ||
8 | * The attributes can be found under | ||
9 | * /sys/devices/system/cpu/cpuX/thermal | ||
10 | * /sys/devices/system/spu/spuX/thermal | ||
11 | * | ||
12 | * The following attributes are added for each node: | ||
13 | * temperature: | ||
14 | * contains the current temperature measured by the DTS | ||
15 | * throttle_begin: | ||
16 | * throttling begins when temperature is greater or equal to | ||
17 | * throttle_begin. Setting this value to 125 prevents throttling. | ||
18 | * throttle_end: | ||
19 | * throttling is being ceased, if the temperature is lower than | ||
20 | * throttle_end. Due to a delay between applying throttling and | ||
21 | * a reduced temperature this value should be less than throttle_begin. | ||
22 | * A value equal to throttle_begin provides only a very little hysteresis. | ||
23 | * throttle_full_stop: | ||
24 | * If the temperatrue is greater or equal to throttle_full_stop, | ||
25 | * full throttling is applied to the cpu or spu. This value should be | ||
26 | * greater than throttle_begin and throttle_end. Setting this value to | ||
27 | * 65 prevents the unit from running code at all. | ||
28 | * | ||
4 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 | 29 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 |
5 | * | 30 | * |
6 | * Author: Christian Krafft <krafft@de.ibm.com> | 31 | * Author: Christian Krafft <krafft@de.ibm.com> |
@@ -31,6 +56,26 @@ | |||
31 | #include "cbe_regs.h" | 56 | #include "cbe_regs.h" |
32 | #include "spu_priv1_mmio.h" | 57 | #include "spu_priv1_mmio.h" |
33 | 58 | ||
59 | #define TEMP_MIN 65 | ||
60 | #define TEMP_MAX 125 | ||
61 | |||
62 | #define SYSDEV_PREFIX_ATTR(_prefix,_name,_mode) \ | ||
63 | struct sysdev_attribute attr_ ## _prefix ## _ ## _name = { \ | ||
64 | .attr = { .name = __stringify(_name), .mode = _mode }, \ | ||
65 | .show = _prefix ## _show_ ## _name, \ | ||
66 | .store = _prefix ## _store_ ## _name, \ | ||
67 | }; | ||
68 | |||
69 | static inline u8 reg_to_temp(u8 reg_value) | ||
70 | { | ||
71 | return ((reg_value & 0x3f) << 1) + TEMP_MIN; | ||
72 | } | ||
73 | |||
74 | static inline u8 temp_to_reg(u8 temp) | ||
75 | { | ||
76 | return ((temp - TEMP_MIN) >> 1) & 0x3f; | ||
77 | } | ||
78 | |||
34 | static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) | 79 | static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) |
35 | { | 80 | { |
36 | struct spu *spu; | 81 | struct spu *spu; |
@@ -43,14 +88,14 @@ static struct cbe_pmd_regs __iomem *get_pmd_regs(struct sys_device *sysdev) | |||
43 | /* returns the value for a given spu in a given register */ | 88 | /* returns the value for a given spu in a given register */ |
44 | static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) | 89 | static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iomem *reg) |
45 | { | 90 | { |
46 | unsigned int *id; | 91 | const unsigned int *id; |
47 | union spe_reg value; | 92 | union spe_reg value; |
48 | struct spu *spu; | 93 | struct spu *spu; |
49 | 94 | ||
50 | /* getting the id from the reg attribute will not work on future device-tree layouts | 95 | /* getting the id from the reg attribute will not work on future device-tree layouts |
51 | * in future we should store the id to the spu struct and use it here */ | 96 | * in future we should store the id to the spu struct and use it here */ |
52 | spu = container_of(sysdev, struct spu, sysdev); | 97 | spu = container_of(sysdev, struct spu, sysdev); |
53 | id = (unsigned int *)get_property(spu_devnode(spu), "reg", NULL); | 98 | id = of_get_property(spu_devnode(spu), "reg", NULL); |
54 | value.val = in_be64(®->val); | 99 | value.val = in_be64(®->val); |
55 | 100 | ||
56 | return value.spe[*id]; | 101 | return value.spe[*id]; |
@@ -58,20 +103,81 @@ static u8 spu_read_register_value(struct sys_device *sysdev, union spe_reg __iom | |||
58 | 103 | ||
59 | static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) | 104 | static ssize_t spu_show_temp(struct sys_device *sysdev, char *buf) |
60 | { | 105 | { |
61 | int value; | 106 | u8 value; |
62 | struct cbe_pmd_regs __iomem *pmd_regs; | 107 | struct cbe_pmd_regs __iomem *pmd_regs; |
63 | 108 | ||
64 | pmd_regs = get_pmd_regs(sysdev); | 109 | pmd_regs = get_pmd_regs(sysdev); |
65 | 110 | ||
66 | value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); | 111 | value = spu_read_register_value(sysdev, &pmd_regs->ts_ctsr1); |
67 | /* clear all other bits */ | 112 | |
113 | return sprintf(buf, "%d\n", reg_to_temp(value)); | ||
114 | } | ||
115 | |||
116 | static ssize_t show_throttle(struct cbe_pmd_regs __iomem *pmd_regs, char *buf, int pos) | ||
117 | { | ||
118 | u64 value; | ||
119 | |||
120 | value = in_be64(&pmd_regs->tm_tpr.val); | ||
121 | /* access the corresponding byte */ | ||
122 | value >>= pos; | ||
68 | value &= 0x3F; | 123 | value &= 0x3F; |
69 | /* temp is stored in steps of 2 degrees */ | ||
70 | value *= 2; | ||
71 | /* base temp is 65 degrees */ | ||
72 | value += 65; | ||
73 | 124 | ||
74 | return sprintf(buf, "%d\n", (int) value); | 125 | return sprintf(buf, "%d\n", reg_to_temp(value)); |
126 | } | ||
127 | |||
128 | static ssize_t store_throttle(struct cbe_pmd_regs __iomem *pmd_regs, const char *buf, size_t size, int pos) | ||
129 | { | ||
130 | u64 reg_value; | ||
131 | int temp; | ||
132 | u64 new_value; | ||
133 | int ret; | ||
134 | |||
135 | ret = sscanf(buf, "%u", &temp); | ||
136 | |||
137 | if (ret != 1 || temp < TEMP_MIN || temp > TEMP_MAX) | ||
138 | return -EINVAL; | ||
139 | |||
140 | new_value = temp_to_reg(temp); | ||
141 | |||
142 | reg_value = in_be64(&pmd_regs->tm_tpr.val); | ||
143 | |||
144 | /* zero out bits for new value */ | ||
145 | reg_value &= ~(0xffull << pos); | ||
146 | /* set bits to new value */ | ||
147 | reg_value |= new_value << pos; | ||
148 | |||
149 | out_be64(&pmd_regs->tm_tpr.val, reg_value); | ||
150 | return size; | ||
151 | } | ||
152 | |||
153 | static ssize_t spu_show_throttle_end(struct sys_device *sysdev, char *buf) | ||
154 | { | ||
155 | return show_throttle(get_pmd_regs(sysdev), buf, 0); | ||
156 | } | ||
157 | |||
158 | static ssize_t spu_show_throttle_begin(struct sys_device *sysdev, char *buf) | ||
159 | { | ||
160 | return show_throttle(get_pmd_regs(sysdev), buf, 8); | ||
161 | } | ||
162 | |||
163 | static ssize_t spu_show_throttle_full_stop(struct sys_device *sysdev, char *buf) | ||
164 | { | ||
165 | return show_throttle(get_pmd_regs(sysdev), buf, 16); | ||
166 | } | ||
167 | |||
168 | static ssize_t spu_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size) | ||
169 | { | ||
170 | return store_throttle(get_pmd_regs(sysdev), buf, size, 0); | ||
171 | } | ||
172 | |||
173 | static ssize_t spu_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size) | ||
174 | { | ||
175 | return store_throttle(get_pmd_regs(sysdev), buf, size, 8); | ||
176 | } | ||
177 | |||
178 | static ssize_t spu_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size) | ||
179 | { | ||
180 | return store_throttle(get_pmd_regs(sysdev), buf, size, 16); | ||
75 | } | 181 | } |
76 | 182 | ||
77 | static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) | 183 | static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) |
@@ -82,16 +188,9 @@ static ssize_t ppe_show_temp(struct sys_device *sysdev, char *buf, int pos) | |||
82 | pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); | 188 | pmd_regs = cbe_get_cpu_pmd_regs(sysdev->id); |
83 | value = in_be64(&pmd_regs->ts_ctsr2); | 189 | value = in_be64(&pmd_regs->ts_ctsr2); |
84 | 190 | ||
85 | /* access the corresponding byte */ | 191 | value = (value >> pos) & 0x3f; |
86 | value >>= pos; | ||
87 | /* clear all other bits */ | ||
88 | value &= 0x3F; | ||
89 | /* temp is stored in steps of 2 degrees */ | ||
90 | value *= 2; | ||
91 | /* base temp is 65 degrees */ | ||
92 | value += 65; | ||
93 | 192 | ||
94 | return sprintf(buf, "%d\n", (int) value); | 193 | return sprintf(buf, "%d\n", reg_to_temp(value)); |
95 | } | 194 | } |
96 | 195 | ||
97 | 196 | ||
@@ -108,13 +207,52 @@ static ssize_t ppe_show_temp1(struct sys_device *sysdev, char *buf) | |||
108 | return ppe_show_temp(sysdev, buf, 0); | 207 | return ppe_show_temp(sysdev, buf, 0); |
109 | } | 208 | } |
110 | 209 | ||
210 | static ssize_t ppe_show_throttle_end(struct sys_device *sysdev, char *buf) | ||
211 | { | ||
212 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 32); | ||
213 | } | ||
214 | |||
215 | static ssize_t ppe_show_throttle_begin(struct sys_device *sysdev, char *buf) | ||
216 | { | ||
217 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 40); | ||
218 | } | ||
219 | |||
220 | static ssize_t ppe_show_throttle_full_stop(struct sys_device *sysdev, char *buf) | ||
221 | { | ||
222 | return show_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, 48); | ||
223 | } | ||
224 | |||
225 | static ssize_t ppe_store_throttle_end(struct sys_device *sysdev, const char *buf, size_t size) | ||
226 | { | ||
227 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 32); | ||
228 | } | ||
229 | |||
230 | static ssize_t ppe_store_throttle_begin(struct sys_device *sysdev, const char *buf, size_t size) | ||
231 | { | ||
232 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 40); | ||
233 | } | ||
234 | |||
235 | static ssize_t ppe_store_throttle_full_stop(struct sys_device *sysdev, const char *buf, size_t size) | ||
236 | { | ||
237 | return store_throttle(cbe_get_cpu_pmd_regs(sysdev->id), buf, size, 48); | ||
238 | } | ||
239 | |||
240 | |||
111 | static struct sysdev_attribute attr_spu_temperature = { | 241 | static struct sysdev_attribute attr_spu_temperature = { |
112 | .attr = {.name = "temperature", .mode = 0400 }, | 242 | .attr = {.name = "temperature", .mode = 0400 }, |
113 | .show = spu_show_temp, | 243 | .show = spu_show_temp, |
114 | }; | 244 | }; |
115 | 245 | ||
246 | static SYSDEV_PREFIX_ATTR(spu, throttle_end, 0600); | ||
247 | static SYSDEV_PREFIX_ATTR(spu, throttle_begin, 0600); | ||
248 | static SYSDEV_PREFIX_ATTR(spu, throttle_full_stop, 0600); | ||
249 | |||
250 | |||
116 | static struct attribute *spu_attributes[] = { | 251 | static struct attribute *spu_attributes[] = { |
117 | &attr_spu_temperature.attr, | 252 | &attr_spu_temperature.attr, |
253 | &attr_spu_throttle_end.attr, | ||
254 | &attr_spu_throttle_begin.attr, | ||
255 | &attr_spu_throttle_full_stop.attr, | ||
118 | NULL, | 256 | NULL, |
119 | }; | 257 | }; |
120 | 258 | ||
@@ -133,9 +271,16 @@ static struct sysdev_attribute attr_ppe_temperature1 = { | |||
133 | .show = ppe_show_temp1, | 271 | .show = ppe_show_temp1, |
134 | }; | 272 | }; |
135 | 273 | ||
274 | static SYSDEV_PREFIX_ATTR(ppe, throttle_end, 0600); | ||
275 | static SYSDEV_PREFIX_ATTR(ppe, throttle_begin, 0600); | ||
276 | static SYSDEV_PREFIX_ATTR(ppe, throttle_full_stop, 0600); | ||
277 | |||
136 | static struct attribute *ppe_attributes[] = { | 278 | static struct attribute *ppe_attributes[] = { |
137 | &attr_ppe_temperature0.attr, | 279 | &attr_ppe_temperature0.attr, |
138 | &attr_ppe_temperature1.attr, | 280 | &attr_ppe_temperature1.attr, |
281 | &attr_ppe_throttle_end.attr, | ||
282 | &attr_ppe_throttle_begin.attr, | ||
283 | &attr_ppe_throttle_full_stop.attr, | ||
139 | NULL, | 284 | NULL, |
140 | }; | 285 | }; |
141 | 286 | ||
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c index 6666d037eb44..4fc4e92775d0 100644 --- a/arch/powerpc/platforms/cell/interrupt.c +++ b/arch/powerpc/platforms/cell/interrupt.c | |||
@@ -261,7 +261,7 @@ static int iic_host_xlate(struct irq_host *h, struct device_node *ct, | |||
261 | return -ENODEV; | 261 | return -ENODEV; |
262 | if (intsize != 1) | 262 | if (intsize != 1) |
263 | return -ENODEV; | 263 | return -ENODEV; |
264 | val = get_property(ct, "#interrupt-cells", NULL); | 264 | val = of_get_property(ct, "#interrupt-cells", NULL); |
265 | if (val == NULL || *val != 1) | 265 | if (val == NULL || *val != 1) |
266 | return -ENODEV; | 266 | return -ENODEV; |
267 | 267 | ||
@@ -327,7 +327,7 @@ static int __init setup_iic(void) | |||
327 | if (!device_is_compatible(dn, | 327 | if (!device_is_compatible(dn, |
328 | "IBM,CBEA-Internal-Interrupt-Controller")) | 328 | "IBM,CBEA-Internal-Interrupt-Controller")) |
329 | continue; | 329 | continue; |
330 | np = get_property(dn, "ibm,interrupt-server-ranges", NULL); | 330 | np = of_get_property(dn, "ibm,interrupt-server-ranges", NULL); |
331 | if (np == NULL) { | 331 | if (np == NULL) { |
332 | printk(KERN_WARNING "IIC: CPU association not found\n"); | 332 | printk(KERN_WARNING "IIC: CPU association not found\n"); |
333 | of_node_put(dn); | 333 | of_node_put(dn); |
diff --git a/arch/powerpc/platforms/cell/io-workarounds.c b/arch/powerpc/platforms/cell/io-workarounds.c index 7c73128305ec..d68d920eb2c4 100644 --- a/arch/powerpc/platforms/cell/io-workarounds.c +++ b/arch/powerpc/platforms/cell/io-workarounds.c | |||
@@ -318,7 +318,7 @@ static int __init spider_pci_workaround_init(void) | |||
318 | */ | 318 | */ |
319 | list_for_each_entry(phb, &hose_list, list_node) { | 319 | list_for_each_entry(phb, &hose_list, list_node) { |
320 | struct device_node *np = phb->arch_data; | 320 | struct device_node *np = phb->arch_data; |
321 | const char *model = get_property(np, "model", NULL); | 321 | const char *model = of_get_property(np, "model", NULL); |
322 | 322 | ||
323 | /* If no model property or name isn't exactly "pci", skip */ | 323 | /* If no model property or name isn't exactly "pci", skip */ |
324 | if (model == NULL || strcmp(np->name, "pci")) | 324 | if (model == NULL || strcmp(np->name, "pci")) |
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c index 67d617b60a23..760caa76841a 100644 --- a/arch/powerpc/platforms/cell/iommu.c +++ b/arch/powerpc/platforms/cell/iommu.c | |||
@@ -291,9 +291,9 @@ static int cell_iommu_find_ioc(int nid, unsigned long *base) | |||
291 | const unsigned int *nidp; | 291 | const unsigned int *nidp; |
292 | const unsigned long *tmp; | 292 | const unsigned long *tmp; |
293 | 293 | ||
294 | nidp = get_property(np, "node-id", NULL); | 294 | nidp = of_get_property(np, "node-id", NULL); |
295 | if (nidp && *nidp == nid) { | 295 | if (nidp && *nidp == nid) { |
296 | tmp = get_property(np, "ioc-translation", NULL); | 296 | tmp = of_get_property(np, "ioc-translation", NULL); |
297 | if (tmp) { | 297 | if (tmp) { |
298 | *base = *tmp; | 298 | *base = *tmp; |
299 | of_node_put(np); | 299 | of_node_put(np); |
@@ -430,7 +430,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct device_node *np, | |||
430 | struct iommu_window *window; | 430 | struct iommu_window *window; |
431 | const unsigned int *ioid; | 431 | const unsigned int *ioid; |
432 | 432 | ||
433 | ioid = get_property(np, "ioid", NULL); | 433 | ioid = of_get_property(np, "ioid", NULL); |
434 | if (ioid == NULL) | 434 | if (ioid == NULL) |
435 | printk(KERN_WARNING "iommu: missing ioid for %s using 0\n", | 435 | printk(KERN_WARNING "iommu: missing ioid for %s using 0\n", |
436 | np->full_name); | 436 | np->full_name); |
@@ -496,7 +496,7 @@ static void cell_dma_dev_setup(struct device *dev) | |||
496 | struct dev_archdata *archdata = &dev->archdata; | 496 | struct dev_archdata *archdata = &dev->archdata; |
497 | 497 | ||
498 | /* If we run without iommu, no need to do anything */ | 498 | /* If we run without iommu, no need to do anything */ |
499 | if (pci_dma_ops == &dma_direct_ops) | 499 | if (get_pci_dma_ops() == &dma_direct_ops) |
500 | return; | 500 | return; |
501 | 501 | ||
502 | /* Current implementation uses the first window available in that | 502 | /* Current implementation uses the first window available in that |
@@ -530,7 +530,7 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action, | |||
530 | return 0; | 530 | return 0; |
531 | 531 | ||
532 | /* We use the PCI DMA ops */ | 532 | /* We use the PCI DMA ops */ |
533 | dev->archdata.dma_ops = pci_dma_ops; | 533 | dev->archdata.dma_ops = get_pci_dma_ops(); |
534 | 534 | ||
535 | cell_dma_dev_setup(dev); | 535 | cell_dma_dev_setup(dev); |
536 | 536 | ||
@@ -549,7 +549,7 @@ static int __init cell_iommu_get_window(struct device_node *np, | |||
549 | unsigned long index; | 549 | unsigned long index; |
550 | 550 | ||
551 | /* Use ibm,dma-window if available, else, hard code ! */ | 551 | /* Use ibm,dma-window if available, else, hard code ! */ |
552 | dma_window = get_property(np, "ibm,dma-window", NULL); | 552 | dma_window = of_get_property(np, "ibm,dma-window", NULL); |
553 | if (dma_window == NULL) { | 553 | if (dma_window == NULL) { |
554 | *base = 0; | 554 | *base = 0; |
555 | *size = 0x80000000u; | 555 | *size = 0x80000000u; |
@@ -646,7 +646,7 @@ static int __init cell_iommu_init_disabled(void) | |||
646 | unsigned long base = 0, size; | 646 | unsigned long base = 0, size; |
647 | 647 | ||
648 | /* When no iommu is present, we use direct DMA ops */ | 648 | /* When no iommu is present, we use direct DMA ops */ |
649 | pci_dma_ops = &dma_direct_ops; | 649 | set_pci_dma_ops(&dma_direct_ops); |
650 | 650 | ||
651 | /* First make sure all IOC translation is turned off */ | 651 | /* First make sure all IOC translation is turned off */ |
652 | cell_disable_iommus(); | 652 | cell_disable_iommus(); |
@@ -734,7 +734,7 @@ static int __init cell_iommu_init(void) | |||
734 | } | 734 | } |
735 | 735 | ||
736 | /* Setup default PCI iommu ops */ | 736 | /* Setup default PCI iommu ops */ |
737 | pci_dma_ops = &dma_iommu_ops; | 737 | set_pci_dma_ops(&dma_iommu_ops); |
738 | 738 | ||
739 | bail: | 739 | bail: |
740 | /* Register callbacks on OF platform device addition/removal | 740 | /* Register callbacks on OF platform device addition/removal |
diff --git a/arch/powerpc/platforms/cell/ras.c b/arch/powerpc/platforms/cell/ras.c index 0984c7071695..3961a085b432 100644 --- a/arch/powerpc/platforms/cell/ras.c +++ b/arch/powerpc/platforms/cell/ras.c | |||
@@ -3,11 +3,13 @@ | |||
3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
5 | #include <linux/smp.h> | 5 | #include <linux/smp.h> |
6 | #include <linux/reboot.h> | ||
6 | 7 | ||
7 | #include <asm/reg.h> | 8 | #include <asm/reg.h> |
8 | #include <asm/io.h> | 9 | #include <asm/io.h> |
9 | #include <asm/prom.h> | 10 | #include <asm/prom.h> |
10 | #include <asm/machdep.h> | 11 | #include <asm/machdep.h> |
12 | #include <asm/rtas.h> | ||
11 | 13 | ||
12 | #include "ras.h" | 14 | #include "ras.h" |
13 | #include "cbe_regs.h" | 15 | #include "cbe_regs.h" |
@@ -82,6 +84,164 @@ static int cbe_machine_check_handler(struct pt_regs *regs) | |||
82 | return 0; | 84 | return 0; |
83 | } | 85 | } |
84 | 86 | ||
87 | struct ptcal_area { | ||
88 | struct list_head list; | ||
89 | int nid; | ||
90 | int order; | ||
91 | struct page *pages; | ||
92 | }; | ||
93 | |||
94 | static LIST_HEAD(ptcal_list); | ||
95 | |||
96 | static int ptcal_start_tok, ptcal_stop_tok; | ||
97 | |||
98 | static int __init cbe_ptcal_enable_on_node(int nid, int order) | ||
99 | { | ||
100 | struct ptcal_area *area; | ||
101 | int ret = -ENOMEM; | ||
102 | unsigned long addr; | ||
103 | |||
104 | #ifdef CONFIG_CRASH_DUMP | ||
105 | rtas_call(ptcal_stop_tok, 1, 1, NULL, nid); | ||
106 | #endif | ||
107 | |||
108 | area = kmalloc(sizeof(*area), GFP_KERNEL); | ||
109 | if (!area) | ||
110 | goto out_err; | ||
111 | |||
112 | area->nid = nid; | ||
113 | area->order = order; | ||
114 | area->pages = alloc_pages_node(area->nid, GFP_KERNEL, area->order); | ||
115 | |||
116 | if (!area->pages) | ||
117 | goto out_free_area; | ||
118 | |||
119 | addr = __pa(page_address(area->pages)); | ||
120 | |||
121 | ret = -EIO; | ||
122 | if (rtas_call(ptcal_start_tok, 3, 1, NULL, area->nid, | ||
123 | (unsigned int)(addr >> 32), | ||
124 | (unsigned int)(addr & 0xffffffff))) { | ||
125 | printk(KERN_ERR "%s: error enabling PTCAL on node %d!\n", | ||
126 | __FUNCTION__, nid); | ||
127 | goto out_free_pages; | ||
128 | } | ||
129 | |||
130 | list_add(&area->list, &ptcal_list); | ||
131 | |||
132 | return 0; | ||
133 | |||
134 | out_free_pages: | ||
135 | __free_pages(area->pages, area->order); | ||
136 | out_free_area: | ||
137 | kfree(area); | ||
138 | out_err: | ||
139 | return ret; | ||
140 | } | ||
141 | |||
142 | static int __init cbe_ptcal_enable(void) | ||
143 | { | ||
144 | const u32 *size; | ||
145 | struct device_node *np; | ||
146 | int order, found_mic = 0; | ||
147 | |||
148 | np = of_find_node_by_path("/rtas"); | ||
149 | if (!np) | ||
150 | return -ENODEV; | ||
151 | |||
152 | size = of_get_property(np, "ibm,cbe-ptcal-size", NULL); | ||
153 | if (!size) | ||
154 | return -ENODEV; | ||
155 | |||
156 | pr_debug("%s: enabling PTCAL, size = 0x%x\n", __FUNCTION__, *size); | ||
157 | order = get_order(*size); | ||
158 | of_node_put(np); | ||
159 | |||
160 | /* support for malta device trees, with be@/mic@ nodes */ | ||
161 | for_each_node_by_type(np, "mic-tm") { | ||
162 | cbe_ptcal_enable_on_node(of_node_to_nid(np), order); | ||
163 | found_mic = 1; | ||
164 | } | ||
165 | |||
166 | if (found_mic) | ||
167 | return 0; | ||
168 | |||
169 | /* support for older device tree - use cpu nodes */ | ||
170 | for_each_node_by_type(np, "cpu") { | ||
171 | const u32 *nid = of_get_property(np, "node-id", NULL); | ||
172 | if (!nid) { | ||
173 | printk(KERN_ERR "%s: node %s is missing node-id?\n", | ||
174 | __FUNCTION__, np->full_name); | ||
175 | continue; | ||
176 | } | ||
177 | cbe_ptcal_enable_on_node(*nid, order); | ||
178 | found_mic = 1; | ||
179 | } | ||
180 | |||
181 | return found_mic ? 0 : -ENODEV; | ||
182 | } | ||
183 | |||
184 | static int cbe_ptcal_disable(void) | ||
185 | { | ||
186 | struct ptcal_area *area, *tmp; | ||
187 | int ret = 0; | ||
188 | |||
189 | pr_debug("%s: disabling PTCAL\n", __FUNCTION__); | ||
190 | |||
191 | list_for_each_entry_safe(area, tmp, &ptcal_list, list) { | ||
192 | /* disable ptcal on this node */ | ||
193 | if (rtas_call(ptcal_stop_tok, 1, 1, NULL, area->nid)) { | ||
194 | printk(KERN_ERR "%s: error disabling PTCAL " | ||
195 | "on node %d!\n", __FUNCTION__, | ||
196 | area->nid); | ||
197 | ret = -EIO; | ||
198 | continue; | ||
199 | } | ||
200 | |||
201 | /* ensure we can access the PTCAL area */ | ||
202 | memset(page_address(area->pages), 0, | ||
203 | 1 << (area->order + PAGE_SHIFT)); | ||
204 | |||
205 | /* clean up */ | ||
206 | list_del(&area->list); | ||
207 | __free_pages(area->pages, area->order); | ||
208 | kfree(area); | ||
209 | } | ||
210 | |||
211 | return ret; | ||
212 | } | ||
213 | |||
214 | static int cbe_ptcal_notify_reboot(struct notifier_block *nb, | ||
215 | unsigned long code, void *data) | ||
216 | { | ||
217 | return cbe_ptcal_disable(); | ||
218 | } | ||
219 | |||
220 | static struct notifier_block cbe_ptcal_reboot_notifier = { | ||
221 | .notifier_call = cbe_ptcal_notify_reboot | ||
222 | }; | ||
223 | |||
224 | int __init cbe_ptcal_init(void) | ||
225 | { | ||
226 | int ret; | ||
227 | ptcal_start_tok = rtas_token("ibm,cbe-start-ptcal"); | ||
228 | ptcal_stop_tok = rtas_token("ibm,cbe-stop-ptcal"); | ||
229 | |||
230 | if (ptcal_start_tok == RTAS_UNKNOWN_SERVICE | ||
231 | || ptcal_stop_tok == RTAS_UNKNOWN_SERVICE) | ||
232 | return -ENODEV; | ||
233 | |||
234 | ret = register_reboot_notifier(&cbe_ptcal_reboot_notifier); | ||
235 | if (ret) { | ||
236 | printk(KERN_ERR "Can't disable PTCAL, so not enabling\n"); | ||
237 | return ret; | ||
238 | } | ||
239 | |||
240 | return cbe_ptcal_enable(); | ||
241 | } | ||
242 | |||
243 | arch_initcall(cbe_ptcal_init); | ||
244 | |||
85 | void __init cbe_ras_init(void) | 245 | void __init cbe_ras_init(void) |
86 | { | 246 | { |
87 | unsigned long hid0; | 247 | unsigned long hid0; |
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c index 36989c2eee66..54b96183cb64 100644 --- a/arch/powerpc/platforms/cell/setup.c +++ b/arch/powerpc/platforms/cell/setup.c | |||
@@ -71,7 +71,7 @@ static void cell_show_cpuinfo(struct seq_file *m) | |||
71 | 71 | ||
72 | root = of_find_node_by_path("/"); | 72 | root = of_find_node_by_path("/"); |
73 | if (root) | 73 | if (root) |
74 | model = get_property(root, "model", NULL); | 74 | model = of_get_property(root, "model", NULL); |
75 | seq_printf(m, "machine\t\t: CHRP %s\n", model); | 75 | seq_printf(m, "machine\t\t: CHRP %s\n", model); |
76 | of_node_put(root); | 76 | of_node_put(root); |
77 | } | 77 | } |
@@ -190,15 +190,6 @@ static int __init cell_probe(void) | |||
190 | return 1; | 190 | return 1; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* | ||
194 | * Cell has no legacy IO; anything calling this function has to | ||
195 | * fail or bad things will happen | ||
196 | */ | ||
197 | static int cell_check_legacy_ioport(unsigned int baseport) | ||
198 | { | ||
199 | return -ENODEV; | ||
200 | } | ||
201 | |||
202 | define_machine(cell) { | 193 | define_machine(cell) { |
203 | .name = "Cell", | 194 | .name = "Cell", |
204 | .probe = cell_probe, | 195 | .probe = cell_probe, |
@@ -211,7 +202,6 @@ define_machine(cell) { | |||
211 | .get_rtc_time = rtas_get_rtc_time, | 202 | .get_rtc_time = rtas_get_rtc_time, |
212 | .set_rtc_time = rtas_set_rtc_time, | 203 | .set_rtc_time = rtas_set_rtc_time, |
213 | .calibrate_decr = generic_calibrate_decr, | 204 | .calibrate_decr = generic_calibrate_decr, |
214 | .check_legacy_ioport = cell_check_legacy_ioport, | ||
215 | .progress = cell_progress, | 205 | .progress = cell_progress, |
216 | .init_IRQ = cell_init_irq, | 206 | .init_IRQ = cell_init_irq, |
217 | .pci_setup_phb = rtas_setup_phb, | 207 | .pci_setup_phb = rtas_setup_phb, |
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c index 21a9ebd4978e..fb1f15797bbb 100644 --- a/arch/powerpc/platforms/cell/spider-pic.c +++ b/arch/powerpc/platforms/cell/spider-pic.c | |||
@@ -254,25 +254,25 @@ static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) | |||
254 | } | 254 | } |
255 | 255 | ||
256 | /* Now do the horrible hacks */ | 256 | /* Now do the horrible hacks */ |
257 | tmp = get_property(pic->of_node, "#interrupt-cells", NULL); | 257 | tmp = of_get_property(pic->of_node, "#interrupt-cells", NULL); |
258 | if (tmp == NULL) | 258 | if (tmp == NULL) |
259 | return NO_IRQ; | 259 | return NO_IRQ; |
260 | intsize = *tmp; | 260 | intsize = *tmp; |
261 | imap = get_property(pic->of_node, "interrupt-map", &imaplen); | 261 | imap = of_get_property(pic->of_node, "interrupt-map", &imaplen); |
262 | if (imap == NULL || imaplen < (intsize + 1)) | 262 | if (imap == NULL || imaplen < (intsize + 1)) |
263 | return NO_IRQ; | 263 | return NO_IRQ; |
264 | iic = of_find_node_by_phandle(imap[intsize]); | 264 | iic = of_find_node_by_phandle(imap[intsize]); |
265 | if (iic == NULL) | 265 | if (iic == NULL) |
266 | return NO_IRQ; | 266 | return NO_IRQ; |
267 | imap += intsize + 1; | 267 | imap += intsize + 1; |
268 | tmp = get_property(iic, "#interrupt-cells", NULL); | 268 | tmp = of_get_property(iic, "#interrupt-cells", NULL); |
269 | if (tmp == NULL) | 269 | if (tmp == NULL) |
270 | return NO_IRQ; | 270 | return NO_IRQ; |
271 | intsize = *tmp; | 271 | intsize = *tmp; |
272 | /* Assume unit is last entry of interrupt specifier */ | 272 | /* Assume unit is last entry of interrupt specifier */ |
273 | unit = imap[intsize - 1]; | 273 | unit = imap[intsize - 1]; |
274 | /* Ok, we have a unit, now let's try to get the node */ | 274 | /* Ok, we have a unit, now let's try to get the node */ |
275 | tmp = get_property(iic, "ibm,interrupt-server-ranges", NULL); | 275 | tmp = of_get_property(iic, "ibm,interrupt-server-ranges", NULL); |
276 | if (tmp == NULL) { | 276 | if (tmp == NULL) { |
277 | of_node_put(iic); | 277 | of_node_put(iic); |
278 | return NO_IRQ; | 278 | return NO_IRQ; |
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c index eba7a2641dce..fec51525252e 100644 --- a/arch/powerpc/platforms/cell/spu_base.c +++ b/arch/powerpc/platforms/cell/spu_base.c | |||
@@ -36,12 +36,14 @@ | |||
36 | #include <asm/xmon.h> | 36 | #include <asm/xmon.h> |
37 | 37 | ||
38 | const struct spu_management_ops *spu_management_ops; | 38 | const struct spu_management_ops *spu_management_ops; |
39 | EXPORT_SYMBOL_GPL(spu_management_ops); | ||
40 | |||
39 | const struct spu_priv1_ops *spu_priv1_ops; | 41 | const struct spu_priv1_ops *spu_priv1_ops; |
40 | 42 | ||
41 | static struct list_head spu_list[MAX_NUMNODES]; | 43 | static struct list_head spu_list[MAX_NUMNODES]; |
42 | static LIST_HEAD(spu_full_list); | 44 | static LIST_HEAD(spu_full_list); |
43 | static DEFINE_MUTEX(spu_mutex); | 45 | static DEFINE_MUTEX(spu_mutex); |
44 | static spinlock_t spu_list_lock = SPIN_LOCK_UNLOCKED; | 46 | static DEFINE_SPINLOCK(spu_list_lock); |
45 | 47 | ||
46 | EXPORT_SYMBOL_GPL(spu_priv1_ops); | 48 | EXPORT_SYMBOL_GPL(spu_priv1_ops); |
47 | 49 | ||
@@ -290,7 +292,6 @@ spu_irq_class_1(int irq, void *data) | |||
290 | 292 | ||
291 | return stat ? IRQ_HANDLED : IRQ_NONE; | 293 | return stat ? IRQ_HANDLED : IRQ_NONE; |
292 | } | 294 | } |
293 | EXPORT_SYMBOL_GPL(spu_irq_class_1_bottom); | ||
294 | 295 | ||
295 | static irqreturn_t | 296 | static irqreturn_t |
296 | spu_irq_class_2(int irq, void *data) | 297 | spu_irq_class_2(int irq, void *data) |
@@ -431,10 +432,11 @@ struct spu *spu_alloc_node(int node) | |||
431 | spu = list_entry(spu_list[node].next, struct spu, list); | 432 | spu = list_entry(spu_list[node].next, struct spu, list); |
432 | list_del_init(&spu->list); | 433 | list_del_init(&spu->list); |
433 | pr_debug("Got SPU %d %d\n", spu->number, spu->node); | 434 | pr_debug("Got SPU %d %d\n", spu->number, spu->node); |
434 | spu_init_channels(spu); | ||
435 | } | 435 | } |
436 | mutex_unlock(&spu_mutex); | 436 | mutex_unlock(&spu_mutex); |
437 | 437 | ||
438 | if (spu) | ||
439 | spu_init_channels(spu); | ||
438 | return spu; | 440 | return spu; |
439 | } | 441 | } |
440 | EXPORT_SYMBOL_GPL(spu_alloc_node); | 442 | EXPORT_SYMBOL_GPL(spu_alloc_node); |
@@ -461,108 +463,6 @@ void spu_free(struct spu *spu) | |||
461 | } | 463 | } |
462 | EXPORT_SYMBOL_GPL(spu_free); | 464 | EXPORT_SYMBOL_GPL(spu_free); |
463 | 465 | ||
464 | static int spu_handle_mm_fault(struct spu *spu) | ||
465 | { | ||
466 | struct mm_struct *mm = spu->mm; | ||
467 | struct vm_area_struct *vma; | ||
468 | u64 ea, dsisr, is_write; | ||
469 | int ret; | ||
470 | |||
471 | ea = spu->dar; | ||
472 | dsisr = spu->dsisr; | ||
473 | #if 0 | ||
474 | if (!IS_VALID_EA(ea)) { | ||
475 | return -EFAULT; | ||
476 | } | ||
477 | #endif /* XXX */ | ||
478 | if (mm == NULL) { | ||
479 | return -EFAULT; | ||
480 | } | ||
481 | if (mm->pgd == NULL) { | ||
482 | return -EFAULT; | ||
483 | } | ||
484 | |||
485 | down_read(&mm->mmap_sem); | ||
486 | vma = find_vma(mm, ea); | ||
487 | if (!vma) | ||
488 | goto bad_area; | ||
489 | if (vma->vm_start <= ea) | ||
490 | goto good_area; | ||
491 | if (!(vma->vm_flags & VM_GROWSDOWN)) | ||
492 | goto bad_area; | ||
493 | #if 0 | ||
494 | if (expand_stack(vma, ea)) | ||
495 | goto bad_area; | ||
496 | #endif /* XXX */ | ||
497 | good_area: | ||
498 | is_write = dsisr & MFC_DSISR_ACCESS_PUT; | ||
499 | if (is_write) { | ||
500 | if (!(vma->vm_flags & VM_WRITE)) | ||
501 | goto bad_area; | ||
502 | } else { | ||
503 | if (dsisr & MFC_DSISR_ACCESS_DENIED) | ||
504 | goto bad_area; | ||
505 | if (!(vma->vm_flags & (VM_READ | VM_EXEC))) | ||
506 | goto bad_area; | ||
507 | } | ||
508 | ret = 0; | ||
509 | switch (handle_mm_fault(mm, vma, ea, is_write)) { | ||
510 | case VM_FAULT_MINOR: | ||
511 | current->min_flt++; | ||
512 | break; | ||
513 | case VM_FAULT_MAJOR: | ||
514 | current->maj_flt++; | ||
515 | break; | ||
516 | case VM_FAULT_SIGBUS: | ||
517 | ret = -EFAULT; | ||
518 | goto bad_area; | ||
519 | case VM_FAULT_OOM: | ||
520 | ret = -ENOMEM; | ||
521 | goto bad_area; | ||
522 | default: | ||
523 | BUG(); | ||
524 | } | ||
525 | up_read(&mm->mmap_sem); | ||
526 | return ret; | ||
527 | |||
528 | bad_area: | ||
529 | up_read(&mm->mmap_sem); | ||
530 | return -EFAULT; | ||
531 | } | ||
532 | |||
533 | int spu_irq_class_1_bottom(struct spu *spu) | ||
534 | { | ||
535 | u64 ea, dsisr, access, error = 0UL; | ||
536 | int ret = 0; | ||
537 | |||
538 | ea = spu->dar; | ||
539 | dsisr = spu->dsisr; | ||
540 | if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) { | ||
541 | u64 flags; | ||
542 | |||
543 | access = (_PAGE_PRESENT | _PAGE_USER); | ||
544 | access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; | ||
545 | local_irq_save(flags); | ||
546 | if (hash_page(ea, access, 0x300) != 0) | ||
547 | error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; | ||
548 | local_irq_restore(flags); | ||
549 | } | ||
550 | if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) { | ||
551 | if ((ret = spu_handle_mm_fault(spu)) != 0) | ||
552 | error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; | ||
553 | else | ||
554 | error &= ~CLASS1_ENABLE_STORAGE_FAULT_INTR; | ||
555 | } | ||
556 | spu->dar = 0UL; | ||
557 | spu->dsisr = 0UL; | ||
558 | if (!error) { | ||
559 | spu_restart_dma(spu); | ||
560 | } else { | ||
561 | spu->dma_callback(spu, SPE_EVENT_SPE_DATA_STORAGE); | ||
562 | } | ||
563 | return ret; | ||
564 | } | ||
565 | |||
566 | struct sysdev_class spu_sysdev_class = { | 466 | struct sysdev_class spu_sysdev_class = { |
567 | set_kset_name("spu") | 467 | set_kset_name("spu") |
568 | }; | 468 | }; |
@@ -636,12 +536,6 @@ static int spu_create_sysdev(struct spu *spu) | |||
636 | return 0; | 536 | return 0; |
637 | } | 537 | } |
638 | 538 | ||
639 | static void spu_destroy_sysdev(struct spu *spu) | ||
640 | { | ||
641 | sysfs_remove_device_from_node(&spu->sysdev, spu->node); | ||
642 | sysdev_unregister(&spu->sysdev); | ||
643 | } | ||
644 | |||
645 | static int __init create_spu(void *data) | 539 | static int __init create_spu(void *data) |
646 | { | 540 | { |
647 | struct spu *spu; | 541 | struct spu *spu; |
@@ -693,58 +587,37 @@ out: | |||
693 | return ret; | 587 | return ret; |
694 | } | 588 | } |
695 | 589 | ||
696 | static void destroy_spu(struct spu *spu) | ||
697 | { | ||
698 | list_del_init(&spu->list); | ||
699 | list_del_init(&spu->full_list); | ||
700 | |||
701 | spu_destroy_sysdev(spu); | ||
702 | spu_free_irqs(spu); | ||
703 | spu_destroy_spu(spu); | ||
704 | kfree(spu); | ||
705 | } | ||
706 | |||
707 | static void cleanup_spu_base(void) | ||
708 | { | ||
709 | struct spu *spu, *tmp; | ||
710 | int node; | ||
711 | |||
712 | mutex_lock(&spu_mutex); | ||
713 | for (node = 0; node < MAX_NUMNODES; node++) { | ||
714 | list_for_each_entry_safe(spu, tmp, &spu_list[node], list) | ||
715 | destroy_spu(spu); | ||
716 | } | ||
717 | mutex_unlock(&spu_mutex); | ||
718 | sysdev_class_unregister(&spu_sysdev_class); | ||
719 | } | ||
720 | module_exit(cleanup_spu_base); | ||
721 | |||
722 | static int __init init_spu_base(void) | 590 | static int __init init_spu_base(void) |
723 | { | 591 | { |
724 | int i, ret; | 592 | int i, ret = 0; |
593 | |||
594 | for (i = 0; i < MAX_NUMNODES; i++) | ||
595 | INIT_LIST_HEAD(&spu_list[i]); | ||
725 | 596 | ||
726 | if (!spu_management_ops) | 597 | if (!spu_management_ops) |
727 | return 0; | 598 | goto out; |
728 | 599 | ||
729 | /* create sysdev class for spus */ | 600 | /* create sysdev class for spus */ |
730 | ret = sysdev_class_register(&spu_sysdev_class); | 601 | ret = sysdev_class_register(&spu_sysdev_class); |
731 | if (ret) | 602 | if (ret) |
732 | return ret; | 603 | goto out; |
733 | |||
734 | for (i = 0; i < MAX_NUMNODES; i++) | ||
735 | INIT_LIST_HEAD(&spu_list[i]); | ||
736 | 604 | ||
737 | ret = spu_enumerate_spus(create_spu); | 605 | ret = spu_enumerate_spus(create_spu); |
738 | 606 | ||
739 | if (ret) { | 607 | if (ret) { |
740 | printk(KERN_WARNING "%s: Error initializing spus\n", | 608 | printk(KERN_WARNING "%s: Error initializing spus\n", |
741 | __FUNCTION__); | 609 | __FUNCTION__); |
742 | cleanup_spu_base(); | 610 | goto out_unregister_sysdev_class; |
743 | return ret; | ||
744 | } | 611 | } |
745 | 612 | ||
746 | xmon_register_spus(&spu_full_list); | 613 | xmon_register_spus(&spu_full_list); |
747 | 614 | ||
615 | return 0; | ||
616 | |||
617 | out_unregister_sysdev_class: | ||
618 | sysdev_class_unregister(&spu_sysdev_class); | ||
619 | out: | ||
620 | |||
748 | return ret; | 621 | return ret; |
749 | } | 622 | } |
750 | module_init(init_spu_base); | 623 | module_init(init_spu_base); |
diff --git a/arch/powerpc/platforms/cell/spu_coredump.c b/arch/powerpc/platforms/cell/spu_coredump.c index 6915b418ee73..4fd37ff1e210 100644 --- a/arch/powerpc/platforms/cell/spu_coredump.c +++ b/arch/powerpc/platforms/cell/spu_coredump.c | |||
@@ -26,19 +26,18 @@ | |||
26 | 26 | ||
27 | #include <asm/spu.h> | 27 | #include <asm/spu.h> |
28 | 28 | ||
29 | static struct spu_coredump_calls spu_coredump_calls; | 29 | static struct spu_coredump_calls *spu_coredump_calls; |
30 | static DEFINE_MUTEX(spu_coredump_mutex); | 30 | static DEFINE_MUTEX(spu_coredump_mutex); |
31 | 31 | ||
32 | int arch_notes_size(void) | 32 | int arch_notes_size(void) |
33 | { | 33 | { |
34 | long ret; | 34 | long ret; |
35 | struct module *owner = spu_coredump_calls.owner; | ||
36 | 35 | ||
37 | ret = -ENOSYS; | 36 | ret = -ENOSYS; |
38 | mutex_lock(&spu_coredump_mutex); | 37 | mutex_lock(&spu_coredump_mutex); |
39 | if (owner && try_module_get(owner)) { | 38 | if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) { |
40 | ret = spu_coredump_calls.arch_notes_size(); | 39 | ret = spu_coredump_calls->arch_notes_size(); |
41 | module_put(owner); | 40 | module_put(spu_coredump_calls->owner); |
42 | } | 41 | } |
43 | mutex_unlock(&spu_coredump_mutex); | 42 | mutex_unlock(&spu_coredump_mutex); |
44 | return ret; | 43 | return ret; |
@@ -46,36 +45,35 @@ int arch_notes_size(void) | |||
46 | 45 | ||
47 | void arch_write_notes(struct file *file) | 46 | void arch_write_notes(struct file *file) |
48 | { | 47 | { |
49 | struct module *owner = spu_coredump_calls.owner; | ||
50 | |||
51 | mutex_lock(&spu_coredump_mutex); | 48 | mutex_lock(&spu_coredump_mutex); |
52 | if (owner && try_module_get(owner)) { | 49 | if (spu_coredump_calls && try_module_get(spu_coredump_calls->owner)) { |
53 | spu_coredump_calls.arch_write_notes(file); | 50 | spu_coredump_calls->arch_write_notes(file); |
54 | module_put(owner); | 51 | module_put(spu_coredump_calls->owner); |
55 | } | 52 | } |
56 | mutex_unlock(&spu_coredump_mutex); | 53 | mutex_unlock(&spu_coredump_mutex); |
57 | } | 54 | } |
58 | 55 | ||
59 | int register_arch_coredump_calls(struct spu_coredump_calls *calls) | 56 | int register_arch_coredump_calls(struct spu_coredump_calls *calls) |
60 | { | 57 | { |
61 | if (spu_coredump_calls.owner) | 58 | int ret = 0; |
62 | return -EBUSY; | 59 | |
63 | 60 | ||
64 | mutex_lock(&spu_coredump_mutex); | 61 | mutex_lock(&spu_coredump_mutex); |
65 | spu_coredump_calls.arch_notes_size = calls->arch_notes_size; | 62 | if (spu_coredump_calls) |
66 | spu_coredump_calls.arch_write_notes = calls->arch_write_notes; | 63 | ret = -EBUSY; |
67 | spu_coredump_calls.owner = calls->owner; | 64 | else |
65 | spu_coredump_calls = calls; | ||
68 | mutex_unlock(&spu_coredump_mutex); | 66 | mutex_unlock(&spu_coredump_mutex); |
69 | return 0; | 67 | return ret; |
70 | } | 68 | } |
71 | EXPORT_SYMBOL_GPL(register_arch_coredump_calls); | 69 | EXPORT_SYMBOL_GPL(register_arch_coredump_calls); |
72 | 70 | ||
73 | void unregister_arch_coredump_calls(struct spu_coredump_calls *calls) | 71 | void unregister_arch_coredump_calls(struct spu_coredump_calls *calls) |
74 | { | 72 | { |
75 | BUG_ON(spu_coredump_calls.owner != calls->owner); | 73 | BUG_ON(spu_coredump_calls != calls); |
76 | 74 | ||
77 | mutex_lock(&spu_coredump_mutex); | 75 | mutex_lock(&spu_coredump_mutex); |
78 | spu_coredump_calls.owner = NULL; | 76 | spu_coredump_calls = NULL; |
79 | mutex_unlock(&spu_coredump_mutex); | 77 | mutex_unlock(&spu_coredump_mutex); |
80 | } | 78 | } |
81 | EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); | 79 | EXPORT_SYMBOL_GPL(unregister_arch_coredump_calls); |
diff --git a/arch/powerpc/platforms/cell/spu_manage.c b/arch/powerpc/platforms/cell/spu_manage.c index e34599f53d28..1d4562ae463d 100644 --- a/arch/powerpc/platforms/cell/spu_manage.c +++ b/arch/powerpc/platforms/cell/spu_manage.c | |||
@@ -48,11 +48,11 @@ static u64 __init find_spu_unit_number(struct device_node *spe) | |||
48 | { | 48 | { |
49 | const unsigned int *prop; | 49 | const unsigned int *prop; |
50 | int proplen; | 50 | int proplen; |
51 | prop = get_property(spe, "unit-id", &proplen); | 51 | prop = of_get_property(spe, "unit-id", &proplen); |
52 | if (proplen == 4) | 52 | if (proplen == 4) |
53 | return (u64)*prop; | 53 | return (u64)*prop; |
54 | 54 | ||
55 | prop = get_property(spe, "reg", &proplen); | 55 | prop = of_get_property(spe, "reg", &proplen); |
56 | if (proplen == 4) | 56 | if (proplen == 4) |
57 | return (u64)*prop; | 57 | return (u64)*prop; |
58 | 58 | ||
@@ -76,12 +76,12 @@ static int __init spu_map_interrupts_old(struct spu *spu, | |||
76 | int nid; | 76 | int nid; |
77 | 77 | ||
78 | /* Get the interrupt source unit from the device-tree */ | 78 | /* Get the interrupt source unit from the device-tree */ |
79 | tmp = get_property(np, "isrc", NULL); | 79 | tmp = of_get_property(np, "isrc", NULL); |
80 | if (!tmp) | 80 | if (!tmp) |
81 | return -ENODEV; | 81 | return -ENODEV; |
82 | isrc = tmp[0]; | 82 | isrc = tmp[0]; |
83 | 83 | ||
84 | tmp = get_property(np->parent->parent, "node-id", NULL); | 84 | tmp = of_get_property(np->parent->parent, "node-id", NULL); |
85 | if (!tmp) { | 85 | if (!tmp) { |
86 | printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__); | 86 | printk(KERN_WARNING "%s: can't find node-id\n", __FUNCTION__); |
87 | nid = spu->node; | 87 | nid = spu->node; |
@@ -110,7 +110,7 @@ static void __iomem * __init spu_map_prop_old(struct spu *spu, | |||
110 | } __attribute__((packed)) *prop; | 110 | } __attribute__((packed)) *prop; |
111 | int proplen; | 111 | int proplen; |
112 | 112 | ||
113 | prop = get_property(n, name, &proplen); | 113 | prop = of_get_property(n, name, &proplen); |
114 | if (prop == NULL || proplen != sizeof (struct address_prop)) | 114 | if (prop == NULL || proplen != sizeof (struct address_prop)) |
115 | return NULL; | 115 | return NULL; |
116 | 116 | ||
@@ -124,11 +124,11 @@ static int __init spu_map_device_old(struct spu *spu) | |||
124 | int ret; | 124 | int ret; |
125 | 125 | ||
126 | ret = -ENODEV; | 126 | ret = -ENODEV; |
127 | spu->name = get_property(node, "name", NULL); | 127 | spu->name = of_get_property(node, "name", NULL); |
128 | if (!spu->name) | 128 | if (!spu->name) |
129 | goto out; | 129 | goto out; |
130 | 130 | ||
131 | prop = get_property(node, "local-store", NULL); | 131 | prop = of_get_property(node, "local-store", NULL); |
132 | if (!prop) | 132 | if (!prop) |
133 | goto out; | 133 | goto out; |
134 | spu->local_store_phys = *(unsigned long *)prop; | 134 | spu->local_store_phys = *(unsigned long *)prop; |
@@ -139,7 +139,7 @@ static int __init spu_map_device_old(struct spu *spu) | |||
139 | if (!spu->local_store) | 139 | if (!spu->local_store) |
140 | goto out; | 140 | goto out; |
141 | 141 | ||
142 | prop = get_property(node, "problem", NULL); | 142 | prop = of_get_property(node, "problem", NULL); |
143 | if (!prop) | 143 | if (!prop) |
144 | goto out_unmap; | 144 | goto out_unmap; |
145 | spu->problem_phys = *(unsigned long *)prop; | 145 | spu->problem_phys = *(unsigned long *)prop; |
@@ -226,7 +226,7 @@ static int __init spu_map_device(struct spu *spu) | |||
226 | struct device_node *np = spu->devnode; | 226 | struct device_node *np = spu->devnode; |
227 | int ret = -ENODEV; | 227 | int ret = -ENODEV; |
228 | 228 | ||
229 | spu->name = get_property(np, "name", NULL); | 229 | spu->name = of_get_property(np, "name", NULL); |
230 | if (!spu->name) | 230 | if (!spu->name) |
231 | goto out; | 231 | goto out; |
232 | 232 | ||
diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile index 472217d19faf..2cd89c11af5a 100644 --- a/arch/powerpc/platforms/cell/spufs/Makefile +++ b/arch/powerpc/platforms/cell/spufs/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | obj-y += switch.o | 1 | obj-y += switch.o fault.o |
2 | 2 | ||
3 | obj-$(CONFIG_SPU_FS) += spufs.o | 3 | obj-$(CONFIG_SPU_FS) += spufs.o |
4 | spufs-y += inode.o file.o context.o syscalls.o coredump.o | 4 | spufs-y += inode.o file.o context.o syscalls.o coredump.o |
diff --git a/arch/powerpc/platforms/cell/spufs/backing_ops.c b/arch/powerpc/platforms/cell/spufs/backing_ops.c index 1898f0d3a8b8..3322528fa6eb 100644 --- a/arch/powerpc/platforms/cell/spufs/backing_ops.c +++ b/arch/powerpc/platforms/cell/spufs/backing_ops.c | |||
@@ -350,6 +350,11 @@ static int spu_backing_send_mfc_command(struct spu_context *ctx, | |||
350 | return ret; | 350 | return ret; |
351 | } | 351 | } |
352 | 352 | ||
353 | static void spu_backing_restart_dma(struct spu_context *ctx) | ||
354 | { | ||
355 | /* nothing to do here */ | ||
356 | } | ||
357 | |||
353 | struct spu_context_ops spu_backing_ops = { | 358 | struct spu_context_ops spu_backing_ops = { |
354 | .mbox_read = spu_backing_mbox_read, | 359 | .mbox_read = spu_backing_mbox_read, |
355 | .mbox_stat_read = spu_backing_mbox_stat_read, | 360 | .mbox_stat_read = spu_backing_mbox_stat_read, |
@@ -376,4 +381,5 @@ struct spu_context_ops spu_backing_ops = { | |||
376 | .read_mfc_tagstatus = spu_backing_read_mfc_tagstatus, | 381 | .read_mfc_tagstatus = spu_backing_read_mfc_tagstatus, |
377 | .get_mfc_free_elements = spu_backing_get_mfc_free_elements, | 382 | .get_mfc_free_elements = spu_backing_get_mfc_free_elements, |
378 | .send_mfc_command = spu_backing_send_mfc_command, | 383 | .send_mfc_command = spu_backing_send_mfc_command, |
384 | .restart_dma = spu_backing_restart_dma, | ||
379 | }; | 385 | }; |
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c index 04ad2e364e97..a87d9ca3dba2 100644 --- a/arch/powerpc/platforms/cell/spufs/context.c +++ b/arch/powerpc/platforms/cell/spufs/context.c | |||
@@ -41,9 +41,10 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang) | |||
41 | goto out_free; | 41 | goto out_free; |
42 | } | 42 | } |
43 | spin_lock_init(&ctx->mmio_lock); | 43 | spin_lock_init(&ctx->mmio_lock); |
44 | spin_lock_init(&ctx->mapping_lock); | ||
44 | kref_init(&ctx->kref); | 45 | kref_init(&ctx->kref); |
45 | mutex_init(&ctx->state_mutex); | 46 | mutex_init(&ctx->state_mutex); |
46 | init_MUTEX(&ctx->run_sema); | 47 | mutex_init(&ctx->run_mutex); |
47 | init_waitqueue_head(&ctx->ibox_wq); | 48 | init_waitqueue_head(&ctx->ibox_wq); |
48 | init_waitqueue_head(&ctx->wbox_wq); | 49 | init_waitqueue_head(&ctx->wbox_wq); |
49 | init_waitqueue_head(&ctx->stop_wq); | 50 | init_waitqueue_head(&ctx->stop_wq); |
@@ -51,6 +52,7 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang) | |||
51 | ctx->state = SPU_STATE_SAVED; | 52 | ctx->state = SPU_STATE_SAVED; |
52 | ctx->ops = &spu_backing_ops; | 53 | ctx->ops = &spu_backing_ops; |
53 | ctx->owner = get_task_mm(current); | 54 | ctx->owner = get_task_mm(current); |
55 | INIT_LIST_HEAD(&ctx->rq); | ||
54 | if (gang) | 56 | if (gang) |
55 | spu_gang_add_ctx(gang, ctx); | 57 | spu_gang_add_ctx(gang, ctx); |
56 | ctx->rt_priority = current->rt_priority; | 58 | ctx->rt_priority = current->rt_priority; |
@@ -75,6 +77,7 @@ void destroy_spu_context(struct kref *kref) | |||
75 | spu_fini_csa(&ctx->csa); | 77 | spu_fini_csa(&ctx->csa); |
76 | if (ctx->gang) | 78 | if (ctx->gang) |
77 | spu_gang_remove_ctx(ctx->gang, ctx); | 79 | spu_gang_remove_ctx(ctx->gang, ctx); |
80 | BUG_ON(!list_empty(&ctx->rq)); | ||
78 | kfree(ctx); | 81 | kfree(ctx); |
79 | } | 82 | } |
80 | 83 | ||
@@ -119,46 +122,6 @@ void spu_unmap_mappings(struct spu_context *ctx) | |||
119 | } | 122 | } |
120 | 123 | ||
121 | /** | 124 | /** |
122 | * spu_acquire_exclusive - lock spu contex and protect against userspace access | ||
123 | * @ctx: spu contex to lock | ||
124 | * | ||
125 | * Note: | ||
126 | * Returns 0 and with the context locked on success | ||
127 | * Returns negative error and with the context _unlocked_ on failure. | ||
128 | */ | ||
129 | int spu_acquire_exclusive(struct spu_context *ctx) | ||
130 | { | ||
131 | int ret = -EINVAL; | ||
132 | |||
133 | spu_acquire(ctx); | ||
134 | /* | ||
135 | * Context is about to be freed, so we can't acquire it anymore. | ||
136 | */ | ||
137 | if (!ctx->owner) | ||
138 | goto out_unlock; | ||
139 | |||
140 | if (ctx->state == SPU_STATE_SAVED) { | ||
141 | ret = spu_activate(ctx, 0); | ||
142 | if (ret) | ||
143 | goto out_unlock; | ||
144 | } else { | ||
145 | /* | ||
146 | * We need to exclude userspace access to the context. | ||
147 | * | ||
148 | * To protect against memory access we invalidate all ptes | ||
149 | * and make sure the pagefault handlers block on the mutex. | ||
150 | */ | ||
151 | spu_unmap_mappings(ctx); | ||
152 | } | ||
153 | |||
154 | return 0; | ||
155 | |||
156 | out_unlock: | ||
157 | spu_release(ctx); | ||
158 | return ret; | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * spu_acquire_runnable - lock spu contex and make sure it is in runnable state | 125 | * spu_acquire_runnable - lock spu contex and make sure it is in runnable state |
163 | * @ctx: spu contex to lock | 126 | * @ctx: spu contex to lock |
164 | * | 127 | * |
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index 725e19561159..5d9ad5a0307b 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
@@ -169,12 +169,12 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i, | |||
169 | struct spu_context *ctx; | 169 | struct spu_context *ctx; |
170 | loff_t pos = 0; | 170 | loff_t pos = 0; |
171 | int sz, dfd, rc, total = 0; | 171 | int sz, dfd, rc, total = 0; |
172 | const int bufsz = 4096; | 172 | const int bufsz = PAGE_SIZE; |
173 | char *name; | 173 | char *name; |
174 | char fullname[80], *buf; | 174 | char fullname[80], *buf; |
175 | struct elf_note en; | 175 | struct elf_note en; |
176 | 176 | ||
177 | buf = kmalloc(bufsz, GFP_KERNEL); | 177 | buf = (void *)get_zeroed_page(GFP_KERNEL); |
178 | if (!buf) | 178 | if (!buf) |
179 | return; | 179 | return; |
180 | 180 | ||
@@ -187,9 +187,8 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i, | |||
187 | sz = spufs_coredump_read[i].size; | 187 | sz = spufs_coredump_read[i].size; |
188 | 188 | ||
189 | ctx = ctx_info->ctx; | 189 | ctx = ctx_info->ctx; |
190 | if (!ctx) { | 190 | if (!ctx) |
191 | return; | 191 | goto out; |
192 | } | ||
193 | 192 | ||
194 | sprintf(fullname, "SPU/%d/%s", dfd, name); | 193 | sprintf(fullname, "SPU/%d/%s", dfd, name); |
195 | en.n_namesz = strlen(fullname) + 1; | 194 | en.n_namesz = strlen(fullname) + 1; |
@@ -197,23 +196,25 @@ static void spufs_arch_write_note(struct spufs_ctx_info *ctx_info, int i, | |||
197 | en.n_type = NT_SPU; | 196 | en.n_type = NT_SPU; |
198 | 197 | ||
199 | if (!spufs_dump_write(file, &en, sizeof(en))) | 198 | if (!spufs_dump_write(file, &en, sizeof(en))) |
200 | return; | 199 | goto out; |
201 | if (!spufs_dump_write(file, fullname, en.n_namesz)) | 200 | if (!spufs_dump_write(file, fullname, en.n_namesz)) |
202 | return; | 201 | goto out; |
203 | if (!spufs_dump_seek(file, roundup((unsigned long)file->f_pos, 4))) | 202 | if (!spufs_dump_seek(file, roundup((unsigned long)file->f_pos, 4))) |
204 | return; | 203 | goto out; |
205 | 204 | ||
206 | do { | 205 | do { |
207 | rc = do_coredump_read(i, ctx, buf, bufsz, &pos); | 206 | rc = do_coredump_read(i, ctx, buf, bufsz, &pos); |
208 | if (rc > 0) { | 207 | if (rc > 0) { |
209 | if (!spufs_dump_write(file, buf, rc)) | 208 | if (!spufs_dump_write(file, buf, rc)) |
210 | return; | 209 | goto out; |
211 | total += rc; | 210 | total += rc; |
212 | } | 211 | } |
213 | } while (rc == bufsz && total < sz); | 212 | } while (rc == bufsz && total < sz); |
214 | 213 | ||
215 | spufs_dump_seek(file, roundup((unsigned long)file->f_pos | 214 | spufs_dump_seek(file, roundup((unsigned long)file->f_pos |
216 | - total + sz, 4)); | 215 | - total + sz, 4)); |
216 | out: | ||
217 | free_page((unsigned long)buf); | ||
217 | } | 218 | } |
218 | 219 | ||
219 | static void spufs_arch_write_notes(struct file *file) | 220 | static void spufs_arch_write_notes(struct file *file) |
diff --git a/arch/powerpc/platforms/cell/spufs/fault.c b/arch/powerpc/platforms/cell/spufs/fault.c new file mode 100644 index 000000000000..0f75c07e29d8 --- /dev/null +++ b/arch/powerpc/platforms/cell/spufs/fault.c | |||
@@ -0,0 +1,211 @@ | |||
1 | /* | ||
2 | * Low-level SPU handling | ||
3 | * | ||
4 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 | ||
5 | * | ||
6 | * Author: Arnd Bergmann <arndb@de.ibm.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2, or (at your option) | ||
11 | * any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
21 | */ | ||
22 | #include <linux/sched.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/module.h> | ||
25 | |||
26 | #include <asm/spu.h> | ||
27 | #include <asm/spu_csa.h> | ||
28 | |||
29 | #include "spufs.h" | ||
30 | |||
31 | /* | ||
32 | * This ought to be kept in sync with the powerpc specific do_page_fault | ||
33 | * function. Currently, there are a few corner cases that we haven't had | ||
34 | * to handle fortunately. | ||
35 | */ | ||
36 | static int spu_handle_mm_fault(struct mm_struct *mm, unsigned long ea, unsigned long dsisr) | ||
37 | { | ||
38 | struct vm_area_struct *vma; | ||
39 | unsigned long is_write; | ||
40 | int ret; | ||
41 | |||
42 | #if 0 | ||
43 | if (!IS_VALID_EA(ea)) { | ||
44 | return -EFAULT; | ||
45 | } | ||
46 | #endif /* XXX */ | ||
47 | if (mm == NULL) { | ||
48 | return -EFAULT; | ||
49 | } | ||
50 | if (mm->pgd == NULL) { | ||
51 | return -EFAULT; | ||
52 | } | ||
53 | |||
54 | down_read(&mm->mmap_sem); | ||
55 | vma = find_vma(mm, ea); | ||
56 | if (!vma) | ||
57 | goto bad_area; | ||
58 | if (vma->vm_start <= ea) | ||
59 | goto good_area; | ||
60 | if (!(vma->vm_flags & VM_GROWSDOWN)) | ||
61 | goto bad_area; | ||
62 | if (expand_stack(vma, ea)) | ||
63 | goto bad_area; | ||
64 | good_area: | ||
65 | is_write = dsisr & MFC_DSISR_ACCESS_PUT; | ||
66 | if (is_write) { | ||
67 | if (!(vma->vm_flags & VM_WRITE)) | ||
68 | goto bad_area; | ||
69 | } else { | ||
70 | if (dsisr & MFC_DSISR_ACCESS_DENIED) | ||
71 | goto bad_area; | ||
72 | if (!(vma->vm_flags & (VM_READ | VM_EXEC))) | ||
73 | goto bad_area; | ||
74 | } | ||
75 | ret = 0; | ||
76 | switch (handle_mm_fault(mm, vma, ea, is_write)) { | ||
77 | case VM_FAULT_MINOR: | ||
78 | current->min_flt++; | ||
79 | break; | ||
80 | case VM_FAULT_MAJOR: | ||
81 | current->maj_flt++; | ||
82 | break; | ||
83 | case VM_FAULT_SIGBUS: | ||
84 | ret = -EFAULT; | ||
85 | goto bad_area; | ||
86 | case VM_FAULT_OOM: | ||
87 | ret = -ENOMEM; | ||
88 | goto bad_area; | ||
89 | default: | ||
90 | BUG(); | ||
91 | } | ||
92 | up_read(&mm->mmap_sem); | ||
93 | return ret; | ||
94 | |||
95 | bad_area: | ||
96 | up_read(&mm->mmap_sem); | ||
97 | return -EFAULT; | ||
98 | } | ||
99 | |||
100 | static void spufs_handle_dma_error(struct spu_context *ctx, | ||
101 | unsigned long ea, int type) | ||
102 | { | ||
103 | if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) { | ||
104 | ctx->event_return |= type; | ||
105 | wake_up_all(&ctx->stop_wq); | ||
106 | } else { | ||
107 | siginfo_t info; | ||
108 | memset(&info, 0, sizeof(info)); | ||
109 | |||
110 | switch (type) { | ||
111 | case SPE_EVENT_INVALID_DMA: | ||
112 | info.si_signo = SIGBUS; | ||
113 | info.si_code = BUS_OBJERR; | ||
114 | break; | ||
115 | case SPE_EVENT_SPE_DATA_STORAGE: | ||
116 | info.si_signo = SIGBUS; | ||
117 | info.si_addr = (void __user *)ea; | ||
118 | info.si_code = BUS_ADRERR; | ||
119 | break; | ||
120 | case SPE_EVENT_DMA_ALIGNMENT: | ||
121 | info.si_signo = SIGBUS; | ||
122 | /* DAR isn't set for an alignment fault :( */ | ||
123 | info.si_code = BUS_ADRALN; | ||
124 | break; | ||
125 | case SPE_EVENT_SPE_ERROR: | ||
126 | info.si_signo = SIGILL; | ||
127 | info.si_addr = (void __user *)(unsigned long) | ||
128 | ctx->ops->npc_read(ctx) - 4; | ||
129 | info.si_code = ILL_ILLOPC; | ||
130 | break; | ||
131 | } | ||
132 | if (info.si_signo) | ||
133 | force_sig_info(info.si_signo, &info, current); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | void spufs_dma_callback(struct spu *spu, int type) | ||
138 | { | ||
139 | spufs_handle_dma_error(spu->ctx, spu->dar, type); | ||
140 | } | ||
141 | EXPORT_SYMBOL_GPL(spufs_dma_callback); | ||
142 | |||
143 | /* | ||
144 | * bottom half handler for page faults, we can't do this from | ||
145 | * interrupt context, since we might need to sleep. | ||
146 | * we also need to give up the mutex so we can get scheduled | ||
147 | * out while waiting for the backing store. | ||
148 | * | ||
149 | * TODO: try calling hash_page from the interrupt handler first | ||
150 | * in order to speed up the easy case. | ||
151 | */ | ||
152 | int spufs_handle_class1(struct spu_context *ctx) | ||
153 | { | ||
154 | u64 ea, dsisr, access; | ||
155 | unsigned long flags; | ||
156 | int ret; | ||
157 | |||
158 | /* | ||
159 | * dar and dsisr get passed from the registers | ||
160 | * to the spu_context, to this function, but not | ||
161 | * back to the spu if it gets scheduled again. | ||
162 | * | ||
163 | * if we don't handle the fault for a saved context | ||
164 | * in time, we can still expect to get the same fault | ||
165 | * the immediately after the context restore. | ||
166 | */ | ||
167 | if (ctx->state == SPU_STATE_RUNNABLE) { | ||
168 | ea = ctx->spu->dar; | ||
169 | dsisr = ctx->spu->dsisr; | ||
170 | ctx->spu->dar= ctx->spu->dsisr = 0; | ||
171 | } else { | ||
172 | ea = ctx->csa.priv1.mfc_dar_RW; | ||
173 | dsisr = ctx->csa.priv1.mfc_dsisr_RW; | ||
174 | ctx->csa.priv1.mfc_dar_RW = 0; | ||
175 | ctx->csa.priv1.mfc_dsisr_RW = 0; | ||
176 | } | ||
177 | |||
178 | if (!(dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED))) | ||
179 | return 0; | ||
180 | |||
181 | pr_debug("ctx %p: ea %016lx, dsisr %016lx state %d\n", ctx, ea, | ||
182 | dsisr, ctx->state); | ||
183 | |||
184 | /* we must not hold the lock when entering spu_handle_mm_fault */ | ||
185 | spu_release(ctx); | ||
186 | |||
187 | access = (_PAGE_PRESENT | _PAGE_USER); | ||
188 | access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; | ||
189 | local_irq_save(flags); | ||
190 | ret = hash_page(ea, access, 0x300); | ||
191 | local_irq_restore(flags); | ||
192 | |||
193 | /* hashing failed, so try the actual fault handler */ | ||
194 | if (ret) | ||
195 | ret = spu_handle_mm_fault(current->mm, ea, dsisr); | ||
196 | |||
197 | spu_acquire(ctx); | ||
198 | /* | ||
199 | * If we handled the fault successfully and are in runnable | ||
200 | * state, restart the DMA. | ||
201 | * In case of unhandled error report the problem to user space. | ||
202 | */ | ||
203 | if (!ret) { | ||
204 | if (ctx->spu) | ||
205 | ctx->ops->restart_dma(ctx); | ||
206 | } else | ||
207 | spufs_handle_dma_error(ctx, ea, SPE_EVENT_SPE_DATA_STORAGE); | ||
208 | |||
209 | return ret; | ||
210 | } | ||
211 | EXPORT_SYMBOL_GPL(spufs_handle_class1); | ||
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c index 505266a568d4..d010b2464a98 100644 --- a/arch/powerpc/platforms/cell/spufs/file.c +++ b/arch/powerpc/platforms/cell/spufs/file.c | |||
@@ -44,9 +44,25 @@ spufs_mem_open(struct inode *inode, struct file *file) | |||
44 | { | 44 | { |
45 | struct spufs_inode_info *i = SPUFS_I(inode); | 45 | struct spufs_inode_info *i = SPUFS_I(inode); |
46 | struct spu_context *ctx = i->i_ctx; | 46 | struct spu_context *ctx = i->i_ctx; |
47 | |||
48 | spin_lock(&ctx->mapping_lock); | ||
47 | file->private_data = ctx; | 49 | file->private_data = ctx; |
48 | ctx->local_store = inode->i_mapping; | 50 | if (!i->i_openers++) |
49 | smp_wmb(); | 51 | ctx->local_store = inode->i_mapping; |
52 | spin_unlock(&ctx->mapping_lock); | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | static int | ||
57 | spufs_mem_release(struct inode *inode, struct file *file) | ||
58 | { | ||
59 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
60 | struct spu_context *ctx = i->i_ctx; | ||
61 | |||
62 | spin_lock(&ctx->mapping_lock); | ||
63 | if (!--i->i_openers) | ||
64 | ctx->local_store = NULL; | ||
65 | spin_unlock(&ctx->mapping_lock); | ||
50 | return 0; | 66 | return 0; |
51 | } | 67 | } |
52 | 68 | ||
@@ -149,6 +165,7 @@ spufs_mem_mmap(struct file *file, struct vm_area_struct *vma) | |||
149 | 165 | ||
150 | static const struct file_operations spufs_mem_fops = { | 166 | static const struct file_operations spufs_mem_fops = { |
151 | .open = spufs_mem_open, | 167 | .open = spufs_mem_open, |
168 | .release = spufs_mem_release, | ||
152 | .read = spufs_mem_read, | 169 | .read = spufs_mem_read, |
153 | .write = spufs_mem_write, | 170 | .write = spufs_mem_write, |
154 | .llseek = generic_file_llseek, | 171 | .llseek = generic_file_llseek, |
@@ -238,16 +255,33 @@ static int spufs_cntl_open(struct inode *inode, struct file *file) | |||
238 | struct spufs_inode_info *i = SPUFS_I(inode); | 255 | struct spufs_inode_info *i = SPUFS_I(inode); |
239 | struct spu_context *ctx = i->i_ctx; | 256 | struct spu_context *ctx = i->i_ctx; |
240 | 257 | ||
258 | spin_lock(&ctx->mapping_lock); | ||
241 | file->private_data = ctx; | 259 | file->private_data = ctx; |
242 | ctx->cntl = inode->i_mapping; | 260 | if (!i->i_openers++) |
243 | smp_wmb(); | 261 | ctx->cntl = inode->i_mapping; |
262 | spin_unlock(&ctx->mapping_lock); | ||
244 | return simple_attr_open(inode, file, spufs_cntl_get, | 263 | return simple_attr_open(inode, file, spufs_cntl_get, |
245 | spufs_cntl_set, "0x%08lx"); | 264 | spufs_cntl_set, "0x%08lx"); |
246 | } | 265 | } |
247 | 266 | ||
267 | static int | ||
268 | spufs_cntl_release(struct inode *inode, struct file *file) | ||
269 | { | ||
270 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
271 | struct spu_context *ctx = i->i_ctx; | ||
272 | |||
273 | simple_attr_close(inode, file); | ||
274 | |||
275 | spin_lock(&ctx->mapping_lock); | ||
276 | if (!--i->i_openers) | ||
277 | ctx->cntl = NULL; | ||
278 | spin_unlock(&ctx->mapping_lock); | ||
279 | return 0; | ||
280 | } | ||
281 | |||
248 | static const struct file_operations spufs_cntl_fops = { | 282 | static const struct file_operations spufs_cntl_fops = { |
249 | .open = spufs_cntl_open, | 283 | .open = spufs_cntl_open, |
250 | .release = simple_attr_close, | 284 | .release = spufs_cntl_release, |
251 | .read = simple_attr_read, | 285 | .read = simple_attr_read, |
252 | .write = simple_attr_write, | 286 | .write = simple_attr_write, |
253 | .mmap = spufs_cntl_mmap, | 287 | .mmap = spufs_cntl_mmap, |
@@ -723,12 +757,28 @@ static int spufs_signal1_open(struct inode *inode, struct file *file) | |||
723 | { | 757 | { |
724 | struct spufs_inode_info *i = SPUFS_I(inode); | 758 | struct spufs_inode_info *i = SPUFS_I(inode); |
725 | struct spu_context *ctx = i->i_ctx; | 759 | struct spu_context *ctx = i->i_ctx; |
760 | |||
761 | spin_lock(&ctx->mapping_lock); | ||
726 | file->private_data = ctx; | 762 | file->private_data = ctx; |
727 | ctx->signal1 = inode->i_mapping; | 763 | if (!i->i_openers++) |
728 | smp_wmb(); | 764 | ctx->signal1 = inode->i_mapping; |
765 | spin_unlock(&ctx->mapping_lock); | ||
729 | return nonseekable_open(inode, file); | 766 | return nonseekable_open(inode, file); |
730 | } | 767 | } |
731 | 768 | ||
769 | static int | ||
770 | spufs_signal1_release(struct inode *inode, struct file *file) | ||
771 | { | ||
772 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
773 | struct spu_context *ctx = i->i_ctx; | ||
774 | |||
775 | spin_lock(&ctx->mapping_lock); | ||
776 | if (!--i->i_openers) | ||
777 | ctx->signal1 = NULL; | ||
778 | spin_unlock(&ctx->mapping_lock); | ||
779 | return 0; | ||
780 | } | ||
781 | |||
732 | static ssize_t __spufs_signal1_read(struct spu_context *ctx, char __user *buf, | 782 | static ssize_t __spufs_signal1_read(struct spu_context *ctx, char __user *buf, |
733 | size_t len, loff_t *pos) | 783 | size_t len, loff_t *pos) |
734 | { | 784 | { |
@@ -821,6 +871,7 @@ static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma) | |||
821 | 871 | ||
822 | static const struct file_operations spufs_signal1_fops = { | 872 | static const struct file_operations spufs_signal1_fops = { |
823 | .open = spufs_signal1_open, | 873 | .open = spufs_signal1_open, |
874 | .release = spufs_signal1_release, | ||
824 | .read = spufs_signal1_read, | 875 | .read = spufs_signal1_read, |
825 | .write = spufs_signal1_write, | 876 | .write = spufs_signal1_write, |
826 | .mmap = spufs_signal1_mmap, | 877 | .mmap = spufs_signal1_mmap, |
@@ -830,12 +881,28 @@ static int spufs_signal2_open(struct inode *inode, struct file *file) | |||
830 | { | 881 | { |
831 | struct spufs_inode_info *i = SPUFS_I(inode); | 882 | struct spufs_inode_info *i = SPUFS_I(inode); |
832 | struct spu_context *ctx = i->i_ctx; | 883 | struct spu_context *ctx = i->i_ctx; |
884 | |||
885 | spin_lock(&ctx->mapping_lock); | ||
833 | file->private_data = ctx; | 886 | file->private_data = ctx; |
834 | ctx->signal2 = inode->i_mapping; | 887 | if (!i->i_openers++) |
835 | smp_wmb(); | 888 | ctx->signal2 = inode->i_mapping; |
889 | spin_unlock(&ctx->mapping_lock); | ||
836 | return nonseekable_open(inode, file); | 890 | return nonseekable_open(inode, file); |
837 | } | 891 | } |
838 | 892 | ||
893 | static int | ||
894 | spufs_signal2_release(struct inode *inode, struct file *file) | ||
895 | { | ||
896 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
897 | struct spu_context *ctx = i->i_ctx; | ||
898 | |||
899 | spin_lock(&ctx->mapping_lock); | ||
900 | if (!--i->i_openers) | ||
901 | ctx->signal2 = NULL; | ||
902 | spin_unlock(&ctx->mapping_lock); | ||
903 | return 0; | ||
904 | } | ||
905 | |||
839 | static ssize_t __spufs_signal2_read(struct spu_context *ctx, char __user *buf, | 906 | static ssize_t __spufs_signal2_read(struct spu_context *ctx, char __user *buf, |
840 | size_t len, loff_t *pos) | 907 | size_t len, loff_t *pos) |
841 | { | 908 | { |
@@ -932,6 +999,7 @@ static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma) | |||
932 | 999 | ||
933 | static const struct file_operations spufs_signal2_fops = { | 1000 | static const struct file_operations spufs_signal2_fops = { |
934 | .open = spufs_signal2_open, | 1001 | .open = spufs_signal2_open, |
1002 | .release = spufs_signal2_release, | ||
935 | .read = spufs_signal2_read, | 1003 | .read = spufs_signal2_read, |
936 | .write = spufs_signal2_write, | 1004 | .write = spufs_signal2_write, |
937 | .mmap = spufs_signal2_mmap, | 1005 | .mmap = spufs_signal2_mmap, |
@@ -1031,13 +1099,30 @@ static int spufs_mss_open(struct inode *inode, struct file *file) | |||
1031 | struct spu_context *ctx = i->i_ctx; | 1099 | struct spu_context *ctx = i->i_ctx; |
1032 | 1100 | ||
1033 | file->private_data = i->i_ctx; | 1101 | file->private_data = i->i_ctx; |
1034 | ctx->mss = inode->i_mapping; | 1102 | |
1035 | smp_wmb(); | 1103 | spin_lock(&ctx->mapping_lock); |
1104 | if (!i->i_openers++) | ||
1105 | ctx->mss = inode->i_mapping; | ||
1106 | spin_unlock(&ctx->mapping_lock); | ||
1036 | return nonseekable_open(inode, file); | 1107 | return nonseekable_open(inode, file); |
1037 | } | 1108 | } |
1038 | 1109 | ||
1110 | static int | ||
1111 | spufs_mss_release(struct inode *inode, struct file *file) | ||
1112 | { | ||
1113 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
1114 | struct spu_context *ctx = i->i_ctx; | ||
1115 | |||
1116 | spin_lock(&ctx->mapping_lock); | ||
1117 | if (!--i->i_openers) | ||
1118 | ctx->mss = NULL; | ||
1119 | spin_unlock(&ctx->mapping_lock); | ||
1120 | return 0; | ||
1121 | } | ||
1122 | |||
1039 | static const struct file_operations spufs_mss_fops = { | 1123 | static const struct file_operations spufs_mss_fops = { |
1040 | .open = spufs_mss_open, | 1124 | .open = spufs_mss_open, |
1125 | .release = spufs_mss_release, | ||
1041 | .mmap = spufs_mss_mmap, | 1126 | .mmap = spufs_mss_mmap, |
1042 | }; | 1127 | }; |
1043 | 1128 | ||
@@ -1072,14 +1157,30 @@ static int spufs_psmap_open(struct inode *inode, struct file *file) | |||
1072 | struct spufs_inode_info *i = SPUFS_I(inode); | 1157 | struct spufs_inode_info *i = SPUFS_I(inode); |
1073 | struct spu_context *ctx = i->i_ctx; | 1158 | struct spu_context *ctx = i->i_ctx; |
1074 | 1159 | ||
1160 | spin_lock(&ctx->mapping_lock); | ||
1075 | file->private_data = i->i_ctx; | 1161 | file->private_data = i->i_ctx; |
1076 | ctx->psmap = inode->i_mapping; | 1162 | if (!i->i_openers++) |
1077 | smp_wmb(); | 1163 | ctx->psmap = inode->i_mapping; |
1164 | spin_unlock(&ctx->mapping_lock); | ||
1078 | return nonseekable_open(inode, file); | 1165 | return nonseekable_open(inode, file); |
1079 | } | 1166 | } |
1080 | 1167 | ||
1168 | static int | ||
1169 | spufs_psmap_release(struct inode *inode, struct file *file) | ||
1170 | { | ||
1171 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
1172 | struct spu_context *ctx = i->i_ctx; | ||
1173 | |||
1174 | spin_lock(&ctx->mapping_lock); | ||
1175 | if (!--i->i_openers) | ||
1176 | ctx->psmap = NULL; | ||
1177 | spin_unlock(&ctx->mapping_lock); | ||
1178 | return 0; | ||
1179 | } | ||
1180 | |||
1081 | static const struct file_operations spufs_psmap_fops = { | 1181 | static const struct file_operations spufs_psmap_fops = { |
1082 | .open = spufs_psmap_open, | 1182 | .open = spufs_psmap_open, |
1183 | .release = spufs_psmap_release, | ||
1083 | .mmap = spufs_psmap_mmap, | 1184 | .mmap = spufs_psmap_mmap, |
1084 | }; | 1185 | }; |
1085 | 1186 | ||
@@ -1126,12 +1227,27 @@ static int spufs_mfc_open(struct inode *inode, struct file *file) | |||
1126 | if (atomic_read(&inode->i_count) != 1) | 1227 | if (atomic_read(&inode->i_count) != 1) |
1127 | return -EBUSY; | 1228 | return -EBUSY; |
1128 | 1229 | ||
1230 | spin_lock(&ctx->mapping_lock); | ||
1129 | file->private_data = ctx; | 1231 | file->private_data = ctx; |
1130 | ctx->mfc = inode->i_mapping; | 1232 | if (!i->i_openers++) |
1131 | smp_wmb(); | 1233 | ctx->mfc = inode->i_mapping; |
1234 | spin_unlock(&ctx->mapping_lock); | ||
1132 | return nonseekable_open(inode, file); | 1235 | return nonseekable_open(inode, file); |
1133 | } | 1236 | } |
1134 | 1237 | ||
1238 | static int | ||
1239 | spufs_mfc_release(struct inode *inode, struct file *file) | ||
1240 | { | ||
1241 | struct spufs_inode_info *i = SPUFS_I(inode); | ||
1242 | struct spu_context *ctx = i->i_ctx; | ||
1243 | |||
1244 | spin_lock(&ctx->mapping_lock); | ||
1245 | if (!--i->i_openers) | ||
1246 | ctx->mfc = NULL; | ||
1247 | spin_unlock(&ctx->mapping_lock); | ||
1248 | return 0; | ||
1249 | } | ||
1250 | |||
1135 | /* interrupt-level mfc callback function. */ | 1251 | /* interrupt-level mfc callback function. */ |
1136 | void spufs_mfc_callback(struct spu *spu) | 1252 | void spufs_mfc_callback(struct spu *spu) |
1137 | { | 1253 | { |
@@ -1313,7 +1429,10 @@ static ssize_t spufs_mfc_write(struct file *file, const char __user *buffer, | |||
1313 | if (ret) | 1429 | if (ret) |
1314 | goto out; | 1430 | goto out; |
1315 | 1431 | ||
1316 | spu_acquire_runnable(ctx, 0); | 1432 | ret = spu_acquire_runnable(ctx, 0); |
1433 | if (ret) | ||
1434 | goto out; | ||
1435 | |||
1317 | if (file->f_flags & O_NONBLOCK) { | 1436 | if (file->f_flags & O_NONBLOCK) { |
1318 | ret = ctx->ops->send_mfc_command(ctx, &cmd); | 1437 | ret = ctx->ops->send_mfc_command(ctx, &cmd); |
1319 | } else { | 1438 | } else { |
@@ -1399,6 +1518,7 @@ static int spufs_mfc_fasync(int fd, struct file *file, int on) | |||
1399 | 1518 | ||
1400 | static const struct file_operations spufs_mfc_fops = { | 1519 | static const struct file_operations spufs_mfc_fops = { |
1401 | .open = spufs_mfc_open, | 1520 | .open = spufs_mfc_open, |
1521 | .release = spufs_mfc_release, | ||
1402 | .read = spufs_mfc_read, | 1522 | .read = spufs_mfc_read, |
1403 | .write = spufs_mfc_write, | 1523 | .write = spufs_mfc_write, |
1404 | .poll = spufs_mfc_poll, | 1524 | .poll = spufs_mfc_poll, |
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c index ae42e03b8c86..428875c5e4ec 100644 --- a/arch/powerpc/platforms/cell/spufs/hw_ops.c +++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c | |||
@@ -296,6 +296,14 @@ static int spu_hw_send_mfc_command(struct spu_context *ctx, | |||
296 | } | 296 | } |
297 | } | 297 | } |
298 | 298 | ||
299 | static void spu_hw_restart_dma(struct spu_context *ctx) | ||
300 | { | ||
301 | struct spu_priv2 __iomem *priv2 = ctx->spu->priv2; | ||
302 | |||
303 | if (!test_bit(SPU_CONTEXT_SWITCH_PENDING, &ctx->spu->flags)) | ||
304 | out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND); | ||
305 | } | ||
306 | |||
299 | struct spu_context_ops spu_hw_ops = { | 307 | struct spu_context_ops spu_hw_ops = { |
300 | .mbox_read = spu_hw_mbox_read, | 308 | .mbox_read = spu_hw_mbox_read, |
301 | .mbox_stat_read = spu_hw_mbox_stat_read, | 309 | .mbox_stat_read = spu_hw_mbox_stat_read, |
@@ -320,4 +328,5 @@ struct spu_context_ops spu_hw_ops = { | |||
320 | .read_mfc_tagstatus = spu_hw_read_mfc_tagstatus, | 328 | .read_mfc_tagstatus = spu_hw_read_mfc_tagstatus, |
321 | .get_mfc_free_elements = spu_hw_get_mfc_free_elements, | 329 | .get_mfc_free_elements = spu_hw_get_mfc_free_elements, |
322 | .send_mfc_command = spu_hw_send_mfc_command, | 330 | .send_mfc_command = spu_hw_send_mfc_command, |
331 | .restart_dma = spu_hw_restart_dma, | ||
323 | }; | 332 | }; |
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 8079983ef94f..13e4f70ec8c0 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/prom.h> | 36 | #include <asm/prom.h> |
37 | #include <asm/semaphore.h> | 37 | #include <asm/semaphore.h> |
38 | #include <asm/spu.h> | 38 | #include <asm/spu.h> |
39 | #include <asm/spu_priv1.h> | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | 41 | ||
41 | #include "spufs.h" | 42 | #include "spufs.h" |
@@ -54,6 +55,7 @@ spufs_alloc_inode(struct super_block *sb) | |||
54 | 55 | ||
55 | ei->i_gang = NULL; | 56 | ei->i_gang = NULL; |
56 | ei->i_ctx = NULL; | 57 | ei->i_ctx = NULL; |
58 | ei->i_openers = 0; | ||
57 | 59 | ||
58 | return &ei->vfs_inode; | 60 | return &ei->vfs_inode; |
59 | } | 61 | } |
@@ -520,13 +522,14 @@ out: | |||
520 | 522 | ||
521 | /* File system initialization */ | 523 | /* File system initialization */ |
522 | enum { | 524 | enum { |
523 | Opt_uid, Opt_gid, Opt_err, | 525 | Opt_uid, Opt_gid, Opt_mode, Opt_err, |
524 | }; | 526 | }; |
525 | 527 | ||
526 | static match_table_t spufs_tokens = { | 528 | static match_table_t spufs_tokens = { |
527 | { Opt_uid, "uid=%d" }, | 529 | { Opt_uid, "uid=%d" }, |
528 | { Opt_gid, "gid=%d" }, | 530 | { Opt_gid, "gid=%d" }, |
529 | { Opt_err, NULL }, | 531 | { Opt_mode, "mode=%o" }, |
532 | { Opt_err, NULL }, | ||
530 | }; | 533 | }; |
531 | 534 | ||
532 | static int | 535 | static int |
@@ -553,6 +556,11 @@ spufs_parse_options(char *options, struct inode *root) | |||
553 | return 0; | 556 | return 0; |
554 | root->i_gid = option; | 557 | root->i_gid = option; |
555 | break; | 558 | break; |
559 | case Opt_mode: | ||
560 | if (match_octal(&args[0], &option)) | ||
561 | return 0; | ||
562 | root->i_mode = option | S_IFDIR; | ||
563 | break; | ||
556 | default: | 564 | default: |
557 | return 0; | 565 | return 0; |
558 | } | 566 | } |
@@ -560,6 +568,11 @@ spufs_parse_options(char *options, struct inode *root) | |||
560 | return 1; | 568 | return 1; |
561 | } | 569 | } |
562 | 570 | ||
571 | static void spufs_exit_isolated_loader(void) | ||
572 | { | ||
573 | kfree(isolated_loader); | ||
574 | } | ||
575 | |||
563 | static void | 576 | static void |
564 | spufs_init_isolated_loader(void) | 577 | spufs_init_isolated_loader(void) |
565 | { | 578 | { |
@@ -571,7 +584,7 @@ spufs_init_isolated_loader(void) | |||
571 | if (!dn) | 584 | if (!dn) |
572 | return; | 585 | return; |
573 | 586 | ||
574 | loader = get_property(dn, "loader", &size); | 587 | loader = of_get_property(dn, "loader", &size); |
575 | if (!loader) | 588 | if (!loader) |
576 | return; | 589 | return; |
577 | 590 | ||
@@ -653,6 +666,10 @@ static int __init spufs_init(void) | |||
653 | { | 666 | { |
654 | int ret; | 667 | int ret; |
655 | 668 | ||
669 | ret = -ENODEV; | ||
670 | if (!spu_management_ops) | ||
671 | goto out; | ||
672 | |||
656 | ret = -ENOMEM; | 673 | ret = -ENOMEM; |
657 | spufs_inode_cache = kmem_cache_create("spufs_inode_cache", | 674 | spufs_inode_cache = kmem_cache_create("spufs_inode_cache", |
658 | sizeof(struct spufs_inode_info), 0, | 675 | sizeof(struct spufs_inode_info), 0, |
@@ -660,25 +677,29 @@ static int __init spufs_init(void) | |||
660 | 677 | ||
661 | if (!spufs_inode_cache) | 678 | if (!spufs_inode_cache) |
662 | goto out; | 679 | goto out; |
663 | if (spu_sched_init() != 0) { | 680 | ret = spu_sched_init(); |
664 | kmem_cache_destroy(spufs_inode_cache); | ||
665 | goto out; | ||
666 | } | ||
667 | ret = register_filesystem(&spufs_type); | ||
668 | if (ret) | 681 | if (ret) |
669 | goto out_cache; | 682 | goto out_cache; |
683 | ret = register_filesystem(&spufs_type); | ||
684 | if (ret) | ||
685 | goto out_sched; | ||
670 | ret = register_spu_syscalls(&spufs_calls); | 686 | ret = register_spu_syscalls(&spufs_calls); |
671 | if (ret) | 687 | if (ret) |
672 | goto out_fs; | 688 | goto out_fs; |
673 | ret = register_arch_coredump_calls(&spufs_coredump_calls); | 689 | ret = register_arch_coredump_calls(&spufs_coredump_calls); |
674 | if (ret) | 690 | if (ret) |
675 | goto out_fs; | 691 | goto out_syscalls; |
676 | 692 | ||
677 | spufs_init_isolated_loader(); | 693 | spufs_init_isolated_loader(); |
678 | 694 | ||
679 | return 0; | 695 | return 0; |
696 | |||
697 | out_syscalls: | ||
698 | unregister_spu_syscalls(&spufs_calls); | ||
680 | out_fs: | 699 | out_fs: |
681 | unregister_filesystem(&spufs_type); | 700 | unregister_filesystem(&spufs_type); |
701 | out_sched: | ||
702 | spu_sched_exit(); | ||
682 | out_cache: | 703 | out_cache: |
683 | kmem_cache_destroy(spufs_inode_cache); | 704 | kmem_cache_destroy(spufs_inode_cache); |
684 | out: | 705 | out: |
@@ -689,6 +710,7 @@ module_init(spufs_init); | |||
689 | static void __exit spufs_exit(void) | 710 | static void __exit spufs_exit(void) |
690 | { | 711 | { |
691 | spu_sched_exit(); | 712 | spu_sched_exit(); |
713 | spufs_exit_isolated_loader(); | ||
692 | unregister_arch_coredump_calls(&spufs_coredump_calls); | 714 | unregister_arch_coredump_calls(&spufs_coredump_calls); |
693 | unregister_spu_syscalls(&spufs_calls); | 715 | unregister_spu_syscalls(&spufs_calls); |
694 | unregister_filesystem(&spufs_type); | 716 | unregister_filesystem(&spufs_type); |
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c index f95a611ca362..57626600b1a4 100644 --- a/arch/powerpc/platforms/cell/spufs/run.c +++ b/arch/powerpc/platforms/cell/spufs/run.c | |||
@@ -18,27 +18,6 @@ void spufs_stop_callback(struct spu *spu) | |||
18 | wake_up_all(&ctx->stop_wq); | 18 | wake_up_all(&ctx->stop_wq); |
19 | } | 19 | } |
20 | 20 | ||
21 | void spufs_dma_callback(struct spu *spu, int type) | ||
22 | { | ||
23 | struct spu_context *ctx = spu->ctx; | ||
24 | |||
25 | if (ctx->flags & SPU_CREATE_EVENTS_ENABLED) { | ||
26 | ctx->event_return |= type; | ||
27 | wake_up_all(&ctx->stop_wq); | ||
28 | } else { | ||
29 | switch (type) { | ||
30 | case SPE_EVENT_DMA_ALIGNMENT: | ||
31 | case SPE_EVENT_SPE_DATA_STORAGE: | ||
32 | case SPE_EVENT_INVALID_DMA: | ||
33 | force_sig(SIGBUS, /* info, */ current); | ||
34 | break; | ||
35 | case SPE_EVENT_SPE_ERROR: | ||
36 | force_sig(SIGILL, /* info */ current); | ||
37 | break; | ||
38 | } | ||
39 | } | ||
40 | } | ||
41 | |||
42 | static inline int spu_stopped(struct spu_context *ctx, u32 * stat) | 21 | static inline int spu_stopped(struct spu_context *ctx, u32 * stat) |
43 | { | 22 | { |
44 | struct spu *spu; | 23 | struct spu *spu; |
@@ -63,13 +42,18 @@ static int spu_setup_isolated(struct spu_context *ctx) | |||
63 | const u32 status_loading = SPU_STATUS_RUNNING | 42 | const u32 status_loading = SPU_STATUS_RUNNING |
64 | | SPU_STATUS_ISOLATED_STATE | SPU_STATUS_ISOLATED_LOAD_STATUS; | 43 | | SPU_STATUS_ISOLATED_STATE | SPU_STATUS_ISOLATED_LOAD_STATUS; |
65 | 44 | ||
45 | ret = -ENODEV; | ||
66 | if (!isolated_loader) | 46 | if (!isolated_loader) |
67 | return -ENODEV; | ||
68 | |||
69 | ret = spu_acquire_exclusive(ctx); | ||
70 | if (ret) | ||
71 | goto out; | 47 | goto out; |
72 | 48 | ||
49 | /* | ||
50 | * We need to exclude userspace access to the context. | ||
51 | * | ||
52 | * To protect against memory access we invalidate all ptes | ||
53 | * and make sure the pagefault handlers block on the mutex. | ||
54 | */ | ||
55 | spu_unmap_mappings(ctx); | ||
56 | |||
73 | mfc_cntl = &ctx->spu->priv2->mfc_control_RW; | 57 | mfc_cntl = &ctx->spu->priv2->mfc_control_RW; |
74 | 58 | ||
75 | /* purge the MFC DMA queue to ensure no spurious accesses before we | 59 | /* purge the MFC DMA queue to ensure no spurious accesses before we |
@@ -82,7 +66,7 @@ static int spu_setup_isolated(struct spu_context *ctx) | |||
82 | printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n", | 66 | printk(KERN_ERR "%s: timeout flushing MFC DMA queue\n", |
83 | __FUNCTION__); | 67 | __FUNCTION__); |
84 | ret = -EIO; | 68 | ret = -EIO; |
85 | goto out_unlock; | 69 | goto out; |
86 | } | 70 | } |
87 | cond_resched(); | 71 | cond_resched(); |
88 | } | 72 | } |
@@ -119,12 +103,15 @@ static int spu_setup_isolated(struct spu_context *ctx) | |||
119 | pr_debug("%s: isolated LOAD failed\n", __FUNCTION__); | 103 | pr_debug("%s: isolated LOAD failed\n", __FUNCTION__); |
120 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); | 104 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); |
121 | ret = -EACCES; | 105 | ret = -EACCES; |
106 | goto out_drop_priv; | ||
107 | } | ||
122 | 108 | ||
123 | } else if (!(status & SPU_STATUS_ISOLATED_STATE)) { | 109 | if (!(status & SPU_STATUS_ISOLATED_STATE)) { |
124 | /* This isn't allowed by the CBEA, but check anyway */ | 110 | /* This isn't allowed by the CBEA, but check anyway */ |
125 | pr_debug("%s: SPU fell out of isolated mode?\n", __FUNCTION__); | 111 | pr_debug("%s: SPU fell out of isolated mode?\n", __FUNCTION__); |
126 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP); | 112 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_STOP); |
127 | ret = -EINVAL; | 113 | ret = -EINVAL; |
114 | goto out_drop_priv; | ||
128 | } | 115 | } |
129 | 116 | ||
130 | out_drop_priv: | 117 | out_drop_priv: |
@@ -132,30 +119,19 @@ out_drop_priv: | |||
132 | sr1 |= MFC_STATE1_PROBLEM_STATE_MASK; | 119 | sr1 |= MFC_STATE1_PROBLEM_STATE_MASK; |
133 | spu_mfc_sr1_set(ctx->spu, sr1); | 120 | spu_mfc_sr1_set(ctx->spu, sr1); |
134 | 121 | ||
135 | out_unlock: | ||
136 | spu_release(ctx); | ||
137 | out: | 122 | out: |
138 | return ret; | 123 | return ret; |
139 | } | 124 | } |
140 | 125 | ||
141 | static inline int spu_run_init(struct spu_context *ctx, u32 * npc) | 126 | static int spu_run_init(struct spu_context *ctx, u32 * npc) |
142 | { | 127 | { |
143 | int ret; | ||
144 | unsigned long runcntl = SPU_RUNCNTL_RUNNABLE; | ||
145 | |||
146 | ret = spu_acquire_runnable(ctx, 0); | ||
147 | if (ret) | ||
148 | return ret; | ||
149 | |||
150 | if (ctx->flags & SPU_CREATE_ISOLATE) { | 128 | if (ctx->flags & SPU_CREATE_ISOLATE) { |
129 | unsigned long runcntl; | ||
130 | |||
151 | if (!(ctx->ops->status_read(ctx) & SPU_STATUS_ISOLATED_STATE)) { | 131 | if (!(ctx->ops->status_read(ctx) & SPU_STATUS_ISOLATED_STATE)) { |
152 | /* Need to release ctx, because spu_setup_isolated will | 132 | int ret = spu_setup_isolated(ctx); |
153 | * acquire it exclusively. | 133 | if (ret) |
154 | */ | 134 | return ret; |
155 | spu_release(ctx); | ||
156 | ret = spu_setup_isolated(ctx); | ||
157 | if (!ret) | ||
158 | ret = spu_acquire_runnable(ctx, 0); | ||
159 | } | 135 | } |
160 | 136 | ||
161 | /* if userspace has set the runcntrl register (eg, to issue an | 137 | /* if userspace has set the runcntrl register (eg, to issue an |
@@ -164,16 +140,17 @@ static inline int spu_run_init(struct spu_context *ctx, u32 * npc) | |||
164 | (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE); | 140 | (SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE); |
165 | if (runcntl == 0) | 141 | if (runcntl == 0) |
166 | runcntl = SPU_RUNCNTL_RUNNABLE; | 142 | runcntl = SPU_RUNCNTL_RUNNABLE; |
143 | ctx->ops->runcntl_write(ctx, runcntl); | ||
167 | } else { | 144 | } else { |
168 | spu_start_tick(ctx); | 145 | spu_start_tick(ctx); |
169 | ctx->ops->npc_write(ctx, *npc); | 146 | ctx->ops->npc_write(ctx, *npc); |
147 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); | ||
170 | } | 148 | } |
171 | 149 | ||
172 | ctx->ops->runcntl_write(ctx, runcntl); | 150 | return 0; |
173 | return ret; | ||
174 | } | 151 | } |
175 | 152 | ||
176 | static inline int spu_run_fini(struct spu_context *ctx, u32 * npc, | 153 | static int spu_run_fini(struct spu_context *ctx, u32 * npc, |
177 | u32 * status) | 154 | u32 * status) |
178 | { | 155 | { |
179 | int ret = 0; | 156 | int ret = 0; |
@@ -189,19 +166,27 @@ static inline int spu_run_fini(struct spu_context *ctx, u32 * npc, | |||
189 | return ret; | 166 | return ret; |
190 | } | 167 | } |
191 | 168 | ||
192 | static inline int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc, | 169 | static int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc, |
193 | u32 *status) | 170 | u32 *status) |
194 | { | 171 | { |
195 | int ret; | 172 | int ret; |
196 | 173 | ||
197 | if ((ret = spu_run_fini(ctx, npc, status)) != 0) | 174 | ret = spu_run_fini(ctx, npc, status); |
175 | if (ret) | ||
198 | return ret; | 176 | return ret; |
199 | if (*status & (SPU_STATUS_STOPPED_BY_STOP | | 177 | |
200 | SPU_STATUS_STOPPED_BY_HALT)) { | 178 | if (*status & (SPU_STATUS_STOPPED_BY_STOP | SPU_STATUS_STOPPED_BY_HALT)) |
201 | return *status; | 179 | return *status; |
202 | } | 180 | |
203 | if ((ret = spu_run_init(ctx, npc)) != 0) | 181 | ret = spu_acquire_runnable(ctx, 0); |
182 | if (ret) | ||
183 | return ret; | ||
184 | |||
185 | ret = spu_run_init(ctx, npc); | ||
186 | if (ret) { | ||
187 | spu_release(ctx); | ||
204 | return ret; | 188 | return ret; |
189 | } | ||
205 | return 0; | 190 | return 0; |
206 | } | 191 | } |
207 | 192 | ||
@@ -253,17 +238,17 @@ int spu_process_callback(struct spu_context *ctx) | |||
253 | { | 238 | { |
254 | struct spu_syscall_block s; | 239 | struct spu_syscall_block s; |
255 | u32 ls_pointer, npc; | 240 | u32 ls_pointer, npc; |
256 | char *ls; | 241 | void __iomem *ls; |
257 | long spu_ret; | 242 | long spu_ret; |
258 | int ret; | 243 | int ret; |
259 | 244 | ||
260 | /* get syscall block from local store */ | 245 | /* get syscall block from local store */ |
261 | npc = ctx->ops->npc_read(ctx); | 246 | npc = ctx->ops->npc_read(ctx) & ~3; |
262 | ls = ctx->ops->get_ls(ctx); | 247 | ls = (void __iomem *)ctx->ops->get_ls(ctx); |
263 | ls_pointer = *(u32*)(ls + npc); | 248 | ls_pointer = in_be32(ls + npc); |
264 | if (ls_pointer > (LS_SIZE - sizeof(s))) | 249 | if (ls_pointer > (LS_SIZE - sizeof(s))) |
265 | return -EFAULT; | 250 | return -EFAULT; |
266 | memcpy(&s, ls + ls_pointer, sizeof (s)); | 251 | memcpy_fromio(&s, ls + ls_pointer, sizeof(s)); |
267 | 252 | ||
268 | /* do actual syscall without pinning the spu */ | 253 | /* do actual syscall without pinning the spu */ |
269 | ret = 0; | 254 | ret = 0; |
@@ -283,7 +268,7 @@ int spu_process_callback(struct spu_context *ctx) | |||
283 | } | 268 | } |
284 | 269 | ||
285 | /* write result, jump over indirect pointer */ | 270 | /* write result, jump over indirect pointer */ |
286 | memcpy(ls + ls_pointer, &spu_ret, sizeof (spu_ret)); | 271 | memcpy_toio(ls + ls_pointer, &spu_ret, sizeof(spu_ret)); |
287 | ctx->ops->npc_write(ctx, npc); | 272 | ctx->ops->npc_write(ctx, npc); |
288 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); | 273 | ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE); |
289 | return ret; | 274 | return ret; |
@@ -292,11 +277,8 @@ int spu_process_callback(struct spu_context *ctx) | |||
292 | static inline int spu_process_events(struct spu_context *ctx) | 277 | static inline int spu_process_events(struct spu_context *ctx) |
293 | { | 278 | { |
294 | struct spu *spu = ctx->spu; | 279 | struct spu *spu = ctx->spu; |
295 | u64 pte_fault = MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED; | ||
296 | int ret = 0; | 280 | int ret = 0; |
297 | 281 | ||
298 | if (spu->dsisr & pte_fault) | ||
299 | ret = spu_irq_class_1_bottom(spu); | ||
300 | if (spu->class_0_pending) | 282 | if (spu->class_0_pending) |
301 | ret = spu_irq_class_0_bottom(spu); | 283 | ret = spu_irq_class_0_bottom(spu); |
302 | if (!ret && signal_pending(current)) | 284 | if (!ret && signal_pending(current)) |
@@ -310,14 +292,21 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx, | |||
310 | int ret; | 292 | int ret; |
311 | u32 status; | 293 | u32 status; |
312 | 294 | ||
313 | if (down_interruptible(&ctx->run_sema)) | 295 | if (mutex_lock_interruptible(&ctx->run_mutex)) |
314 | return -ERESTARTSYS; | 296 | return -ERESTARTSYS; |
315 | 297 | ||
316 | ctx->ops->master_start(ctx); | 298 | ctx->ops->master_start(ctx); |
317 | ctx->event_return = 0; | 299 | ctx->event_return = 0; |
318 | ret = spu_run_init(ctx, npc); | 300 | |
301 | ret = spu_acquire_runnable(ctx, 0); | ||
319 | if (ret) | 302 | if (ret) |
303 | return ret; | ||
304 | |||
305 | ret = spu_run_init(ctx, npc); | ||
306 | if (ret) { | ||
307 | spu_release(ctx); | ||
320 | goto out; | 308 | goto out; |
309 | } | ||
321 | 310 | ||
322 | do { | 311 | do { |
323 | ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status)); | 312 | ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, &status)); |
@@ -330,6 +319,10 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx, | |||
330 | break; | 319 | break; |
331 | status &= ~SPU_STATUS_STOPPED_BY_STOP; | 320 | status &= ~SPU_STATUS_STOPPED_BY_STOP; |
332 | } | 321 | } |
322 | ret = spufs_handle_class1(ctx); | ||
323 | if (ret) | ||
324 | break; | ||
325 | |||
333 | if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) { | 326 | if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) { |
334 | ret = spu_reacquire_runnable(ctx, npc, &status); | 327 | ret = spu_reacquire_runnable(ctx, npc, &status); |
335 | if (ret) { | 328 | if (ret) { |
@@ -363,6 +356,6 @@ out2: | |||
363 | 356 | ||
364 | out: | 357 | out: |
365 | *event = ctx->event_return; | 358 | *event = ctx->event_return; |
366 | up(&ctx->run_sema); | 359 | mutex_unlock(&ctx->run_mutex); |
367 | return ret; | 360 | return ret; |
368 | } | 361 | } |
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 39823cec0844..91030b8abdca 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -71,14 +71,27 @@ static inline int node_allowed(int node) | |||
71 | 71 | ||
72 | void spu_start_tick(struct spu_context *ctx) | 72 | void spu_start_tick(struct spu_context *ctx) |
73 | { | 73 | { |
74 | if (ctx->policy == SCHED_RR) | 74 | if (ctx->policy == SCHED_RR) { |
75 | /* | ||
76 | * Make sure the exiting bit is cleared. | ||
77 | */ | ||
78 | clear_bit(SPU_SCHED_EXITING, &ctx->sched_flags); | ||
79 | mb(); | ||
75 | queue_delayed_work(spu_sched_wq, &ctx->sched_work, SPU_TIMESLICE); | 80 | queue_delayed_work(spu_sched_wq, &ctx->sched_work, SPU_TIMESLICE); |
81 | } | ||
76 | } | 82 | } |
77 | 83 | ||
78 | void spu_stop_tick(struct spu_context *ctx) | 84 | void spu_stop_tick(struct spu_context *ctx) |
79 | { | 85 | { |
80 | if (ctx->policy == SCHED_RR) | 86 | if (ctx->policy == SCHED_RR) { |
87 | /* | ||
88 | * While the work can be rearming normally setting this flag | ||
89 | * makes sure it does not rearm itself anymore. | ||
90 | */ | ||
91 | set_bit(SPU_SCHED_EXITING, &ctx->sched_flags); | ||
92 | mb(); | ||
81 | cancel_delayed_work(&ctx->sched_work); | 93 | cancel_delayed_work(&ctx->sched_work); |
94 | } | ||
82 | } | 95 | } |
83 | 96 | ||
84 | void spu_sched_tick(struct work_struct *work) | 97 | void spu_sched_tick(struct work_struct *work) |
@@ -86,7 +99,15 @@ void spu_sched_tick(struct work_struct *work) | |||
86 | struct spu_context *ctx = | 99 | struct spu_context *ctx = |
87 | container_of(work, struct spu_context, sched_work.work); | 100 | container_of(work, struct spu_context, sched_work.work); |
88 | struct spu *spu; | 101 | struct spu *spu; |
89 | int rearm = 1; | 102 | int preempted = 0; |
103 | |||
104 | /* | ||
105 | * If this context is being stopped avoid rescheduling from the | ||
106 | * scheduler tick because we would block on the state_mutex. | ||
107 | * The caller will yield the spu later on anyway. | ||
108 | */ | ||
109 | if (test_bit(SPU_SCHED_EXITING, &ctx->sched_flags)) | ||
110 | return; | ||
90 | 111 | ||
91 | mutex_lock(&ctx->state_mutex); | 112 | mutex_lock(&ctx->state_mutex); |
92 | spu = ctx->spu; | 113 | spu = ctx->spu; |
@@ -94,12 +115,19 @@ void spu_sched_tick(struct work_struct *work) | |||
94 | int best = sched_find_first_bit(spu_prio->bitmap); | 115 | int best = sched_find_first_bit(spu_prio->bitmap); |
95 | if (best <= ctx->prio) { | 116 | if (best <= ctx->prio) { |
96 | spu_deactivate(ctx); | 117 | spu_deactivate(ctx); |
97 | rearm = 0; | 118 | preempted = 1; |
98 | } | 119 | } |
99 | } | 120 | } |
100 | mutex_unlock(&ctx->state_mutex); | 121 | mutex_unlock(&ctx->state_mutex); |
101 | 122 | ||
102 | if (rearm) | 123 | if (preempted) { |
124 | /* | ||
125 | * We need to break out of the wait loop in spu_run manually | ||
126 | * to ensure this context gets put on the runqueue again | ||
127 | * ASAP. | ||
128 | */ | ||
129 | wake_up(&ctx->stop_wq); | ||
130 | } else | ||
103 | spu_start_tick(ctx); | 131 | spu_start_tick(ctx); |
104 | } | 132 | } |
105 | 133 | ||
@@ -208,58 +236,40 @@ static void spu_unbind_context(struct spu *spu, struct spu_context *ctx) | |||
208 | * spu_add_to_rq - add a context to the runqueue | 236 | * spu_add_to_rq - add a context to the runqueue |
209 | * @ctx: context to add | 237 | * @ctx: context to add |
210 | */ | 238 | */ |
211 | static void spu_add_to_rq(struct spu_context *ctx) | 239 | static void __spu_add_to_rq(struct spu_context *ctx) |
212 | { | 240 | { |
213 | spin_lock(&spu_prio->runq_lock); | 241 | int prio = ctx->prio; |
214 | list_add_tail(&ctx->rq, &spu_prio->runq[ctx->prio]); | ||
215 | set_bit(ctx->prio, spu_prio->bitmap); | ||
216 | spin_unlock(&spu_prio->runq_lock); | ||
217 | } | ||
218 | 242 | ||
219 | /** | 243 | list_add_tail(&ctx->rq, &spu_prio->runq[prio]); |
220 | * spu_del_from_rq - remove a context from the runqueue | 244 | set_bit(prio, spu_prio->bitmap); |
221 | * @ctx: context to remove | ||
222 | */ | ||
223 | static void spu_del_from_rq(struct spu_context *ctx) | ||
224 | { | ||
225 | spin_lock(&spu_prio->runq_lock); | ||
226 | list_del_init(&ctx->rq); | ||
227 | if (list_empty(&spu_prio->runq[ctx->prio])) | ||
228 | clear_bit(ctx->prio, spu_prio->bitmap); | ||
229 | spin_unlock(&spu_prio->runq_lock); | ||
230 | } | 245 | } |
231 | 246 | ||
232 | /** | 247 | static void __spu_del_from_rq(struct spu_context *ctx) |
233 | * spu_grab_context - remove one context from the runqueue | ||
234 | * @prio: priority of the context to be removed | ||
235 | * | ||
236 | * This function removes one context from the runqueue for priority @prio. | ||
237 | * If there is more than one context with the given priority the first | ||
238 | * task on the runqueue will be taken. | ||
239 | * | ||
240 | * Returns the spu_context it just removed. | ||
241 | * | ||
242 | * Must be called with spu_prio->runq_lock held. | ||
243 | */ | ||
244 | static struct spu_context *spu_grab_context(int prio) | ||
245 | { | 248 | { |
246 | struct list_head *rq = &spu_prio->runq[prio]; | 249 | int prio = ctx->prio; |
247 | 250 | ||
248 | if (list_empty(rq)) | 251 | if (!list_empty(&ctx->rq)) |
249 | return NULL; | 252 | list_del_init(&ctx->rq); |
250 | return list_entry(rq->next, struct spu_context, rq); | 253 | if (list_empty(&spu_prio->runq[prio])) |
254 | clear_bit(prio, spu_prio->bitmap); | ||
251 | } | 255 | } |
252 | 256 | ||
253 | static void spu_prio_wait(struct spu_context *ctx) | 257 | static void spu_prio_wait(struct spu_context *ctx) |
254 | { | 258 | { |
255 | DEFINE_WAIT(wait); | 259 | DEFINE_WAIT(wait); |
256 | 260 | ||
261 | spin_lock(&spu_prio->runq_lock); | ||
257 | prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE); | 262 | prepare_to_wait_exclusive(&ctx->stop_wq, &wait, TASK_INTERRUPTIBLE); |
258 | if (!signal_pending(current)) { | 263 | if (!signal_pending(current)) { |
264 | __spu_add_to_rq(ctx); | ||
265 | spin_unlock(&spu_prio->runq_lock); | ||
259 | mutex_unlock(&ctx->state_mutex); | 266 | mutex_unlock(&ctx->state_mutex); |
260 | schedule(); | 267 | schedule(); |
261 | mutex_lock(&ctx->state_mutex); | 268 | mutex_lock(&ctx->state_mutex); |
269 | spin_lock(&spu_prio->runq_lock); | ||
270 | __spu_del_from_rq(ctx); | ||
262 | } | 271 | } |
272 | spin_unlock(&spu_prio->runq_lock); | ||
263 | __set_current_state(TASK_RUNNING); | 273 | __set_current_state(TASK_RUNNING); |
264 | remove_wait_queue(&ctx->stop_wq, &wait); | 274 | remove_wait_queue(&ctx->stop_wq, &wait); |
265 | } | 275 | } |
@@ -280,9 +290,14 @@ static void spu_reschedule(struct spu *spu) | |||
280 | spin_lock(&spu_prio->runq_lock); | 290 | spin_lock(&spu_prio->runq_lock); |
281 | best = sched_find_first_bit(spu_prio->bitmap); | 291 | best = sched_find_first_bit(spu_prio->bitmap); |
282 | if (best < MAX_PRIO) { | 292 | if (best < MAX_PRIO) { |
283 | struct spu_context *ctx = spu_grab_context(best); | 293 | struct list_head *rq = &spu_prio->runq[best]; |
284 | if (ctx) | 294 | struct spu_context *ctx; |
285 | wake_up(&ctx->stop_wq); | 295 | |
296 | BUG_ON(list_empty(rq)); | ||
297 | |||
298 | ctx = list_entry(rq->next, struct spu_context, rq); | ||
299 | __spu_del_from_rq(ctx); | ||
300 | wake_up(&ctx->stop_wq); | ||
286 | } | 301 | } |
287 | spin_unlock(&spu_prio->runq_lock); | 302 | spin_unlock(&spu_prio->runq_lock); |
288 | } | 303 | } |
@@ -365,6 +380,12 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
365 | } | 380 | } |
366 | spu_unbind_context(spu, victim); | 381 | spu_unbind_context(spu, victim); |
367 | mutex_unlock(&victim->state_mutex); | 382 | mutex_unlock(&victim->state_mutex); |
383 | /* | ||
384 | * We need to break out of the wait loop in spu_run | ||
385 | * manually to ensure this context gets put on the | ||
386 | * runqueue again ASAP. | ||
387 | */ | ||
388 | wake_up(&victim->stop_wq); | ||
368 | return spu; | 389 | return spu; |
369 | } | 390 | } |
370 | } | 391 | } |
@@ -377,7 +398,7 @@ static struct spu *find_victim(struct spu_context *ctx) | |||
377 | * @ctx: spu context to schedule | 398 | * @ctx: spu context to schedule |
378 | * @flags: flags (currently ignored) | 399 | * @flags: flags (currently ignored) |
379 | * | 400 | * |
380 | * Tries to find a free spu to run @ctx. If no free spu is availble | 401 | * Tries to find a free spu to run @ctx. If no free spu is available |
381 | * add the context to the runqueue so it gets woken up once an spu | 402 | * add the context to the runqueue so it gets woken up once an spu |
382 | * is available. | 403 | * is available. |
383 | */ | 404 | */ |
@@ -402,9 +423,7 @@ int spu_activate(struct spu_context *ctx, unsigned long flags) | |||
402 | return 0; | 423 | return 0; |
403 | } | 424 | } |
404 | 425 | ||
405 | spu_add_to_rq(ctx); | ||
406 | spu_prio_wait(ctx); | 426 | spu_prio_wait(ctx); |
407 | spu_del_from_rq(ctx); | ||
408 | } while (!signal_pending(current)); | 427 | } while (!signal_pending(current)); |
409 | 428 | ||
410 | return -ERESTARTSYS; | 429 | return -ERESTARTSYS; |
@@ -438,7 +457,6 @@ void spu_deactivate(struct spu_context *ctx) | |||
438 | void spu_yield(struct spu_context *ctx) | 457 | void spu_yield(struct spu_context *ctx) |
439 | { | 458 | { |
440 | struct spu *spu; | 459 | struct spu *spu; |
441 | int need_yield = 0; | ||
442 | 460 | ||
443 | if (mutex_trylock(&ctx->state_mutex)) { | 461 | if (mutex_trylock(&ctx->state_mutex)) { |
444 | if ((spu = ctx->spu) != NULL) { | 462 | if ((spu = ctx->spu) != NULL) { |
@@ -447,13 +465,10 @@ void spu_yield(struct spu_context *ctx) | |||
447 | pr_debug("%s: yielding SPU %d NODE %d\n", | 465 | pr_debug("%s: yielding SPU %d NODE %d\n", |
448 | __FUNCTION__, spu->number, spu->node); | 466 | __FUNCTION__, spu->number, spu->node); |
449 | spu_deactivate(ctx); | 467 | spu_deactivate(ctx); |
450 | need_yield = 1; | ||
451 | } | 468 | } |
452 | } | 469 | } |
453 | mutex_unlock(&ctx->state_mutex); | 470 | mutex_unlock(&ctx->state_mutex); |
454 | } | 471 | } |
455 | if (unlikely(need_yield)) | ||
456 | yield(); | ||
457 | } | 472 | } |
458 | 473 | ||
459 | int __init spu_sched_init(void) | 474 | int __init spu_sched_init(void) |
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h index 5c4e47d69d79..0a947fd7de57 100644 --- a/arch/powerpc/platforms/cell/spufs/spufs.h +++ b/arch/powerpc/platforms/cell/spufs/spufs.h | |||
@@ -41,7 +41,7 @@ struct spu_gang; | |||
41 | 41 | ||
42 | /* ctx->sched_flags */ | 42 | /* ctx->sched_flags */ |
43 | enum { | 43 | enum { |
44 | SPU_SCHED_WAKE = 0, /* currently unused */ | 44 | SPU_SCHED_EXITING = 0, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | struct spu_context { | 47 | struct spu_context { |
@@ -50,16 +50,17 @@ struct spu_context { | |||
50 | spinlock_t mmio_lock; /* protects mmio access */ | 50 | spinlock_t mmio_lock; /* protects mmio access */ |
51 | struct address_space *local_store; /* local store mapping. */ | 51 | struct address_space *local_store; /* local store mapping. */ |
52 | struct address_space *mfc; /* 'mfc' area mappings. */ | 52 | struct address_space *mfc; /* 'mfc' area mappings. */ |
53 | struct address_space *cntl; /* 'control' area mappings. */ | 53 | struct address_space *cntl; /* 'control' area mappings. */ |
54 | struct address_space *signal1; /* 'signal1' area mappings. */ | 54 | struct address_space *signal1; /* 'signal1' area mappings. */ |
55 | struct address_space *signal2; /* 'signal2' area mappings. */ | 55 | struct address_space *signal2; /* 'signal2' area mappings. */ |
56 | struct address_space *mss; /* 'mss' area mappings. */ | 56 | struct address_space *mss; /* 'mss' area mappings. */ |
57 | struct address_space *psmap; /* 'psmap' area mappings. */ | 57 | struct address_space *psmap; /* 'psmap' area mappings. */ |
58 | spinlock_t mapping_lock; | ||
58 | u64 object_id; /* user space pointer for oprofile */ | 59 | u64 object_id; /* user space pointer for oprofile */ |
59 | 60 | ||
60 | enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; | 61 | enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; |
61 | struct mutex state_mutex; | 62 | struct mutex state_mutex; |
62 | struct semaphore run_sema; | 63 | struct mutex run_mutex; |
63 | 64 | ||
64 | struct mm_struct *owner; | 65 | struct mm_struct *owner; |
65 | 66 | ||
@@ -140,6 +141,7 @@ struct spu_context_ops { | |||
140 | struct spu_dma_info * info); | 141 | struct spu_dma_info * info); |
141 | void (*proxydma_info_read) (struct spu_context * ctx, | 142 | void (*proxydma_info_read) (struct spu_context * ctx, |
142 | struct spu_proxydma_info * info); | 143 | struct spu_proxydma_info * info); |
144 | void (*restart_dma)(struct spu_context *ctx); | ||
143 | }; | 145 | }; |
144 | 146 | ||
145 | extern struct spu_context_ops spu_hw_ops; | 147 | extern struct spu_context_ops spu_hw_ops; |
@@ -149,6 +151,7 @@ struct spufs_inode_info { | |||
149 | struct spu_context *i_ctx; | 151 | struct spu_context *i_ctx; |
150 | struct spu_gang *i_gang; | 152 | struct spu_gang *i_gang; |
151 | struct inode vfs_inode; | 153 | struct inode vfs_inode; |
154 | int i_openers; | ||
152 | }; | 155 | }; |
153 | #define SPUFS_I(inode) \ | 156 | #define SPUFS_I(inode) \ |
154 | container_of(inode, struct spufs_inode_info, vfs_inode) | 157 | container_of(inode, struct spufs_inode_info, vfs_inode) |
@@ -170,6 +173,9 @@ int put_spu_gang(struct spu_gang *gang); | |||
170 | void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx); | 173 | void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx); |
171 | void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); | 174 | void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx); |
172 | 175 | ||
176 | /* fault handling */ | ||
177 | int spufs_handle_class1(struct spu_context *ctx); | ||
178 | |||
173 | /* context management */ | 179 | /* context management */ |
174 | static inline void spu_acquire(struct spu_context *ctx) | 180 | static inline void spu_acquire(struct spu_context *ctx) |
175 | { | 181 | { |
@@ -190,7 +196,6 @@ void spu_unmap_mappings(struct spu_context *ctx); | |||
190 | void spu_forget(struct spu_context *ctx); | 196 | void spu_forget(struct spu_context *ctx); |
191 | int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); | 197 | int spu_acquire_runnable(struct spu_context *ctx, unsigned long flags); |
192 | void spu_acquire_saved(struct spu_context *ctx); | 198 | void spu_acquire_saved(struct spu_context *ctx); |
193 | int spu_acquire_exclusive(struct spu_context *ctx); | ||
194 | 199 | ||
195 | int spu_activate(struct spu_context *ctx, unsigned long flags); | 200 | int spu_activate(struct spu_context *ctx, unsigned long flags); |
196 | void spu_deactivate(struct spu_context *ctx); | 201 | void spu_deactivate(struct spu_context *ctx); |
@@ -218,14 +223,13 @@ extern char *isolated_loader; | |||
218 | prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \ | 223 | prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \ |
219 | if (condition) \ | 224 | if (condition) \ |
220 | break; \ | 225 | break; \ |
221 | if (!signal_pending(current)) { \ | 226 | if (signal_pending(current)) { \ |
222 | spu_release(ctx); \ | 227 | __ret = -ERESTARTSYS; \ |
223 | schedule(); \ | 228 | break; \ |
224 | spu_acquire(ctx); \ | ||
225 | continue; \ | ||
226 | } \ | 229 | } \ |
227 | __ret = -ERESTARTSYS; \ | 230 | spu_release(ctx); \ |
228 | break; \ | 231 | schedule(); \ |
232 | spu_acquire(ctx); \ | ||
229 | } \ | 233 | } \ |
230 | finish_wait(&(wq), &__wait); \ | 234 | finish_wait(&(wq), &__wait); \ |
231 | __ret; \ | 235 | __ret; \ |
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c index fd91c73de34e..8347c4a3f894 100644 --- a/arch/powerpc/platforms/cell/spufs/switch.c +++ b/arch/powerpc/platforms/cell/spufs/switch.c | |||
@@ -2084,6 +2084,10 @@ int spu_save(struct spu_state *prev, struct spu *spu) | |||
2084 | int rc; | 2084 | int rc; |
2085 | 2085 | ||
2086 | acquire_spu_lock(spu); /* Step 1. */ | 2086 | acquire_spu_lock(spu); /* Step 1. */ |
2087 | prev->dar = spu->dar; | ||
2088 | prev->dsisr = spu->dsisr; | ||
2089 | spu->dar = 0; | ||
2090 | spu->dsisr = 0; | ||
2087 | rc = __do_spu_save(prev, spu); /* Steps 2-53. */ | 2091 | rc = __do_spu_save(prev, spu); /* Steps 2-53. */ |
2088 | release_spu_lock(spu); | 2092 | release_spu_lock(spu); |
2089 | if (rc != 0 && rc != 2 && rc != 6) { | 2093 | if (rc != 0 && rc != 2 && rc != 6) { |
@@ -2109,9 +2113,9 @@ int spu_restore(struct spu_state *new, struct spu *spu) | |||
2109 | 2113 | ||
2110 | acquire_spu_lock(spu); | 2114 | acquire_spu_lock(spu); |
2111 | harvest(NULL, spu); | 2115 | harvest(NULL, spu); |
2112 | spu->dar = 0; | ||
2113 | spu->dsisr = 0; | ||
2114 | spu->slb_replace = 0; | 2116 | spu->slb_replace = 0; |
2117 | new->dar = 0; | ||
2118 | new->dsisr = 0; | ||
2115 | spu->class_0_pending = 0; | 2119 | spu->class_0_pending = 0; |
2116 | rc = __do_spu_restore(new, spu); | 2120 | rc = __do_spu_restore(new, spu); |
2117 | release_spu_lock(spu); | 2121 | release_spu_lock(spu); |
diff --git a/arch/powerpc/platforms/celleb/Kconfig b/arch/powerpc/platforms/celleb/Kconfig new file mode 100644 index 000000000000..2db1e293433e --- /dev/null +++ b/arch/powerpc/platforms/celleb/Kconfig | |||
@@ -0,0 +1,9 @@ | |||
1 | config PPC_CELLEB | ||
2 | bool "Toshiba's Cell Reference Set 'Celleb' Architecture" | ||
3 | depends on PPC_MULTIPLATFORM && PPC64 | ||
4 | select PPC_CELL | ||
5 | select PPC_OF_PLATFORM_PCI | ||
6 | select HAS_TXX9_SERIAL | ||
7 | select PPC_UDBG_BEAT | ||
8 | select USB_OHCI_BIG_ENDIAN_MMIO | ||
9 | select USB_EHCI_BIG_ENDIAN_MMIO | ||
diff --git a/arch/powerpc/platforms/celleb/iommu.c b/arch/powerpc/platforms/celleb/iommu.c index f63b94c65353..755d869d8553 100644 --- a/arch/powerpc/platforms/celleb/iommu.c +++ b/arch/powerpc/platforms/celleb/iommu.c | |||
@@ -37,7 +37,7 @@ static int __init find_dma_window(u64 *io_space_id, u64 *ioid, | |||
37 | const unsigned long *dma_window; | 37 | const unsigned long *dma_window; |
38 | 38 | ||
39 | for_each_node_by_type(dn, "ioif") { | 39 | for_each_node_by_type(dn, "ioif") { |
40 | dma_window = get_property(dn, "toshiba,dma-window", NULL); | 40 | dma_window = of_get_property(dn, "toshiba,dma-window", NULL); |
41 | if (dma_window) { | 41 | if (dma_window) { |
42 | *io_space_id = (dma_window[0] >> 32) & 0xffffffffUL; | 42 | *io_space_id = (dma_window[0] >> 32) & 0xffffffffUL; |
43 | *ioid = dma_window[0] & 0x7ffUL; | 43 | *ioid = dma_window[0] & 0x7ffUL; |
@@ -80,7 +80,7 @@ static int celleb_of_bus_notify(struct notifier_block *nb, | |||
80 | if (action != BUS_NOTIFY_ADD_DEVICE) | 80 | if (action != BUS_NOTIFY_ADD_DEVICE) |
81 | return 0; | 81 | return 0; |
82 | 82 | ||
83 | dev->archdata.dma_ops = pci_dma_ops; | 83 | dev->archdata.dma_ops = get_pci_dma_ops(); |
84 | 84 | ||
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
@@ -95,7 +95,7 @@ static int __init celleb_init_iommu(void) | |||
95 | return -ENODEV; | 95 | return -ENODEV; |
96 | 96 | ||
97 | celleb_init_direct_mapping(); | 97 | celleb_init_direct_mapping(); |
98 | pci_dma_ops = &dma_direct_ops; | 98 | set_pci_dma_ops(&dma_direct_ops); |
99 | bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); | 99 | bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); |
100 | 100 | ||
101 | return 0; | 101 | return 0; |
diff --git a/arch/powerpc/platforms/celleb/pci.c b/arch/powerpc/platforms/celleb/pci.c index 98de836dfed3..d1adf34cd5e8 100644 --- a/arch/powerpc/platforms/celleb/pci.c +++ b/arch/powerpc/platforms/celleb/pci.c | |||
@@ -309,13 +309,13 @@ static int __devinit celleb_setup_fake_pci_device(struct device_node *node, | |||
309 | goto error; | 309 | goto error; |
310 | } | 310 | } |
311 | 311 | ||
312 | name = get_property(node, "model", &rlen); | 312 | name = of_get_property(node, "model", &rlen); |
313 | if (!name) { | 313 | if (!name) { |
314 | printk(KERN_ERR "PCI: model property not found.\n"); | 314 | printk(KERN_ERR "PCI: model property not found.\n"); |
315 | goto error; | 315 | goto error; |
316 | } | 316 | } |
317 | 317 | ||
318 | wi4 = get_property(node, "reg", &rlen); | 318 | wi4 = of_get_property(node, "reg", &rlen); |
319 | if (wi4 == NULL) | 319 | if (wi4 == NULL) |
320 | goto error; | 320 | goto error; |
321 | 321 | ||
@@ -352,10 +352,10 @@ static int __devinit celleb_setup_fake_pci_device(struct device_node *node, | |||
352 | } | 352 | } |
353 | pr_debug("PCI: res assigned 0x%016lx\n", (unsigned long)*res); | 353 | pr_debug("PCI: res assigned 0x%016lx\n", (unsigned long)*res); |
354 | 354 | ||
355 | wi0 = get_property(node, "device-id", NULL); | 355 | wi0 = of_get_property(node, "device-id", NULL); |
356 | wi1 = get_property(node, "vendor-id", NULL); | 356 | wi1 = of_get_property(node, "vendor-id", NULL); |
357 | wi2 = get_property(node, "class-code", NULL); | 357 | wi2 = of_get_property(node, "class-code", NULL); |
358 | wi3 = get_property(node, "revision-id", NULL); | 358 | wi3 = of_get_property(node, "revision-id", NULL); |
359 | 359 | ||
360 | celleb_config_write_fake(*config, PCI_DEVICE_ID, 2, wi0[0] & 0xffff); | 360 | celleb_config_write_fake(*config, PCI_DEVICE_ID, 2, wi0[0] & 0xffff); |
361 | celleb_config_write_fake(*config, PCI_VENDOR_ID, 2, wi1[0] & 0xffff); | 361 | celleb_config_write_fake(*config, PCI_VENDOR_ID, 2, wi1[0] & 0xffff); |
@@ -376,7 +376,7 @@ static int __devinit celleb_setup_fake_pci_device(struct device_node *node, | |||
376 | 376 | ||
377 | celleb_setup_pci_base_addrs(hose, devno, fn, num_base_addr); | 377 | celleb_setup_pci_base_addrs(hose, devno, fn, num_base_addr); |
378 | 378 | ||
379 | li = get_property(node, "interrupts", &rlen); | 379 | li = of_get_property(node, "interrupts", &rlen); |
380 | val = li[0]; | 380 | val = li[0]; |
381 | celleb_config_write_fake(*config, PCI_INTERRUPT_PIN, 1, 1); | 381 | celleb_config_write_fake(*config, PCI_INTERRUPT_PIN, 1, 1); |
382 | celleb_config_write_fake(*config, PCI_INTERRUPT_LINE, 1, val); | 382 | celleb_config_write_fake(*config, PCI_INTERRUPT_LINE, 1, val); |
@@ -424,7 +424,7 @@ static int __devinit phb_set_bus_ranges(struct device_node *dev, | |||
424 | const int *bus_range; | 424 | const int *bus_range; |
425 | unsigned int len; | 425 | unsigned int len; |
426 | 426 | ||
427 | bus_range = get_property(dev, "bus-range", &len); | 427 | bus_range = of_get_property(dev, "bus-range", &len); |
428 | if (bus_range == NULL || len < 2 * sizeof(int)) | 428 | if (bus_range == NULL || len < 2 * sizeof(int)) |
429 | return 1; | 429 | return 1; |
430 | 430 | ||
@@ -451,7 +451,7 @@ int __devinit celleb_setup_phb(struct pci_controller *phb) | |||
451 | struct device_node *node; | 451 | struct device_node *node; |
452 | unsigned int rlen; | 452 | unsigned int rlen; |
453 | 453 | ||
454 | name = get_property(dev, "name", &rlen); | 454 | name = of_get_property(dev, "name", &rlen); |
455 | if (!name) | 455 | if (!name) |
456 | return 1; | 456 | return 1; |
457 | 457 | ||
diff --git a/arch/powerpc/platforms/celleb/setup.c b/arch/powerpc/platforms/celleb/setup.c index 5f4d0d933238..596ab2a788d4 100644 --- a/arch/powerpc/platforms/celleb/setup.c +++ b/arch/powerpc/platforms/celleb/setup.c | |||
@@ -67,7 +67,7 @@ static void celleb_show_cpuinfo(struct seq_file *m) | |||
67 | 67 | ||
68 | root = of_find_node_by_path("/"); | 68 | root = of_find_node_by_path("/"); |
69 | if (root) | 69 | if (root) |
70 | model = get_property(root, "model", NULL); | 70 | model = of_get_property(root, "model", NULL); |
71 | /* using "CHRP" is to trick anaconda into installing FCx into Celleb */ | 71 | /* using "CHRP" is to trick anaconda into installing FCx into Celleb */ |
72 | seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model); | 72 | seq_printf(m, "machine\t\t: %s %s\n", celleb_machine_type, model); |
73 | of_node_put(root); | 73 | of_node_put(root); |
@@ -128,15 +128,6 @@ static int __init celleb_probe(void) | |||
128 | return 1; | 128 | return 1; |
129 | } | 129 | } |
130 | 130 | ||
131 | /* | ||
132 | * Cell has no legacy IO; anything calling this function has to | ||
133 | * fail or bad things will happen | ||
134 | */ | ||
135 | static int celleb_check_legacy_ioport(unsigned int baseport) | ||
136 | { | ||
137 | return -ENODEV; | ||
138 | } | ||
139 | |||
140 | #ifdef CONFIG_KEXEC | 131 | #ifdef CONFIG_KEXEC |
141 | static void celleb_kexec_cpu_down(int crash, int secondary) | 132 | static void celleb_kexec_cpu_down(int crash, int secondary) |
142 | { | 133 | { |
@@ -173,7 +164,6 @@ define_machine(celleb) { | |||
173 | .get_rtc_time = beat_get_rtc_time, | 164 | .get_rtc_time = beat_get_rtc_time, |
174 | .set_rtc_time = beat_set_rtc_time, | 165 | .set_rtc_time = beat_set_rtc_time, |
175 | .calibrate_decr = generic_calibrate_decr, | 166 | .calibrate_decr = generic_calibrate_decr, |
176 | .check_legacy_ioport = celleb_check_legacy_ioport, | ||
177 | .progress = celleb_progress, | 167 | .progress = celleb_progress, |
178 | .power_save = beat_power_save, | 168 | .power_save = beat_power_save, |
179 | .nvram_size = beat_nvram_get_size, | 169 | .nvram_size = beat_nvram_get_size, |
diff --git a/arch/powerpc/platforms/chrp/Kconfig b/arch/powerpc/platforms/chrp/Kconfig new file mode 100644 index 000000000000..d2c690531963 --- /dev/null +++ b/arch/powerpc/platforms/chrp/Kconfig | |||
@@ -0,0 +1,11 @@ | |||
1 | config PPC_CHRP | ||
2 | bool "Common Hardware Reference Platform (CHRP) based machines" | ||
3 | depends on PPC_MULTIPLATFORM && PPC32 | ||
4 | select MPIC | ||
5 | select PPC_I8259 | ||
6 | select PPC_INDIRECT_PCI | ||
7 | select PPC_RTAS | ||
8 | select PPC_MPC106 | ||
9 | select PPC_UDBG_16550 | ||
10 | select PPC_NATIVE | ||
11 | default y | ||
diff --git a/arch/powerpc/platforms/chrp/nvram.c b/arch/powerpc/platforms/chrp/nvram.c index 0dd4a64757d9..8efd4244701c 100644 --- a/arch/powerpc/platforms/chrp/nvram.c +++ b/arch/powerpc/platforms/chrp/nvram.c | |||
@@ -74,7 +74,7 @@ void __init chrp_nvram_init(void) | |||
74 | if (nvram == NULL) | 74 | if (nvram == NULL) |
75 | return; | 75 | return; |
76 | 76 | ||
77 | nbytes_p = get_property(nvram, "#bytes", &proplen); | 77 | nbytes_p = of_get_property(nvram, "#bytes", &proplen); |
78 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) | 78 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) |
79 | return; | 79 | return; |
80 | 80 | ||
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c index ddb4a116ea89..1469d6478f67 100644 --- a/arch/powerpc/platforms/chrp/pci.c +++ b/arch/powerpc/platforms/chrp/pci.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <linux/delay.h> | 7 | #include <linux/delay.h> |
8 | #include <linux/string.h> | 8 | #include <linux/string.h> |
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/ide.h> | ||
11 | 10 | ||
12 | #include <asm/io.h> | 11 | #include <asm/io.h> |
13 | #include <asm/pgtable.h> | 12 | #include <asm/pgtable.h> |
@@ -137,9 +136,11 @@ hydra_init(void) | |||
137 | struct device_node *np; | 136 | struct device_node *np; |
138 | struct resource r; | 137 | struct resource r; |
139 | 138 | ||
140 | np = find_devices("mac-io"); | 139 | np = of_find_node_by_name(NULL, "mac-io"); |
141 | if (np == NULL || of_address_to_resource(np, 0, &r)) | 140 | if (np == NULL || of_address_to_resource(np, 0, &r)) { |
141 | of_node_put(np); | ||
142 | return 0; | 142 | return 0; |
143 | } | ||
143 | Hydra = ioremap(r.start, r.end-r.start); | 144 | Hydra = ioremap(r.start, r.end-r.start); |
144 | printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); | 145 | printk("Hydra Mac I/O at %llx\n", (unsigned long long)r.start); |
145 | printk("Hydra Feature_Control was %x", | 146 | printk("Hydra Feature_Control was %x", |
@@ -186,10 +187,9 @@ setup_python(struct pci_controller *hose, struct device_node *dev) | |||
186 | /* Marvell Discovery II based Pegasos 2 */ | 187 | /* Marvell Discovery II based Pegasos 2 */ |
187 | static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev) | 188 | static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev) |
188 | { | 189 | { |
189 | struct device_node *root = find_path_device("/"); | 190 | struct device_node *root = of_find_node_by_path("/"); |
190 | struct device_node *rtas; | 191 | struct device_node *rtas; |
191 | 192 | ||
192 | of_node_get(root); | ||
193 | rtas = of_find_node_by_name (root, "rtas"); | 193 | rtas = of_find_node_by_name (root, "rtas"); |
194 | if (rtas) { | 194 | if (rtas) { |
195 | hose->ops = &rtas_pci_ops; | 195 | hose->ops = &rtas_pci_ops; |
@@ -199,6 +199,7 @@ static void __init setup_peg2(struct pci_controller *hose, struct device_node *d | |||
199 | " your firmware\n"); | 199 | " your firmware\n"); |
200 | } | 200 | } |
201 | pci_assign_all_buses = 1; | 201 | pci_assign_all_buses = 1; |
202 | /* keep the reference to the root node */ | ||
202 | } | 203 | } |
203 | 204 | ||
204 | void __init | 205 | void __init |
@@ -211,14 +212,14 @@ chrp_find_bridges(void) | |||
211 | const unsigned int *dma; | 212 | const unsigned int *dma; |
212 | const char *model, *machine; | 213 | const char *model, *machine; |
213 | int is_longtrail = 0, is_mot = 0, is_pegasos = 0; | 214 | int is_longtrail = 0, is_mot = 0, is_pegasos = 0; |
214 | struct device_node *root = find_path_device("/"); | 215 | struct device_node *root = of_find_node_by_path("/"); |
215 | struct resource r; | 216 | struct resource r; |
216 | /* | 217 | /* |
217 | * The PCI host bridge nodes on some machines don't have | 218 | * The PCI host bridge nodes on some machines don't have |
218 | * properties to adequately identify them, so we have to | 219 | * properties to adequately identify them, so we have to |
219 | * look at what sort of machine this is as well. | 220 | * look at what sort of machine this is as well. |
220 | */ | 221 | */ |
221 | machine = get_property(root, "model", NULL); | 222 | machine = of_get_property(root, "model", NULL); |
222 | if (machine != NULL) { | 223 | if (machine != NULL) { |
223 | is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0; | 224 | is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0; |
224 | is_mot = strncmp(machine, "MOT", 3) == 0; | 225 | is_mot = strncmp(machine, "MOT", 3) == 0; |
@@ -237,7 +238,7 @@ chrp_find_bridges(void) | |||
237 | dev->full_name); | 238 | dev->full_name); |
238 | continue; | 239 | continue; |
239 | } | 240 | } |
240 | bus_range = get_property(dev, "bus-range", &len); | 241 | bus_range = of_get_property(dev, "bus-range", &len); |
241 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 242 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
242 | printk(KERN_WARNING "Can't get bus-range for %s\n", | 243 | printk(KERN_WARNING "Can't get bus-range for %s\n", |
243 | dev->full_name); | 244 | dev->full_name); |
@@ -263,7 +264,7 @@ chrp_find_bridges(void) | |||
263 | hose->first_busno = bus_range[0]; | 264 | hose->first_busno = bus_range[0]; |
264 | hose->last_busno = bus_range[1]; | 265 | hose->last_busno = bus_range[1]; |
265 | 266 | ||
266 | model = get_property(dev, "model", NULL); | 267 | model = of_get_property(dev, "model", NULL); |
267 | if (model == NULL) | 268 | if (model == NULL) |
268 | model = "<none>"; | 269 | model = "<none>"; |
269 | if (device_is_compatible(dev, "IBM,python")) { | 270 | if (device_is_compatible(dev, "IBM,python")) { |
@@ -285,7 +286,8 @@ chrp_find_bridges(void) | |||
285 | r.start + 0x000f8000, | 286 | r.start + 0x000f8000, |
286 | r.start + 0x000f8010); | 287 | r.start + 0x000f8010); |
287 | if (index == 0) { | 288 | if (index == 0) { |
288 | dma = get_property(dev, "system-dma-base",&len); | 289 | dma = of_get_property(dev, "system-dma-base", |
290 | &len); | ||
289 | if (dma && len >= sizeof(*dma)) { | 291 | if (dma && len >= sizeof(*dma)) { |
290 | dma = (unsigned int *) | 292 | dma = (unsigned int *) |
291 | (((unsigned long)dma) + | 293 | (((unsigned long)dma) + |
@@ -303,12 +305,13 @@ chrp_find_bridges(void) | |||
303 | 305 | ||
304 | /* check the first bridge for a property that we can | 306 | /* check the first bridge for a property that we can |
305 | use to set pci_dram_offset */ | 307 | use to set pci_dram_offset */ |
306 | dma = get_property(dev, "ibm,dma-ranges", &len); | 308 | dma = of_get_property(dev, "ibm,dma-ranges", &len); |
307 | if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { | 309 | if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { |
308 | pci_dram_offset = dma[2] - dma[3]; | 310 | pci_dram_offset = dma[2] - dma[3]; |
309 | printk("pci_dram_offset = %lx\n", pci_dram_offset); | 311 | printk("pci_dram_offset = %lx\n", pci_dram_offset); |
310 | } | 312 | } |
311 | } | 313 | } |
314 | of_node_put(root); | ||
312 | } | 315 | } |
313 | 316 | ||
314 | /* SL82C105 IDE Control/Status Register */ | 317 | /* SL82C105 IDE Control/Status Register */ |
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c index 117c9a0055bd..1870038a8e0a 100644 --- a/arch/powerpc/platforms/chrp/setup.c +++ b/arch/powerpc/platforms/chrp/setup.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/adb.h> | 28 | #include <linux/adb.h> |
29 | #include <linux/module.h> | 29 | #include <linux/module.h> |
30 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
31 | #include <linux/ide.h> | ||
32 | #include <linux/console.h> | 31 | #include <linux/console.h> |
33 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
34 | #include <linux/root_dev.h> | 33 | #include <linux/root_dev.h> |
@@ -111,9 +110,9 @@ void chrp_show_cpuinfo(struct seq_file *m) | |||
111 | struct device_node *root; | 110 | struct device_node *root; |
112 | const char *model = ""; | 111 | const char *model = ""; |
113 | 112 | ||
114 | root = find_path_device("/"); | 113 | root = of_find_node_by_path("/"); |
115 | if (root) | 114 | if (root) |
116 | model = get_property(root, "model", NULL); | 115 | model = of_get_property(root, "model", NULL); |
117 | seq_printf(m, "machine\t\t: CHRP %s\n", model); | 116 | seq_printf(m, "machine\t\t: CHRP %s\n", model); |
118 | 117 | ||
119 | /* longtrail (goldengate) stuff */ | 118 | /* longtrail (goldengate) stuff */ |
@@ -161,6 +160,7 @@ void chrp_show_cpuinfo(struct seq_file *m) | |||
161 | gg2_cachetypes[(t>>2) & 3], | 160 | gg2_cachetypes[(t>>2) & 3], |
162 | gg2_cachemodes[t & 3]); | 161 | gg2_cachemodes[t & 3]); |
163 | } | 162 | } |
163 | of_node_put(root); | ||
164 | } | 164 | } |
165 | 165 | ||
166 | /* | 166 | /* |
@@ -205,13 +205,15 @@ static void __init sio_init(void) | |||
205 | { | 205 | { |
206 | struct device_node *root; | 206 | struct device_node *root; |
207 | 207 | ||
208 | if ((root = find_path_device("/")) && | 208 | if ((root = of_find_node_by_path("/")) && |
209 | !strncmp(get_property(root, "model", NULL), "IBM,LongTrail", 13)) { | 209 | !strncmp(of_get_property(root, "model", NULL), |
210 | "IBM,LongTrail", 13)) { | ||
210 | /* logical device 0 (KBC/Keyboard) */ | 211 | /* logical device 0 (KBC/Keyboard) */ |
211 | sio_fixup_irq("keyboard", 0, 1, 2); | 212 | sio_fixup_irq("keyboard", 0, 1, 2); |
212 | /* select logical device 1 (KBC/Mouse) */ | 213 | /* select logical device 1 (KBC/Mouse) */ |
213 | sio_fixup_irq("mouse", 1, 12, 2); | 214 | sio_fixup_irq("mouse", 1, 12, 2); |
214 | } | 215 | } |
216 | of_node_put(root); | ||
215 | } | 217 | } |
216 | 218 | ||
217 | 219 | ||
@@ -224,12 +226,12 @@ static void __init pegasos_set_l2cr(void) | |||
224 | return; | 226 | return; |
225 | 227 | ||
226 | /* Enable L2 cache if needed */ | 228 | /* Enable L2 cache if needed */ |
227 | np = find_type_devices("cpu"); | 229 | np = of_find_node_by_type(NULL, "cpu"); |
228 | if (np != NULL) { | 230 | if (np != NULL) { |
229 | const unsigned int *l2cr = get_property(np, "l2cr", NULL); | 231 | const unsigned int *l2cr = of_get_property(np, "l2cr", NULL); |
230 | if (l2cr == NULL) { | 232 | if (l2cr == NULL) { |
231 | printk ("Pegasos l2cr : no cpu l2cr property found\n"); | 233 | printk ("Pegasos l2cr : no cpu l2cr property found\n"); |
232 | return; | 234 | goto out; |
233 | } | 235 | } |
234 | if (!((*l2cr) & 0x80000000)) { | 236 | if (!((*l2cr) & 0x80000000)) { |
235 | printk ("Pegasos l2cr : L2 cache was not active, " | 237 | printk ("Pegasos l2cr : L2 cache was not active, " |
@@ -238,6 +240,8 @@ static void __init pegasos_set_l2cr(void) | |||
238 | _set_L2CR((*l2cr) | 0x80000000); | 240 | _set_L2CR((*l2cr) | 0x80000000); |
239 | } | 241 | } |
240 | } | 242 | } |
243 | out: | ||
244 | of_node_put(np); | ||
241 | } | 245 | } |
242 | 246 | ||
243 | static void briq_restart(char *cmd) | 247 | static void briq_restart(char *cmd) |
@@ -250,14 +254,14 @@ static void briq_restart(char *cmd) | |||
250 | 254 | ||
251 | void __init chrp_setup_arch(void) | 255 | void __init chrp_setup_arch(void) |
252 | { | 256 | { |
253 | struct device_node *root = find_path_device ("/"); | 257 | struct device_node *root = of_find_node_by_path("/"); |
254 | const char *machine = NULL; | 258 | const char *machine = NULL; |
255 | 259 | ||
256 | /* init to some ~sane value until calibrate_delay() runs */ | 260 | /* init to some ~sane value until calibrate_delay() runs */ |
257 | loops_per_jiffy = 50000000/HZ; | 261 | loops_per_jiffy = 50000000/HZ; |
258 | 262 | ||
259 | if (root) | 263 | if (root) |
260 | machine = get_property(root, "model", NULL); | 264 | machine = of_get_property(root, "model", NULL); |
261 | if (machine && strncmp(machine, "Pegasos", 7) == 0) { | 265 | if (machine && strncmp(machine, "Pegasos", 7) == 0) { |
262 | _chrp_type = _CHRP_Pegasos; | 266 | _chrp_type = _CHRP_Pegasos; |
263 | } else if (machine && strncmp(machine, "IBM", 3) == 0) { | 267 | } else if (machine && strncmp(machine, "IBM", 3) == 0) { |
@@ -273,6 +277,7 @@ void __init chrp_setup_arch(void) | |||
273 | /* Let's assume it is an IBM chrp if all else fails */ | 277 | /* Let's assume it is an IBM chrp if all else fails */ |
274 | _chrp_type = _CHRP_IBM; | 278 | _chrp_type = _CHRP_IBM; |
275 | } | 279 | } |
280 | of_node_put(root); | ||
276 | printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); | 281 | printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); |
277 | 282 | ||
278 | rtas_initialize(); | 283 | rtas_initialize(); |
@@ -361,8 +366,8 @@ static void __init chrp_find_openpic(void) | |||
361 | return; | 366 | return; |
362 | root = of_find_node_by_path("/"); | 367 | root = of_find_node_by_path("/"); |
363 | if (root) { | 368 | if (root) { |
364 | opprop = get_property(root, "platform-open-pic", &oplen); | 369 | opprop = of_get_property(root, "platform-open-pic", &oplen); |
365 | na = prom_n_addr_cells(root); | 370 | na = of_n_addr_cells(root); |
366 | } | 371 | } |
367 | if (opprop && oplen >= na * sizeof(unsigned int)) { | 372 | if (opprop && oplen >= na * sizeof(unsigned int)) { |
368 | opaddr = opprop[na-1]; /* assume 32-bit */ | 373 | opaddr = opprop[na-1]; /* assume 32-bit */ |
@@ -378,7 +383,7 @@ static void __init chrp_find_openpic(void) | |||
378 | 383 | ||
379 | printk(KERN_INFO "OpenPIC at %lx\n", opaddr); | 384 | printk(KERN_INFO "OpenPIC at %lx\n", opaddr); |
380 | 385 | ||
381 | iranges = get_property(np, "interrupt-ranges", &len); | 386 | iranges = of_get_property(np, "interrupt-ranges", &len); |
382 | if (iranges == NULL) | 387 | if (iranges == NULL) |
383 | len = 0; /* non-distributed mpic */ | 388 | len = 0; /* non-distributed mpic */ |
384 | else | 389 | else |
@@ -427,7 +432,7 @@ static void __init chrp_find_openpic(void) | |||
427 | of_node_put(np); | 432 | of_node_put(np); |
428 | } | 433 | } |
429 | 434 | ||
430 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) | 435 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
431 | static struct irqaction xmon_irqaction = { | 436 | static struct irqaction xmon_irqaction = { |
432 | .handler = xmon_irq, | 437 | .handler = xmon_irq, |
433 | .mask = CPU_MASK_NONE, | 438 | .mask = CPU_MASK_NONE, |
@@ -463,15 +468,16 @@ static void __init chrp_find_8259(void) | |||
463 | * Also, Pegasos-type platforms don't have a proper node to start | 468 | * Also, Pegasos-type platforms don't have a proper node to start |
464 | * from anyway | 469 | * from anyway |
465 | */ | 470 | */ |
466 | for (np = find_devices("pci"); np != NULL; np = np->next) { | 471 | for_each_node_by_name(np, "pci") { |
467 | const unsigned int *addrp = get_property(np, | 472 | const unsigned int *addrp = of_get_property(np, |
468 | "8259-interrupt-acknowledge", NULL); | 473 | "8259-interrupt-acknowledge", NULL); |
469 | 474 | ||
470 | if (addrp == NULL) | 475 | if (addrp == NULL) |
471 | continue; | 476 | continue; |
472 | chrp_int_ack = addrp[prom_n_addr_cells(np)-1]; | 477 | chrp_int_ack = addrp[of_n_addr_cells(np)-1]; |
473 | break; | 478 | break; |
474 | } | 479 | } |
480 | of_node_put(np); | ||
475 | if (np == NULL) | 481 | if (np == NULL) |
476 | printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" | 482 | printk(KERN_WARNING "Cannot find PCI interrupt acknowledge" |
477 | " address, polling\n"); | 483 | " address, polling\n"); |
@@ -493,7 +499,7 @@ static void __init chrp_find_8259(void) | |||
493 | 499 | ||
494 | void __init chrp_init_IRQ(void) | 500 | void __init chrp_init_IRQ(void) |
495 | { | 501 | { |
496 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) | 502 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
497 | struct device_node *kbd; | 503 | struct device_node *kbd; |
498 | #endif | 504 | #endif |
499 | chrp_find_openpic(); | 505 | chrp_find_openpic(); |
@@ -510,13 +516,14 @@ void __init chrp_init_IRQ(void) | |||
510 | if (_chrp_type == _CHRP_Pegasos) | 516 | if (_chrp_type == _CHRP_Pegasos) |
511 | ppc_md.get_irq = i8259_irq; | 517 | ppc_md.get_irq = i8259_irq; |
512 | 518 | ||
513 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) | 519 | #if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(CONFIG_XMON) |
514 | /* see if there is a keyboard in the device tree | 520 | /* see if there is a keyboard in the device tree |
515 | with a parent of type "adb" */ | 521 | with a parent of type "adb" */ |
516 | for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next) | 522 | for_each_node_by_name(kbd, "keyboard") |
517 | if (kbd->parent && kbd->parent->type | 523 | if (kbd->parent && kbd->parent->type |
518 | && strcmp(kbd->parent->type, "adb") == 0) | 524 | && strcmp(kbd->parent->type, "adb") == 0) |
519 | break; | 525 | break; |
526 | of_node_put(kbd); | ||
520 | if (kbd) | 527 | if (kbd) |
521 | setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); | 528 | setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction); |
522 | #endif | 529 | #endif |
@@ -542,9 +549,9 @@ chrp_init2(void) | |||
542 | /* Get the event scan rate for the rtas so we know how | 549 | /* Get the event scan rate for the rtas so we know how |
543 | * often it expects a heartbeat. -- Cort | 550 | * often it expects a heartbeat. -- Cort |
544 | */ | 551 | */ |
545 | device = find_devices("rtas"); | 552 | device = of_find_node_by_name(NULL, "rtas"); |
546 | if (device) | 553 | if (device) |
547 | p = get_property(device, "rtas-event-scan-rate", NULL); | 554 | p = of_get_property(device, "rtas-event-scan-rate", NULL); |
548 | if (p && *p) { | 555 | if (p && *p) { |
549 | /* | 556 | /* |
550 | * Arrange to call chrp_event_scan at least *p times | 557 | * Arrange to call chrp_event_scan at least *p times |
@@ -571,6 +578,7 @@ chrp_init2(void) | |||
571 | printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", | 578 | printk("RTAS Event Scan Rate: %u (%lu jiffies)\n", |
572 | *p, interval); | 579 | *p, interval); |
573 | } | 580 | } |
581 | of_node_put(device); | ||
574 | 582 | ||
575 | if (ppc_md.progress) | 583 | if (ppc_md.progress) |
576 | ppc_md.progress(" Have fun! ", 0x7777); | 584 | ppc_md.progress(" Have fun! ", 0x7777); |
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c index 7d7889026936..96d1e4b3c493 100644 --- a/arch/powerpc/platforms/chrp/time.c +++ b/arch/powerpc/platforms/chrp/time.c | |||
@@ -39,12 +39,17 @@ long __init chrp_time_init(void) | |||
39 | struct resource r; | 39 | struct resource r; |
40 | int base; | 40 | int base; |
41 | 41 | ||
42 | rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); | 42 | rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00"); |
43 | if (rtcs == NULL) | 43 | if (rtcs == NULL) |
44 | rtcs = find_compatible_devices("rtc", "ds1385-rtc"); | 44 | rtcs = of_find_compatible_node(NULL, "rtc", "ds1385-rtc"); |
45 | if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r)) | 45 | if (rtcs == NULL) |
46 | return 0; | ||
47 | if (of_address_to_resource(rtcs, 0, &r)) { | ||
48 | of_node_put(rtcs); | ||
46 | return 0; | 49 | return 0; |
47 | 50 | } | |
51 | of_node_put(rtcs); | ||
52 | |||
48 | base = r.start; | 53 | base = r.start; |
49 | nvram_as1 = 0; | 54 | nvram_as1 = 0; |
50 | nvram_as0 = base; | 55 | nvram_as0 = base; |
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig index 3410bcbc9dbe..9557908ef545 100644 --- a/arch/powerpc/platforms/embedded6xx/Kconfig +++ b/arch/powerpc/platforms/embedded6xx/Kconfig | |||
@@ -2,78 +2,6 @@ choice | |||
2 | prompt "Machine Type" | 2 | prompt "Machine Type" |
3 | depends on EMBEDDED6xx | 3 | depends on EMBEDDED6xx |
4 | 4 | ||
5 | config KATANA | ||
6 | bool "Artesyn-Katana" | ||
7 | help | ||
8 | Select KATANA if configuring an Artesyn KATANA 750i or 3750 | ||
9 | cPCI board. | ||
10 | |||
11 | config WILLOW | ||
12 | bool "Cogent-Willow" | ||
13 | |||
14 | config CPCI690 | ||
15 | bool "Force-CPCI690" | ||
16 | help | ||
17 | Select CPCI690 if configuring a Force CPCI690 cPCI board. | ||
18 | |||
19 | config POWERPMC250 | ||
20 | bool "Force-PowerPMC250" | ||
21 | |||
22 | config CHESTNUT | ||
23 | bool "IBM 750FX Eval board or 750GX Eval board" | ||
24 | help | ||
25 | Select CHESTNUT if configuring an IBM 750FX Eval Board or a | ||
26 | IBM 750GX Eval board. | ||
27 | |||
28 | config SPRUCE | ||
29 | bool "IBM-Spruce" | ||
30 | select PPC_INDIRECT_PCI | ||
31 | |||
32 | config HDPU | ||
33 | bool "Sky-HDPU" | ||
34 | help | ||
35 | Select HDPU if configuring a Sky Computers Compute Blade. | ||
36 | |||
37 | config HDPU_FEATURES | ||
38 | depends on HDPU | ||
39 | tristate "HDPU-Features" | ||
40 | help | ||
41 | Select to enable HDPU enhanced features. | ||
42 | |||
43 | config EV64260 | ||
44 | bool "Marvell-EV64260BP" | ||
45 | help | ||
46 | Select EV64260 if configuring a Marvell (formerly Galileo) | ||
47 | EV64260BP Evaluation platform. | ||
48 | |||
49 | config LOPEC | ||
50 | bool "Motorola-LoPEC" | ||
51 | select PPC_I8259 | ||
52 | |||
53 | config MVME5100 | ||
54 | bool "Motorola-MVME5100" | ||
55 | select PPC_INDIRECT_PCI | ||
56 | |||
57 | config PPLUS | ||
58 | bool "Motorola-PowerPlus" | ||
59 | select PPC_I8259 | ||
60 | select PPC_INDIRECT_PCI | ||
61 | |||
62 | config PRPMC750 | ||
63 | bool "Motorola-PrPMC750" | ||
64 | select PPC_INDIRECT_PCI | ||
65 | |||
66 | config PRPMC800 | ||
67 | bool "Motorola-PrPMC800" | ||
68 | select PPC_INDIRECT_PCI | ||
69 | |||
70 | config SANDPOINT | ||
71 | bool "Motorola-Sandpoint" | ||
72 | select PPC_I8259 | ||
73 | help | ||
74 | Select SANDPOINT if configuring for a Motorola Sandpoint X3 | ||
75 | (any flavor). | ||
76 | |||
77 | config LINKSTATION | 5 | config LINKSTATION |
78 | bool "Linkstation / Kurobox(HG) from Buffalo" | 6 | bool "Linkstation / Kurobox(HG) from Buffalo" |
79 | select MPIC | 7 | select MPIC |
@@ -97,212 +25,24 @@ config MPC7448HPC2 | |||
97 | help | 25 | help |
98 | Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga) | 26 | Select MPC7448HPC2 if configuring for Freescale MPC7448HPC2 (Taiga) |
99 | platform | 27 | platform |
100 | |||
101 | config RADSTONE_PPC7D | ||
102 | bool "Radstone Technology PPC7D board" | ||
103 | select PPC_I8259 | ||
104 | |||
105 | config PAL4 | ||
106 | bool "SBS-Palomar4" | ||
107 | |||
108 | config EST8260 | ||
109 | bool "EST8260" | ||
110 | ---help--- | ||
111 | The EST8260 is a single-board computer manufactured by Wind River | ||
112 | Systems, Inc. (formerly Embedded Support Tools Corp.) and based on | ||
113 | the MPC8260. Wind River Systems has a website at | ||
114 | <http://www.windriver.com/>, but the EST8260 cannot be found on it | ||
115 | and has probably been discontinued or rebadged. | ||
116 | |||
117 | config SBC82xx | ||
118 | bool "SBC82xx" | ||
119 | ---help--- | ||
120 | SBC PowerQUICC II, single-board computer with MPC82xx CPU | ||
121 | Manufacturer: Wind River Systems, Inc. | ||
122 | Date of Release: May 2003 | ||
123 | End of Life: - | ||
124 | URL: <http://www.windriver.com/> | ||
125 | |||
126 | config SBS8260 | ||
127 | bool "SBS8260" | ||
128 | |||
129 | config RPX8260 | ||
130 | bool "RPXSUPER" | ||
131 | |||
132 | config TQM8260 | ||
133 | bool "TQM8260" | ||
134 | ---help--- | ||
135 | MPC8260 based module, little larger than credit card, | ||
136 | up to 128 MB global + 64 MB local RAM, 32 MB Flash, | ||
137 | 32 kB EEPROM, 256 kB L@ Cache, 10baseT + 100baseT Ethernet, | ||
138 | 2 x serial ports, ... | ||
139 | Manufacturer: TQ Components, www.tq-group.de | ||
140 | Date of Release: June 2001 | ||
141 | End of Life: not yet :-) | ||
142 | URL: <http://www.denx.de/PDF/TQM82xx_SPEC_Rev005.pdf> | ||
143 | |||
144 | config ADS8272 | ||
145 | bool "ADS8272" | ||
146 | |||
147 | config PQ2FADS | ||
148 | bool "Freescale-PQ2FADS" | ||
149 | help | ||
150 | Select PQ2FADS if you wish to configure for a Freescale | ||
151 | PQ2FADS board (-VR or -ZU). | ||
152 | |||
153 | config EV64360 | ||
154 | bool "Marvell-EV64360BP" | ||
155 | help | ||
156 | Select EV64360 if configuring a Marvell EV64360BP Evaluation | ||
157 | platform. | ||
158 | endchoice | 28 | endchoice |
159 | 29 | ||
160 | config PQ2ADS | ||
161 | bool | ||
162 | depends on ADS8272 | ||
163 | default y | ||
164 | |||
165 | config TQM8xxL | ||
166 | bool | ||
167 | depends on 8xx && (TQM823L || TQM850L || FPS850L || TQM855L || TQM860L) | ||
168 | default y | ||
169 | |||
170 | config 8260 | ||
171 | bool "CPM2 Support" if WILLOW | ||
172 | depends on 6xx | ||
173 | default y if TQM8260 || RPX8260 || EST8260 || SBS8260 || SBC82xx || PQ2FADS | ||
174 | help | ||
175 | The MPC8260 is a typical embedded CPU made by Motorola. Selecting | ||
176 | this option means that you wish to build a kernel for a machine with | ||
177 | an 8260 class CPU. | ||
178 | |||
179 | config 8272 | ||
180 | bool | ||
181 | depends on 6xx | ||
182 | default y if ADS8272 | ||
183 | select 8260 | ||
184 | help | ||
185 | The MPC8272 CPM has a different internal dpram setup than other CPM2 | ||
186 | devices | ||
187 | |||
188 | config CPM2 | ||
189 | bool | ||
190 | depends on 8260 || MPC8560 || MPC8555 | ||
191 | default y | ||
192 | help | ||
193 | The CPM2 (Communications Processor Module) is a coprocessor on | ||
194 | embedded CPUs made by Motorola. Selecting this option means that | ||
195 | you wish to build a kernel for a machine with a CPM2 coprocessor | ||
196 | on it (826x, 827x, 8560). | ||
197 | |||
198 | config PPC_GEN550 | ||
199 | bool | ||
200 | depends on SANDPOINT || SPRUCE || PPLUS || \ | ||
201 | PRPMC750 || PRPMC800 || LOPEC || \ | ||
202 | (EV64260 && !SERIAL_MPSC) || CHESTNUT || RADSTONE_PPC7D || \ | ||
203 | 83xx || LINKSTATION | ||
204 | default y | ||
205 | |||
206 | config FORCE | ||
207 | bool | ||
208 | depends on 6xx && POWERPMC250 | ||
209 | default y | ||
210 | |||
211 | config GT64260 | ||
212 | bool | ||
213 | depends on EV64260 || CPCI690 | ||
214 | default y | ||
215 | |||
216 | config MV64360 # Really MV64360 & MV64460 | ||
217 | bool | ||
218 | depends on CHESTNUT || KATANA || RADSTONE_PPC7D || HDPU || EV64360 | ||
219 | default y | ||
220 | |||
221 | config MV64X60 | ||
222 | bool | ||
223 | depends on (GT64260 || MV64360) | ||
224 | select PPC_INDIRECT_PCI | ||
225 | default y | ||
226 | |||
227 | config TSI108_BRIDGE | 30 | config TSI108_BRIDGE |
228 | bool | 31 | bool |
229 | depends on MPC7448HPC2 | 32 | depends on MPC7448HPC2 |
230 | default y | 33 | default y |
231 | 34 | ||
232 | menu "Set bridge options" | ||
233 | depends on MV64X60 | ||
234 | |||
235 | config NOT_COHERENT_CACHE | ||
236 | bool "Turn off Cache Coherency" | ||
237 | default n | ||
238 | help | ||
239 | Some 64x60 bridges lock up when trying to enforce cache coherency. | ||
240 | When this option is selected, cache coherency will be turned off. | ||
241 | Note that this can cause other problems (e.g., stale data being | ||
242 | speculatively loaded via a cached mapping). Use at your own risk. | ||
243 | |||
244 | config MV64X60_BASE | ||
245 | hex "Set bridge base used by firmware" | ||
246 | default "0xf1000000" | ||
247 | help | ||
248 | A firmware can leave the base address of the bridge's registers at | ||
249 | a non-standard location. If so, set this value to reflect the | ||
250 | address of that non-standard location. | ||
251 | |||
252 | config MV64X60_NEW_BASE | ||
253 | hex "Set bridge base used by kernel" | ||
254 | default "0xf1000000" | ||
255 | help | ||
256 | If the current base address of the bridge's registers is not where | ||
257 | you want it, set this value to the address that you want it moved to. | ||
258 | |||
259 | endmenu | ||
260 | |||
261 | config NONMONARCH_SUPPORT | ||
262 | bool "Enable Non-Monarch Support" | ||
263 | depends on PRPMC800 | ||
264 | |||
265 | config HARRIER | ||
266 | bool | ||
267 | depends on PRPMC800 | ||
268 | default y | ||
269 | |||
270 | config EPIC_SERIAL_MODE | ||
271 | bool | ||
272 | depends on 6xx && (LOPEC || SANDPOINT) | ||
273 | default y | ||
274 | |||
275 | config MPC10X_BRIDGE | 35 | config MPC10X_BRIDGE |
276 | bool | 36 | bool |
277 | depends on POWERPMC250 || LOPEC || SANDPOINT || LINKSTATION | 37 | depends on LINKSTATION |
278 | select PPC_INDIRECT_PCI | 38 | select PPC_INDIRECT_PCI |
279 | default y | 39 | default y |
280 | 40 | ||
281 | config MPC10X_OPENPIC | 41 | config MPC10X_OPENPIC |
282 | bool | 42 | bool |
283 | depends on POWERPMC250 || LOPEC || SANDPOINT || LINKSTATION | 43 | depends on LINKSTATION |
284 | default y | 44 | default y |
285 | 45 | ||
286 | config MPC10X_STORE_GATHERING | 46 | config MPC10X_STORE_GATHERING |
287 | bool "Enable MPC10x store gathering" | 47 | bool "Enable MPC10x store gathering" |
288 | depends on MPC10X_BRIDGE | 48 | depends on MPC10X_BRIDGE |
289 | |||
290 | config SANDPOINT_ENABLE_UART1 | ||
291 | bool "Enable DUART mode on Sandpoint" | ||
292 | depends on SANDPOINT | ||
293 | help | ||
294 | If this option is enabled then the MPC824x processor will run | ||
295 | in DUART mode instead of UART mode. | ||
296 | |||
297 | config HARRIER_STORE_GATHERING | ||
298 | bool "Enable Harrier store gathering" | ||
299 | depends on HARRIER | ||
300 | |||
301 | config MVME5100_IPMC761_PRESENT | ||
302 | bool "MVME5100 configured with an IPMC761" | ||
303 | depends on MVME5100 | ||
304 | select PPC_I8259 | ||
305 | |||
306 | config SPRUCE_BAUD_33M | ||
307 | bool "Spruce baud clock support" | ||
308 | depends on SPRUCE | ||
diff --git a/arch/powerpc/platforms/embedded6xx/linkstation.c b/arch/powerpc/platforms/embedded6xx/linkstation.c index 3f6c4114f908..b412f006a9c5 100644 --- a/arch/powerpc/platforms/embedded6xx/linkstation.c +++ b/arch/powerpc/platforms/embedded6xx/linkstation.c | |||
@@ -58,11 +58,11 @@ static int __init add_bridge(struct device_node *dev) | |||
58 | { | 58 | { |
59 | int len; | 59 | int len; |
60 | struct pci_controller *hose; | 60 | struct pci_controller *hose; |
61 | int *bus_range; | 61 | const int *bus_range; |
62 | 62 | ||
63 | printk("Adding PCI host bridge %s\n", dev->full_name); | 63 | printk("Adding PCI host bridge %s\n", dev->full_name); |
64 | 64 | ||
65 | bus_range = (int *) get_property(dev, "bus-range", &len); | 65 | bus_range = of_get_property(dev, "bus-range", &len); |
66 | if (bus_range == NULL || len < 2 * sizeof(int)) | 66 | if (bus_range == NULL || len < 2 * sizeof(int)) |
67 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 67 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
68 | " bus 0\n", dev->full_name); | 68 | " bus 0\n", dev->full_name); |
@@ -106,7 +106,7 @@ static void __init linkstation_init_IRQ(void) | |||
106 | { | 106 | { |
107 | struct mpic *mpic; | 107 | struct mpic *mpic; |
108 | struct device_node *dnp; | 108 | struct device_node *dnp; |
109 | void *prop; | 109 | const u32 *prop; |
110 | int size; | 110 | int size; |
111 | phys_addr_t paddr; | 111 | phys_addr_t paddr; |
112 | 112 | ||
@@ -114,7 +114,7 @@ static void __init linkstation_init_IRQ(void) | |||
114 | if (dnp == NULL) | 114 | if (dnp == NULL) |
115 | return; | 115 | return; |
116 | 116 | ||
117 | prop = (struct device_node *)get_property(dnp, "reg", &size); | 117 | prop = of_get_property(dnp, "reg", &size); |
118 | paddr = (phys_addr_t)of_translate_address(dnp, prop); | 118 | paddr = (phys_addr_t)of_translate_address(dnp, prop); |
119 | 119 | ||
120 | mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC "); | 120 | mpic = mpic_alloc(dnp, paddr, MPIC_PRIMARY | MPIC_WANTS_RESET, 4, 32, " EPIC "); |
diff --git a/arch/powerpc/platforms/embedded6xx/ls_uart.c b/arch/powerpc/platforms/embedded6xx/ls_uart.c index 0e837762cc5b..d0bee9f19e4e 100644 --- a/arch/powerpc/platforms/embedded6xx/ls_uart.c +++ b/arch/powerpc/platforms/embedded6xx/ls_uart.c | |||
@@ -110,8 +110,8 @@ static int __init ls_uarts_init(void) | |||
110 | if (!avr) | 110 | if (!avr) |
111 | return -EINVAL; | 111 | return -EINVAL; |
112 | 112 | ||
113 | avr_clock = *(u32*)get_property(avr, "clock-frequency", &len); | 113 | avr_clock = *(u32*)of_get_property(avr, "clock-frequency", &len); |
114 | phys_addr = ((u32*)get_property(avr, "reg", &len))[0]; | 114 | phys_addr = ((u32*)of_get_property(avr, "reg", &len))[0]; |
115 | 115 | ||
116 | if (!avr_clock || !phys_addr) | 116 | if (!avr_clock || !phys_addr) |
117 | return -EINVAL; | 117 | return -EINVAL; |
diff --git a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c index 3fcc85f60fbf..c3f64ddb0be6 100644 --- a/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c +++ b/arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/irq.h> | 27 | #include <linux/irq.h> |
28 | #include <linux/ide.h> | ||
29 | #include <linux/seq_file.h> | 28 | #include <linux/seq_file.h> |
30 | #include <linux/root_dev.h> | 29 | #include <linux/root_dev.h> |
31 | #include <linux/serial.h> | 30 | #include <linux/serial.h> |
@@ -82,7 +81,7 @@ static void __init mpc7448_hpc2_setup_arch(void) | |||
82 | if (cpu != 0) { | 81 | if (cpu != 0) { |
83 | const unsigned int *fp; | 82 | const unsigned int *fp; |
84 | 83 | ||
85 | fp = get_property(cpu, "clock-frequency", NULL); | 84 | fp = of_get_property(cpu, "clock-frequency", NULL); |
86 | if (fp != 0) | 85 | if (fp != 0) |
87 | loops_per_jiffy = *fp / HZ; | 86 | loops_per_jiffy = *fp / HZ; |
88 | else | 87 | else |
@@ -91,16 +90,6 @@ static void __init mpc7448_hpc2_setup_arch(void) | |||
91 | } | 90 | } |
92 | tsi108_csr_vir_base = get_vir_csrbase(); | 91 | tsi108_csr_vir_base = get_vir_csrbase(); |
93 | 92 | ||
94 | #ifdef CONFIG_ROOT_NFS | ||
95 | ROOT_DEV = Root_NFS; | ||
96 | #else | ||
97 | ROOT_DEV = Root_HDA1; | ||
98 | #endif | ||
99 | |||
100 | #ifdef CONFIG_BLK_DEV_INITRD | ||
101 | ROOT_DEV = Root_RAM0; | ||
102 | #endif | ||
103 | |||
104 | /* setup PCI host bridge */ | 93 | /* setup PCI host bridge */ |
105 | #ifdef CONFIG_PCI | 94 | #ifdef CONFIG_PCI |
106 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) | 95 | for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) |
@@ -143,7 +132,7 @@ static void __init mpc7448_hpc2_init_IRQ(void) | |||
143 | tsi_pic = of_find_node_by_type(NULL, "open-pic"); | 132 | tsi_pic = of_find_node_by_type(NULL, "open-pic"); |
144 | if (tsi_pic) { | 133 | if (tsi_pic) { |
145 | unsigned int size; | 134 | unsigned int size; |
146 | const void *prop = get_property(tsi_pic, "reg", &size); | 135 | const void *prop = of_get_property(tsi_pic, "reg", &size); |
147 | mpic_paddr = of_translate_address(tsi_pic, prop); | 136 | mpic_paddr = of_translate_address(tsi_pic, prop); |
148 | } | 137 | } |
149 | 138 | ||
diff --git a/arch/powerpc/platforms/iseries/Kconfig b/arch/powerpc/platforms/iseries/Kconfig index 54e6b3b6f261..46c3a8e7c3a8 100644 --- a/arch/powerpc/platforms/iseries/Kconfig +++ b/arch/powerpc/platforms/iseries/Kconfig | |||
@@ -1,3 +1,7 @@ | |||
1 | config PPC_ISERIES | ||
2 | bool "IBM Legacy iSeries" | ||
3 | depends on PPC_MULTIPLATFORM && PPC64 | ||
4 | select PPC_INDIRECT_IO | ||
1 | 5 | ||
2 | menu "iSeries device drivers" | 6 | menu "iSeries device drivers" |
3 | depends on PPC_ISERIES | 7 | depends on PPC_ISERIES |
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c index d7a756d5135c..3b6a9666c2c0 100644 --- a/arch/powerpc/platforms/iseries/iommu.c +++ b/arch/powerpc/platforms/iseries/iommu.c | |||
@@ -171,7 +171,7 @@ void iommu_devnode_init_iSeries(struct pci_dev *pdev, struct device_node *dn) | |||
171 | { | 171 | { |
172 | struct iommu_table *tbl; | 172 | struct iommu_table *tbl; |
173 | struct pci_dn *pdn = PCI_DN(dn); | 173 | struct pci_dn *pdn = PCI_DN(dn); |
174 | const u32 *lsn = get_property(dn, "linux,logical-slot-number", NULL); | 174 | const u32 *lsn = of_get_property(dn, "linux,logical-slot-number", NULL); |
175 | 175 | ||
176 | BUG_ON(lsn == NULL); | 176 | BUG_ON(lsn == NULL); |
177 | 177 | ||
@@ -194,5 +194,5 @@ void iommu_init_early_iSeries(void) | |||
194 | ppc_md.tce_build = tce_build_iSeries; | 194 | ppc_md.tce_build = tce_build_iSeries; |
195 | ppc_md.tce_free = tce_free_iSeries; | 195 | ppc_md.tce_free = tce_free_iSeries; |
196 | 196 | ||
197 | pci_dma_ops = &dma_iommu_ops; | 197 | set_pci_dma_ops(&dma_iommu_ops); |
198 | } | 198 | } |
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c index 5225abfafd9b..63b33675848b 100644 --- a/arch/powerpc/platforms/iseries/irq.c +++ b/arch/powerpc/platforms/iseries/irq.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/param.h> | 30 | #include <linux/param.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/bootmem.h> | 32 | #include <linux/bootmem.h> |
33 | #include <linux/ide.h> | ||
34 | #include <linux/irq.h> | 33 | #include <linux/irq.h> |
35 | #include <linux/spinlock.h> | 34 | #include <linux/spinlock.h> |
36 | 35 | ||
@@ -337,6 +336,8 @@ unsigned int iSeries_get_irq(void) | |||
337 | return irq; | 336 | return irq; |
338 | } | 337 | } |
339 | 338 | ||
339 | #ifdef CONFIG_PCI | ||
340 | |||
340 | static int iseries_irq_host_map(struct irq_host *h, unsigned int virq, | 341 | static int iseries_irq_host_map(struct irq_host *h, unsigned int virq, |
341 | irq_hw_number_t hw) | 342 | irq_hw_number_t hw) |
342 | { | 343 | { |
@@ -384,3 +385,4 @@ void __init iSeries_init_IRQ(void) | |||
384 | "failed with rc 0x%x\n", ret); | 385 | "failed with rc 0x%x\n", ret); |
385 | } | 386 | } |
386 | 387 | ||
388 | #endif /* CONFIG_PCI */ | ||
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c index 4a06d9c34986..9c974227155e 100644 --- a/arch/powerpc/platforms/iseries/pci.c +++ b/arch/powerpc/platforms/iseries/pci.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/ide.h> | ||
28 | #include <linux/pci.h> | 27 | #include <linux/pci.h> |
29 | 28 | ||
30 | #include <asm/io.h> | 29 | #include <asm/io.h> |
@@ -177,7 +176,7 @@ void __init iSeries_pci_final_fixup(void) | |||
177 | struct pci_dn *pdn = PCI_DN(node); | 176 | struct pci_dn *pdn = PCI_DN(node); |
178 | const u32 *agent; | 177 | const u32 *agent; |
179 | 178 | ||
180 | agent = get_property(node, "linux,agent-id", NULL); | 179 | agent = of_get_property(node, "linux,agent-id", NULL); |
181 | if ((pdn != NULL) && (agent != NULL)) { | 180 | if ((pdn != NULL) && (agent != NULL)) { |
182 | u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, | 181 | u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, |
183 | pdn->bussubno); | 182 | pdn->bussubno); |
@@ -755,7 +754,7 @@ void __init iSeries_pcibios_init(void) | |||
755 | if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) | 754 | if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) |
756 | continue; | 755 | continue; |
757 | 756 | ||
758 | busp = get_property(node, "bus-range", NULL); | 757 | busp = of_get_property(node, "bus-range", NULL); |
759 | if (busp == NULL) | 758 | if (busp == NULL) |
760 | continue; | 759 | continue; |
761 | bus = *busp; | 760 | bus = *busp; |
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c index cce7e309340c..7f5dcee814d4 100644 --- a/arch/powerpc/platforms/iseries/setup.c +++ b/arch/powerpc/platforms/iseries/setup.c | |||
@@ -628,15 +628,6 @@ static void iseries_iounmap(volatile void __iomem *token) | |||
628 | { | 628 | { |
629 | } | 629 | } |
630 | 630 | ||
631 | /* | ||
632 | * iSeries has no legacy IO, anything calling this function has to | ||
633 | * fail or bad things will happen | ||
634 | */ | ||
635 | static int iseries_check_legacy_ioport(unsigned int baseport) | ||
636 | { | ||
637 | return -ENODEV; | ||
638 | } | ||
639 | |||
640 | static int __init iseries_probe(void) | 631 | static int __init iseries_probe(void) |
641 | { | 632 | { |
642 | unsigned long root = of_get_flat_dt_root(); | 633 | unsigned long root = of_get_flat_dt_root(); |
@@ -667,7 +658,6 @@ define_machine(iseries) { | |||
667 | .calibrate_decr = generic_calibrate_decr, | 658 | .calibrate_decr = generic_calibrate_decr, |
668 | .progress = iSeries_progress, | 659 | .progress = iSeries_progress, |
669 | .probe = iseries_probe, | 660 | .probe = iseries_probe, |
670 | .check_legacy_ioport = iseries_check_legacy_ioport, | ||
671 | .ioremap = iseries_ioremap, | 661 | .ioremap = iseries_ioremap, |
672 | .iounmap = iseries_iounmap, | 662 | .iounmap = iseries_iounmap, |
673 | /* XXX Implement enable_pmcs for iSeries */ | 663 | /* XXX Implement enable_pmcs for iSeries */ |
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c index e2100ece9c65..2ca2d8a9de97 100644 --- a/arch/powerpc/platforms/iseries/viopath.c +++ b/arch/powerpc/platforms/iseries/viopath.c | |||
@@ -155,7 +155,7 @@ static int proc_viopath_show(struct seq_file *m, void *v) | |||
155 | node = of_find_node_by_path("/"); | 155 | node = of_find_node_by_path("/"); |
156 | sysid = NULL; | 156 | sysid = NULL; |
157 | if (node != NULL) | 157 | if (node != NULL) |
158 | sysid = get_property(node, "system-id", NULL); | 158 | sysid = of_get_property(node, "system-id", NULL); |
159 | 159 | ||
160 | if (sysid == NULL) | 160 | if (sysid == NULL) |
161 | seq_printf(m, "SRLNBR=<UNKNOWN>\n"); | 161 | seq_printf(m, "SRLNBR=<UNKNOWN>\n"); |
diff --git a/arch/powerpc/platforms/maple/Kconfig b/arch/powerpc/platforms/maple/Kconfig new file mode 100644 index 000000000000..f7c95eb5d8ba --- /dev/null +++ b/arch/powerpc/platforms/maple/Kconfig | |||
@@ -0,0 +1,17 @@ | |||
1 | config PPC_MAPLE | ||
2 | depends on PPC_MULTIPLATFORM && PPC64 | ||
3 | bool "Maple 970FX Evaluation Board" | ||
4 | select MPIC | ||
5 | select U3_DART | ||
6 | select MPIC_U3_HT_IRQS | ||
7 | select GENERIC_TBSYNC | ||
8 | select PPC_UDBG_16550 | ||
9 | select PPC_970_NAP | ||
10 | select PPC_NATIVE | ||
11 | select PPC_RTAS | ||
12 | select MMIO_NVRAM | ||
13 | select ATA_NONSTANDARD if ATA | ||
14 | default n | ||
15 | help | ||
16 | This option enables support for the Maple 970FX Evaluation Board. | ||
17 | For more information, refer to <http://www.970eval.com> | ||
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c index 73c59904697f..b1d3b99c3f9d 100644 --- a/arch/powerpc/platforms/maple/pci.c +++ b/arch/powerpc/platforms/maple/pci.c | |||
@@ -44,11 +44,11 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher | |||
44 | int len; | 44 | int len; |
45 | 45 | ||
46 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ | 46 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ |
47 | class_code = get_property(node, "class-code", NULL); | 47 | class_code = of_get_property(node, "class-code", NULL); |
48 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 48 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
49 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 49 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
50 | continue; | 50 | continue; |
51 | bus_range = get_property(node, "bus-range", &len); | 51 | bus_range = of_get_property(node, "bus-range", &len); |
52 | if (bus_range != NULL && len > 2 * sizeof(int)) { | 52 | if (bus_range != NULL && len > 2 * sizeof(int)) { |
53 | if (bus_range[1] > higher) | 53 | if (bus_range[1] > higher) |
54 | higher = bus_range[1]; | 54 | higher = bus_range[1]; |
@@ -77,7 +77,7 @@ static void __init fixup_bus_range(struct device_node *bridge) | |||
77 | bridge->full_name); | 77 | bridge->full_name); |
78 | return; | 78 | return; |
79 | } | 79 | } |
80 | bus_range = (int *)prop->value; | 80 | bus_range = prop->value; |
81 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); | 81 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); |
82 | } | 82 | } |
83 | 83 | ||
@@ -454,7 +454,7 @@ static int __init add_bridge(struct device_node *dev) | |||
454 | 454 | ||
455 | DBG("Adding PCI host bridge %s\n", dev->full_name); | 455 | DBG("Adding PCI host bridge %s\n", dev->full_name); |
456 | 456 | ||
457 | bus_range = get_property(dev, "bus-range", &len); | 457 | bus_range = of_get_property(dev, "bus-range", &len); |
458 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 458 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
459 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", | 459 | printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", |
460 | dev->full_name); | 460 | dev->full_name); |
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c index 82d3f9e28d7c..2a30c5b2532e 100644 --- a/arch/powerpc/platforms/maple/setup.c +++ b/arch/powerpc/platforms/maple/setup.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/initrd.h> | 32 | #include <linux/initrd.h> |
33 | #include <linux/vt_kern.h> | 33 | #include <linux/vt_kern.h> |
34 | #include <linux/console.h> | 34 | #include <linux/console.h> |
35 | #include <linux/ide.h> | ||
36 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
37 | #include <linux/adb.h> | 36 | #include <linux/adb.h> |
38 | #include <linux/cuda.h> | 37 | #include <linux/cuda.h> |
@@ -114,8 +113,8 @@ static void maple_restart(char *cmd) | |||
114 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); | 113 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); |
115 | goto fail; | 114 | goto fail; |
116 | } | 115 | } |
117 | maple_nvram_offset = get_property(sp, "restart-addr", NULL); | 116 | maple_nvram_offset = of_get_property(sp, "restart-addr", NULL); |
118 | maple_nvram_command = get_property(sp, "restart-value", NULL); | 117 | maple_nvram_command = of_get_property(sp, "restart-value", NULL); |
119 | of_node_put(sp); | 118 | of_node_put(sp); |
120 | 119 | ||
121 | /* send command */ | 120 | /* send command */ |
@@ -141,8 +140,8 @@ static void maple_power_off(void) | |||
141 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); | 140 | printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); |
142 | goto fail; | 141 | goto fail; |
143 | } | 142 | } |
144 | maple_nvram_offset = get_property(sp, "power-off-addr", NULL); | 143 | maple_nvram_offset = of_get_property(sp, "power-off-addr", NULL); |
145 | maple_nvram_command = get_property(sp, "power-off-value", NULL); | 144 | maple_nvram_command = of_get_property(sp, "power-off-value", NULL); |
146 | of_node_put(sp); | 145 | of_node_put(sp); |
147 | 146 | ||
148 | /* send command */ | 147 | /* send command */ |
@@ -249,8 +248,8 @@ static void __init maple_init_IRQ(void) | |||
249 | 248 | ||
250 | /* Find address list in /platform-open-pic */ | 249 | /* Find address list in /platform-open-pic */ |
251 | root = of_find_node_by_path("/"); | 250 | root = of_find_node_by_path("/"); |
252 | naddr = prom_n_addr_cells(root); | 251 | naddr = of_n_addr_cells(root); |
253 | opprop = get_property(root, "platform-open-pic", &opplen); | 252 | opprop = of_get_property(root, "platform-open-pic", &opplen); |
254 | if (opprop != 0) { | 253 | if (opprop != 0) { |
255 | openpic_addr = of_read_number(opprop, naddr); | 254 | openpic_addr = of_read_number(opprop, naddr); |
256 | has_isus = (opplen > naddr); | 255 | has_isus = (opplen > naddr); |
@@ -261,11 +260,11 @@ static void __init maple_init_IRQ(void) | |||
261 | BUG_ON(openpic_addr == 0); | 260 | BUG_ON(openpic_addr == 0); |
262 | 261 | ||
263 | /* Check for a big endian MPIC */ | 262 | /* Check for a big endian MPIC */ |
264 | if (get_property(np, "big-endian", NULL) != NULL) | 263 | if (of_get_property(np, "big-endian", NULL) != NULL) |
265 | flags |= MPIC_BIG_ENDIAN; | 264 | flags |= MPIC_BIG_ENDIAN; |
266 | 265 | ||
267 | /* XXX Maple specific bits */ | 266 | /* XXX Maple specific bits */ |
268 | flags |= MPIC_BROKEN_U3 | MPIC_WANTS_RESET; | 267 | flags |= MPIC_U3_HT_IRQS | MPIC_WANTS_RESET; |
269 | /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */ | 268 | /* All U3/U4 are big-endian, older SLOF firmware doesn't encode this */ |
270 | flags |= MPIC_BIG_ENDIAN; | 269 | flags |= MPIC_BIG_ENDIAN; |
271 | 270 | ||
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig index 68dc529dfd2f..eb4dbc705b06 100644 --- a/arch/powerpc/platforms/pasemi/Kconfig +++ b/arch/powerpc/platforms/pasemi/Kconfig | |||
@@ -1,3 +1,15 @@ | |||
1 | config PPC_PASEMI | ||
2 | depends on PPC_MULTIPLATFORM && PPC64 | ||
3 | bool "PA Semi SoC-based platforms" | ||
4 | default n | ||
5 | select MPIC | ||
6 | select PPC_UDBG_16550 | ||
7 | select GENERIC_TBSYNC | ||
8 | select PPC_NATIVE | ||
9 | help | ||
10 | This option enables support for PA Semi's PWRficient line | ||
11 | of SoC processors, including PA6T-1682M | ||
12 | |||
1 | menu "PA Semi PWRficient options" | 13 | menu "PA Semi PWRficient options" |
2 | depends on PPC_PASEMI | 14 | depends on PPC_PASEMI |
3 | 15 | ||
@@ -7,4 +19,11 @@ config PPC_PASEMI_IOMMU | |||
7 | help | 19 | help |
8 | IOMMU support for PA6T-1682M | 20 | IOMMU support for PA6T-1682M |
9 | 21 | ||
22 | config PPC_PASEMI_MDIO | ||
23 | depends on PHYLIB | ||
24 | tristate "MDIO support via GPIO" | ||
25 | default y | ||
26 | help | ||
27 | Driver for MDIO via GPIO on PWRficient platforms | ||
28 | |||
10 | endmenu | 29 | endmenu |
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile index e657ccae90a9..2cd2a4f26a48 100644 --- a/arch/powerpc/platforms/pasemi/Makefile +++ b/arch/powerpc/platforms/pasemi/Makefile | |||
@@ -1,2 +1,3 @@ | |||
1 | obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o | 1 | obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o |
2 | 2 | obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o | |
3 | obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o | ||
diff --git a/arch/powerpc/platforms/pasemi/cpufreq.c b/arch/powerpc/platforms/pasemi/cpufreq.c new file mode 100644 index 000000000000..2a57d6023685 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/cpufreq.c | |||
@@ -0,0 +1,308 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 PA Semi, Inc | ||
3 | * | ||
4 | * Authors: Egor Martovetsky <egor@pasemi.com> | ||
5 | * Olof Johansson <olof@lixom.net> | ||
6 | * | ||
7 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
8 | * | ||
9 | * Based on arch/powerpc/platforms/cell/cbe_cpufreq.c: | ||
10 | * (C) Copyright IBM Deutschland Entwicklung GmbH 2005 | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2, or (at your option) | ||
15 | * any later version. | ||
16 | * | ||
17 | * This program is distributed in the hope that it will be useful, | ||
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
20 | * GNU General Public License for more details. | ||
21 | * | ||
22 | * You should have received a copy of the GNU General Public License | ||
23 | * along with this program; if not, write to the Free Software | ||
24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
25 | * | ||
26 | */ | ||
27 | |||
28 | #include <linux/cpufreq.h> | ||
29 | #include <linux/timer.h> | ||
30 | |||
31 | #include <asm/hw_irq.h> | ||
32 | #include <asm/io.h> | ||
33 | #include <asm/prom.h> | ||
34 | |||
35 | #define SDCASR_REG 0x0100 | ||
36 | #define SDCASR_REG_STRIDE 0x1000 | ||
37 | #define SDCPWR_CFGA0_REG 0x0100 | ||
38 | #define SDCPWR_PWST0_REG 0x0000 | ||
39 | #define SDCPWR_GIZTIME_REG 0x0440 | ||
40 | |||
41 | /* SDCPWR_GIZTIME_REG fields */ | ||
42 | #define SDCPWR_GIZTIME_GR 0x80000000 | ||
43 | #define SDCPWR_GIZTIME_LONGLOCK 0x000000ff | ||
44 | |||
45 | /* Offset of ASR registers from SDC base */ | ||
46 | #define SDCASR_OFFSET 0x120000 | ||
47 | |||
48 | static void __iomem *sdcpwr_mapbase; | ||
49 | static void __iomem *sdcasr_mapbase; | ||
50 | |||
51 | static DEFINE_MUTEX(pas_switch_mutex); | ||
52 | |||
53 | /* Current astate, is used when waking up from power savings on | ||
54 | * one core, in case the other core has switched states during | ||
55 | * the idle time. | ||
56 | */ | ||
57 | static int current_astate; | ||
58 | |||
59 | /* We support 5(A0-A4) power states excluding turbo(A5-A6) modes */ | ||
60 | static struct cpufreq_frequency_table pas_freqs[] = { | ||
61 | {0, 0}, | ||
62 | {1, 0}, | ||
63 | {2, 0}, | ||
64 | {3, 0}, | ||
65 | {4, 0}, | ||
66 | {0, CPUFREQ_TABLE_END}, | ||
67 | }; | ||
68 | |||
69 | static struct freq_attr *pas_cpu_freqs_attr[] = { | ||
70 | &cpufreq_freq_attr_scaling_available_freqs, | ||
71 | NULL, | ||
72 | }; | ||
73 | |||
74 | /* | ||
75 | * hardware specific functions | ||
76 | */ | ||
77 | |||
78 | static int get_astate_freq(int astate) | ||
79 | { | ||
80 | u32 ret; | ||
81 | ret = in_le32(sdcpwr_mapbase + SDCPWR_CFGA0_REG + (astate * 0x10)); | ||
82 | |||
83 | return ret & 0x3f; | ||
84 | } | ||
85 | |||
86 | static int get_cur_astate(int cpu) | ||
87 | { | ||
88 | u32 ret; | ||
89 | |||
90 | ret = in_le32(sdcpwr_mapbase + SDCPWR_PWST0_REG); | ||
91 | ret = (ret >> (cpu * 4)) & 0x7; | ||
92 | |||
93 | return ret; | ||
94 | } | ||
95 | |||
96 | static int get_gizmo_latency(void) | ||
97 | { | ||
98 | u32 giztime, ret; | ||
99 | |||
100 | giztime = in_le32(sdcpwr_mapbase + SDCPWR_GIZTIME_REG); | ||
101 | |||
102 | /* just provide the upper bound */ | ||
103 | if (giztime & SDCPWR_GIZTIME_GR) | ||
104 | ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 128000; | ||
105 | else | ||
106 | ret = (giztime & SDCPWR_GIZTIME_LONGLOCK) * 1000; | ||
107 | |||
108 | return ret; | ||
109 | } | ||
110 | |||
111 | static void set_astate(int cpu, unsigned int astate) | ||
112 | { | ||
113 | u64 flags; | ||
114 | |||
115 | /* Return if called before init has run */ | ||
116 | if (unlikely(!sdcasr_mapbase)) | ||
117 | return; | ||
118 | |||
119 | local_irq_save(flags); | ||
120 | |||
121 | out_le32(sdcasr_mapbase + SDCASR_REG + SDCASR_REG_STRIDE*cpu, astate); | ||
122 | |||
123 | local_irq_restore(flags); | ||
124 | } | ||
125 | |||
126 | void restore_astate(int cpu) | ||
127 | { | ||
128 | set_astate(cpu, current_astate); | ||
129 | } | ||
130 | |||
131 | /* | ||
132 | * cpufreq functions | ||
133 | */ | ||
134 | |||
135 | static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy) | ||
136 | { | ||
137 | const u32 *max_freqp; | ||
138 | u32 max_freq; | ||
139 | int i, cur_astate; | ||
140 | struct resource res; | ||
141 | struct device_node *cpu, *dn; | ||
142 | int err = -ENODEV; | ||
143 | |||
144 | cpu = of_get_cpu_node(policy->cpu, NULL); | ||
145 | |||
146 | if (!cpu) | ||
147 | goto out; | ||
148 | |||
149 | dn = of_find_compatible_node(NULL, "sdc", "1682m-sdc"); | ||
150 | if (!dn) | ||
151 | goto out; | ||
152 | err = of_address_to_resource(dn, 0, &res); | ||
153 | of_node_put(dn); | ||
154 | if (err) | ||
155 | goto out; | ||
156 | sdcasr_mapbase = ioremap(res.start + SDCASR_OFFSET, 0x2000); | ||
157 | if (!sdcasr_mapbase) { | ||
158 | err = -EINVAL; | ||
159 | goto out; | ||
160 | } | ||
161 | |||
162 | dn = of_find_compatible_node(NULL, "gizmo", "1682m-gizmo"); | ||
163 | if (!dn) { | ||
164 | err = -ENODEV; | ||
165 | goto out_unmap_sdcasr; | ||
166 | } | ||
167 | err = of_address_to_resource(dn, 0, &res); | ||
168 | of_node_put(dn); | ||
169 | if (err) | ||
170 | goto out_unmap_sdcasr; | ||
171 | sdcpwr_mapbase = ioremap(res.start, 0x1000); | ||
172 | if (!sdcpwr_mapbase) { | ||
173 | err = -EINVAL; | ||
174 | goto out_unmap_sdcasr; | ||
175 | } | ||
176 | |||
177 | pr_debug("init cpufreq on CPU %d\n", policy->cpu); | ||
178 | |||
179 | max_freqp = of_get_property(cpu, "clock-frequency", NULL); | ||
180 | if (!max_freqp) { | ||
181 | err = -EINVAL; | ||
182 | goto out_unmap_sdcpwr; | ||
183 | } | ||
184 | |||
185 | /* we need the freq in kHz */ | ||
186 | max_freq = *max_freqp / 1000; | ||
187 | |||
188 | pr_debug("max clock-frequency is at %u kHz\n", max_freq); | ||
189 | pr_debug("initializing frequency table\n"); | ||
190 | |||
191 | /* initialize frequency table */ | ||
192 | for (i=0; pas_freqs[i].frequency!=CPUFREQ_TABLE_END; i++) { | ||
193 | pas_freqs[i].frequency = get_astate_freq(pas_freqs[i].index) * 100000; | ||
194 | pr_debug("%d: %d\n", i, pas_freqs[i].frequency); | ||
195 | } | ||
196 | |||
197 | policy->governor = CPUFREQ_DEFAULT_GOVERNOR; | ||
198 | |||
199 | policy->cpuinfo.transition_latency = get_gizmo_latency(); | ||
200 | |||
201 | cur_astate = get_cur_astate(policy->cpu); | ||
202 | pr_debug("current astate is at %d\n",cur_astate); | ||
203 | |||
204 | policy->cur = pas_freqs[cur_astate].frequency; | ||
205 | policy->cpus = cpu_online_map; | ||
206 | |||
207 | cpufreq_frequency_table_get_attr(pas_freqs, policy->cpu); | ||
208 | |||
209 | /* this ensures that policy->cpuinfo_min and policy->cpuinfo_max | ||
210 | * are set correctly | ||
211 | */ | ||
212 | return cpufreq_frequency_table_cpuinfo(policy, pas_freqs); | ||
213 | |||
214 | out_unmap_sdcpwr: | ||
215 | iounmap(sdcpwr_mapbase); | ||
216 | |||
217 | out_unmap_sdcasr: | ||
218 | iounmap(sdcasr_mapbase); | ||
219 | out: | ||
220 | return err; | ||
221 | } | ||
222 | |||
223 | static int pas_cpufreq_cpu_exit(struct cpufreq_policy *policy) | ||
224 | { | ||
225 | if (sdcasr_mapbase) | ||
226 | iounmap(sdcasr_mapbase); | ||
227 | if (sdcpwr_mapbase) | ||
228 | iounmap(sdcpwr_mapbase); | ||
229 | |||
230 | cpufreq_frequency_table_put_attr(policy->cpu); | ||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int pas_cpufreq_verify(struct cpufreq_policy *policy) | ||
235 | { | ||
236 | return cpufreq_frequency_table_verify(policy, pas_freqs); | ||
237 | } | ||
238 | |||
239 | static int pas_cpufreq_target(struct cpufreq_policy *policy, | ||
240 | unsigned int target_freq, | ||
241 | unsigned int relation) | ||
242 | { | ||
243 | struct cpufreq_freqs freqs; | ||
244 | int pas_astate_new; | ||
245 | int i; | ||
246 | |||
247 | cpufreq_frequency_table_target(policy, | ||
248 | pas_freqs, | ||
249 | target_freq, | ||
250 | relation, | ||
251 | &pas_astate_new); | ||
252 | |||
253 | freqs.old = policy->cur; | ||
254 | freqs.new = pas_freqs[pas_astate_new].frequency; | ||
255 | freqs.cpu = policy->cpu; | ||
256 | |||
257 | mutex_lock(&pas_switch_mutex); | ||
258 | cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); | ||
259 | |||
260 | pr_debug("setting frequency for cpu %d to %d kHz, 1/%d of max frequency\n", | ||
261 | policy->cpu, | ||
262 | pas_freqs[pas_astate_new].frequency, | ||
263 | pas_freqs[pas_astate_new].index); | ||
264 | |||
265 | current_astate = pas_astate_new; | ||
266 | |||
267 | for_each_online_cpu(i) | ||
268 | set_astate(i, pas_astate_new); | ||
269 | |||
270 | cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); | ||
271 | mutex_unlock(&pas_switch_mutex); | ||
272 | |||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | static struct cpufreq_driver pas_cpufreq_driver = { | ||
277 | .name = "pas-cpufreq", | ||
278 | .owner = THIS_MODULE, | ||
279 | .flags = CPUFREQ_CONST_LOOPS, | ||
280 | .init = pas_cpufreq_cpu_init, | ||
281 | .exit = pas_cpufreq_cpu_exit, | ||
282 | .verify = pas_cpufreq_verify, | ||
283 | .target = pas_cpufreq_target, | ||
284 | .attr = pas_cpu_freqs_attr, | ||
285 | }; | ||
286 | |||
287 | /* | ||
288 | * module init and destoy | ||
289 | */ | ||
290 | |||
291 | static int __init pas_cpufreq_init(void) | ||
292 | { | ||
293 | if (!machine_is_compatible("PA6T-1682M")) | ||
294 | return -ENODEV; | ||
295 | |||
296 | return cpufreq_register_driver(&pas_cpufreq_driver); | ||
297 | } | ||
298 | |||
299 | static void __exit pas_cpufreq_exit(void) | ||
300 | { | ||
301 | cpufreq_unregister_driver(&pas_cpufreq_driver); | ||
302 | } | ||
303 | |||
304 | module_init(pas_cpufreq_init); | ||
305 | module_exit(pas_cpufreq_exit); | ||
306 | |||
307 | MODULE_LICENSE("GPL"); | ||
308 | MODULE_AUTHOR("Egor Martovetsky <egor@pasemi.com>, Olof Johansson <olof@lixom.net>"); | ||
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c new file mode 100644 index 000000000000..c91a33593bb8 --- /dev/null +++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c | |||
@@ -0,0 +1,339 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006-2007 PA Semi, Inc | ||
3 | * | ||
4 | * Author: Olof Johansson, PA Semi | ||
5 | * | ||
6 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
7 | * | ||
8 | * Based on drivers/net/fs_enet/mii-bitbang.c. | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | * | ||
14 | * This program is distributed in the hope that it will be useful, | ||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | * | ||
19 | * You should have received a copy of the GNU General Public License | ||
20 | * along with this program; if not, write to the Free Software | ||
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
22 | */ | ||
23 | |||
24 | #include <linux/io.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/types.h> | ||
27 | #include <linux/sched.h> | ||
28 | #include <linux/errno.h> | ||
29 | #include <linux/ioport.h> | ||
30 | #include <linux/interrupt.h> | ||
31 | #include <linux/phy.h> | ||
32 | #include <linux/platform_device.h> | ||
33 | #include <asm/of_platform.h> | ||
34 | |||
35 | #define DELAY 1 | ||
36 | |||
37 | static void __iomem *gpio_regs; | ||
38 | |||
39 | struct gpio_priv { | ||
40 | int mdc_pin; | ||
41 | int mdio_pin; | ||
42 | }; | ||
43 | |||
44 | #define MDC_PIN(bus) (((struct gpio_priv *)bus->priv)->mdc_pin) | ||
45 | #define MDIO_PIN(bus) (((struct gpio_priv *)bus->priv)->mdio_pin) | ||
46 | |||
47 | static inline void mdio_lo(struct mii_bus *bus) | ||
48 | { | ||
49 | out_le32(gpio_regs+0x10, 1 << MDIO_PIN(bus)); | ||
50 | } | ||
51 | |||
52 | static inline void mdio_hi(struct mii_bus *bus) | ||
53 | { | ||
54 | out_le32(gpio_regs, 1 << MDIO_PIN(bus)); | ||
55 | } | ||
56 | |||
57 | static inline void mdc_lo(struct mii_bus *bus) | ||
58 | { | ||
59 | out_le32(gpio_regs+0x10, 1 << MDC_PIN(bus)); | ||
60 | } | ||
61 | |||
62 | static inline void mdc_hi(struct mii_bus *bus) | ||
63 | { | ||
64 | out_le32(gpio_regs, 1 << MDC_PIN(bus)); | ||
65 | } | ||
66 | |||
67 | static inline void mdio_active(struct mii_bus *bus) | ||
68 | { | ||
69 | out_le32(gpio_regs+0x20, (1 << MDC_PIN(bus)) | (1 << MDIO_PIN(bus))); | ||
70 | } | ||
71 | |||
72 | static inline void mdio_tristate(struct mii_bus *bus) | ||
73 | { | ||
74 | out_le32(gpio_regs+0x30, (1 << MDIO_PIN(bus))); | ||
75 | } | ||
76 | |||
77 | static inline int mdio_read(struct mii_bus *bus) | ||
78 | { | ||
79 | return !!(in_le32(gpio_regs+0x40) & (1 << MDIO_PIN(bus))); | ||
80 | } | ||
81 | |||
82 | static void clock_out(struct mii_bus *bus, int bit) | ||
83 | { | ||
84 | if (bit) | ||
85 | mdio_hi(bus); | ||
86 | else | ||
87 | mdio_lo(bus); | ||
88 | udelay(DELAY); | ||
89 | mdc_hi(bus); | ||
90 | udelay(DELAY); | ||
91 | mdc_lo(bus); | ||
92 | } | ||
93 | |||
94 | /* Utility to send the preamble, address, and register (common to read and write). */ | ||
95 | static void bitbang_pre(struct mii_bus *bus, int read, u8 addr, u8 reg) | ||
96 | { | ||
97 | int i; | ||
98 | |||
99 | /* CFE uses a really long preamble (40 bits). We'll do the same. */ | ||
100 | mdio_active(bus); | ||
101 | for (i = 0; i < 40; i++) { | ||
102 | clock_out(bus, 1); | ||
103 | } | ||
104 | |||
105 | /* send the start bit (01) and the read opcode (10) or write (10) */ | ||
106 | clock_out(bus, 0); | ||
107 | clock_out(bus, 1); | ||
108 | |||
109 | clock_out(bus, read); | ||
110 | clock_out(bus, !read); | ||
111 | |||
112 | /* send the PHY address */ | ||
113 | for (i = 0; i < 5; i++) { | ||
114 | clock_out(bus, (addr & 0x10) != 0); | ||
115 | addr <<= 1; | ||
116 | } | ||
117 | |||
118 | /* send the register address */ | ||
119 | for (i = 0; i < 5; i++) { | ||
120 | clock_out(bus, (reg & 0x10) != 0); | ||
121 | reg <<= 1; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | static int gpio_mdio_read(struct mii_bus *bus, int phy_id, int location) | ||
126 | { | ||
127 | u16 rdreg; | ||
128 | int ret, i; | ||
129 | u8 addr = phy_id & 0xff; | ||
130 | u8 reg = location & 0xff; | ||
131 | |||
132 | bitbang_pre(bus, 1, addr, reg); | ||
133 | |||
134 | /* tri-state our MDIO I/O pin so we can read */ | ||
135 | mdio_tristate(bus); | ||
136 | udelay(DELAY); | ||
137 | mdc_hi(bus); | ||
138 | udelay(DELAY); | ||
139 | mdc_lo(bus); | ||
140 | |||
141 | /* read 16 bits of register data, MSB first */ | ||
142 | rdreg = 0; | ||
143 | for (i = 0; i < 16; i++) { | ||
144 | mdc_lo(bus); | ||
145 | udelay(DELAY); | ||
146 | mdc_hi(bus); | ||
147 | udelay(DELAY); | ||
148 | mdc_lo(bus); | ||
149 | udelay(DELAY); | ||
150 | rdreg <<= 1; | ||
151 | rdreg |= mdio_read(bus); | ||
152 | } | ||
153 | |||
154 | mdc_hi(bus); | ||
155 | udelay(DELAY); | ||
156 | mdc_lo(bus); | ||
157 | udelay(DELAY); | ||
158 | |||
159 | ret = rdreg; | ||
160 | |||
161 | return ret; | ||
162 | } | ||
163 | |||
164 | static int gpio_mdio_write(struct mii_bus *bus, int phy_id, int location, u16 val) | ||
165 | { | ||
166 | int i; | ||
167 | |||
168 | u8 addr = phy_id & 0xff; | ||
169 | u8 reg = location & 0xff; | ||
170 | u16 value = val & 0xffff; | ||
171 | |||
172 | bitbang_pre(bus, 0, addr, reg); | ||
173 | |||
174 | /* send the turnaround (10) */ | ||
175 | mdc_lo(bus); | ||
176 | mdio_hi(bus); | ||
177 | udelay(DELAY); | ||
178 | mdc_hi(bus); | ||
179 | udelay(DELAY); | ||
180 | mdc_lo(bus); | ||
181 | mdio_lo(bus); | ||
182 | udelay(DELAY); | ||
183 | mdc_hi(bus); | ||
184 | udelay(DELAY); | ||
185 | |||
186 | /* write 16 bits of register data, MSB first */ | ||
187 | for (i = 0; i < 16; i++) { | ||
188 | mdc_lo(bus); | ||
189 | if (value & 0x8000) | ||
190 | mdio_hi(bus); | ||
191 | else | ||
192 | mdio_lo(bus); | ||
193 | udelay(DELAY); | ||
194 | mdc_hi(bus); | ||
195 | udelay(DELAY); | ||
196 | value <<= 1; | ||
197 | } | ||
198 | |||
199 | /* | ||
200 | * Tri-state the MDIO line. | ||
201 | */ | ||
202 | mdio_tristate(bus); | ||
203 | mdc_lo(bus); | ||
204 | udelay(DELAY); | ||
205 | mdc_hi(bus); | ||
206 | udelay(DELAY); | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static int gpio_mdio_reset(struct mii_bus *bus) | ||
211 | { | ||
212 | /*nothing here - dunno how to reset it*/ | ||
213 | return 0; | ||
214 | } | ||
215 | |||
216 | |||
217 | static int __devinit gpio_mdio_probe(struct of_device *ofdev, | ||
218 | const struct of_device_id *match) | ||
219 | { | ||
220 | struct device *dev = &ofdev->dev; | ||
221 | struct device_node *np = ofdev->node; | ||
222 | struct device_node *gpio_np; | ||
223 | struct mii_bus *new_bus; | ||
224 | struct resource res; | ||
225 | struct gpio_priv *priv; | ||
226 | const unsigned int *prop; | ||
227 | int err = 0; | ||
228 | int i; | ||
229 | |||
230 | gpio_np = of_find_compatible_node(NULL, "gpio", "1682m-gpio"); | ||
231 | |||
232 | if (!gpio_np) | ||
233 | return -ENODEV; | ||
234 | |||
235 | err = of_address_to_resource(gpio_np, 0, &res); | ||
236 | of_node_put(gpio_np); | ||
237 | |||
238 | if (err) | ||
239 | return -EINVAL; | ||
240 | |||
241 | if (!gpio_regs) | ||
242 | gpio_regs = ioremap(res.start, 0x100); | ||
243 | |||
244 | if (!gpio_regs) | ||
245 | return -EPERM; | ||
246 | |||
247 | priv = kzalloc(sizeof(struct gpio_priv), GFP_KERNEL); | ||
248 | if (priv == NULL) | ||
249 | return -ENOMEM; | ||
250 | |||
251 | new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL); | ||
252 | |||
253 | if (new_bus == NULL) | ||
254 | return -ENOMEM; | ||
255 | |||
256 | new_bus->name = "pasemi gpio mdio bus", | ||
257 | new_bus->read = &gpio_mdio_read, | ||
258 | new_bus->write = &gpio_mdio_write, | ||
259 | new_bus->reset = &gpio_mdio_reset, | ||
260 | |||
261 | prop = of_get_property(np, "reg", NULL); | ||
262 | new_bus->id = *prop; | ||
263 | new_bus->priv = priv; | ||
264 | |||
265 | new_bus->phy_mask = 0; | ||
266 | |||
267 | new_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL); | ||
268 | for(i = 0; i < PHY_MAX_ADDR; ++i) | ||
269 | new_bus->irq[i] = irq_create_mapping(NULL, 10); | ||
270 | |||
271 | |||
272 | prop = of_get_property(np, "mdc-pin", NULL); | ||
273 | priv->mdc_pin = *prop; | ||
274 | |||
275 | prop = of_get_property(np, "mdio-pin", NULL); | ||
276 | priv->mdio_pin = *prop; | ||
277 | |||
278 | new_bus->dev = dev; | ||
279 | dev_set_drvdata(dev, new_bus); | ||
280 | |||
281 | err = mdiobus_register(new_bus); | ||
282 | |||
283 | if (0 != err) { | ||
284 | printk(KERN_ERR "%s: Cannot register as MDIO bus, err %d\n", | ||
285 | new_bus->name, err); | ||
286 | goto bus_register_fail; | ||
287 | } | ||
288 | |||
289 | return 0; | ||
290 | |||
291 | bus_register_fail: | ||
292 | kfree(new_bus); | ||
293 | |||
294 | return err; | ||
295 | } | ||
296 | |||
297 | |||
298 | static int gpio_mdio_remove(struct of_device *dev) | ||
299 | { | ||
300 | struct mii_bus *bus = dev_get_drvdata(&dev->dev); | ||
301 | |||
302 | mdiobus_unregister(bus); | ||
303 | |||
304 | dev_set_drvdata(&dev->dev, NULL); | ||
305 | |||
306 | kfree(bus->priv); | ||
307 | bus->priv = NULL; | ||
308 | kfree(bus); | ||
309 | |||
310 | return 0; | ||
311 | } | ||
312 | |||
313 | static struct of_device_id gpio_mdio_match[] = | ||
314 | { | ||
315 | { | ||
316 | .compatible = "gpio-mdio", | ||
317 | }, | ||
318 | {}, | ||
319 | }; | ||
320 | |||
321 | static struct of_platform_driver gpio_mdio_driver = | ||
322 | { | ||
323 | .name = "gpio-mdio-bitbang", | ||
324 | .match_table = gpio_mdio_match, | ||
325 | .probe = gpio_mdio_probe, | ||
326 | .remove = gpio_mdio_remove, | ||
327 | }; | ||
328 | |||
329 | int gpio_mdio_init(void) | ||
330 | { | ||
331 | return of_register_platform_driver(&gpio_mdio_driver); | ||
332 | } | ||
333 | |||
334 | void gpio_mdio_exit(void) | ||
335 | { | ||
336 | of_unregister_platform_driver(&gpio_mdio_driver); | ||
337 | } | ||
338 | device_initcall(gpio_mdio_init); | ||
339 | |||
diff --git a/arch/powerpc/platforms/pasemi/idle.c b/arch/powerpc/platforms/pasemi/idle.c index 1ca3ff381591..5985ce0c5c48 100644 --- a/arch/powerpc/platforms/pasemi/idle.c +++ b/arch/powerpc/platforms/pasemi/idle.c | |||
@@ -61,6 +61,10 @@ static int pasemi_system_reset_exception(struct pt_regs *regs) | |||
61 | /* do system reset */ | 61 | /* do system reset */ |
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | |||
65 | /* Set higher astate since we come out of power savings at 0 */ | ||
66 | restore_astate(hard_smp_processor_id()); | ||
67 | |||
64 | /* everything handled */ | 68 | /* everything handled */ |
65 | regs->msr |= MSR_RI; | 69 | regs->msr |= MSR_RI; |
66 | return 1; | 70 | return 1; |
@@ -68,6 +72,11 @@ static int pasemi_system_reset_exception(struct pt_regs *regs) | |||
68 | 72 | ||
69 | void __init pasemi_idle_init(void) | 73 | void __init pasemi_idle_init(void) |
70 | { | 74 | { |
75 | #ifndef CONFIG_PPC_PASEMI_CPUFREQ | ||
76 | printk(KERN_WARNING "No cpufreq driver, powersavings modes disabled\n"); | ||
77 | current_mode = 0; | ||
78 | #endif | ||
79 | |||
71 | ppc_md.system_reset_exception = pasemi_system_reset_exception; | 80 | ppc_md.system_reset_exception = pasemi_system_reset_exception; |
72 | ppc_md.power_save = modes[current_mode].entry; | 81 | ppc_md.power_save = modes[current_mode].entry; |
73 | printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name); | 82 | printk(KERN_INFO "Using PA6T idle loop (%s)\n", modes[current_mode].name); |
diff --git a/arch/powerpc/platforms/pasemi/iommu.c b/arch/powerpc/platforms/pasemi/iommu.c index 71dbf1a56e13..95fa6a7d15ee 100644 --- a/arch/powerpc/platforms/pasemi/iommu.c +++ b/arch/powerpc/platforms/pasemi/iommu.c | |||
@@ -249,13 +249,13 @@ void iommu_init_early_pasemi(void) | |||
249 | iommu_off = 1; | 249 | iommu_off = 1; |
250 | #else | 250 | #else |
251 | iommu_off = of_chosen && | 251 | iommu_off = of_chosen && |
252 | get_property(of_chosen, "linux,iommu-off", NULL); | 252 | of_get_property(of_chosen, "linux,iommu-off", NULL); |
253 | #endif | 253 | #endif |
254 | if (iommu_off) { | 254 | if (iommu_off) { |
255 | /* Direct I/O, IOMMU off */ | 255 | /* Direct I/O, IOMMU off */ |
256 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null; | 256 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_null; |
257 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null; | 257 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_null; |
258 | pci_dma_ops = &dma_direct_ops; | 258 | set_pci_dma_ops(&dma_direct_ops); |
259 | 259 | ||
260 | return; | 260 | return; |
261 | } | 261 | } |
@@ -266,7 +266,7 @@ void iommu_init_early_pasemi(void) | |||
266 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; | 266 | ppc_md.pci_dma_bus_setup = pci_dma_bus_setup_pasemi; |
267 | ppc_md.tce_build = iobmap_build; | 267 | ppc_md.tce_build = iobmap_build; |
268 | ppc_md.tce_free = iobmap_free; | 268 | ppc_md.tce_free = iobmap_free; |
269 | pci_dma_ops = &dma_iommu_ops; | 269 | set_pci_dma_ops(&dma_iommu_ops); |
270 | } | 270 | } |
271 | 271 | ||
272 | void __init alloc_iobmap_l2(void) | 272 | void __init alloc_iobmap_l2(void) |
diff --git a/arch/powerpc/platforms/pasemi/pasemi.h b/arch/powerpc/platforms/pasemi/pasemi.h index 2d3927e6edb0..be8495497611 100644 --- a/arch/powerpc/platforms/pasemi/pasemi.h +++ b/arch/powerpc/platforms/pasemi/pasemi.h | |||
@@ -14,6 +14,14 @@ extern void __init pasemi_idle_init(void); | |||
14 | extern void idle_spin(void); | 14 | extern void idle_spin(void); |
15 | extern void idle_doze(void); | 15 | extern void idle_doze(void); |
16 | 16 | ||
17 | /* Restore astate to last set */ | ||
18 | #ifdef CONFIG_PPC_PASEMI_CPUFREQ | ||
19 | extern void restore_astate(int cpu); | ||
20 | #else | ||
21 | static inline void restore_astate(int cpu) | ||
22 | { | ||
23 | } | ||
24 | #endif | ||
17 | 25 | ||
18 | 26 | ||
19 | #endif /* _PASEMI_PASEMI_H */ | 27 | #endif /* _PASEMI_PASEMI_H */ |
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c index 7ecb2ba24db9..056243da360b 100644 --- a/arch/powerpc/platforms/pasemi/pci.c +++ b/arch/powerpc/platforms/pasemi/pci.c | |||
@@ -33,7 +33,17 @@ | |||
33 | 33 | ||
34 | #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) | 34 | #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) |
35 | 35 | ||
36 | #define CONFIG_OFFSET_VALID(off) ((off) < 4096) | 36 | static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset) |
37 | { | ||
38 | /* Device 0 Function 0 is special: It's config space spans function 1 as | ||
39 | * well, so allow larger offset. It's really a two-function device but the | ||
40 | * second function does not probe. | ||
41 | */ | ||
42 | if (bus == 0 && devfn == 0) | ||
43 | return offset < 8192; | ||
44 | else | ||
45 | return offset < 4096; | ||
46 | } | ||
37 | 47 | ||
38 | static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose, | 48 | static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose, |
39 | u8 bus, u8 devfn, int offset) | 49 | u8 bus, u8 devfn, int offset) |
@@ -51,7 +61,7 @@ static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, | |||
51 | if (!hose) | 61 | if (!hose) |
52 | return PCIBIOS_DEVICE_NOT_FOUND; | 62 | return PCIBIOS_DEVICE_NOT_FOUND; |
53 | 63 | ||
54 | if (!CONFIG_OFFSET_VALID(offset)) | 64 | if (!pa_pxp_offset_valid(bus->number, devfn, offset)) |
55 | return PCIBIOS_BAD_REGISTER_NUMBER; | 65 | return PCIBIOS_BAD_REGISTER_NUMBER; |
56 | 66 | ||
57 | addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); | 67 | addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); |
@@ -85,7 +95,7 @@ static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn, | |||
85 | if (!hose) | 95 | if (!hose) |
86 | return PCIBIOS_DEVICE_NOT_FOUND; | 96 | return PCIBIOS_DEVICE_NOT_FOUND; |
87 | 97 | ||
88 | if (!CONFIG_OFFSET_VALID(offset)) | 98 | if (!pa_pxp_offset_valid(bus->number, devfn, offset)) |
89 | return PCIBIOS_BAD_REGISTER_NUMBER; | 99 | return PCIBIOS_BAD_REGISTER_NUMBER; |
90 | 100 | ||
91 | addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); | 101 | addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); |
diff --git a/arch/powerpc/platforms/pasemi/setup.c b/arch/powerpc/platforms/pasemi/setup.c index 449cf1a08291..f88f0ec4c8cb 100644 --- a/arch/powerpc/platforms/pasemi/setup.c +++ b/arch/powerpc/platforms/pasemi/setup.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <asm/mpic.h> | 35 | #include <asm/mpic.h> |
36 | #include <asm/smp.h> | 36 | #include <asm/smp.h> |
37 | #include <asm/time.h> | 37 | #include <asm/time.h> |
38 | #include <asm/of_platform.h> | ||
38 | 39 | ||
39 | #include "pasemi.h" | 40 | #include "pasemi.h" |
40 | 41 | ||
@@ -101,12 +102,6 @@ void __init pas_setup_arch(void) | |||
101 | pasemi_idle_init(); | 102 | pasemi_idle_init(); |
102 | } | 103 | } |
103 | 104 | ||
104 | /* No legacy IO on our parts */ | ||
105 | static int pas_check_legacy_ioport(unsigned int baseport) | ||
106 | { | ||
107 | return -ENODEV; | ||
108 | } | ||
109 | |||
110 | static __init void pas_init_IRQ(void) | 105 | static __init void pas_init_IRQ(void) |
111 | { | 106 | { |
112 | struct device_node *np; | 107 | struct device_node *np; |
@@ -136,8 +131,8 @@ static __init void pas_init_IRQ(void) | |||
136 | 131 | ||
137 | /* Find address list in /platform-open-pic */ | 132 | /* Find address list in /platform-open-pic */ |
138 | root = of_find_node_by_path("/"); | 133 | root = of_find_node_by_path("/"); |
139 | naddr = prom_n_addr_cells(root); | 134 | naddr = of_n_addr_cells(root); |
140 | opprop = get_property(root, "platform-open-pic", &opplen); | 135 | opprop = of_get_property(root, "platform-open-pic", &opplen); |
141 | if (!opprop) { | 136 | if (!opprop) { |
142 | printk(KERN_ERR "No platform-open-pic property.\n"); | 137 | printk(KERN_ERR "No platform-open-pic property.\n"); |
143 | of_node_put(root); | 138 | of_node_put(root); |
@@ -147,7 +142,7 @@ static __init void pas_init_IRQ(void) | |||
147 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); | 142 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); |
148 | 143 | ||
149 | mpic = mpic_alloc(mpic_node, openpic_addr, | 144 | mpic = mpic_alloc(mpic_node, openpic_addr, |
150 | MPIC_PRIMARY|MPIC_LARGE_VECTORS, | 145 | MPIC_PRIMARY|MPIC_LARGE_VECTORS|MPIC_WANTS_RESET, |
151 | 0, 0, " PAS-OPIC "); | 146 | 0, 0, " PAS-OPIC "); |
152 | BUG_ON(!mpic); | 147 | BUG_ON(!mpic); |
153 | 148 | ||
@@ -209,6 +204,20 @@ static void __init pas_init_early(void) | |||
209 | iommu_init_early_pasemi(); | 204 | iommu_init_early_pasemi(); |
210 | } | 205 | } |
211 | 206 | ||
207 | static struct of_device_id pasemi_bus_ids[] = { | ||
208 | { .type = "sdc", }, | ||
209 | {}, | ||
210 | }; | ||
211 | |||
212 | static int __init pasemi_publish_devices(void) | ||
213 | { | ||
214 | /* Publish OF platform devices for southbridge IOs */ | ||
215 | of_platform_bus_probe(NULL, pasemi_bus_ids, NULL); | ||
216 | |||
217 | return 0; | ||
218 | } | ||
219 | device_initcall(pasemi_publish_devices); | ||
220 | |||
212 | 221 | ||
213 | /* | 222 | /* |
214 | * Called very early, MMU is off, device-tree isn't unflattened | 223 | * Called very early, MMU is off, device-tree isn't unflattened |
@@ -237,7 +246,6 @@ define_machine(pas) { | |||
237 | .restart = pas_restart, | 246 | .restart = pas_restart, |
238 | .get_boot_time = pas_get_boot_time, | 247 | .get_boot_time = pas_get_boot_time, |
239 | .calibrate_decr = generic_calibrate_decr, | 248 | .calibrate_decr = generic_calibrate_decr, |
240 | .check_legacy_ioport = pas_check_legacy_ioport, | ||
241 | .progress = pas_progress, | 249 | .progress = pas_progress, |
242 | .machine_check_exception = pas_machine_check_handler, | 250 | .machine_check_exception = pas_machine_check_handler, |
243 | .pci_irq_fixup = pas_pci_irq_fixup, | 251 | .pci_irq_fixup = pas_pci_irq_fixup, |
diff --git a/arch/powerpc/platforms/powermac/Kconfig b/arch/powerpc/platforms/powermac/Kconfig new file mode 100644 index 000000000000..5b7afe50039a --- /dev/null +++ b/arch/powerpc/platforms/powermac/Kconfig | |||
@@ -0,0 +1,20 @@ | |||
1 | config PPC_PMAC | ||
2 | bool "Apple PowerMac based machines" | ||
3 | depends on PPC_MULTIPLATFORM | ||
4 | select MPIC | ||
5 | select PPC_INDIRECT_PCI if PPC32 | ||
6 | select PPC_MPC106 if PPC32 | ||
7 | select PPC_NATIVE | ||
8 | default y | ||
9 | |||
10 | config PPC_PMAC64 | ||
11 | bool | ||
12 | depends on PPC_PMAC && POWER4 | ||
13 | select MPIC | ||
14 | select U3_DART | ||
15 | select MPIC_U3_HT_IRQS | ||
16 | select GENERIC_TBSYNC | ||
17 | select PPC_970_NAP | ||
18 | default y | ||
19 | |||
20 | |||
diff --git a/arch/powerpc/platforms/powermac/backlight.c b/arch/powerpc/platforms/powermac/backlight.c index de7440e62cc4..d679964ae2ab 100644 --- a/arch/powerpc/platforms/powermac/backlight.c +++ b/arch/powerpc/platforms/powermac/backlight.c | |||
@@ -56,13 +56,16 @@ struct backlight_device *pmac_backlight; | |||
56 | 56 | ||
57 | int pmac_has_backlight_type(const char *type) | 57 | int pmac_has_backlight_type(const char *type) |
58 | { | 58 | { |
59 | struct device_node* bk_node = find_devices("backlight"); | 59 | struct device_node* bk_node = of_find_node_by_name(NULL, "backlight"); |
60 | 60 | ||
61 | if (bk_node) { | 61 | if (bk_node) { |
62 | const char *prop = get_property(bk_node, | 62 | const char *prop = of_get_property(bk_node, |
63 | "backlight-control", NULL); | 63 | "backlight-control", NULL); |
64 | if (prop && strncmp(prop, type, strlen(type)) == 0) | 64 | if (prop && strncmp(prop, type, strlen(type)) == 0) { |
65 | of_node_put(bk_node); | ||
65 | return 1; | 66 | return 1; |
67 | } | ||
68 | of_node_put(bk_node); | ||
66 | } | 69 | } |
67 | 70 | ||
68 | return 0; | 71 | return 0; |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c index c2b6b4134f68..8943a9456bb7 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_32.c +++ b/arch/powerpc/platforms/powermac/cpufreq_32.c | |||
@@ -421,7 +421,7 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) | |||
421 | 421 | ||
422 | static u32 read_gpio(struct device_node *np) | 422 | static u32 read_gpio(struct device_node *np) |
423 | { | 423 | { |
424 | const u32 *reg = get_property(np, "reg", NULL); | 424 | const u32 *reg = of_get_property(np, "reg", NULL); |
425 | u32 offset; | 425 | u32 offset; |
426 | 426 | ||
427 | if (reg == NULL) | 427 | if (reg == NULL) |
@@ -521,13 +521,14 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
521 | int lenp, rc; | 521 | int lenp, rc; |
522 | const u32 *freqs, *ratio; | 522 | const u32 *freqs, *ratio; |
523 | 523 | ||
524 | freqs = get_property(cpunode, "bus-frequencies", &lenp); | 524 | freqs = of_get_property(cpunode, "bus-frequencies", &lenp); |
525 | lenp /= sizeof(u32); | 525 | lenp /= sizeof(u32); |
526 | if (freqs == NULL || lenp != 2) { | 526 | if (freqs == NULL || lenp != 2) { |
527 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); | 527 | printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); |
528 | return 1; | 528 | return 1; |
529 | } | 529 | } |
530 | ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL); | 530 | ratio = of_get_property(cpunode, "processor-to-bus-ratio*2", |
531 | NULL); | ||
531 | if (ratio == NULL) { | 532 | if (ratio == NULL) { |
532 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); | 533 | printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); |
533 | return 1; | 534 | return 1; |
@@ -562,7 +563,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
562 | /* If we use the PMU, look for the min & max frequencies in the | 563 | /* If we use the PMU, look for the min & max frequencies in the |
563 | * device-tree | 564 | * device-tree |
564 | */ | 565 | */ |
565 | value = get_property(cpunode, "min-clock-frequency", NULL); | 566 | value = of_get_property(cpunode, "min-clock-frequency", NULL); |
566 | if (!value) | 567 | if (!value) |
567 | return 1; | 568 | return 1; |
568 | low_freq = (*value) / 1000; | 569 | low_freq = (*value) / 1000; |
@@ -571,7 +572,7 @@ static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode) | |||
571 | if (low_freq < 100000) | 572 | if (low_freq < 100000) |
572 | low_freq *= 10; | 573 | low_freq *= 10; |
573 | 574 | ||
574 | value = get_property(cpunode, "max-clock-frequency", NULL); | 575 | value = of_get_property(cpunode, "max-clock-frequency", NULL); |
575 | if (!value) | 576 | if (!value) |
576 | return 1; | 577 | return 1; |
577 | hi_freq = (*value) / 1000; | 578 | hi_freq = (*value) / 1000; |
@@ -585,7 +586,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) | |||
585 | { | 586 | { |
586 | struct device_node *volt_gpio_np; | 587 | struct device_node *volt_gpio_np; |
587 | 588 | ||
588 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) | 589 | if (of_get_property(cpunode, "dynamic-power-step", NULL) == NULL) |
589 | return 1; | 590 | return 1; |
590 | 591 | ||
591 | volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); | 592 | volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); |
@@ -614,11 +615,11 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) | |||
614 | u32 pvr; | 615 | u32 pvr; |
615 | const u32 *value; | 616 | const u32 *value; |
616 | 617 | ||
617 | if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) | 618 | if (of_get_property(cpunode, "dynamic-power-step", NULL) == NULL) |
618 | return 1; | 619 | return 1; |
619 | 620 | ||
620 | hi_freq = cur_freq; | 621 | hi_freq = cur_freq; |
621 | value = get_property(cpunode, "reduced-clock-frequency", NULL); | 622 | value = of_get_property(cpunode, "reduced-clock-frequency", NULL); |
622 | if (!value) | 623 | if (!value) |
623 | return 1; | 624 | return 1; |
624 | low_freq = (*value) / 1000; | 625 | low_freq = (*value) / 1000; |
@@ -657,19 +658,19 @@ static int __init pmac_cpufreq_setup(void) | |||
657 | return 0; | 658 | return 0; |
658 | 659 | ||
659 | /* Assume only one CPU */ | 660 | /* Assume only one CPU */ |
660 | cpunode = find_type_devices("cpu"); | 661 | cpunode = of_find_node_by_type(NULL, "cpu"); |
661 | if (!cpunode) | 662 | if (!cpunode) |
662 | goto out; | 663 | goto out; |
663 | 664 | ||
664 | /* Get current cpu clock freq */ | 665 | /* Get current cpu clock freq */ |
665 | value = get_property(cpunode, "clock-frequency", NULL); | 666 | value = of_get_property(cpunode, "clock-frequency", NULL); |
666 | if (!value) | 667 | if (!value) |
667 | goto out; | 668 | goto out; |
668 | cur_freq = (*value) / 1000; | 669 | cur_freq = (*value) / 1000; |
669 | 670 | ||
670 | /* Check for 7447A based MacRISC3 */ | 671 | /* Check for 7447A based MacRISC3 */ |
671 | if (machine_is_compatible("MacRISC3") && | 672 | if (machine_is_compatible("MacRISC3") && |
672 | get_property(cpunode, "dynamic-power-step", NULL) && | 673 | of_get_property(cpunode, "dynamic-power-step", NULL) && |
673 | PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { | 674 | PVR_VER(mfspr(SPRN_PVR)) == 0x8003) { |
674 | pmac_cpufreq_init_7447A(cpunode); | 675 | pmac_cpufreq_init_7447A(cpunode); |
675 | /* Check for other MacRISC3 machines */ | 676 | /* Check for other MacRISC3 machines */ |
@@ -707,6 +708,7 @@ static int __init pmac_cpufreq_setup(void) | |||
707 | else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) | 708 | else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000) |
708 | pmac_cpufreq_init_750FX(cpunode); | 709 | pmac_cpufreq_init_750FX(cpunode); |
709 | out: | 710 | out: |
711 | of_node_put(cpunode); | ||
710 | if (set_speed_proc == NULL) | 712 | if (set_speed_proc == NULL) |
711 | return -ENODEV; | 713 | return -ENODEV; |
712 | 714 | ||
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index 9d22361a26d6..567d5523b690 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -410,7 +410,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
410 | /* Get first CPU node */ | 410 | /* Get first CPU node */ |
411 | for (cpunode = NULL; | 411 | for (cpunode = NULL; |
412 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { | 412 | (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { |
413 | const u32 *reg = get_property(cpunode, "reg", NULL); | 413 | const u32 *reg = of_get_property(cpunode, "reg", NULL); |
414 | if (reg == NULL || (*reg) != 0) | 414 | if (reg == NULL || (*reg) != 0) |
415 | continue; | 415 | continue; |
416 | if (!strcmp(cpunode->type, "cpu")) | 416 | if (!strcmp(cpunode->type, "cpu")) |
@@ -422,7 +422,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
422 | } | 422 | } |
423 | 423 | ||
424 | /* Check 970FX for now */ | 424 | /* Check 970FX for now */ |
425 | valp = get_property(cpunode, "cpu-version", NULL); | 425 | valp = of_get_property(cpunode, "cpu-version", NULL); |
426 | if (!valp) { | 426 | if (!valp) { |
427 | DBG("No cpu-version property !\n"); | 427 | DBG("No cpu-version property !\n"); |
428 | goto bail_noprops; | 428 | goto bail_noprops; |
@@ -434,7 +434,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
434 | } | 434 | } |
435 | 435 | ||
436 | /* Look for the powertune data in the device-tree */ | 436 | /* Look for the powertune data in the device-tree */ |
437 | g5_pmode_data = get_property(cpunode, "power-mode-data",&psize); | 437 | g5_pmode_data = of_get_property(cpunode, "power-mode-data",&psize); |
438 | if (!g5_pmode_data) { | 438 | if (!g5_pmode_data) { |
439 | DBG("No power-mode-data !\n"); | 439 | DBG("No power-mode-data !\n"); |
440 | goto bail_noprops; | 440 | goto bail_noprops; |
@@ -493,7 +493,7 @@ static int __init g5_neo2_cpufreq_init(struct device_node *cpus) | |||
493 | * half freq in this version. So far, I haven't yet seen a machine | 493 | * half freq in this version. So far, I haven't yet seen a machine |
494 | * supporting anything else. | 494 | * supporting anything else. |
495 | */ | 495 | */ |
496 | valp = get_property(cpunode, "clock-frequency", NULL); | 496 | valp = of_get_property(cpunode, "clock-frequency", NULL); |
497 | if (!valp) | 497 | if (!valp) |
498 | return -ENODEV; | 498 | return -ENODEV; |
499 | max_freq = (*valp)/1000; | 499 | max_freq = (*valp)/1000; |
@@ -563,7 +563,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
563 | /* Lookup the cpuid eeprom node */ | 563 | /* Lookup the cpuid eeprom node */ |
564 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); | 564 | cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); |
565 | if (cpuid != NULL) | 565 | if (cpuid != NULL) |
566 | eeprom = get_property(cpuid, "cpuid", NULL); | 566 | eeprom = of_get_property(cpuid, "cpuid", NULL); |
567 | if (eeprom == NULL) { | 567 | if (eeprom == NULL) { |
568 | printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); | 568 | printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); |
569 | rc = -ENODEV; | 569 | rc = -ENODEV; |
@@ -573,13 +573,13 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
573 | /* Lookup the i2c hwclock */ | 573 | /* Lookup the i2c hwclock */ |
574 | for (hwclock = NULL; | 574 | for (hwclock = NULL; |
575 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ | 575 | (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ |
576 | const char *loc = get_property(hwclock, | 576 | const char *loc = of_get_property(hwclock, |
577 | "hwctrl-location", NULL); | 577 | "hwctrl-location", NULL); |
578 | if (loc == NULL) | 578 | if (loc == NULL) |
579 | continue; | 579 | continue; |
580 | if (strcmp(loc, "CPU CLOCK")) | 580 | if (strcmp(loc, "CPU CLOCK")) |
581 | continue; | 581 | continue; |
582 | if (!get_property(hwclock, "platform-get-frequency", NULL)) | 582 | if (!of_get_property(hwclock, "platform-get-frequency", NULL)) |
583 | continue; | 583 | continue; |
584 | break; | 584 | break; |
585 | } | 585 | } |
@@ -638,7 +638,7 @@ static int __init g5_pm72_cpufreq_init(struct device_node *cpus) | |||
638 | */ | 638 | */ |
639 | 639 | ||
640 | /* Get max frequency from device-tree */ | 640 | /* Get max frequency from device-tree */ |
641 | valp = get_property(cpunode, "clock-frequency", NULL); | 641 | valp = of_get_property(cpunode, "clock-frequency", NULL); |
642 | if (!valp) { | 642 | if (!valp) { |
643 | printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); | 643 | printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); |
644 | rc = -ENODEV; | 644 | rc = -ENODEV; |
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c index 24cc50c1774a..52cfdd86c928 100644 --- a/arch/powerpc/platforms/powermac/feature.c +++ b/arch/powerpc/platforms/powermac/feature.c | |||
@@ -1044,6 +1044,7 @@ core99_reset_cpu(struct device_node *node, long param, long value) | |||
1044 | unsigned long flags; | 1044 | unsigned long flags; |
1045 | struct macio_chip *macio; | 1045 | struct macio_chip *macio; |
1046 | struct device_node *np; | 1046 | struct device_node *np; |
1047 | struct device_node *cpus; | ||
1047 | const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0, | 1048 | const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0, |
1048 | KL_GPIO_RESET_CPU1, | 1049 | KL_GPIO_RESET_CPU1, |
1049 | KL_GPIO_RESET_CPU2, | 1050 | KL_GPIO_RESET_CPU2, |
@@ -1053,12 +1054,12 @@ core99_reset_cpu(struct device_node *node, long param, long value) | |||
1053 | if (macio->type != macio_keylargo) | 1054 | if (macio->type != macio_keylargo) |
1054 | return -ENODEV; | 1055 | return -ENODEV; |
1055 | 1056 | ||
1056 | np = find_path_device("/cpus"); | 1057 | cpus = of_find_node_by_path("/cpus"); |
1057 | if (np == NULL) | 1058 | if (cpus == NULL) |
1058 | return -ENODEV; | 1059 | return -ENODEV; |
1059 | for (np = np->child; np != NULL; np = np->sibling) { | 1060 | for (np = cpus->child; np != NULL; np = np->sibling) { |
1060 | const u32 *num = get_property(np, "reg", NULL); | 1061 | const u32 *num = of_get_property(np, "reg", NULL); |
1061 | const u32 *rst = get_property(np, "soft-reset", NULL); | 1062 | const u32 *rst = of_get_property(np, "soft-reset", NULL); |
1062 | if (num == NULL || rst == NULL) | 1063 | if (num == NULL || rst == NULL) |
1063 | continue; | 1064 | continue; |
1064 | if (param == *num) { | 1065 | if (param == *num) { |
@@ -1066,6 +1067,7 @@ core99_reset_cpu(struct device_node *node, long param, long value) | |||
1066 | break; | 1067 | break; |
1067 | } | 1068 | } |
1068 | } | 1069 | } |
1070 | of_node_put(cpus); | ||
1069 | if (np == NULL || reset_io == 0) | 1071 | if (np == NULL || reset_io == 0) |
1070 | reset_io = dflt_reset_lines[param]; | 1072 | reset_io = dflt_reset_lines[param]; |
1071 | 1073 | ||
@@ -1095,7 +1097,7 @@ core99_usb_enable(struct device_node *node, long param, long value) | |||
1095 | macio->type != macio_intrepid) | 1097 | macio->type != macio_intrepid) |
1096 | return -ENODEV; | 1098 | return -ENODEV; |
1097 | 1099 | ||
1098 | prop = get_property(node, "AAPL,clock-id", NULL); | 1100 | prop = of_get_property(node, "AAPL,clock-id", NULL); |
1099 | if (!prop) | 1101 | if (!prop) |
1100 | return -ENODEV; | 1102 | return -ENODEV; |
1101 | if (strncmp(prop, "usb0u048", 8) == 0) | 1103 | if (strncmp(prop, "usb0u048", 8) == 0) |
@@ -1497,17 +1499,18 @@ static long g5_reset_cpu(struct device_node *node, long param, long value) | |||
1497 | unsigned long flags; | 1499 | unsigned long flags; |
1498 | struct macio_chip *macio; | 1500 | struct macio_chip *macio; |
1499 | struct device_node *np; | 1501 | struct device_node *np; |
1502 | struct device_node *cpus; | ||
1500 | 1503 | ||
1501 | macio = &macio_chips[0]; | 1504 | macio = &macio_chips[0]; |
1502 | if (macio->type != macio_keylargo2 && macio->type != macio_shasta) | 1505 | if (macio->type != macio_keylargo2 && macio->type != macio_shasta) |
1503 | return -ENODEV; | 1506 | return -ENODEV; |
1504 | 1507 | ||
1505 | np = find_path_device("/cpus"); | 1508 | cpus = of_find_node_by_path("/cpus"); |
1506 | if (np == NULL) | 1509 | if (cpus == NULL) |
1507 | return -ENODEV; | 1510 | return -ENODEV; |
1508 | for (np = np->child; np != NULL; np = np->sibling) { | 1511 | for (np = cpus->child; np != NULL; np = np->sibling) { |
1509 | const u32 *num = get_property(np, "reg", NULL); | 1512 | const u32 *num = of_get_property(np, "reg", NULL); |
1510 | const u32 *rst = get_property(np, "soft-reset", NULL); | 1513 | const u32 *rst = of_get_property(np, "soft-reset", NULL); |
1511 | if (num == NULL || rst == NULL) | 1514 | if (num == NULL || rst == NULL) |
1512 | continue; | 1515 | continue; |
1513 | if (param == *num) { | 1516 | if (param == *num) { |
@@ -1515,6 +1518,7 @@ static long g5_reset_cpu(struct device_node *node, long param, long value) | |||
1515 | break; | 1518 | break; |
1516 | } | 1519 | } |
1517 | } | 1520 | } |
1521 | of_node_put(cpus); | ||
1518 | if (np == NULL || reset_io == 0) | 1522 | if (np == NULL || reset_io == 0) |
1519 | return -ENODEV; | 1523 | return -ENODEV; |
1520 | 1524 | ||
@@ -2404,14 +2408,15 @@ static int __init probe_motherboard(void) | |||
2404 | struct macio_chip *macio = &macio_chips[0]; | 2408 | struct macio_chip *macio = &macio_chips[0]; |
2405 | const char *model = NULL; | 2409 | const char *model = NULL; |
2406 | struct device_node *dt; | 2410 | struct device_node *dt; |
2411 | int ret = 0; | ||
2407 | 2412 | ||
2408 | /* Lookup known motherboard type in device-tree. First try an | 2413 | /* Lookup known motherboard type in device-tree. First try an |
2409 | * exact match on the "model" property, then try a "compatible" | 2414 | * exact match on the "model" property, then try a "compatible" |
2410 | * match is none is found. | 2415 | * match is none is found. |
2411 | */ | 2416 | */ |
2412 | dt = find_devices("device-tree"); | 2417 | dt = of_find_node_by_name(NULL, "device-tree"); |
2413 | if (dt != NULL) | 2418 | if (dt != NULL) |
2414 | model = get_property(dt, "model", NULL); | 2419 | model = of_get_property(dt, "model", NULL); |
2415 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { | 2420 | for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { |
2416 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { | 2421 | if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { |
2417 | pmac_mb = pmac_mb_defs[i]; | 2422 | pmac_mb = pmac_mb_defs[i]; |
@@ -2474,15 +2479,18 @@ static int __init probe_motherboard(void) | |||
2474 | break; | 2479 | break; |
2475 | #endif /* CONFIG_POWER4 */ | 2480 | #endif /* CONFIG_POWER4 */ |
2476 | default: | 2481 | default: |
2477 | return -ENODEV; | 2482 | ret = -ENODEV; |
2483 | goto done; | ||
2478 | } | 2484 | } |
2479 | found: | 2485 | found: |
2480 | #ifndef CONFIG_POWER4 | 2486 | #ifndef CONFIG_POWER4 |
2481 | /* Fixup Hooper vs. Comet */ | 2487 | /* Fixup Hooper vs. Comet */ |
2482 | if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { | 2488 | if (pmac_mb.model_id == PMAC_TYPE_HOOPER) { |
2483 | u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); | 2489 | u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4); |
2484 | if (!mach_id_ptr) | 2490 | if (!mach_id_ptr) { |
2485 | return -ENODEV; | 2491 | ret = -ENODEV; |
2492 | goto done; | ||
2493 | } | ||
2486 | /* Here, I used to disable the media-bay on comet. It | 2494 | /* Here, I used to disable the media-bay on comet. It |
2487 | * appears this is wrong, the floppy connector is actually | 2495 | * appears this is wrong, the floppy connector is actually |
2488 | * a kind of media-bay and works with the current driver. | 2496 | * a kind of media-bay and works with the current driver. |
@@ -2499,18 +2507,26 @@ found: | |||
2499 | * that all Apple OF revs did it properly, I do it the paranoid way. | 2507 | * that all Apple OF revs did it properly, I do it the paranoid way. |
2500 | */ | 2508 | */ |
2501 | while (uninorth_base && uninorth_rev > 3) { | 2509 | while (uninorth_base && uninorth_rev > 3) { |
2502 | struct device_node *np = find_path_device("/cpus"); | 2510 | struct device_node *cpus = of_find_node_by_path("/cpus"); |
2503 | if (!np || !np->child) { | 2511 | struct device_node *np; |
2512 | |||
2513 | if (!cpus || !cpus->child) { | ||
2504 | printk(KERN_WARNING "Can't find CPU(s) in device tree !\n"); | 2514 | printk(KERN_WARNING "Can't find CPU(s) in device tree !\n"); |
2515 | of_node_put(cpus); | ||
2505 | break; | 2516 | break; |
2506 | } | 2517 | } |
2507 | np = np->child; | 2518 | np = cpus->child; |
2508 | /* Nap mode not supported on SMP */ | 2519 | /* Nap mode not supported on SMP */ |
2509 | if (np->sibling) | 2520 | if (np->sibling) { |
2521 | of_node_put(cpus); | ||
2510 | break; | 2522 | break; |
2523 | } | ||
2511 | /* Nap mode not supported if flush-on-lock property is present */ | 2524 | /* Nap mode not supported if flush-on-lock property is present */ |
2512 | if (get_property(np, "flush-on-lock", NULL)) | 2525 | if (of_get_property(np, "flush-on-lock", NULL)) { |
2526 | of_node_put(cpus); | ||
2513 | break; | 2527 | break; |
2528 | } | ||
2529 | of_node_put(cpus); | ||
2514 | powersave_nap = 1; | 2530 | powersave_nap = 1; |
2515 | printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n"); | 2531 | printk(KERN_DEBUG "Processor NAP mode on idle enabled.\n"); |
2516 | break; | 2532 | break; |
@@ -2532,7 +2548,9 @@ found: | |||
2532 | 2548 | ||
2533 | 2549 | ||
2534 | printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name); | 2550 | printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name); |
2535 | return 0; | 2551 | done: |
2552 | of_node_put(dt); | ||
2553 | return ret; | ||
2536 | } | 2554 | } |
2537 | 2555 | ||
2538 | /* Initialize the Core99 UniNorth host bridge and memory controller | 2556 | /* Initialize the Core99 UniNorth host bridge and memory controller |
@@ -2558,7 +2576,7 @@ static void __init probe_uninorth(void) | |||
2558 | if (uninorth_node == NULL) | 2576 | if (uninorth_node == NULL) |
2559 | return; | 2577 | return; |
2560 | 2578 | ||
2561 | addrp = get_property(uninorth_node, "reg", NULL); | 2579 | addrp = of_get_property(uninorth_node, "reg", NULL); |
2562 | if (addrp == NULL) | 2580 | if (addrp == NULL) |
2563 | return; | 2581 | return; |
2564 | address = of_translate_address(uninorth_node, addrp); | 2582 | address = of_translate_address(uninorth_node, addrp); |
@@ -2642,7 +2660,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2642 | return; | 2660 | return; |
2643 | } | 2661 | } |
2644 | if (type == macio_keylargo || type == macio_keylargo2) { | 2662 | if (type == macio_keylargo || type == macio_keylargo2) { |
2645 | const u32 *did = get_property(node, "device-id", NULL); | 2663 | const u32 *did = of_get_property(node, "device-id", NULL); |
2646 | if (*did == 0x00000025) | 2664 | if (*did == 0x00000025) |
2647 | type = macio_pangea; | 2665 | type = macio_pangea; |
2648 | if (*did == 0x0000003e) | 2666 | if (*did == 0x0000003e) |
@@ -2655,7 +2673,7 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ | |||
2655 | macio_chips[i].base = base; | 2673 | macio_chips[i].base = base; |
2656 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; | 2674 | macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; |
2657 | macio_chips[i].name = macio_names[type]; | 2675 | macio_chips[i].name = macio_names[type]; |
2658 | revp = get_property(node, "revision-id", NULL); | 2676 | revp = of_get_property(node, "revision-id", NULL); |
2659 | if (revp) | 2677 | if (revp) |
2660 | macio_chips[i].rev = *revp; | 2678 | macio_chips[i].rev = *revp; |
2661 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", | 2679 | printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", |
@@ -2706,8 +2724,8 @@ initial_serial_shutdown(struct device_node *np) | |||
2706 | int port_type = PMAC_SCC_ASYNC; | 2724 | int port_type = PMAC_SCC_ASYNC; |
2707 | int modem = 0; | 2725 | int modem = 0; |
2708 | 2726 | ||
2709 | slots = get_property(np, "slot-names", &len); | 2727 | slots = of_get_property(np, "slot-names", &len); |
2710 | conn = get_property(np, "AAPL,connector", &len); | 2728 | conn = of_get_property(np, "AAPL,connector", &len); |
2711 | if (conn && (strcmp(conn, "infrared") == 0)) | 2729 | if (conn && (strcmp(conn, "infrared") == 0)) |
2712 | port_type = PMAC_SCC_IRDA; | 2730 | port_type = PMAC_SCC_IRDA; |
2713 | else if (device_is_compatible(np, "cobalt")) | 2731 | else if (device_is_compatible(np, "cobalt")) |
@@ -2735,12 +2753,14 @@ set_initial_features(void) | |||
2735 | * differenciate them all and since that hack was there for a long | 2753 | * differenciate them all and since that hack was there for a long |
2736 | * time, I'll keep it around | 2754 | * time, I'll keep it around |
2737 | */ | 2755 | */ |
2738 | if (macio_chips[0].type == macio_ohare && !find_devices("via-pmu")) { | 2756 | if (macio_chips[0].type == macio_ohare) { |
2739 | struct macio_chip *macio = &macio_chips[0]; | 2757 | struct macio_chip *macio = &macio_chips[0]; |
2740 | MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES); | 2758 | np = of_find_node_by_name(NULL, "via-pmu"); |
2741 | } else if (macio_chips[0].type == macio_ohare) { | 2759 | if (np) |
2742 | struct macio_chip *macio = &macio_chips[0]; | 2760 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); |
2743 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | 2761 | else |
2762 | MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES); | ||
2763 | of_node_put(np); | ||
2744 | } else if (macio_chips[1].type == macio_ohare) { | 2764 | } else if (macio_chips[1].type == macio_ohare) { |
2745 | struct macio_chip *macio = &macio_chips[1]; | 2765 | struct macio_chip *macio = &macio_chips[1]; |
2746 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); | 2766 | MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE); |
@@ -2833,14 +2853,13 @@ set_initial_features(void) | |||
2833 | } | 2853 | } |
2834 | 2854 | ||
2835 | /* Switch airport off */ | 2855 | /* Switch airport off */ |
2836 | np = find_devices("radio"); | 2856 | for_each_node_by_name(np, "radio") { |
2837 | while(np) { | ||
2838 | if (np && np->parent == macio_chips[0].of_node) { | 2857 | if (np && np->parent == macio_chips[0].of_node) { |
2839 | macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; | 2858 | macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON; |
2840 | core99_airport_enable(np, 0, 0); | 2859 | core99_airport_enable(np, 0, 0); |
2841 | } | 2860 | } |
2842 | np = np->next; | ||
2843 | } | 2861 | } |
2862 | of_node_put(np); | ||
2844 | } | 2863 | } |
2845 | 2864 | ||
2846 | /* On all machines that support sound PM, switch sound off */ | 2865 | /* On all machines that support sound PM, switch sound off */ |
@@ -2860,16 +2879,12 @@ set_initial_features(void) | |||
2860 | #endif /* CONFIG_POWER4 */ | 2879 | #endif /* CONFIG_POWER4 */ |
2861 | 2880 | ||
2862 | /* On all machines, switch modem & serial ports off */ | 2881 | /* On all machines, switch modem & serial ports off */ |
2863 | np = find_devices("ch-a"); | 2882 | for_each_node_by_name(np, "ch-a") |
2864 | while(np) { | ||
2865 | initial_serial_shutdown(np); | 2883 | initial_serial_shutdown(np); |
2866 | np = np->next; | 2884 | of_node_put(np); |
2867 | } | 2885 | for_each_node_by_name(np, "ch-b") |
2868 | np = find_devices("ch-b"); | ||
2869 | while(np) { | ||
2870 | initial_serial_shutdown(np); | 2886 | initial_serial_shutdown(np); |
2871 | np = np->next; | 2887 | of_node_put(np); |
2872 | } | ||
2873 | } | 2888 | } |
2874 | 2889 | ||
2875 | void __init | 2890 | void __init |
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c index bfc4829162f1..5430e146b3e9 100644 --- a/arch/powerpc/platforms/powermac/low_i2c.c +++ b/arch/powerpc/platforms/powermac/low_i2c.c | |||
@@ -491,7 +491,7 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
491 | * on all i2c keywest nodes so far ... we would have to fallback | 491 | * on all i2c keywest nodes so far ... we would have to fallback |
492 | * to macio parsing if that wasn't the case | 492 | * to macio parsing if that wasn't the case |
493 | */ | 493 | */ |
494 | addrp = get_property(np, "AAPL,address", NULL); | 494 | addrp = of_get_property(np, "AAPL,address", NULL); |
495 | if (addrp == NULL) { | 495 | if (addrp == NULL) { |
496 | printk(KERN_ERR "low_i2c: Can't find address for %s\n", | 496 | printk(KERN_ERR "low_i2c: Can't find address for %s\n", |
497 | np->full_name); | 497 | np->full_name); |
@@ -505,13 +505,13 @@ static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) | |||
505 | host->timeout_timer.function = kw_i2c_timeout; | 505 | host->timeout_timer.function = kw_i2c_timeout; |
506 | host->timeout_timer.data = (unsigned long)host; | 506 | host->timeout_timer.data = (unsigned long)host; |
507 | 507 | ||
508 | psteps = get_property(np, "AAPL,address-step", NULL); | 508 | psteps = of_get_property(np, "AAPL,address-step", NULL); |
509 | steps = psteps ? (*psteps) : 0x10; | 509 | steps = psteps ? (*psteps) : 0x10; |
510 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) | 510 | for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) |
511 | steps >>= 1; | 511 | steps >>= 1; |
512 | /* Select interface rate */ | 512 | /* Select interface rate */ |
513 | host->speed = KW_I2C_MODE_25KHZ; | 513 | host->speed = KW_I2C_MODE_25KHZ; |
514 | prate = get_property(np, "AAPL,i2c-rate", NULL); | 514 | prate = of_get_property(np, "AAPL,i2c-rate", NULL); |
515 | if (prate) switch(*prate) { | 515 | if (prate) switch(*prate) { |
516 | case 100: | 516 | case 100: |
517 | host->speed = KW_I2C_MODE_100KHZ; | 517 | host->speed = KW_I2C_MODE_100KHZ; |
@@ -619,7 +619,7 @@ static void __init kw_i2c_probe(void) | |||
619 | } else { | 619 | } else { |
620 | for (child = NULL; | 620 | for (child = NULL; |
621 | (child = of_get_next_child(np, child)) != NULL;) { | 621 | (child = of_get_next_child(np, child)) != NULL;) { |
622 | const u32 *reg = get_property(child, | 622 | const u32 *reg = of_get_property(child, |
623 | "reg", NULL); | 623 | "reg", NULL); |
624 | if (reg == NULL) | 624 | if (reg == NULL) |
625 | continue; | 625 | continue; |
@@ -905,7 +905,7 @@ static void __init smu_i2c_probe(void) | |||
905 | if (strcmp(busnode->type, "i2c") && | 905 | if (strcmp(busnode->type, "i2c") && |
906 | strcmp(busnode->type, "i2c-bus")) | 906 | strcmp(busnode->type, "i2c-bus")) |
907 | continue; | 907 | continue; |
908 | reg = get_property(busnode, "reg", NULL); | 908 | reg = of_get_property(busnode, "reg", NULL); |
909 | if (reg == NULL) | 909 | if (reg == NULL) |
910 | continue; | 910 | continue; |
911 | 911 | ||
@@ -950,7 +950,8 @@ struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node) | |||
950 | if (p == bus->busnode) { | 950 | if (p == bus->busnode) { |
951 | if (prev && bus->flags & pmac_i2c_multibus) { | 951 | if (prev && bus->flags & pmac_i2c_multibus) { |
952 | const u32 *reg; | 952 | const u32 *reg; |
953 | reg = get_property(prev, "reg", NULL); | 953 | reg = of_get_property(prev, "reg", |
954 | NULL); | ||
954 | if (!reg) | 955 | if (!reg) |
955 | continue; | 956 | continue; |
956 | if (((*reg) >> 8) != bus->channel) | 957 | if (((*reg) >> 8) != bus->channel) |
@@ -971,7 +972,7 @@ EXPORT_SYMBOL_GPL(pmac_i2c_find_bus); | |||
971 | 972 | ||
972 | u8 pmac_i2c_get_dev_addr(struct device_node *device) | 973 | u8 pmac_i2c_get_dev_addr(struct device_node *device) |
973 | { | 974 | { |
974 | const u32 *reg = get_property(device, "reg", NULL); | 975 | const u32 *reg = of_get_property(device, "reg", NULL); |
975 | 976 | ||
976 | if (reg == NULL) | 977 | if (reg == NULL) |
977 | return 0; | 978 | return 0; |
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c index 6fbac308ded6..22c4ae4c6934 100644 --- a/arch/powerpc/platforms/powermac/pci.c +++ b/arch/powerpc/platforms/powermac/pci.c | |||
@@ -70,11 +70,11 @@ static int __init fixup_one_level_bus_range(struct device_node *node, int higher | |||
70 | int len; | 70 | int len; |
71 | 71 | ||
72 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ | 72 | /* For PCI<->PCI bridges or CardBus bridges, we go down */ |
73 | class_code = get_property(node, "class-code", NULL); | 73 | class_code = of_get_property(node, "class-code", NULL); |
74 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && | 74 | if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && |
75 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) | 75 | (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) |
76 | continue; | 76 | continue; |
77 | bus_range = get_property(node, "bus-range", &len); | 77 | bus_range = of_get_property(node, "bus-range", &len); |
78 | if (bus_range != NULL && len > 2 * sizeof(int)) { | 78 | if (bus_range != NULL && len > 2 * sizeof(int)) { |
79 | if (bus_range[1] > higher) | 79 | if (bus_range[1] > higher) |
80 | higher = bus_range[1]; | 80 | higher = bus_range[1]; |
@@ -100,7 +100,7 @@ static void __init fixup_bus_range(struct device_node *bridge) | |||
100 | if (prop == NULL || prop->length < 2 * sizeof(int)) | 100 | if (prop == NULL || prop->length < 2 * sizeof(int)) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | bus_range = (int *)prop->value; | 103 | bus_range = prop->value; |
104 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); | 104 | bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); |
105 | } | 105 | } |
106 | 106 | ||
@@ -246,8 +246,8 @@ static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) | |||
246 | if (np == NULL) | 246 | if (np == NULL) |
247 | return PCIBIOS_DEVICE_NOT_FOUND; | 247 | return PCIBIOS_DEVICE_NOT_FOUND; |
248 | 248 | ||
249 | vendor = get_property(np, "vendor-id", NULL); | 249 | vendor = of_get_property(np, "vendor-id", NULL); |
250 | device = get_property(np, "device-id", NULL); | 250 | device = of_get_property(np, "device-id", NULL); |
251 | if (vendor == NULL || device == NULL) | 251 | if (vendor == NULL || device == NULL) |
252 | return PCIBIOS_DEVICE_NOT_FOUND; | 252 | return PCIBIOS_DEVICE_NOT_FOUND; |
253 | 253 | ||
@@ -622,13 +622,14 @@ static void __init init_p2pbridge(void) | |||
622 | 622 | ||
623 | /* XXX it would be better here to identify the specific | 623 | /* XXX it would be better here to identify the specific |
624 | PCI-PCI bridge chip we have. */ | 624 | PCI-PCI bridge chip we have. */ |
625 | if ((p2pbridge = find_devices("pci-bridge")) == 0 | 625 | p2pbridge = of_find_node_by_name(NULL, "pci-bridge"); |
626 | if (p2pbridge == NULL | ||
626 | || p2pbridge->parent == NULL | 627 | || p2pbridge->parent == NULL |
627 | || strcmp(p2pbridge->parent->name, "pci") != 0) | 628 | || strcmp(p2pbridge->parent->name, "pci") != 0) |
628 | return; | 629 | goto done; |
629 | if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { | 630 | if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) { |
630 | DBG("Can't find PCI infos for PCI<->PCI bridge\n"); | 631 | DBG("Can't find PCI infos for PCI<->PCI bridge\n"); |
631 | return; | 632 | goto done; |
632 | } | 633 | } |
633 | /* Warning: At this point, we have not yet renumbered all busses. | 634 | /* Warning: At this point, we have not yet renumbered all busses. |
634 | * So we must use OF walking to find out hose | 635 | * So we must use OF walking to find out hose |
@@ -636,16 +637,18 @@ static void __init init_p2pbridge(void) | |||
636 | hose = pci_find_hose_for_OF_device(p2pbridge); | 637 | hose = pci_find_hose_for_OF_device(p2pbridge); |
637 | if (!hose) { | 638 | if (!hose) { |
638 | DBG("Can't find hose for PCI<->PCI bridge\n"); | 639 | DBG("Can't find hose for PCI<->PCI bridge\n"); |
639 | return; | 640 | goto done; |
640 | } | 641 | } |
641 | if (early_read_config_word(hose, bus, devfn, | 642 | if (early_read_config_word(hose, bus, devfn, |
642 | PCI_BRIDGE_CONTROL, &val) < 0) { | 643 | PCI_BRIDGE_CONTROL, &val) < 0) { |
643 | printk(KERN_ERR "init_p2pbridge: couldn't read bridge" | 644 | printk(KERN_ERR "init_p2pbridge: couldn't read bridge" |
644 | " control\n"); | 645 | " control\n"); |
645 | return; | 646 | goto done; |
646 | } | 647 | } |
647 | val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; | 648 | val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; |
648 | early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); | 649 | early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val); |
650 | done: | ||
651 | of_node_put(p2pbridge); | ||
649 | } | 652 | } |
650 | 653 | ||
651 | static void __init init_second_ohare(void) | 654 | static void __init init_second_ohare(void) |
@@ -691,17 +694,17 @@ static void __init fixup_nec_usb2(void) | |||
691 | const u32 *prop; | 694 | const u32 *prop; |
692 | u8 bus, devfn; | 695 | u8 bus, devfn; |
693 | 696 | ||
694 | prop = get_property(nec, "vendor-id", NULL); | 697 | prop = of_get_property(nec, "vendor-id", NULL); |
695 | if (prop == NULL) | 698 | if (prop == NULL) |
696 | continue; | 699 | continue; |
697 | if (0x1033 != *prop) | 700 | if (0x1033 != *prop) |
698 | continue; | 701 | continue; |
699 | prop = get_property(nec, "device-id", NULL); | 702 | prop = of_get_property(nec, "device-id", NULL); |
700 | if (prop == NULL) | 703 | if (prop == NULL) |
701 | continue; | 704 | continue; |
702 | if (0x0035 != *prop) | 705 | if (0x0035 != *prop) |
703 | continue; | 706 | continue; |
704 | prop = get_property(nec, "reg", NULL); | 707 | prop = of_get_property(nec, "reg", NULL); |
705 | if (prop == NULL) | 708 | if (prop == NULL) |
706 | continue; | 709 | continue; |
707 | devfn = (prop[0] >> 8) & 0xff; | 710 | devfn = (prop[0] >> 8) & 0xff; |
@@ -909,7 +912,7 @@ static int __init add_bridge(struct device_node *dev) | |||
909 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); | 912 | has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); |
910 | 913 | ||
911 | /* Get bus range if any */ | 914 | /* Get bus range if any */ |
912 | bus_range = get_property(dev, "bus-range", &len); | 915 | bus_range = of_get_property(dev, "bus-range", &len); |
913 | if (bus_range == NULL || len < 2 * sizeof(int)) { | 916 | if (bus_range == NULL || len < 2 * sizeof(int)) { |
914 | printk(KERN_WARNING "Can't get bus-range for %s, assume" | 917 | printk(KERN_WARNING "Can't get bus-range for %s, assume" |
915 | " bus 0\n", dev->full_name); | 918 | " bus 0\n", dev->full_name); |
@@ -1199,8 +1202,7 @@ void __init pmac_pcibios_after_init(void) | |||
1199 | } | 1202 | } |
1200 | #endif /* CONFIG_BLK_DEV_IDE */ | 1203 | #endif /* CONFIG_BLK_DEV_IDE */ |
1201 | 1204 | ||
1202 | nd = find_devices("firewire"); | 1205 | for_each_node_by_name(nd, "firewire") { |
1203 | while (nd) { | ||
1204 | if (nd->parent && (device_is_compatible(nd, "pci106b,18") || | 1206 | if (nd->parent && (device_is_compatible(nd, "pci106b,18") || |
1205 | device_is_compatible(nd, "pci106b,30") || | 1207 | device_is_compatible(nd, "pci106b,30") || |
1206 | device_is_compatible(nd, "pci11c1,5811")) | 1208 | device_is_compatible(nd, "pci11c1,5811")) |
@@ -1208,15 +1210,14 @@ void __init pmac_pcibios_after_init(void) | |||
1208 | pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0); | 1210 | pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0); |
1209 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); | 1211 | pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0); |
1210 | } | 1212 | } |
1211 | nd = nd->next; | ||
1212 | } | 1213 | } |
1213 | nd = find_devices("ethernet"); | 1214 | of_node_put(nd); |
1214 | while (nd) { | 1215 | for_each_node_by_name(nd, "ethernet") { |
1215 | if (nd->parent && device_is_compatible(nd, "gmac") | 1216 | if (nd->parent && device_is_compatible(nd, "gmac") |
1216 | && device_is_compatible(nd->parent, "uni-north")) | 1217 | && device_is_compatible(nd->parent, "uni-north")) |
1217 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); | 1218 | pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0); |
1218 | nd = nd->next; | ||
1219 | } | 1219 | } |
1220 | of_node_put(nd); | ||
1220 | } | 1221 | } |
1221 | 1222 | ||
1222 | #ifdef CONFIG_PPC32 | 1223 | #ifdef CONFIG_PPC32 |
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c index 5c6c15c5f9a3..45d54b9ad9e0 100644 --- a/arch/powerpc/platforms/powermac/pfunc_base.c +++ b/arch/powerpc/platforms/powermac/pfunc_base.c | |||
@@ -114,7 +114,7 @@ static void macio_gpio_init_one(struct macio_chip *macio) | |||
114 | * we just create them all | 114 | * we just create them all |
115 | */ | 115 | */ |
116 | for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { | 116 | for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { |
117 | const u32 *reg = get_property(gp, "reg", NULL); | 117 | const u32 *reg = of_get_property(gp, "reg", NULL); |
118 | unsigned long offset; | 118 | unsigned long offset; |
119 | if (reg == NULL) | 119 | if (reg == NULL) |
120 | continue; | 120 | continue; |
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c index 7651f278615a..85434231ae14 100644 --- a/arch/powerpc/platforms/powermac/pfunc_core.c +++ b/arch/powerpc/platforms/powermac/pfunc_core.c | |||
@@ -692,8 +692,7 @@ static int pmf_add_functions(struct pmf_device *dev, void *driverdata) | |||
692 | name = pp->name + plen; | 692 | name = pp->name + plen; |
693 | if (strlen(name) && pp->length >= 12) | 693 | if (strlen(name) && pp->length >= 12) |
694 | count += pmf_add_function_prop(dev, driverdata, name, | 694 | count += pmf_add_function_prop(dev, driverdata, name, |
695 | (u32 *)pp->value, | 695 | pp->value, pp->length); |
696 | pp->length); | ||
697 | } | 696 | } |
698 | return count; | 697 | return count; |
699 | } | 698 | } |
@@ -821,7 +820,7 @@ struct pmf_function *__pmf_find_function(struct device_node *target, | |||
821 | * one, then we fallback to a direct call attempt | 820 | * one, then we fallback to a direct call attempt |
822 | */ | 821 | */ |
823 | snprintf(fname, 63, "platform-%s", name); | 822 | snprintf(fname, 63, "platform-%s", name); |
824 | prop = get_property(target, fname, NULL); | 823 | prop = of_get_property(target, fname, NULL); |
825 | if (prop == NULL) | 824 | if (prop == NULL) |
826 | goto find_it; | 825 | goto find_it; |
827 | ph = *prop; | 826 | ph = *prop; |
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index 5e5c0e4add91..ae5097ac0378 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
@@ -482,14 +482,14 @@ static struct mpic * __init pmac_setup_one_mpic(struct device_node *np, | |||
482 | pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0); | 482 | pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0); |
483 | 483 | ||
484 | flags |= MPIC_WANTS_RESET; | 484 | flags |= MPIC_WANTS_RESET; |
485 | if (get_property(np, "big-endian", NULL)) | 485 | if (of_get_property(np, "big-endian", NULL)) |
486 | flags |= MPIC_BIG_ENDIAN; | 486 | flags |= MPIC_BIG_ENDIAN; |
487 | 487 | ||
488 | /* Primary Big Endian means HT interrupts. This is quite dodgy | 488 | /* Primary Big Endian means HT interrupts. This is quite dodgy |
489 | * but works until I find a better way | 489 | * but works until I find a better way |
490 | */ | 490 | */ |
491 | if (master && (flags & MPIC_BIG_ENDIAN)) | 491 | if (master && (flags & MPIC_BIG_ENDIAN)) |
492 | flags |= MPIC_BROKEN_U3; | 492 | flags |= MPIC_U3_HT_IRQS; |
493 | 493 | ||
494 | mpic = mpic_alloc(np, r.start, flags, 0, 0, name); | 494 | mpic = mpic_alloc(np, r.start, flags, 0, 0, name); |
495 | if (mpic == NULL) | 495 | if (mpic == NULL) |
@@ -510,7 +510,7 @@ static int __init pmac_pic_probe_mpic(void) | |||
510 | for (np = NULL; (np = of_find_node_by_type(np, "open-pic")) | 510 | for (np = NULL; (np = of_find_node_by_type(np, "open-pic")) |
511 | != NULL;) { | 511 | != NULL;) { |
512 | if (master == NULL && | 512 | if (master == NULL && |
513 | get_property(np, "interrupts", NULL) == NULL) | 513 | of_get_property(np, "interrupts", NULL) == NULL) |
514 | master = of_node_get(np); | 514 | master = of_node_get(np); |
515 | else if (slave == NULL) | 515 | else if (slave == NULL) |
516 | slave = of_node_get(np); | 516 | slave = of_node_get(np); |
@@ -575,7 +575,7 @@ void __init pmac_pic_init(void) | |||
575 | #ifdef CONFIG_PPC32 | 575 | #ifdef CONFIG_PPC32 |
576 | if (!pmac_newworld) | 576 | if (!pmac_newworld) |
577 | flags |= OF_IMAP_OLDWORLD_MAC; | 577 | flags |= OF_IMAP_OLDWORLD_MAC; |
578 | if (get_property(of_chosen, "linux,bootx", NULL) != NULL) | 578 | if (of_get_property(of_chosen, "linux,bootx", NULL) != NULL) |
579 | flags |= OF_IMAP_NO_PHANDLE; | 579 | flags |= OF_IMAP_NO_PHANDLE; |
580 | #endif /* CONFIG_PPC_32 */ | 580 | #endif /* CONFIG_PPC_32 */ |
581 | 581 | ||
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c index 651fa424ea06..b820cabac697 100644 --- a/arch/powerpc/platforms/powermac/setup.c +++ b/arch/powerpc/platforms/powermac/setup.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/initrd.h> | 42 | #include <linux/initrd.h> |
43 | #include <linux/vt_kern.h> | 43 | #include <linux/vt_kern.h> |
44 | #include <linux/console.h> | 44 | #include <linux/console.h> |
45 | #include <linux/ide.h> | ||
46 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
47 | #include <linux/adb.h> | 46 | #include <linux/adb.h> |
48 | #include <linux/cuda.h> | 47 | #include <linux/cuda.h> |
@@ -135,12 +134,12 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
135 | seq_printf(m, "machine\t\t: "); | 134 | seq_printf(m, "machine\t\t: "); |
136 | np = of_find_node_by_path("/"); | 135 | np = of_find_node_by_path("/"); |
137 | if (np != NULL) { | 136 | if (np != NULL) { |
138 | pp = get_property(np, "model", NULL); | 137 | pp = of_get_property(np, "model", NULL); |
139 | if (pp != NULL) | 138 | if (pp != NULL) |
140 | seq_printf(m, "%s\n", pp); | 139 | seq_printf(m, "%s\n", pp); |
141 | else | 140 | else |
142 | seq_printf(m, "PowerMac\n"); | 141 | seq_printf(m, "PowerMac\n"); |
143 | pp = get_property(np, "compatible", &plen); | 142 | pp = of_get_property(np, "compatible", &plen); |
144 | if (pp != NULL) { | 143 | if (pp != NULL) { |
145 | seq_printf(m, "motherboard\t:"); | 144 | seq_printf(m, "motherboard\t:"); |
146 | while (plen > 0) { | 145 | while (plen > 0) { |
@@ -164,11 +163,13 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
164 | if (np == NULL) | 163 | if (np == NULL) |
165 | np = of_find_node_by_type(NULL, "cache"); | 164 | np = of_find_node_by_type(NULL, "cache"); |
166 | if (np != NULL) { | 165 | if (np != NULL) { |
167 | const unsigned int *ic = get_property(np, "i-cache-size", NULL); | 166 | const unsigned int *ic = |
168 | const unsigned int *dc = get_property(np, "d-cache-size", NULL); | 167 | of_get_property(np, "i-cache-size", NULL); |
168 | const unsigned int *dc = | ||
169 | of_get_property(np, "d-cache-size", NULL); | ||
169 | seq_printf(m, "L2 cache\t:"); | 170 | seq_printf(m, "L2 cache\t:"); |
170 | has_l2cache = 1; | 171 | has_l2cache = 1; |
171 | if (get_property(np, "cache-unified", NULL) != 0 && dc) { | 172 | if (of_get_property(np, "cache-unified", NULL) != 0 && dc) { |
172 | seq_printf(m, " %dK unified", *dc / 1024); | 173 | seq_printf(m, " %dK unified", *dc / 1024); |
173 | } else { | 174 | } else { |
174 | if (ic) | 175 | if (ic) |
@@ -177,7 +178,7 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
177 | seq_printf(m, "%s %dK data", | 178 | seq_printf(m, "%s %dK data", |
178 | (ic? " +": ""), *dc / 1024); | 179 | (ic? " +": ""), *dc / 1024); |
179 | } | 180 | } |
180 | pp = get_property(np, "ram-type", NULL); | 181 | pp = of_get_property(np, "ram-type", NULL); |
181 | if (pp) | 182 | if (pp) |
182 | seq_printf(m, " %s", pp); | 183 | seq_printf(m, " %s", pp); |
183 | seq_printf(m, "\n"); | 184 | seq_printf(m, "\n"); |
@@ -192,8 +193,11 @@ static void pmac_show_cpuinfo(struct seq_file *m) | |||
192 | #ifndef CONFIG_ADB_CUDA | 193 | #ifndef CONFIG_ADB_CUDA |
193 | int find_via_cuda(void) | 194 | int find_via_cuda(void) |
194 | { | 195 | { |
195 | if (!find_devices("via-cuda")) | 196 | struct device_node *dn = of_find_node_by_name(NULL, "via-cuda"); |
197 | |||
198 | if (!dn) | ||
196 | return 0; | 199 | return 0; |
200 | of_node_put(dn); | ||
197 | printk("WARNING ! Your machine is CUDA-based but your kernel\n"); | 201 | printk("WARNING ! Your machine is CUDA-based but your kernel\n"); |
198 | printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); | 202 | printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n"); |
199 | return 0; | 203 | return 0; |
@@ -203,8 +207,11 @@ int find_via_cuda(void) | |||
203 | #ifndef CONFIG_ADB_PMU | 207 | #ifndef CONFIG_ADB_PMU |
204 | int find_via_pmu(void) | 208 | int find_via_pmu(void) |
205 | { | 209 | { |
206 | if (!find_devices("via-pmu")) | 210 | struct device_node *dn = of_find_node_by_name(NULL, "via-pmu"); |
211 | |||
212 | if (!dn) | ||
207 | return 0; | 213 | return 0; |
214 | of_node_put(dn); | ||
208 | printk("WARNING ! Your machine is PMU-based but your kernel\n"); | 215 | printk("WARNING ! Your machine is PMU-based but your kernel\n"); |
209 | printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); | 216 | printk(" wasn't compiled with CONFIG_ADB_PMU option !\n"); |
210 | return 0; | 217 | return 0; |
@@ -224,6 +231,8 @@ static volatile u32 *sysctrl_regs; | |||
224 | 231 | ||
225 | static void __init ohare_init(void) | 232 | static void __init ohare_init(void) |
226 | { | 233 | { |
234 | struct device_node *dn; | ||
235 | |||
227 | /* this area has the CPU identification register | 236 | /* this area has the CPU identification register |
228 | and some registers used by smp boards */ | 237 | and some registers used by smp boards */ |
229 | sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); | 238 | sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000); |
@@ -233,7 +242,9 @@ static void __init ohare_init(void) | |||
233 | * We assume that we have a PSX memory controller iff | 242 | * We assume that we have a PSX memory controller iff |
234 | * we have an ohare I/O controller. | 243 | * we have an ohare I/O controller. |
235 | */ | 244 | */ |
236 | if (find_devices("ohare") != NULL) { | 245 | dn = of_find_node_by_name(NULL, "ohare"); |
246 | if (dn) { | ||
247 | of_node_put(dn); | ||
237 | if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { | 248 | if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) { |
238 | if (sysctrl_regs[4] & 0x10) | 249 | if (sysctrl_regs[4] & 0x10) |
239 | sysctrl_regs[4] |= 0x04000020; | 250 | sysctrl_regs[4] |= 0x04000020; |
@@ -249,18 +260,19 @@ static void __init l2cr_init(void) | |||
249 | { | 260 | { |
250 | /* Checks "l2cr-value" property in the registry */ | 261 | /* Checks "l2cr-value" property in the registry */ |
251 | if (cpu_has_feature(CPU_FTR_L2CR)) { | 262 | if (cpu_has_feature(CPU_FTR_L2CR)) { |
252 | struct device_node *np = find_devices("cpus"); | 263 | struct device_node *np = of_find_node_by_name(NULL, "cpus"); |
253 | if (np == 0) | 264 | if (np == 0) |
254 | np = find_type_devices("cpu"); | 265 | np = of_find_node_by_type(NULL, "cpu"); |
255 | if (np != 0) { | 266 | if (np != 0) { |
256 | const unsigned int *l2cr = | 267 | const unsigned int *l2cr = |
257 | get_property(np, "l2cr-value", NULL); | 268 | of_get_property(np, "l2cr-value", NULL); |
258 | if (l2cr != 0) { | 269 | if (l2cr != 0) { |
259 | ppc_override_l2cr = 1; | 270 | ppc_override_l2cr = 1; |
260 | ppc_override_l2cr_value = *l2cr; | 271 | ppc_override_l2cr_value = *l2cr; |
261 | _set_L2CR(0); | 272 | _set_L2CR(0); |
262 | _set_L2CR(ppc_override_l2cr_value); | 273 | _set_L2CR(ppc_override_l2cr_value); |
263 | } | 274 | } |
275 | of_node_put(np); | ||
264 | } | 276 | } |
265 | } | 277 | } |
266 | 278 | ||
@@ -286,7 +298,7 @@ static void __init pmac_setup_arch(void) | |||
286 | loops_per_jiffy = 50000000 / HZ; | 298 | loops_per_jiffy = 50000000 / HZ; |
287 | cpu = of_find_node_by_type(NULL, "cpu"); | 299 | cpu = of_find_node_by_type(NULL, "cpu"); |
288 | if (cpu != NULL) { | 300 | if (cpu != NULL) { |
289 | fp = get_property(cpu, "clock-frequency", NULL); | 301 | fp = of_get_property(cpu, "clock-frequency", NULL); |
290 | if (fp != NULL) { | 302 | if (fp != NULL) { |
291 | if (pvr >= 0x30 && pvr < 0x80) | 303 | if (pvr >= 0x30 && pvr < 0x80) |
292 | /* PPC970 etc. */ | 304 | /* PPC970 etc. */ |
@@ -303,7 +315,7 @@ static void __init pmac_setup_arch(void) | |||
303 | 315 | ||
304 | /* See if newworld or oldworld */ | 316 | /* See if newworld or oldworld */ |
305 | for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; ) | 317 | for (ic = NULL; (ic = of_find_all_nodes(ic)) != NULL; ) |
306 | if (get_property(ic, "interrupt-controller", NULL)) | 318 | if (of_get_property(ic, "interrupt-controller", NULL)) |
307 | break; | 319 | break; |
308 | if (ic) { | 320 | if (ic) { |
309 | pmac_newworld = 1; | 321 | pmac_newworld = 1; |
@@ -341,8 +353,15 @@ static void __init pmac_setup_arch(void) | |||
341 | 353 | ||
342 | #ifdef CONFIG_SMP | 354 | #ifdef CONFIG_SMP |
343 | /* Check for Core99 */ | 355 | /* Check for Core99 */ |
344 | if (find_devices("uni-n") || find_devices("u3") || find_devices("u4")) | 356 | ic = of_find_node_by_name(NULL, "uni-n"); |
357 | if (!ic) | ||
358 | ic = of_find_node_by_name(NULL, "u3"); | ||
359 | if (!ic) | ||
360 | ic = of_find_node_by_name(NULL, "u4"); | ||
361 | if (ic) { | ||
362 | of_node_put(ic); | ||
345 | smp_ops = &core99_smp_ops; | 363 | smp_ops = &core99_smp_ops; |
364 | } | ||
346 | #ifdef CONFIG_PPC32 | 365 | #ifdef CONFIG_PPC32 |
347 | else | 366 | else |
348 | smp_ops = &psurge_smp_ops; | 367 | smp_ops = &psurge_smp_ops; |
@@ -616,15 +635,6 @@ static void __init pmac_init_early(void) | |||
616 | #endif | 635 | #endif |
617 | } | 636 | } |
618 | 637 | ||
619 | /* | ||
620 | * pmac has no legacy IO, anything calling this function has to | ||
621 | * fail or bad things will happen | ||
622 | */ | ||
623 | static int pmac_check_legacy_ioport(unsigned int baseport) | ||
624 | { | ||
625 | return -ENODEV; | ||
626 | } | ||
627 | |||
628 | static int __init pmac_declare_of_platform_devices(void) | 638 | static int __init pmac_declare_of_platform_devices(void) |
629 | { | 639 | { |
630 | struct device_node *np; | 640 | struct device_node *np; |
@@ -736,7 +746,6 @@ define_machine(powermac) { | |||
736 | .get_rtc_time = pmac_get_rtc_time, | 746 | .get_rtc_time = pmac_get_rtc_time, |
737 | .calibrate_decr = pmac_calibrate_decr, | 747 | .calibrate_decr = pmac_calibrate_decr, |
738 | .feature_call = pmac_do_feature_call, | 748 | .feature_call = pmac_do_feature_call, |
739 | .check_legacy_ioport = pmac_check_legacy_ioport, | ||
740 | .progress = udbg_progress, | 749 | .progress = udbg_progress, |
741 | #ifdef CONFIG_PPC64 | 750 | #ifdef CONFIG_PPC64 |
742 | .pci_probe_mode = pmac_pci_probe_mode, | 751 | .pci_probe_mode = pmac_pci_probe_mode, |
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c index d73fb73802bb..6f32c4eca6e5 100644 --- a/arch/powerpc/platforms/powermac/smp.c +++ b/arch/powerpc/platforms/powermac/smp.c | |||
@@ -264,6 +264,7 @@ static void __init psurge_quad_init(void) | |||
264 | static int __init smp_psurge_probe(void) | 264 | static int __init smp_psurge_probe(void) |
265 | { | 265 | { |
266 | int i, ncpus; | 266 | int i, ncpus; |
267 | struct device_node *dn; | ||
267 | 268 | ||
268 | /* We don't do SMP on the PPC601 -- paulus */ | 269 | /* We don't do SMP on the PPC601 -- paulus */ |
269 | if (PVR_VER(mfspr(SPRN_PVR)) == 1) | 270 | if (PVR_VER(mfspr(SPRN_PVR)) == 1) |
@@ -279,8 +280,10 @@ static int __init smp_psurge_probe(void) | |||
279 | * in the hammerhead memory controller in the case of the | 280 | * in the hammerhead memory controller in the case of the |
280 | * dual-cpu powersurge board. -- paulus. | 281 | * dual-cpu powersurge board. -- paulus. |
281 | */ | 282 | */ |
282 | if (find_devices("hammerhead") == NULL) | 283 | dn = of_find_node_by_name(NULL, "hammerhead"); |
284 | if (dn == NULL) | ||
283 | return 1; | 285 | return 1; |
286 | of_node_put(dn); | ||
284 | 287 | ||
285 | hhead_base = ioremap(HAMMERHEAD_BASE, 0x800); | 288 | hhead_base = ioremap(HAMMERHEAD_BASE, 0x800); |
286 | quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024); | 289 | quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024); |
@@ -567,7 +570,7 @@ static void __init smp_core99_setup_i2c_hwsync(int ncpus) | |||
567 | pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); | 570 | pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); |
568 | if (pmac_tb_clock_chip_host == NULL) | 571 | if (pmac_tb_clock_chip_host == NULL) |
569 | continue; | 572 | continue; |
570 | reg = get_property(cc, "reg", NULL); | 573 | reg = of_get_property(cc, "reg", NULL); |
571 | if (reg == NULL) | 574 | if (reg == NULL) |
572 | continue; | 575 | continue; |
573 | switch (*reg) { | 576 | switch (*reg) { |
@@ -695,7 +698,7 @@ static void __init smp_core99_setup(int ncpus) | |||
695 | struct device_node *cpus = | 698 | struct device_node *cpus = |
696 | of_find_node_by_path("/cpus"); | 699 | of_find_node_by_path("/cpus"); |
697 | if (cpus && | 700 | if (cpus && |
698 | get_property(cpus, "platform-cpu-timebase", NULL)) { | 701 | of_get_property(cpus, "platform-cpu-timebase", NULL)) { |
699 | pmac_tb_freeze = smp_core99_pfunc_tb_freeze; | 702 | pmac_tb_freeze = smp_core99_pfunc_tb_freeze; |
700 | printk(KERN_INFO "Processor timebase sync using" | 703 | printk(KERN_INFO "Processor timebase sync using" |
701 | " platform function\n"); | 704 | " platform function\n"); |
@@ -712,7 +715,7 @@ static void __init smp_core99_setup(int ncpus) | |||
712 | core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ | 715 | core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ |
713 | cpu = of_find_node_by_type(NULL, "cpu"); | 716 | cpu = of_find_node_by_type(NULL, "cpu"); |
714 | if (cpu != NULL) { | 717 | if (cpu != NULL) { |
715 | tbprop = get_property(cpu, "timebase-enable", NULL); | 718 | tbprop = of_get_property(cpu, "timebase-enable", NULL); |
716 | if (tbprop) | 719 | if (tbprop) |
717 | core99_tb_gpio = *tbprop; | 720 | core99_tb_gpio = *tbprop; |
718 | of_node_put(cpu); | 721 | of_node_put(cpu); |
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c index a4173906e945..bf9da56942e8 100644 --- a/arch/powerpc/platforms/powermac/time.c +++ b/arch/powerpc/platforms/powermac/time.c | |||
@@ -297,49 +297,11 @@ int __init via_calibrate_decr(void) | |||
297 | } | 297 | } |
298 | #endif | 298 | #endif |
299 | 299 | ||
300 | #ifdef CONFIG_PM | ||
301 | /* | ||
302 | * Reset the time after a sleep. | ||
303 | */ | ||
304 | static int | ||
305 | time_sleep_notify(struct pmu_sleep_notifier *self, int when) | ||
306 | { | ||
307 | static unsigned long time_diff; | ||
308 | unsigned long flags; | ||
309 | unsigned long seq; | ||
310 | struct timespec tv; | ||
311 | |||
312 | switch (when) { | ||
313 | case PBOOK_SLEEP_NOW: | ||
314 | do { | ||
315 | seq = read_seqbegin_irqsave(&xtime_lock, flags); | ||
316 | time_diff = xtime.tv_sec - pmac_get_boot_time(); | ||
317 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | ||
318 | break; | ||
319 | case PBOOK_WAKE: | ||
320 | tv.tv_sec = pmac_get_boot_time() + time_diff; | ||
321 | tv.tv_nsec = 0; | ||
322 | do_settimeofday(&tv); | ||
323 | break; | ||
324 | } | ||
325 | return PBOOK_SLEEP_OK; | ||
326 | } | ||
327 | |||
328 | static struct pmu_sleep_notifier time_sleep_notifier = { | ||
329 | time_sleep_notify, SLEEP_LEVEL_MISC, | ||
330 | }; | ||
331 | #endif /* CONFIG_PM */ | ||
332 | |||
333 | /* | 300 | /* |
334 | * Query the OF and get the decr frequency. | 301 | * Query the OF and get the decr frequency. |
335 | */ | 302 | */ |
336 | void __init pmac_calibrate_decr(void) | 303 | void __init pmac_calibrate_decr(void) |
337 | { | 304 | { |
338 | #if defined(CONFIG_PM) && defined(CONFIG_ADB_PMU) | ||
339 | /* XXX why here? */ | ||
340 | pmu_register_sleep_notifier(&time_sleep_notifier); | ||
341 | #endif | ||
342 | |||
343 | generic_calibrate_decr(); | 305 | generic_calibrate_decr(); |
344 | 306 | ||
345 | #ifdef CONFIG_PPC32 | 307 | #ifdef CONFIG_PPC32 |
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c index 379db05b0082..47de4d3fc167 100644 --- a/arch/powerpc/platforms/powermac/udbg_scc.c +++ b/arch/powerpc/platforms/powermac/udbg_scc.c | |||
@@ -81,7 +81,7 @@ void udbg_scc_init(int force_scc) | |||
81 | macio = of_get_parent(escc); | 81 | macio = of_get_parent(escc); |
82 | if (macio == NULL) | 82 | if (macio == NULL) |
83 | goto bail; | 83 | goto bail; |
84 | path = get_property(of_chosen, "linux,stdout-path", NULL); | 84 | path = of_get_property(of_chosen, "linux,stdout-path", NULL); |
85 | if (path != NULL) | 85 | if (path != NULL) |
86 | stdout = of_find_node_by_path(path); | 86 | stdout = of_find_node_by_path(path); |
87 | for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { | 87 | for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { |
@@ -96,13 +96,13 @@ void udbg_scc_init(int force_scc) | |||
96 | ch = ch_def ? ch_def : ch_a; | 96 | ch = ch_def ? ch_def : ch_a; |
97 | 97 | ||
98 | /* Get address within mac-io ASIC */ | 98 | /* Get address within mac-io ASIC */ |
99 | reg = get_property(escc, "reg", NULL); | 99 | reg = of_get_property(escc, "reg", NULL); |
100 | if (reg == NULL) | 100 | if (reg == NULL) |
101 | goto bail; | 101 | goto bail; |
102 | addr = reg[0]; | 102 | addr = reg[0]; |
103 | 103 | ||
104 | /* Get address of mac-io PCI itself */ | 104 | /* Get address of mac-io PCI itself */ |
105 | reg = get_property(macio, "assigned-addresses", NULL); | 105 | reg = of_get_property(macio, "assigned-addresses", NULL); |
106 | if (reg == NULL) | 106 | if (reg == NULL) |
107 | goto bail; | 107 | goto bail; |
108 | addr += reg[2]; | 108 | addr += reg[2]; |
diff --git a/arch/powerpc/platforms/prep/Kconfig b/arch/powerpc/platforms/prep/Kconfig index 673ac47a1626..29d411279b0c 100644 --- a/arch/powerpc/platforms/prep/Kconfig +++ b/arch/powerpc/platforms/prep/Kconfig | |||
@@ -1,3 +1,12 @@ | |||
1 | config PPC_PREP | ||
2 | bool "PowerPC Reference Platform (PReP) based machines" | ||
3 | depends on PPC_MULTIPLATFORM && PPC32 && BROKEN | ||
4 | select MPIC | ||
5 | select PPC_I8259 | ||
6 | select PPC_INDIRECT_PCI | ||
7 | select PPC_UDBG_16550 | ||
8 | select PPC_NATIVE | ||
9 | default n | ||
1 | 10 | ||
2 | config PREP_RESIDUAL | 11 | config PREP_RESIDUAL |
3 | bool "Support for PReP Residual Data" | 12 | bool "Support for PReP Residual Data" |
diff --git a/arch/powerpc/platforms/ps3/Kconfig b/arch/powerpc/platforms/ps3/Kconfig index 1a481a60a883..40f0008af4d1 100644 --- a/arch/powerpc/platforms/ps3/Kconfig +++ b/arch/powerpc/platforms/ps3/Kconfig | |||
@@ -1,3 +1,19 @@ | |||
1 | config PPC_PS3 | ||
2 | bool "Sony PS3 (incomplete)" | ||
3 | depends on PPC_MULTIPLATFORM && PPC64 | ||
4 | select PPC_CELL | ||
5 | select USB_ARCH_HAS_OHCI | ||
6 | select USB_OHCI_LITTLE_ENDIAN | ||
7 | select USB_OHCI_BIG_ENDIAN_MMIO | ||
8 | select USB_ARCH_HAS_EHCI | ||
9 | select USB_EHCI_BIG_ENDIAN_MMIO | ||
10 | help | ||
11 | This option enables support for the Sony PS3 game console | ||
12 | and other platforms using the PS3 hypervisor. | ||
13 | Support for this platform is not yet complete, so | ||
14 | enabling this will not result in a bootable kernel on a | ||
15 | PS3 system. | ||
16 | |||
1 | menu "PS3 Platform Options" | 17 | menu "PS3 Platform Options" |
2 | depends on PPC_PS3 | 18 | depends on PPC_PS3 |
3 | 19 | ||
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c index e12e59fea13a..ea60c451cf87 100644 --- a/arch/powerpc/platforms/ps3/htab.c +++ b/arch/powerpc/platforms/ps3/htab.c | |||
@@ -39,7 +39,7 @@ static unsigned long htab_addr; | |||
39 | static unsigned char *bolttab; | 39 | static unsigned char *bolttab; |
40 | static unsigned char *inusetab; | 40 | static unsigned char *inusetab; |
41 | 41 | ||
42 | static spinlock_t ps3_bolttab_lock = SPIN_LOCK_UNLOCKED; | 42 | static DEFINE_SPINLOCK(ps3_bolttab_lock); |
43 | 43 | ||
44 | #define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \ | 44 | #define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \ |
45 | _debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__) | 45 | _debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__) |
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig index a57032cf6f1b..16e4e401b820 100644 --- a/arch/powerpc/platforms/pseries/Kconfig +++ b/arch/powerpc/platforms/pseries/Kconfig | |||
@@ -1,3 +1,13 @@ | |||
1 | config PPC_PSERIES | ||
2 | depends on PPC_MULTIPLATFORM && PPC64 | ||
3 | bool "IBM pSeries & new (POWER5-based) iSeries" | ||
4 | select MPIC | ||
5 | select PPC_I8259 | ||
6 | select PPC_RTAS | ||
7 | select RTAS_ERROR_LOGGING | ||
8 | select PPC_UDBG_16550 | ||
9 | select PPC_NATIVE | ||
10 | default y | ||
1 | 11 | ||
2 | config PPC_SPLPAR | 12 | config PPC_SPLPAR |
3 | depends on PPC_PSERIES | 13 | depends on PPC_PSERIES |
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 2dfd05095a25..90235d598751 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -2,14 +2,15 @@ ifeq ($(CONFIG_PPC64),y) | |||
2 | EXTRA_CFLAGS += -mno-minimal-toc | 2 | EXTRA_CFLAGS += -mno-minimal-toc |
3 | endif | 3 | endif |
4 | 4 | ||
5 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ | 5 | obj-y := lpar.o hvCall.o nvram.o reconfig.o \ |
6 | setup.o iommu.o ras.o rtasd.o pci_dlpar.o \ | 6 | setup.o iommu.o ras.o rtasd.o \ |
7 | firmware.o power.o | 7 | firmware.o power.o |
8 | obj-$(CONFIG_SMP) += smp.o | 8 | obj-$(CONFIG_SMP) += smp.o |
9 | obj-$(CONFIG_XICS) += xics.o | 9 | obj-$(CONFIG_XICS) += xics.o |
10 | obj-$(CONFIG_SCANLOG) += scanlog.o | 10 | obj-$(CONFIG_SCANLOG) += scanlog.o |
11 | obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o | 11 | obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o |
12 | obj-$(CONFIG_KEXEC) += kexec.o | 12 | obj-$(CONFIG_KEXEC) += kexec.o |
13 | obj-$(CONFIG_PCI) += pci.o pci_dlpar.o | ||
13 | 14 | ||
14 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o | 15 | obj-$(CONFIG_HOTPLUG_CPU) += hotplug-cpu.o |
15 | 16 | ||
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index 6cedbc002e0f..48fbd442e9df 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -74,7 +74,10 @@ | |||
74 | * is broken and panic. This sets the threshold for how many read | 74 | * is broken and panic. This sets the threshold for how many read |
75 | * attempts we allow before panicking. | 75 | * attempts we allow before panicking. |
76 | */ | 76 | */ |
77 | #define EEH_MAX_FAILS 100000 | 77 | #define EEH_MAX_FAILS 2100000 |
78 | |||
79 | /* Time to wait for a PCI slot to retport status, in milliseconds */ | ||
80 | #define PCI_BUS_RESET_WAIT_MSEC (60*1000) | ||
78 | 81 | ||
79 | /* RTAS tokens */ | 82 | /* RTAS tokens */ |
80 | static int ibm_set_eeh_option; | 83 | static int ibm_set_eeh_option; |
@@ -83,6 +86,7 @@ static int ibm_read_slot_reset_state; | |||
83 | static int ibm_read_slot_reset_state2; | 86 | static int ibm_read_slot_reset_state2; |
84 | static int ibm_slot_error_detail; | 87 | static int ibm_slot_error_detail; |
85 | static int ibm_get_config_addr_info; | 88 | static int ibm_get_config_addr_info; |
89 | static int ibm_get_config_addr_info2; | ||
86 | static int ibm_configure_bridge; | 90 | static int ibm_configure_bridge; |
87 | 91 | ||
88 | int eeh_subsystem_enabled; | 92 | int eeh_subsystem_enabled; |
@@ -168,6 +172,55 @@ static int read_slot_reset_state(struct pci_dn *pdn, int rets[]) | |||
168 | } | 172 | } |
169 | 173 | ||
170 | /** | 174 | /** |
175 | * eeh_wait_for_slot_status - returns error status of slot | ||
176 | * @pdn pci device node | ||
177 | * @max_wait_msecs maximum number to millisecs to wait | ||
178 | * | ||
179 | * Return negative value if a permanent error, else return | ||
180 | * Partition Endpoint (PE) status value. | ||
181 | * | ||
182 | * If @max_wait_msecs is positive, then this routine will | ||
183 | * sleep until a valid status can be obtained, or until | ||
184 | * the max allowed wait time is exceeded, in which case | ||
185 | * a -2 is returned. | ||
186 | */ | ||
187 | int | ||
188 | eeh_wait_for_slot_status(struct pci_dn *pdn, int max_wait_msecs) | ||
189 | { | ||
190 | int rc; | ||
191 | int rets[3]; | ||
192 | int mwait; | ||
193 | |||
194 | while (1) { | ||
195 | rc = read_slot_reset_state(pdn, rets); | ||
196 | if (rc) return rc; | ||
197 | if (rets[1] == 0) return -1; /* EEH is not supported */ | ||
198 | |||
199 | if (rets[0] != 5) return rets[0]; /* return actual status */ | ||
200 | |||
201 | if (rets[2] == 0) return -1; /* permanently unavailable */ | ||
202 | |||
203 | if (max_wait_msecs <= 0) return -1; | ||
204 | |||
205 | mwait = rets[2]; | ||
206 | if (mwait <= 0) { | ||
207 | printk (KERN_WARNING | ||
208 | "EEH: Firmware returned bad wait value=%d\n", mwait); | ||
209 | mwait = 1000; | ||
210 | } else if (mwait > 300*1000) { | ||
211 | printk (KERN_WARNING | ||
212 | "EEH: Firmware is taking too long, time=%d\n", mwait); | ||
213 | mwait = 300*1000; | ||
214 | } | ||
215 | max_wait_msecs -= mwait; | ||
216 | msleep (mwait); | ||
217 | } | ||
218 | |||
219 | printk(KERN_WARNING "EEH: Timed out waiting for slot status\n"); | ||
220 | return -2; | ||
221 | } | ||
222 | |||
223 | /** | ||
171 | * eeh_token_to_phys - convert EEH address token to phys address | 224 | * eeh_token_to_phys - convert EEH address token to phys address |
172 | * @token i/o token, should be address in the form 0xA.... | 225 | * @token i/o token, should be address in the form 0xA.... |
173 | */ | 226 | */ |
@@ -229,7 +282,7 @@ void eeh_mark_slot (struct device_node *dn, int mode_flag) | |||
229 | dn = find_device_pe (dn); | 282 | dn = find_device_pe (dn); |
230 | 283 | ||
231 | /* Back up one, since config addrs might be shared */ | 284 | /* Back up one, since config addrs might be shared */ |
232 | if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr) | 285 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) |
233 | dn = dn->parent; | 286 | dn = dn->parent; |
234 | 287 | ||
235 | PCI_DN(dn)->eeh_mode |= mode_flag; | 288 | PCI_DN(dn)->eeh_mode |= mode_flag; |
@@ -263,7 +316,7 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag) | |||
263 | dn = find_device_pe (dn); | 316 | dn = find_device_pe (dn); |
264 | 317 | ||
265 | /* Back up one, since config addrs might be shared */ | 318 | /* Back up one, since config addrs might be shared */ |
266 | if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr) | 319 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) |
267 | dn = dn->parent; | 320 | dn = dn->parent; |
268 | 321 | ||
269 | PCI_DN(dn)->eeh_mode &= ~mode_flag; | 322 | PCI_DN(dn)->eeh_mode &= ~mode_flag; |
@@ -293,7 +346,6 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | |||
293 | int rets[3]; | 346 | int rets[3]; |
294 | unsigned long flags; | 347 | unsigned long flags; |
295 | struct pci_dn *pdn; | 348 | struct pci_dn *pdn; |
296 | enum pci_channel_state state; | ||
297 | int rc = 0; | 349 | int rc = 0; |
298 | 350 | ||
299 | total_mmio_ffs++; | 351 | total_mmio_ffs++; |
@@ -367,25 +419,25 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | |||
367 | goto dn_unlock; | 419 | goto dn_unlock; |
368 | } | 420 | } |
369 | 421 | ||
370 | /* If EEH is not supported on this device, punt. */ | 422 | /* Note that config-io to empty slots may fail; |
371 | if (rets[1] != 1) { | 423 | * they are empty when they don't have children. */ |
372 | printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n", | 424 | if ((rets[0] == 5) && (dn->child == NULL)) { |
373 | ret, dn->full_name); | ||
374 | false_positives++; | 425 | false_positives++; |
375 | rc = 0; | 426 | rc = 0; |
376 | goto dn_unlock; | 427 | goto dn_unlock; |
377 | } | 428 | } |
378 | 429 | ||
379 | /* If not the kind of error we know about, punt. */ | 430 | /* If EEH is not supported on this device, punt. */ |
380 | if (rets[0] != 2 && rets[0] != 4 && rets[0] != 5) { | 431 | if (rets[1] != 1) { |
432 | printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n", | ||
433 | ret, dn->full_name); | ||
381 | false_positives++; | 434 | false_positives++; |
382 | rc = 0; | 435 | rc = 0; |
383 | goto dn_unlock; | 436 | goto dn_unlock; |
384 | } | 437 | } |
385 | 438 | ||
386 | /* Note that config-io to empty slots may fail; | 439 | /* If not the kind of error we know about, punt. */ |
387 | * we recognize empty because they don't have children. */ | 440 | if (rets[0] != 1 && rets[0] != 2 && rets[0] != 4 && rets[0] != 5) { |
388 | if ((rets[0] == 5) && (dn->child == NULL)) { | ||
389 | false_positives++; | 441 | false_positives++; |
390 | rc = 0; | 442 | rc = 0; |
391 | goto dn_unlock; | 443 | goto dn_unlock; |
@@ -399,17 +451,12 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev) | |||
399 | eeh_mark_slot (dn, EEH_MODE_ISOLATED); | 451 | eeh_mark_slot (dn, EEH_MODE_ISOLATED); |
400 | spin_unlock_irqrestore(&confirm_error_lock, flags); | 452 | spin_unlock_irqrestore(&confirm_error_lock, flags); |
401 | 453 | ||
402 | state = pci_channel_io_normal; | 454 | eeh_send_failure_event (dn, dev); |
403 | if ((rets[0] == 2) || (rets[0] == 4)) | ||
404 | state = pci_channel_io_frozen; | ||
405 | if (rets[0] == 5) | ||
406 | state = pci_channel_io_perm_failure; | ||
407 | eeh_send_failure_event (dn, dev, state, rets[2]); | ||
408 | 455 | ||
409 | /* Most EEH events are due to device driver bugs. Having | 456 | /* Most EEH events are due to device driver bugs. Having |
410 | * a stack trace will help the device-driver authors figure | 457 | * a stack trace will help the device-driver authors figure |
411 | * out what happened. So print that out. */ | 458 | * out what happened. So print that out. */ |
412 | if (rets[0] != 5) dump_stack(); | 459 | dump_stack(); |
413 | return 1; | 460 | return 1; |
414 | 461 | ||
415 | dn_unlock: | 462 | dn_unlock: |
@@ -458,38 +505,6 @@ EXPORT_SYMBOL(eeh_check_failure); | |||
458 | /* The code below deals with error recovery */ | 505 | /* The code below deals with error recovery */ |
459 | 506 | ||
460 | /** | 507 | /** |
461 | * eeh_slot_availability - returns error status of slot | ||
462 | * @pdn pci device node | ||
463 | * | ||
464 | * Return negative value if a permanent error, else return | ||
465 | * a number of milliseconds to wait until the PCI slot is | ||
466 | * ready to be used. | ||
467 | */ | ||
468 | static int | ||
469 | eeh_slot_availability(struct pci_dn *pdn) | ||
470 | { | ||
471 | int rc; | ||
472 | int rets[3]; | ||
473 | |||
474 | rc = read_slot_reset_state(pdn, rets); | ||
475 | |||
476 | if (rc) return rc; | ||
477 | |||
478 | if (rets[1] == 0) return -1; /* EEH is not supported */ | ||
479 | if (rets[0] == 0) return 0; /* Oll Korrect */ | ||
480 | if (rets[0] == 5) { | ||
481 | if (rets[2] == 0) return -1; /* permanently unavailable */ | ||
482 | return rets[2]; /* number of millisecs to wait */ | ||
483 | } | ||
484 | if (rets[0] == 1) | ||
485 | return 250; | ||
486 | |||
487 | printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n", | ||
488 | rc, rets[0], rets[1], rets[2]); | ||
489 | return -2; | ||
490 | } | ||
491 | |||
492 | /** | ||
493 | * rtas_pci_enable - enable MMIO or DMA transfers for this slot | 508 | * rtas_pci_enable - enable MMIO or DMA transfers for this slot |
494 | * @pdn pci device node | 509 | * @pdn pci device node |
495 | */ | 510 | */ |
@@ -512,9 +527,13 @@ rtas_pci_enable(struct pci_dn *pdn, int function) | |||
512 | function); | 527 | function); |
513 | 528 | ||
514 | if (rc) | 529 | if (rc) |
515 | printk(KERN_WARNING "EEH: Cannot enable function %d, err=%d dn=%s\n", | 530 | printk(KERN_WARNING "EEH: Unexpected state change %d, err=%d dn=%s\n", |
516 | function, rc, pdn->node->full_name); | 531 | function, rc, pdn->node->full_name); |
517 | 532 | ||
533 | rc = eeh_wait_for_slot_status (pdn, PCI_BUS_RESET_WAIT_MSEC); | ||
534 | if ((rc == 4) && (function == EEH_THAW_MMIO)) | ||
535 | return 0; | ||
536 | |||
518 | return rc; | 537 | return rc; |
519 | } | 538 | } |
520 | 539 | ||
@@ -595,36 +614,24 @@ int rtas_set_slot_reset(struct pci_dn *pdn) | |||
595 | { | 614 | { |
596 | int i, rc; | 615 | int i, rc; |
597 | 616 | ||
598 | __rtas_set_slot_reset(pdn); | 617 | /* Take three shots at resetting the bus */ |
618 | for (i=0; i<3; i++) { | ||
619 | __rtas_set_slot_reset(pdn); | ||
599 | 620 | ||
600 | /* Now double check with the firmware to make sure the device is | 621 | rc = eeh_wait_for_slot_status(pdn, PCI_BUS_RESET_WAIT_MSEC); |
601 | * ready to be used; if not, wait for recovery. */ | ||
602 | for (i=0; i<10; i++) { | ||
603 | rc = eeh_slot_availability (pdn); | ||
604 | if (rc == 0) | 622 | if (rc == 0) |
605 | return 0; | 623 | return 0; |
606 | 624 | ||
607 | if (rc == -2) { | ||
608 | printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", | ||
609 | i, pdn->node->full_name); | ||
610 | __rtas_set_slot_reset(pdn); | ||
611 | continue; | ||
612 | } | ||
613 | |||
614 | if (rc < 0) { | 625 | if (rc < 0) { |
615 | printk (KERN_ERR "EEH: unrecoverable slot failure %s\n", | 626 | printk (KERN_ERR "EEH: unrecoverable slot failure %s\n", |
616 | pdn->node->full_name); | 627 | pdn->node->full_name); |
617 | return -1; | 628 | return -1; |
618 | } | 629 | } |
619 | 630 | printk (KERN_ERR "EEH: bus reset %d failed on slot %s\n", | |
620 | msleep (rc+100); | 631 | i+1, pdn->node->full_name); |
621 | } | 632 | } |
622 | 633 | ||
623 | rc = eeh_slot_availability (pdn); | 634 | return -1; |
624 | if (rc) | ||
625 | printk (KERN_ERR "EEH: timeout resetting slot %s\n", pdn->node->full_name); | ||
626 | |||
627 | return rc; | ||
628 | } | 635 | } |
629 | 636 | ||
630 | /* ------------------------------------------------------- */ | 637 | /* ------------------------------------------------------- */ |
@@ -744,16 +751,48 @@ struct eeh_early_enable_info { | |||
744 | unsigned int buid_lo; | 751 | unsigned int buid_lo; |
745 | }; | 752 | }; |
746 | 753 | ||
754 | static int get_pe_addr (int config_addr, | ||
755 | struct eeh_early_enable_info *info) | ||
756 | { | ||
757 | unsigned int rets[3]; | ||
758 | int ret; | ||
759 | |||
760 | /* Use latest config-addr token on power6 */ | ||
761 | if (ibm_get_config_addr_info2 != RTAS_UNKNOWN_SERVICE) { | ||
762 | /* Make sure we have a PE in hand */ | ||
763 | ret = rtas_call (ibm_get_config_addr_info2, 4, 2, rets, | ||
764 | config_addr, info->buid_hi, info->buid_lo, 1); | ||
765 | if (ret || (rets[0]==0)) | ||
766 | return 0; | ||
767 | |||
768 | ret = rtas_call (ibm_get_config_addr_info2, 4, 2, rets, | ||
769 | config_addr, info->buid_hi, info->buid_lo, 0); | ||
770 | if (ret) | ||
771 | return 0; | ||
772 | return rets[0]; | ||
773 | } | ||
774 | |||
775 | /* Use older config-addr token on power5 */ | ||
776 | if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) { | ||
777 | ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets, | ||
778 | config_addr, info->buid_hi, info->buid_lo, 0); | ||
779 | if (ret) | ||
780 | return 0; | ||
781 | return rets[0]; | ||
782 | } | ||
783 | return 0; | ||
784 | } | ||
785 | |||
747 | /* Enable eeh for the given device node. */ | 786 | /* Enable eeh for the given device node. */ |
748 | static void *early_enable_eeh(struct device_node *dn, void *data) | 787 | static void *early_enable_eeh(struct device_node *dn, void *data) |
749 | { | 788 | { |
750 | unsigned int rets[3]; | 789 | unsigned int rets[3]; |
751 | struct eeh_early_enable_info *info = data; | 790 | struct eeh_early_enable_info *info = data; |
752 | int ret; | 791 | int ret; |
753 | const char *status = get_property(dn, "status", NULL); | 792 | const char *status = of_get_property(dn, "status", NULL); |
754 | const u32 *class_code = get_property(dn, "class-code", NULL); | 793 | const u32 *class_code = of_get_property(dn, "class-code", NULL); |
755 | const u32 *vendor_id = get_property(dn, "vendor-id", NULL); | 794 | const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL); |
756 | const u32 *device_id = get_property(dn, "device-id", NULL); | 795 | const u32 *device_id = of_get_property(dn, "device-id", NULL); |
757 | const u32 *regs; | 796 | const u32 *regs; |
758 | int enable; | 797 | int enable; |
759 | struct pci_dn *pdn = PCI_DN(dn); | 798 | struct pci_dn *pdn = PCI_DN(dn); |
@@ -796,7 +835,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data) | |||
796 | 835 | ||
797 | /* Ok... see if this device supports EEH. Some do, some don't, | 836 | /* Ok... see if this device supports EEH. Some do, some don't, |
798 | * and the only way to find out is to check each and every one. */ | 837 | * and the only way to find out is to check each and every one. */ |
799 | regs = get_property(dn, "reg", NULL); | 838 | regs = of_get_property(dn, "reg", NULL); |
800 | if (regs) { | 839 | if (regs) { |
801 | /* First register entry is addr (00BBSS00) */ | 840 | /* First register entry is addr (00BBSS00) */ |
802 | /* Try to enable eeh */ | 841 | /* Try to enable eeh */ |
@@ -810,15 +849,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data) | |||
810 | 849 | ||
811 | /* If the newer, better, ibm,get-config-addr-info is supported, | 850 | /* If the newer, better, ibm,get-config-addr-info is supported, |
812 | * then use that instead. */ | 851 | * then use that instead. */ |
813 | pdn->eeh_pe_config_addr = 0; | 852 | pdn->eeh_pe_config_addr = get_pe_addr(pdn->eeh_config_addr, info); |
814 | if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) { | ||
815 | ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets, | ||
816 | pdn->eeh_config_addr, | ||
817 | info->buid_hi, info->buid_lo, | ||
818 | 0); | ||
819 | if (ret == 0) | ||
820 | pdn->eeh_pe_config_addr = rets[0]; | ||
821 | } | ||
822 | 853 | ||
823 | /* Some older systems (Power4) allow the | 854 | /* Some older systems (Power4) allow the |
824 | * ibm,set-eeh-option call to succeed even on nodes | 855 | * ibm,set-eeh-option call to succeed even on nodes |
@@ -889,6 +920,7 @@ void __init eeh_init(void) | |||
889 | ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state"); | 920 | ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state"); |
890 | ibm_slot_error_detail = rtas_token("ibm,slot-error-detail"); | 921 | ibm_slot_error_detail = rtas_token("ibm,slot-error-detail"); |
891 | ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info"); | 922 | ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info"); |
923 | ibm_get_config_addr_info2 = rtas_token("ibm,get-config-addr-info2"); | ||
892 | ibm_configure_bridge = rtas_token ("ibm,configure-bridge"); | 924 | ibm_configure_bridge = rtas_token ("ibm,configure-bridge"); |
893 | 925 | ||
894 | if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) | 926 | if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) |
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c index a4c0bf84ef2e..3170e003f76a 100644 --- a/arch/powerpc/platforms/pseries/eeh_driver.c +++ b/arch/powerpc/platforms/pseries/eeh_driver.c | |||
@@ -158,7 +158,8 @@ static void eeh_report_reset(struct pci_dev *dev, void *userdata) | |||
158 | return; | 158 | return; |
159 | 159 | ||
160 | rc = driver->err_handler->slot_reset(dev); | 160 | rc = driver->err_handler->slot_reset(dev); |
161 | if (*res == PCI_ERS_RESULT_NONE) *res = rc; | 161 | if ((*res == PCI_ERS_RESULT_NONE) || |
162 | (*res == PCI_ERS_RESULT_RECOVERED)) *res = rc; | ||
162 | if (*res == PCI_ERS_RESULT_DISCONNECT && | 163 | if (*res == PCI_ERS_RESULT_DISCONNECT && |
163 | rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; | 164 | rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; |
164 | } | 165 | } |
@@ -248,6 +249,7 @@ static void eeh_report_failure(struct pci_dev *dev, void *userdata) | |||
248 | 249 | ||
249 | static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) | 250 | static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) |
250 | { | 251 | { |
252 | struct device_node *dn; | ||
251 | int cnt, rc; | 253 | int cnt, rc; |
252 | 254 | ||
253 | /* pcibios will clear the counter; save the value */ | 255 | /* pcibios will clear the counter; save the value */ |
@@ -263,23 +265,20 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) | |||
263 | if (rc) | 265 | if (rc) |
264 | return rc; | 266 | return rc; |
265 | 267 | ||
266 | /* New-style config addrs might be shared across multiple devices, | 268 | /* Walk over all functions on this device. */ |
267 | * Walk over all functions on this device */ | 269 | dn = pe_dn->node; |
268 | if (pe_dn->eeh_pe_config_addr) { | 270 | if (!pcibios_find_pci_bus(dn) && PCI_DN(dn->parent)) |
269 | struct device_node *pe = pe_dn->node; | 271 | dn = dn->parent->child; |
270 | pe = pe->parent->child; | 272 | |
271 | while (pe) { | 273 | while (dn) { |
272 | struct pci_dn *ppe = PCI_DN(pe); | 274 | struct pci_dn *ppe = PCI_DN(dn); |
273 | if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { | 275 | /* On Power4, always true because eeh_pe_config_addr=0 */ |
274 | rtas_configure_bridge(ppe); | 276 | if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) { |
275 | eeh_restore_bars(ppe); | 277 | rtas_configure_bridge(ppe); |
276 | } | 278 | eeh_restore_bars(ppe); |
277 | pe = pe->sibling; | ||
278 | } | 279 | } |
279 | } else { | 280 | dn = dn->sibling; |
280 | rtas_configure_bridge(pe_dn); | 281 | } |
281 | eeh_restore_bars(pe_dn); | ||
282 | } | ||
283 | 282 | ||
284 | /* Give the system 5 seconds to finish running the user-space | 283 | /* Give the system 5 seconds to finish running the user-space |
285 | * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, | 284 | * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes, |
@@ -299,7 +298,7 @@ static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus) | |||
299 | /* The longest amount of time to wait for a pci device | 298 | /* The longest amount of time to wait for a pci device |
300 | * to come back on line, in seconds. | 299 | * to come back on line, in seconds. |
301 | */ | 300 | */ |
302 | #define MAX_WAIT_FOR_RECOVERY 15 | 301 | #define MAX_WAIT_FOR_RECOVERY 150 |
303 | 302 | ||
304 | struct pci_dn * handle_eeh_events (struct eeh_event *event) | 303 | struct pci_dn * handle_eeh_events (struct eeh_event *event) |
305 | { | 304 | { |
@@ -315,14 +314,14 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
315 | 314 | ||
316 | if (!frozen_dn) { | 315 | if (!frozen_dn) { |
317 | 316 | ||
318 | location = get_property(event->dn, "ibm,loc-code", NULL); | 317 | location = of_get_property(event->dn, "ibm,loc-code", NULL); |
319 | location = location ? location : "unknown"; | 318 | location = location ? location : "unknown"; |
320 | printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " | 319 | printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " |
321 | "for location=%s pci addr=%s\n", | 320 | "for location=%s pci addr=%s\n", |
322 | location, pci_name(event->dev)); | 321 | location, pci_name(event->dev)); |
323 | return NULL; | 322 | return NULL; |
324 | } | 323 | } |
325 | location = get_property(frozen_dn, "ibm,loc-code", NULL); | 324 | location = of_get_property(frozen_dn, "ibm,loc-code", NULL); |
326 | location = location ? location : "unknown"; | 325 | location = location ? location : "unknown"; |
327 | 326 | ||
328 | /* There are two different styles for coming up with the PE. | 327 | /* There are two different styles for coming up with the PE. |
@@ -341,13 +340,6 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
341 | return NULL; | 340 | return NULL; |
342 | } | 341 | } |
343 | 342 | ||
344 | #if 0 | ||
345 | /* We may get "permanent failure" messages on empty slots. | ||
346 | * These are false alarms. Empty slots have no child dn. */ | ||
347 | if ((event->state == pci_channel_io_perm_failure) && (frozen_device == NULL)) | ||
348 | return; | ||
349 | #endif | ||
350 | |||
351 | frozen_pdn = PCI_DN(frozen_dn); | 343 | frozen_pdn = PCI_DN(frozen_dn); |
352 | frozen_pdn->eeh_freeze_count++; | 344 | frozen_pdn->eeh_freeze_count++; |
353 | 345 | ||
@@ -362,13 +354,12 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
362 | if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES) | 354 | if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES) |
363 | goto excess_failures; | 355 | goto excess_failures; |
364 | 356 | ||
365 | /* If the reset state is a '5' and the time to reset is 0 (infinity) | 357 | /* Get the current PCI slot state. */ |
366 | * or is more then 15 seconds, then mark this as a permanent failure. | 358 | rc = eeh_wait_for_slot_status (frozen_pdn, MAX_WAIT_FOR_RECOVERY*1000); |
367 | */ | 359 | if (rc < 0) { |
368 | if ((event->state == pci_channel_io_perm_failure) && | 360 | printk(KERN_WARNING "EEH: Permanent failure\n"); |
369 | ((event->time_unavail <= 0) || | ||
370 | (event->time_unavail > MAX_WAIT_FOR_RECOVERY*1000))) | ||
371 | goto hard_fail; | 361 | goto hard_fail; |
362 | } | ||
372 | 363 | ||
373 | eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); | 364 | eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); |
374 | printk(KERN_WARNING | 365 | printk(KERN_WARNING |
@@ -390,14 +381,18 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
390 | */ | 381 | */ |
391 | if (result == PCI_ERS_RESULT_NONE) { | 382 | if (result == PCI_ERS_RESULT_NONE) { |
392 | rc = eeh_reset_device(frozen_pdn, frozen_bus); | 383 | rc = eeh_reset_device(frozen_pdn, frozen_bus); |
393 | if (rc) | 384 | if (rc) { |
385 | printk(KERN_WARNING "EEH: Unable to reset, rc=%d\n", rc); | ||
394 | goto hard_fail; | 386 | goto hard_fail; |
387 | } | ||
395 | } | 388 | } |
396 | 389 | ||
397 | /* If all devices reported they can proceed, then re-enable MMIO */ | 390 | /* If all devices reported they can proceed, then re-enable MMIO */ |
398 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { | 391 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { |
399 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); | 392 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); |
400 | 393 | ||
394 | if (rc < 0) | ||
395 | goto hard_fail; | ||
401 | if (rc) { | 396 | if (rc) { |
402 | result = PCI_ERS_RESULT_NEED_RESET; | 397 | result = PCI_ERS_RESULT_NEED_RESET; |
403 | } else { | 398 | } else { |
@@ -410,6 +405,8 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
410 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { | 405 | if (result == PCI_ERS_RESULT_CAN_RECOVER) { |
411 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); | 406 | rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); |
412 | 407 | ||
408 | if (rc < 0) | ||
409 | goto hard_fail; | ||
413 | if (rc) | 410 | if (rc) |
414 | result = PCI_ERS_RESULT_NEED_RESET; | 411 | result = PCI_ERS_RESULT_NEED_RESET; |
415 | else | 412 | else |
@@ -417,21 +414,28 @@ struct pci_dn * handle_eeh_events (struct eeh_event *event) | |||
417 | } | 414 | } |
418 | 415 | ||
419 | /* If any device has a hard failure, then shut off everything. */ | 416 | /* If any device has a hard failure, then shut off everything. */ |
420 | if (result == PCI_ERS_RESULT_DISCONNECT) | 417 | if (result == PCI_ERS_RESULT_DISCONNECT) { |
418 | printk(KERN_WARNING "EEH: Device driver gave up\n"); | ||
421 | goto hard_fail; | 419 | goto hard_fail; |
420 | } | ||
422 | 421 | ||
423 | /* If any device called out for a reset, then reset the slot */ | 422 | /* If any device called out for a reset, then reset the slot */ |
424 | if (result == PCI_ERS_RESULT_NEED_RESET) { | 423 | if (result == PCI_ERS_RESULT_NEED_RESET) { |
425 | rc = eeh_reset_device(frozen_pdn, NULL); | 424 | rc = eeh_reset_device(frozen_pdn, NULL); |
426 | if (rc) | 425 | if (rc) { |
426 | printk(KERN_WARNING "EEH: Cannot reset, rc=%d\n", rc); | ||
427 | goto hard_fail; | 427 | goto hard_fail; |
428 | } | ||
428 | result = PCI_ERS_RESULT_NONE; | 429 | result = PCI_ERS_RESULT_NONE; |
429 | pci_walk_bus(frozen_bus, eeh_report_reset, &result); | 430 | pci_walk_bus(frozen_bus, eeh_report_reset, &result); |
430 | } | 431 | } |
431 | 432 | ||
432 | /* All devices should claim they have recovered by now. */ | 433 | /* All devices should claim they have recovered by now. */ |
433 | if (result != PCI_ERS_RESULT_RECOVERED) | 434 | if ((result != PCI_ERS_RESULT_RECOVERED) && |
435 | (result != PCI_ERS_RESULT_NONE)) { | ||
436 | printk(KERN_WARNING "EEH: Not recovered\n"); | ||
434 | goto hard_fail; | 437 | goto hard_fail; |
438 | } | ||
435 | 439 | ||
436 | /* Tell all device drivers that they can resume operations */ | 440 | /* Tell all device drivers that they can resume operations */ |
437 | pci_walk_bus(frozen_bus, eeh_report_resume, NULL); | 441 | pci_walk_bus(frozen_bus, eeh_report_resume, NULL); |
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c index 49037edf7d39..ddb80f5d850b 100644 --- a/arch/powerpc/platforms/pseries/eeh_event.c +++ b/arch/powerpc/platforms/pseries/eeh_event.c | |||
@@ -118,9 +118,7 @@ static void eeh_thread_launcher(struct work_struct *dummy) | |||
118 | * (from a workqueue). | 118 | * (from a workqueue). |
119 | */ | 119 | */ |
120 | int eeh_send_failure_event (struct device_node *dn, | 120 | int eeh_send_failure_event (struct device_node *dn, |
121 | struct pci_dev *dev, | 121 | struct pci_dev *dev) |
122 | enum pci_channel_state state, | ||
123 | int time_unavail) | ||
124 | { | 122 | { |
125 | unsigned long flags; | 123 | unsigned long flags; |
126 | struct eeh_event *event; | 124 | struct eeh_event *event; |
@@ -128,7 +126,7 @@ int eeh_send_failure_event (struct device_node *dn, | |||
128 | 126 | ||
129 | if (!mem_init_done) { | 127 | if (!mem_init_done) { |
130 | printk(KERN_ERR "EEH: event during early boot not handled\n"); | 128 | printk(KERN_ERR "EEH: event during early boot not handled\n"); |
131 | location = get_property(dn, "ibm,loc-code", NULL); | 129 | location = of_get_property(dn, "ibm,loc-code", NULL); |
132 | printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); | 130 | printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); |
133 | printk(KERN_ERR "EEH: PCI location = %s\n", location); | 131 | printk(KERN_ERR "EEH: PCI location = %s\n", location); |
134 | return 1; | 132 | return 1; |
@@ -144,8 +142,6 @@ int eeh_send_failure_event (struct device_node *dn, | |||
144 | 142 | ||
145 | event->dn = dn; | 143 | event->dn = dn; |
146 | event->dev = dev; | 144 | event->dev = dev; |
147 | event->state = state; | ||
148 | event->time_unavail = time_unavail; | ||
149 | 145 | ||
150 | /* We may or may not be called in an interrupt context */ | 146 | /* We may or may not be called in an interrupt context */ |
151 | spin_lock_irqsave(&eeh_eventlist_lock, flags); | 147 | spin_lock_irqsave(&eeh_eventlist_lock, flags); |
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c index 90522e3c9d46..29bf83bfb1f0 100644 --- a/arch/powerpc/platforms/pseries/firmware.c +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
@@ -80,7 +80,7 @@ void __init fw_feature_init(void) | |||
80 | goto out; | 80 | goto out; |
81 | } | 81 | } |
82 | 82 | ||
83 | hypertas = get_property(dn, "ibm,hypertas-functions", &len); | 83 | hypertas = of_get_property(dn, "ibm,hypertas-functions", &len); |
84 | if (hypertas == NULL) | 84 | if (hypertas == NULL) |
85 | goto out; | 85 | goto out; |
86 | 86 | ||
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c index f460b9cbfd46..9711eb0d5496 100644 --- a/arch/powerpc/platforms/pseries/hotplug-cpu.c +++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c | |||
@@ -143,7 +143,7 @@ static int pseries_add_processor(struct device_node *np) | |||
143 | int err = -ENOSPC, len, nthreads, i; | 143 | int err = -ENOSPC, len, nthreads, i; |
144 | const u32 *intserv; | 144 | const u32 *intserv; |
145 | 145 | ||
146 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | 146 | intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len); |
147 | if (!intserv) | 147 | if (!intserv) |
148 | return 0; | 148 | return 0; |
149 | 149 | ||
@@ -203,7 +203,7 @@ static void pseries_remove_processor(struct device_node *np) | |||
203 | int len, nthreads, i; | 203 | int len, nthreads, i; |
204 | const u32 *intserv; | 204 | const u32 *intserv; |
205 | 205 | ||
206 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | 206 | intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len); |
207 | if (!intserv) | 207 | if (!intserv) |
208 | return; | 208 | return; |
209 | 209 | ||
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c index e6653a868b91..66665c82415c 100644 --- a/arch/powerpc/platforms/pseries/iommu.c +++ b/arch/powerpc/platforms/pseries/iommu.c | |||
@@ -242,6 +242,7 @@ static unsigned long tce_get_pSeriesLP(struct iommu_table *tbl, long tcenum) | |||
242 | return tce_ret; | 242 | return tce_ret; |
243 | } | 243 | } |
244 | 244 | ||
245 | #ifdef CONFIG_PCI | ||
245 | static void iommu_table_setparms(struct pci_controller *phb, | 246 | static void iommu_table_setparms(struct pci_controller *phb, |
246 | struct device_node *dn, | 247 | struct device_node *dn, |
247 | struct iommu_table *tbl) | 248 | struct iommu_table *tbl) |
@@ -252,8 +253,8 @@ static void iommu_table_setparms(struct pci_controller *phb, | |||
252 | 253 | ||
253 | node = (struct device_node *)phb->arch_data; | 254 | node = (struct device_node *)phb->arch_data; |
254 | 255 | ||
255 | basep = get_property(node, "linux,tce-base", NULL); | 256 | basep = of_get_property(node, "linux,tce-base", NULL); |
256 | sizep = get_property(node, "linux,tce-size", NULL); | 257 | sizep = of_get_property(node, "linux,tce-size", NULL); |
257 | if (basep == NULL || sizep == NULL) { | 258 | if (basep == NULL || sizep == NULL) { |
258 | printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " | 259 | printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " |
259 | "missing tce entries !\n", dn->full_name); | 260 | "missing tce entries !\n", dn->full_name); |
@@ -403,7 +404,7 @@ static void pci_dma_bus_setup_pSeriesLP(struct pci_bus *bus) | |||
403 | 404 | ||
404 | /* Find nearest ibm,dma-window, walking up the device tree */ | 405 | /* Find nearest ibm,dma-window, walking up the device tree */ |
405 | for (pdn = dn; pdn != NULL; pdn = pdn->parent) { | 406 | for (pdn = dn; pdn != NULL; pdn = pdn->parent) { |
406 | dma_window = get_property(pdn, "ibm,dma-window", NULL); | 407 | dma_window = of_get_property(pdn, "ibm,dma-window", NULL); |
407 | if (dma_window != NULL) | 408 | if (dma_window != NULL) |
408 | break; | 409 | break; |
409 | } | 410 | } |
@@ -478,29 +479,6 @@ static void pci_dma_dev_setup_pSeries(struct pci_dev *dev) | |||
478 | pci_name(dev)); | 479 | pci_name(dev)); |
479 | } | 480 | } |
480 | 481 | ||
481 | static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) | ||
482 | { | ||
483 | int err = NOTIFY_OK; | ||
484 | struct device_node *np = node; | ||
485 | struct pci_dn *pci = PCI_DN(np); | ||
486 | |||
487 | switch (action) { | ||
488 | case PSERIES_RECONFIG_REMOVE: | ||
489 | if (pci && pci->iommu_table && | ||
490 | get_property(np, "ibm,dma-window", NULL)) | ||
491 | iommu_free_table(np); | ||
492 | break; | ||
493 | default: | ||
494 | err = NOTIFY_DONE; | ||
495 | break; | ||
496 | } | ||
497 | return err; | ||
498 | } | ||
499 | |||
500 | static struct notifier_block iommu_reconfig_nb = { | ||
501 | .notifier_call = iommu_reconfig_notifier, | ||
502 | }; | ||
503 | |||
504 | static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) | 482 | static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) |
505 | { | 483 | { |
506 | struct device_node *pdn, *dn; | 484 | struct device_node *pdn, *dn; |
@@ -521,7 +499,7 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) | |||
521 | 499 | ||
522 | for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table; | 500 | for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table; |
523 | pdn = pdn->parent) { | 501 | pdn = pdn->parent) { |
524 | dma_window = get_property(pdn, "ibm,dma-window", NULL); | 502 | dma_window = of_get_property(pdn, "ibm,dma-window", NULL); |
525 | if (dma_window) | 503 | if (dma_window) |
526 | break; | 504 | break; |
527 | } | 505 | } |
@@ -554,15 +532,44 @@ static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev) | |||
554 | 532 | ||
555 | dev->dev.archdata.dma_data = pci->iommu_table; | 533 | dev->dev.archdata.dma_data = pci->iommu_table; |
556 | } | 534 | } |
535 | #else /* CONFIG_PCI */ | ||
536 | #define pci_dma_bus_setup_pSeries NULL | ||
537 | #define pci_dma_dev_setup_pSeries NULL | ||
538 | #define pci_dma_bus_setup_pSeriesLP NULL | ||
539 | #define pci_dma_dev_setup_pSeriesLP NULL | ||
540 | #endif /* !CONFIG_PCI */ | ||
541 | |||
542 | static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node) | ||
543 | { | ||
544 | int err = NOTIFY_OK; | ||
545 | struct device_node *np = node; | ||
546 | struct pci_dn *pci = PCI_DN(np); | ||
547 | |||
548 | switch (action) { | ||
549 | case PSERIES_RECONFIG_REMOVE: | ||
550 | if (pci && pci->iommu_table && | ||
551 | of_get_property(np, "ibm,dma-window", NULL)) | ||
552 | iommu_free_table(np); | ||
553 | break; | ||
554 | default: | ||
555 | err = NOTIFY_DONE; | ||
556 | break; | ||
557 | } | ||
558 | return err; | ||
559 | } | ||
560 | |||
561 | static struct notifier_block iommu_reconfig_nb = { | ||
562 | .notifier_call = iommu_reconfig_notifier, | ||
563 | }; | ||
557 | 564 | ||
558 | /* These are called very early. */ | 565 | /* These are called very early. */ |
559 | void iommu_init_early_pSeries(void) | 566 | void iommu_init_early_pSeries(void) |
560 | { | 567 | { |
561 | if (of_chosen && get_property(of_chosen, "linux,iommu-off", NULL)) { | 568 | if (of_chosen && of_get_property(of_chosen, "linux,iommu-off", NULL)) { |
562 | /* Direct I/O, IOMMU off */ | 569 | /* Direct I/O, IOMMU off */ |
563 | ppc_md.pci_dma_dev_setup = NULL; | 570 | ppc_md.pci_dma_dev_setup = NULL; |
564 | ppc_md.pci_dma_bus_setup = NULL; | 571 | ppc_md.pci_dma_bus_setup = NULL; |
565 | pci_dma_ops = &dma_direct_ops; | 572 | set_pci_dma_ops(&dma_direct_ops); |
566 | return; | 573 | return; |
567 | } | 574 | } |
568 | 575 | ||
@@ -588,6 +595,6 @@ void iommu_init_early_pSeries(void) | |||
588 | 595 | ||
589 | pSeries_reconfig_notifier_register(&iommu_reconfig_nb); | 596 | pSeries_reconfig_notifier_register(&iommu_reconfig_nb); |
590 | 597 | ||
591 | pci_dma_ops = &dma_iommu_ops; | 598 | set_pci_dma_ops(&dma_iommu_ops); |
592 | } | 599 | } |
593 | 600 | ||
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 843ee9643211..3a70e8ad7bc8 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -209,13 +209,13 @@ void __init find_udbg_vterm(void) | |||
209 | /* find the boot console from /chosen/stdout */ | 209 | /* find the boot console from /chosen/stdout */ |
210 | if (!of_chosen) | 210 | if (!of_chosen) |
211 | return; | 211 | return; |
212 | name = get_property(of_chosen, "linux,stdout-path", NULL); | 212 | name = of_get_property(of_chosen, "linux,stdout-path", NULL); |
213 | if (name == NULL) | 213 | if (name == NULL) |
214 | return; | 214 | return; |
215 | stdout_node = of_find_node_by_path(name); | 215 | stdout_node = of_find_node_by_path(name); |
216 | if (!stdout_node) | 216 | if (!stdout_node) |
217 | return; | 217 | return; |
218 | name = get_property(stdout_node, "name", NULL); | 218 | name = of_get_property(stdout_node, "name", NULL); |
219 | if (!name) { | 219 | if (!name) { |
220 | printk(KERN_WARNING "stdout node missing 'name' property!\n"); | 220 | printk(KERN_WARNING "stdout node missing 'name' property!\n"); |
221 | goto out; | 221 | goto out; |
@@ -226,7 +226,7 @@ void __init find_udbg_vterm(void) | |||
226 | /* Check if it's a virtual terminal */ | 226 | /* Check if it's a virtual terminal */ |
227 | if (strncmp(name, "vty", 3) != 0) | 227 | if (strncmp(name, "vty", 3) != 0) |
228 | goto out; | 228 | goto out; |
229 | termno = get_property(stdout_node, "reg", NULL); | 229 | termno = of_get_property(stdout_node, "reg", NULL); |
230 | if (termno == NULL) | 230 | if (termno == NULL) |
231 | goto out; | 231 | goto out; |
232 | vtermno = termno[0]; | 232 | vtermno = termno[0]; |
diff --git a/arch/powerpc/platforms/pseries/nvram.c b/arch/powerpc/platforms/pseries/nvram.c index 64163cecdf93..f68903e15bd5 100644 --- a/arch/powerpc/platforms/pseries/nvram.c +++ b/arch/powerpc/platforms/pseries/nvram.c | |||
@@ -130,7 +130,7 @@ int __init pSeries_nvram_init(void) | |||
130 | if (nvram == NULL) | 130 | if (nvram == NULL) |
131 | return -ENODEV; | 131 | return -ENODEV; |
132 | 132 | ||
133 | nbytes_p = get_property(nvram, "#bytes", &proplen); | 133 | nbytes_p = of_get_property(nvram, "#bytes", &proplen); |
134 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) | 134 | if (nbytes_p == NULL || proplen != sizeof(unsigned int)) |
135 | return -EIO; | 135 | return -EIO; |
136 | 136 | ||
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index fa59124ce3fe..2c6ded29f73d 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/pci.h> | 25 | #include <linux/pci.h> |
26 | #include <linux/string.h> | 26 | #include <linux/string.h> |
27 | 27 | ||
28 | #include <asm/eeh.h> | ||
28 | #include <asm/pci-bridge.h> | 29 | #include <asm/pci-bridge.h> |
29 | #include <asm/prom.h> | 30 | #include <asm/prom.h> |
30 | #include <asm/ppc-pci.h> | 31 | #include <asm/ppc-pci.h> |
@@ -39,7 +40,7 @@ void pcibios_name_device(struct pci_dev *dev) | |||
39 | */ | 40 | */ |
40 | dn = pci_device_to_OF_node(dev); | 41 | dn = pci_device_to_OF_node(dev); |
41 | if (dn) { | 42 | if (dn) { |
42 | char *loc_code = get_property(dn, "ibm,loc-code", 0); | 43 | const char *loc_code = of_get_property(dn, "ibm,loc-code", 0); |
43 | if (loc_code) { | 44 | if (loc_code) { |
44 | int loc_len = strlen(loc_code); | 45 | int loc_len = strlen(loc_code); |
45 | if (loc_len < sizeof(dev->dev.name)) { | 46 | if (loc_len < sizeof(dev->dev.name)) { |
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c index ac56b868913a..fdc1a369f767 100644 --- a/arch/powerpc/platforms/pseries/pci_dlpar.c +++ b/arch/powerpc/platforms/pseries/pci_dlpar.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <asm/pci-bridge.h> | 29 | #include <asm/pci-bridge.h> |
30 | #include <asm/ppc-pci.h> | 30 | #include <asm/ppc-pci.h> |
31 | #include <asm/firmware.h> | 31 | #include <asm/firmware.h> |
32 | #include <asm/eeh.h> | ||
32 | 33 | ||
33 | static struct pci_bus * | 34 | static struct pci_bus * |
34 | find_bus_among_children(struct pci_bus *bus, | 35 | find_bus_among_children(struct pci_bus *bus, |
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index edc038873113..53aa04101ced 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c | |||
@@ -85,7 +85,7 @@ static void request_ras_irqs(struct device_node *np, | |||
85 | * map those interrupts using the default interrupt host and default | 85 | * map those interrupts using the default interrupt host and default |
86 | * trigger | 86 | * trigger |
87 | */ | 87 | */ |
88 | opicprop = get_property(np, "open-pic-interrupt", &opicplen); | 88 | opicprop = of_get_property(np, "open-pic-interrupt", &opicplen); |
89 | if (opicprop) { | 89 | if (opicprop) { |
90 | opicplen /= sizeof(u32); | 90 | opicplen /= sizeof(u32); |
91 | for (i = 0; i < opicplen; i++) { | 91 | for (i = 0; i < opicplen; i++) { |
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index 77d0937d5c07..9797b10b2935 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c | |||
@@ -363,7 +363,7 @@ static int get_eventscan_parms(void) | |||
363 | 363 | ||
364 | node = of_find_node_by_path("/rtas"); | 364 | node = of_find_node_by_path("/rtas"); |
365 | 365 | ||
366 | ip = get_property(node, "rtas-event-scan-rate", NULL); | 366 | ip = of_get_property(node, "rtas-event-scan-rate", NULL); |
367 | if (ip == NULL) { | 367 | if (ip == NULL) { |
368 | printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n"); | 368 | printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n"); |
369 | of_node_put(node); | 369 | of_node_put(node); |
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 34aff47b1f55..33eec2822c66 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -65,6 +65,7 @@ | |||
65 | #include <asm/udbg.h> | 65 | #include <asm/udbg.h> |
66 | #include <asm/smp.h> | 66 | #include <asm/smp.h> |
67 | #include <asm/firmware.h> | 67 | #include <asm/firmware.h> |
68 | #include <asm/eeh.h> | ||
68 | 69 | ||
69 | #include "plpar_wrappers.h" | 70 | #include "plpar_wrappers.h" |
70 | #include "pseries.h" | 71 | #include "pseries.h" |
@@ -92,7 +93,7 @@ static void pSeries_show_cpuinfo(struct seq_file *m) | |||
92 | 93 | ||
93 | root = of_find_node_by_path("/"); | 94 | root = of_find_node_by_path("/"); |
94 | if (root) | 95 | if (root) |
95 | model = get_property(root, "model", NULL); | 96 | model = of_get_property(root, "model", NULL); |
96 | seq_printf(m, "machine\t\t: CHRP %s\n", model); | 97 | seq_printf(m, "machine\t\t: CHRP %s\n", model); |
97 | of_node_put(root); | 98 | of_node_put(root); |
98 | } | 99 | } |
@@ -138,8 +139,8 @@ static void __init pseries_mpic_init_IRQ(void) | |||
138 | struct mpic *mpic; | 139 | struct mpic *mpic; |
139 | 140 | ||
140 | np = of_find_node_by_path("/"); | 141 | np = of_find_node_by_path("/"); |
141 | naddr = prom_n_addr_cells(np); | 142 | naddr = of_n_addr_cells(np); |
142 | opprop = get_property(np, "platform-open-pic", &opplen); | 143 | opprop = of_get_property(np, "platform-open-pic", &opplen); |
143 | if (opprop != 0) { | 144 | if (opprop != 0) { |
144 | openpic_addr = of_read_number(opprop, naddr); | 145 | openpic_addr = of_read_number(opprop, naddr); |
145 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); | 146 | printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); |
@@ -188,11 +189,11 @@ static void __init pseries_mpic_init_IRQ(void) | |||
188 | break; | 189 | break; |
189 | if (strcmp(np->name, "pci") != 0) | 190 | if (strcmp(np->name, "pci") != 0) |
190 | continue; | 191 | continue; |
191 | addrp = get_property(np, "8259-interrupt-acknowledge", | 192 | addrp = of_get_property(np, "8259-interrupt-acknowledge", |
192 | NULL); | 193 | NULL); |
193 | if (addrp == NULL) | 194 | if (addrp == NULL) |
194 | continue; | 195 | continue; |
195 | naddr = prom_n_addr_cells(np); | 196 | naddr = of_n_addr_cells(np); |
196 | intack = addrp[naddr-1]; | 197 | intack = addrp[naddr-1]; |
197 | if (naddr > 1) | 198 | if (naddr > 1) |
198 | intack |= ((unsigned long)addrp[naddr-2]) << 32; | 199 | intack |= ((unsigned long)addrp[naddr-2]) << 32; |
@@ -225,7 +226,7 @@ static void __init pseries_discover_pic(void) | |||
225 | 226 | ||
226 | for (np = NULL; (np = of_find_node_by_name(np, | 227 | for (np = NULL; (np = of_find_node_by_name(np, |
227 | "interrupt-controller"));) { | 228 | "interrupt-controller"));) { |
228 | typep = get_property(np, "compatible", NULL); | 229 | typep = of_get_property(np, "compatible", NULL); |
229 | if (strstr(typep, "open-pic")) { | 230 | if (strstr(typep, "open-pic")) { |
230 | pSeries_mpic_node = of_node_get(np); | 231 | pSeries_mpic_node = of_node_get(np); |
231 | ppc_md.init_IRQ = pseries_mpic_init_IRQ; | 232 | ppc_md.init_IRQ = pseries_mpic_init_IRQ; |
@@ -334,32 +335,6 @@ static void __init pSeries_init_early(void) | |||
334 | DBG(" <- pSeries_init_early()\n"); | 335 | DBG(" <- pSeries_init_early()\n"); |
335 | } | 336 | } |
336 | 337 | ||
337 | |||
338 | static int pSeries_check_legacy_ioport(unsigned int baseport) | ||
339 | { | ||
340 | struct device_node *np; | ||
341 | |||
342 | #define I8042_DATA_REG 0x60 | ||
343 | #define FDC_BASE 0x3f0 | ||
344 | |||
345 | |||
346 | switch(baseport) { | ||
347 | case I8042_DATA_REG: | ||
348 | np = of_find_node_by_type(NULL, "8042"); | ||
349 | if (np == NULL) | ||
350 | return -ENODEV; | ||
351 | of_node_put(np); | ||
352 | break; | ||
353 | case FDC_BASE: | ||
354 | np = of_find_node_by_type(NULL, "fdc"); | ||
355 | if (np == NULL) | ||
356 | return -ENODEV; | ||
357 | of_node_put(np); | ||
358 | break; | ||
359 | } | ||
360 | return 0; | ||
361 | } | ||
362 | |||
363 | /* | 338 | /* |
364 | * Called very early, MMU is off, device-tree isn't unflattened | 339 | * Called very early, MMU is off, device-tree isn't unflattened |
365 | */ | 340 | */ |
@@ -514,6 +489,10 @@ void pSeries_power_off(void) | |||
514 | for (;;); | 489 | for (;;); |
515 | } | 490 | } |
516 | 491 | ||
492 | #ifndef CONFIG_PCI | ||
493 | void pSeries_final_fixup(void) { } | ||
494 | #endif | ||
495 | |||
517 | define_machine(pseries) { | 496 | define_machine(pseries) { |
518 | .name = "pSeries", | 497 | .name = "pSeries", |
519 | .probe = pSeries_probe, | 498 | .probe = pSeries_probe, |
@@ -532,7 +511,6 @@ define_machine(pseries) { | |||
532 | .set_rtc_time = rtas_set_rtc_time, | 511 | .set_rtc_time = rtas_set_rtc_time, |
533 | .calibrate_decr = generic_calibrate_decr, | 512 | .calibrate_decr = generic_calibrate_decr, |
534 | .progress = rtas_progress, | 513 | .progress = rtas_progress, |
535 | .check_legacy_ioport = pSeries_check_legacy_ioport, | ||
536 | .system_reset_exception = pSeries_system_reset_exception, | 514 | .system_reset_exception = pSeries_system_reset_exception, |
537 | .machine_check_exception = pSeries_machine_check_exception, | 515 | .machine_check_exception = pSeries_machine_check_exception, |
538 | }; | 516 | }; |
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index 81d172d65038..896cbf340c42 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c | |||
@@ -576,7 +576,7 @@ static void __init xics_init_one_node(struct device_node *np, | |||
576 | * This happens to be the case so far but we are playing with fire... | 576 | * This happens to be the case so far but we are playing with fire... |
577 | * should be fixed one of these days. -BenH. | 577 | * should be fixed one of these days. -BenH. |
578 | */ | 578 | */ |
579 | ireg = get_property(np, "ibm,interrupt-server-ranges", NULL); | 579 | ireg = of_get_property(np, "ibm,interrupt-server-ranges", NULL); |
580 | 580 | ||
581 | /* Do that ever happen ? we'll know soon enough... but even good'old | 581 | /* Do that ever happen ? we'll know soon enough... but even good'old |
582 | * f80 does have that property .. | 582 | * f80 does have that property .. |
@@ -588,7 +588,7 @@ static void __init xics_init_one_node(struct device_node *np, | |||
588 | */ | 588 | */ |
589 | *indx = *ireg; | 589 | *indx = *ireg; |
590 | } | 590 | } |
591 | ireg = get_property(np, "reg", &ilen); | 591 | ireg = of_get_property(np, "reg", &ilen); |
592 | if (!ireg) | 592 | if (!ireg) |
593 | panic("xics_init_IRQ: can't find interrupt reg property"); | 593 | panic("xics_init_IRQ: can't find interrupt reg property"); |
594 | 594 | ||
@@ -640,10 +640,10 @@ static void __init xics_setup_8259_cascade(void) | |||
640 | break; | 640 | break; |
641 | if (strcmp(np->name, "pci") != 0) | 641 | if (strcmp(np->name, "pci") != 0) |
642 | continue; | 642 | continue; |
643 | addrp = get_property(np, "8259-interrupt-acknowledge", NULL); | 643 | addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL); |
644 | if (addrp == NULL) | 644 | if (addrp == NULL) |
645 | continue; | 645 | continue; |
646 | naddr = prom_n_addr_cells(np); | 646 | naddr = of_n_addr_cells(np); |
647 | intack = addrp[naddr-1]; | 647 | intack = addrp[naddr-1]; |
648 | if (naddr > 1) | 648 | if (naddr > 1) |
649 | intack |= ((unsigned long)addrp[naddr-2]) << 32; | 649 | intack |= ((unsigned long)addrp[naddr-2]) << 32; |
@@ -664,10 +664,11 @@ static struct device_node *cpuid_to_of_node(int cpu) | |||
664 | int i, len; | 664 | int i, len; |
665 | const u32 *intserv; | 665 | const u32 *intserv; |
666 | 666 | ||
667 | intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); | 667 | intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", |
668 | &len); | ||
668 | 669 | ||
669 | if (!intserv) | 670 | if (!intserv) |
670 | intserv = get_property(np, "reg", &len); | 671 | intserv = of_get_property(np, "reg", &len); |
671 | 672 | ||
672 | i = len / sizeof(u32); | 673 | i = len / sizeof(u32); |
673 | 674 | ||
@@ -709,7 +710,7 @@ void __init xics_init_IRQ(void) | |||
709 | /* Find the server numbers for the boot cpu. */ | 710 | /* Find the server numbers for the boot cpu. */ |
710 | np = cpuid_to_of_node(boot_cpuid); | 711 | np = cpuid_to_of_node(boot_cpuid); |
711 | BUG_ON(!np); | 712 | BUG_ON(!np); |
712 | ireg = get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen); | 713 | ireg = of_get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen); |
713 | if (!ireg) | 714 | if (!ireg) |
714 | goto skip_gserver_check; | 715 | goto skip_gserver_check; |
715 | i = ilen / sizeof(int); | 716 | i = ilen / sizeof(int); |
@@ -725,7 +726,7 @@ void __init xics_init_IRQ(void) | |||
725 | default_server = hcpuid; | 726 | default_server = hcpuid; |
726 | default_distrib_server = ireg[j+1]; | 727 | default_distrib_server = ireg[j+1]; |
727 | 728 | ||
728 | isize = get_property(np, | 729 | isize = of_get_property(np, |
729 | "ibm,interrupt-server#-size", NULL); | 730 | "ibm,interrupt-server#-size", NULL); |
730 | if (isize) | 731 | if (isize) |
731 | interrupt_server_size = *isize; | 732 | interrupt_server_size = *isize; |