aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powermac/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/powermac/setup.c')
-rw-r--r--arch/powerpc/platforms/powermac/setup.c61
1 files changed, 35 insertions, 26 deletions
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
193int find_via_cuda(void) 194int 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
204int find_via_pmu(void) 208int 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
225static void __init ohare_init(void) 232static 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 */
623static int pmac_check_legacy_ioport(unsigned int baseport)
624{
625 return -ENODEV;
626}
627
628static int __init pmac_declare_of_platform_devices(void) 638static 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,