aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-01-14 00:35:35 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-14 21:14:47 -0500
commit4c882b019160ebd7e954ba787f6353ed69281fd7 (patch)
tree170a0b5cf15992bd4ab3f7da7209ae12f0fac9a0 /arch
parent8385a6a3acfbb4b68150c25cfe9084b6c4f501cf (diff)
[PATCH] powerpc: Fix Maple build
The changes to the device node structure broke Maple build. This fixes it. Unfortunately I coudn't test as my Maple board appears to be dead. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/maple/pci.c1
-rw-r--r--arch/powerpc/platforms/maple/setup.c85
-rw-r--r--arch/powerpc/platforms/maple/time.c23
3 files changed, 68 insertions, 41 deletions
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index f40451da037c..7d4099a34f92 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -316,7 +316,6 @@ static int __init add_bridge(struct device_node *dev)
316 char* disp_name; 316 char* disp_name;
317 int *bus_range; 317 int *bus_range;
318 int primary = 1; 318 int primary = 1;
319 struct property *of_prop;
320 319
321 DBG("Adding PCI host bridge %s\n", dev->full_name); 320 DBG("Adding PCI host bridge %s\n", dev->full_name);
322 321
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index a1cb4d236720..ec5c1e10c407 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -71,38 +71,60 @@
71#define DBG(fmt...) 71#define DBG(fmt...)
72#endif 72#endif
73 73
74static unsigned long maple_find_nvram_base(void)
75{
76 struct device_node *rtcs;
77 unsigned long result = 0;
78
79 /* find NVRAM device */
80 rtcs = of_find_compatible_node(NULL, "nvram", "AMD8111");
81 if (rtcs) {
82 struct resource r;
83 if (of_address_to_resource(rtcs, 0, &r)) {
84 printk(KERN_EMERG "Maple: Unable to translate NVRAM"
85 " address\n");
86 goto bail;
87 }
88 if (!(r.flags & IORESOURCE_IO)) {
89 printk(KERN_EMERG "Maple: NVRAM address isn't PIO!\n");
90 goto bail;
91 }
92 result = r.start;
93 } else
94 printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
95 bail:
96 of_node_put(rtcs);
97 return result;
98}
99
74static void maple_restart(char *cmd) 100static void maple_restart(char *cmd)
75{ 101{
76 unsigned int maple_nvram_base; 102 unsigned int maple_nvram_base;
77 unsigned int maple_nvram_offset; 103 unsigned int maple_nvram_offset;
78 unsigned int maple_nvram_command; 104 unsigned int maple_nvram_command;
79 struct device_node *rtcs; 105 struct device_node *sp;
80 106
81 /* find NVRAM device */ 107 maple_nvram_base = maple_find_nvram_base();
82 rtcs = find_compatible_devices("nvram", "AMD8111"); 108 if (maple_nvram_base == 0)
83 if (rtcs && rtcs->addrs) { 109 goto fail;
84 maple_nvram_base = rtcs->addrs[0].address;
85 } else {
86 printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
87 printk(KERN_EMERG "Maple: Manual Restart Required\n");
88 return;
89 }
90 110
91 /* find service processor device */ 111 /* find service processor device */
92 rtcs = find_devices("service-processor"); 112 sp = of_find_node_by_name(NULL, "service-processor");
93 if (!rtcs) { 113 if (!sp) {
94 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 114 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
95 printk(KERN_EMERG "Maple: Manual Restart Required\n"); 115 goto fail;
96 return;
97 } 116 }
98 maple_nvram_offset = *(unsigned int*) get_property(rtcs, 117 maple_nvram_offset = *(unsigned int*) get_property(sp,
99 "restart-addr", NULL); 118 "restart-addr", NULL);
100 maple_nvram_command = *(unsigned int*) get_property(rtcs, 119 maple_nvram_command = *(unsigned int*) get_property(sp,
101 "restart-value", NULL); 120 "restart-value", NULL);
121 of_node_put(sp);
102 122
103 /* send command */ 123 /* send command */
104 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 124 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
105 for (;;) ; 125 for (;;) ;
126 fail:
127 printk(KERN_EMERG "Maple: Manual Restart Required\n");
106} 128}
107 129
108static void maple_power_off(void) 130static void maple_power_off(void)
@@ -110,33 +132,29 @@ static void maple_power_off(void)
110 unsigned int maple_nvram_base; 132 unsigned int maple_nvram_base;
111 unsigned int maple_nvram_offset; 133 unsigned int maple_nvram_offset;
112 unsigned int maple_nvram_command; 134 unsigned int maple_nvram_command;
113 struct device_node *rtcs; 135 struct device_node *sp;
114 136
115 /* find NVRAM device */ 137 maple_nvram_base = maple_find_nvram_base();
116 rtcs = find_compatible_devices("nvram", "AMD8111"); 138 if (maple_nvram_base == 0)
117 if (rtcs && rtcs->addrs) { 139 goto fail;
118 maple_nvram_base = rtcs->addrs[0].address;
119 } else {
120 printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
121 printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
122 return;
123 }
124 140
125 /* find service processor device */ 141 /* find service processor device */
126 rtcs = find_devices("service-processor"); 142 sp = of_find_node_by_name(NULL, "service-processor");
127 if (!rtcs) { 143 if (!sp) {
128 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 144 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
129 printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); 145 goto fail;
130 return;
131 } 146 }
132 maple_nvram_offset = *(unsigned int*) get_property(rtcs, 147 maple_nvram_offset = *(unsigned int*) get_property(sp,
133 "power-off-addr", NULL); 148 "power-off-addr", NULL);
134 maple_nvram_command = *(unsigned int*) get_property(rtcs, 149 maple_nvram_command = *(unsigned int*) get_property(sp,
135 "power-off-value", NULL); 150 "power-off-value", NULL);
151 of_node_put(sp);
136 152
137 /* send command */ 153 /* send command */
138 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 154 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
139 for (;;) ; 155 for (;;) ;
156 fail:
157 printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
140} 158}
141 159
142static void maple_halt(void) 160static void maple_halt(void)
@@ -179,9 +197,6 @@ void __init maple_setup_arch(void)
179 */ 197 */
180static void __init maple_init_early(void) 198static void __init maple_init_early(void)
181{ 199{
182 unsigned int default_speed;
183 u64 physport;
184
185 DBG(" -> maple_init_early\n"); 200 DBG(" -> maple_init_early\n");
186 201
187 /* Initialize hash table, from now on, we can take hash faults 202 /* Initialize hash table, from now on, we can take hash faults
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 15846cc938ac..50bc4eb85353 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -168,11 +168,24 @@ unsigned long __init maple_get_boot_time(void)
168 struct rtc_time tm; 168 struct rtc_time tm;
169 struct device_node *rtcs; 169 struct device_node *rtcs;
170 170
171 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 171 rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
172 if (rtcs && rtcs->addrs) { 172 if (rtcs) {
173 maple_rtc_addr = rtcs->addrs[0].address; 173 struct resource r;
174 printk(KERN_INFO "Maple: Found RTC at 0x%x\n", maple_rtc_addr); 174 if (of_address_to_resource(rtcs, 0, &r)) {
175 } else { 175 printk(KERN_EMERG "Maple: Unable to translate RTC"
176 " address\n");
177 goto bail;
178 }
179 if (!(r.flags & IORESOURCE_IO)) {
180 printk(KERN_EMERG "Maple: RTC address isn't PIO!\n");
181 goto bail;
182 }
183 maple_rtc_addr = r.start;
184 printk(KERN_INFO "Maple: Found RTC at IO 0x%x\n",
185 maple_rtc_addr);
186 }
187 bail:
188 if (maple_rtc_addr == 0) {
176 maple_rtc_addr = RTC_PORT(0); /* legacy address */ 189 maple_rtc_addr = RTC_PORT(0); /* legacy address */
177 printk(KERN_INFO "Maple: No device node for RTC, assuming " 190 printk(KERN_INFO "Maple: No device node for RTC, assuming "
178 "legacy address (0x%x)\n", maple_rtc_addr); 191 "legacy address (0x%x)\n", maple_rtc_addr);