[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>

authored by Benjamin Herrenschmidt and committed by Paul Mackerras 4c882b01 8385a6a3

+68 -41
-1
arch/powerpc/platforms/maple/pci.c
··· 316 char* disp_name; 317 int *bus_range; 318 int primary = 1; 319 - struct property *of_prop; 320 321 DBG("Adding PCI host bridge %s\n", dev->full_name); 322
··· 316 char* disp_name; 317 int *bus_range; 318 int primary = 1; 319 320 DBG("Adding PCI host bridge %s\n", dev->full_name); 321
+50 -35
arch/powerpc/platforms/maple/setup.c
··· 71 #define DBG(fmt...) 72 #endif 73 74 static void maple_restart(char *cmd) 75 { 76 unsigned int maple_nvram_base; 77 unsigned int maple_nvram_offset; 78 unsigned int maple_nvram_command; 79 - struct device_node *rtcs; 80 81 - /* find NVRAM device */ 82 - rtcs = find_compatible_devices("nvram", "AMD8111"); 83 - if (rtcs && rtcs->addrs) { 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 91 /* find service processor device */ 92 - rtcs = find_devices("service-processor"); 93 - if (!rtcs) { 94 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 95 - printk(KERN_EMERG "Maple: Manual Restart Required\n"); 96 - return; 97 } 98 - maple_nvram_offset = *(unsigned int*) get_property(rtcs, 99 "restart-addr", NULL); 100 - maple_nvram_command = *(unsigned int*) get_property(rtcs, 101 "restart-value", NULL); 102 103 /* send command */ 104 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 105 for (;;) ; 106 } 107 108 static void maple_power_off(void) ··· 132 unsigned int maple_nvram_base; 133 unsigned int maple_nvram_offset; 134 unsigned int maple_nvram_command; 135 - struct device_node *rtcs; 136 137 - /* find NVRAM device */ 138 - rtcs = find_compatible_devices("nvram", "AMD8111"); 139 - if (rtcs && rtcs->addrs) { 140 - maple_nvram_base = rtcs->addrs[0].address; 141 - } else { 142 - printk(KERN_EMERG "Maple: Unable to find NVRAM\n"); 143 - printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); 144 - return; 145 - } 146 147 /* find service processor device */ 148 - rtcs = find_devices("service-processor"); 149 - if (!rtcs) { 150 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 151 - printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); 152 - return; 153 } 154 - maple_nvram_offset = *(unsigned int*) get_property(rtcs, 155 "power-off-addr", NULL); 156 - maple_nvram_command = *(unsigned int*) get_property(rtcs, 157 "power-off-value", NULL); 158 159 /* send command */ 160 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 161 for (;;) ; 162 } 163 164 static void maple_halt(void) ··· 197 */ 198 static void __init maple_init_early(void) 199 { 200 - unsigned int default_speed; 201 - u64 physport; 202 - 203 DBG(" -> maple_init_early\n"); 204 205 /* Initialize hash table, from now on, we can take hash faults
··· 71 #define DBG(fmt...) 72 #endif 73 74 + static 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 + 100 static void maple_restart(char *cmd) 101 { 102 unsigned int maple_nvram_base; 103 unsigned int maple_nvram_offset; 104 unsigned int maple_nvram_command; 105 + struct device_node *sp; 106 107 + maple_nvram_base = maple_find_nvram_base(); 108 + if (maple_nvram_base == 0) 109 + goto fail; 110 111 /* find service processor device */ 112 + sp = of_find_node_by_name(NULL, "service-processor"); 113 + if (!sp) { 114 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 115 + goto fail; 116 } 117 + maple_nvram_offset = *(unsigned int*) get_property(sp, 118 "restart-addr", NULL); 119 + maple_nvram_command = *(unsigned int*) get_property(sp, 120 "restart-value", NULL); 121 + of_node_put(sp); 122 123 /* send command */ 124 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 125 for (;;) ; 126 + fail: 127 + printk(KERN_EMERG "Maple: Manual Restart Required\n"); 128 } 129 130 static void maple_power_off(void) ··· 110 unsigned int maple_nvram_base; 111 unsigned int maple_nvram_offset; 112 unsigned int maple_nvram_command; 113 + struct device_node *sp; 114 115 + maple_nvram_base = maple_find_nvram_base(); 116 + if (maple_nvram_base == 0) 117 + goto fail; 118 119 /* find service processor device */ 120 + sp = of_find_node_by_name(NULL, "service-processor"); 121 + if (!sp) { 122 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 123 + goto fail; 124 } 125 + maple_nvram_offset = *(unsigned int*) get_property(sp, 126 "power-off-addr", NULL); 127 + maple_nvram_command = *(unsigned int*) get_property(sp, 128 "power-off-value", NULL); 129 + of_node_put(sp); 130 131 /* send command */ 132 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 133 for (;;) ; 134 + fail: 135 + printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); 136 } 137 138 static void maple_halt(void) ··· 179 */ 180 static void __init maple_init_early(void) 181 { 182 DBG(" -> maple_init_early\n"); 183 184 /* Initialize hash table, from now on, we can take hash faults
+18 -5
arch/powerpc/platforms/maple/time.c
··· 168 struct rtc_time tm; 169 struct device_node *rtcs; 170 171 - rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 172 - if (rtcs && rtcs->addrs) { 173 - maple_rtc_addr = rtcs->addrs[0].address; 174 - printk(KERN_INFO "Maple: Found RTC at 0x%x\n", maple_rtc_addr); 175 - } else { 176 maple_rtc_addr = RTC_PORT(0); /* legacy address */ 177 printk(KERN_INFO "Maple: No device node for RTC, assuming " 178 "legacy address (0x%x)\n", maple_rtc_addr);
··· 168 struct rtc_time tm; 169 struct device_node *rtcs; 170 171 + rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00"); 172 + if (rtcs) { 173 + struct resource r; 174 + if (of_address_to_resource(rtcs, 0, &r)) { 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) { 189 maple_rtc_addr = RTC_PORT(0); /* legacy address */ 190 printk(KERN_INFO "Maple: No device node for RTC, assuming " 191 "legacy address (0x%x)\n", maple_rtc_addr);