[PATCH] powerpc: Make CHRP build again

This makes CHRP build again, although it's untested because my Pegasos
is currently in pieces.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>

authored by David Woodhouse and committed by Paul Mackerras 575e3216 91dc182c

+26 -15
+17 -10
arch/powerpc/platforms/chrp/pci.c
··· 135 hydra_init(void) 136 { 137 struct device_node *np; 138 139 np = find_devices("mac-io"); 140 - if (np == NULL || np->n_addrs == 0) 141 return 0; 142 - Hydra = ioremap(np->addrs[0].address, np->addrs[0].size); 143 - printk("Hydra Mac I/O at %lx\n", np->addrs[0].address); 144 printk("Hydra Feature_Control was %x", 145 in_le32(&Hydra->Feature_Control)); 146 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN | ··· 178 { 179 u32 __iomem *reg; 180 u32 val; 181 - unsigned long addr = dev->addrs[0].address; 182 183 - setup_indirect_pci(hose, addr + 0xf8000, addr + 0xf8010); 184 185 /* Clear the magic go-slow bit */ 186 - reg = ioremap(dev->addrs[0].address + 0xf6000, 0x40); 187 val = in_be32(&reg[12]); 188 if (val & PRG_CL_RESET_VALID) { 189 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID); 190 in_be32(&reg[12]); 191 } 192 iounmap(reg); 193 } 194 195 /* Marvell Discovery II based Pegasos 2 */ ··· 225 char *model, *machine; 226 int is_longtrail = 0, is_mot = 0, is_pegasos = 0; 227 struct device_node *root = find_path_device("/"); 228 - 229 /* 230 * The PCI host bridge nodes on some machines don't have 231 * properties to adequately identify them, so we have to ··· 245 continue; 246 ++index; 247 /* The GG2 bridge on the LongTrail doesn't have an address */ 248 - if (dev->n_addrs < 1 && !is_longtrail) { 249 printk(KERN_WARNING "Can't use %s: no address\n", 250 dev->full_name); 251 continue; ··· 262 printk(KERN_INFO "PCI buses %d..%d", 263 bus_range[0], bus_range[1]); 264 printk(" controlled by %s", dev->type); 265 - if (dev->n_addrs > 0) 266 - printk(" at %lx", dev->addrs[0].address); 267 printk("\n"); 268 269 hose = pcibios_alloc_controller();
··· 135 hydra_init(void) 136 { 137 struct device_node *np; 138 + struct resource r; 139 140 np = find_devices("mac-io"); 141 + if (np == NULL || of_address_to_resource(np, 0, &r)) 142 return 0; 143 + Hydra = ioremap(r.start, r.end-r.start); 144 + printk("Hydra Mac I/O at %lx\n", r.start); 145 printk("Hydra Feature_Control was %x", 146 in_le32(&Hydra->Feature_Control)); 147 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN | ··· 177 { 178 u32 __iomem *reg; 179 u32 val; 180 + struct resource r; 181 182 + if (of_address_to_resource(dev, 0, &r)) { 183 + printk(KERN_ERR "No address for Python PCI controller\n"); 184 + return; 185 + } 186 187 /* Clear the magic go-slow bit */ 188 + reg = ioremap(r.start + 0xf6000, 0x40); 189 + BUG_ON(!reg); 190 val = in_be32(&reg[12]); 191 if (val & PRG_CL_RESET_VALID) { 192 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID); 193 in_be32(&reg[12]); 194 } 195 iounmap(reg); 196 + 197 + setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010); 198 } 199 200 /* Marvell Discovery II based Pegasos 2 */ ··· 218 char *model, *machine; 219 int is_longtrail = 0, is_mot = 0, is_pegasos = 0; 220 struct device_node *root = find_path_device("/"); 221 + struct resource r; 222 /* 223 * The PCI host bridge nodes on some machines don't have 224 * properties to adequately identify them, so we have to ··· 238 continue; 239 ++index; 240 /* The GG2 bridge on the LongTrail doesn't have an address */ 241 + if (of_address_to_resource(dev, 0, &r) && !is_longtrail) { 242 printk(KERN_WARNING "Can't use %s: no address\n", 243 dev->full_name); 244 continue; ··· 255 printk(KERN_INFO "PCI buses %d..%d", 256 bus_range[0], bus_range[1]); 257 printk(" controlled by %s", dev->type); 258 + if (!is_longtrail) 259 + printk(" at %lx", r.start); 260 printk("\n"); 261 262 hose = pcibios_alloc_controller();
+4 -3
arch/powerpc/platforms/chrp/setup.c
··· 352 opaddr = opprop[na-1]; /* assume 32-bit */ 353 oplen /= na * sizeof(unsigned int); 354 } else { 355 - if (np->n_addrs == 0) 356 return; 357 - opaddr = np->addrs[0].address; 358 oplen = 0; 359 } 360 ··· 378 */ 379 if (oplen < len) { 380 printk(KERN_ERR "Insufficient addresses for distributed" 381 - " OpenPIC (%d < %d)\n", np->n_addrs, len); 382 len = oplen; 383 } 384
··· 352 opaddr = opprop[na-1]; /* assume 32-bit */ 353 oplen /= na * sizeof(unsigned int); 354 } else { 355 + struct resource r; 356 + if (of_address_to_resource(np, 0, &r)) 357 return; 358 + opaddr = r.start; 359 oplen = 0; 360 } 361 ··· 377 */ 378 if (oplen < len) { 379 printk(KERN_ERR "Insufficient addresses for distributed" 380 + " OpenPIC (%d < %d)\n", oplen, len); 381 len = oplen; 382 } 383
+5 -2
arch/powerpc/platforms/chrp/time.c
··· 21 #include <linux/mc146818rtc.h> 22 #include <linux/init.h> 23 #include <linux/bcd.h> 24 25 #include <asm/io.h> 26 #include <asm/nvram.h> ··· 38 long __init chrp_time_init(void) 39 { 40 struct device_node *rtcs; 41 int base; 42 43 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 44 if (rtcs == NULL) 45 rtcs = find_compatible_devices("rtc", "ds1385-rtc"); 46 - if (rtcs == NULL || rtcs->addrs == NULL) 47 return 0; 48 - base = rtcs->addrs[0].address; 49 nvram_as1 = 0; 50 nvram_as0 = base; 51 nvram_data = base + 1;
··· 21 #include <linux/mc146818rtc.h> 22 #include <linux/init.h> 23 #include <linux/bcd.h> 24 + #include <linux/ioport.h> 25 26 #include <asm/io.h> 27 #include <asm/nvram.h> ··· 37 long __init chrp_time_init(void) 38 { 39 struct device_node *rtcs; 40 + struct resource r; 41 int base; 42 43 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 44 if (rtcs == NULL) 45 rtcs = find_compatible_devices("rtc", "ds1385-rtc"); 46 + if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r)) 47 return 0; 48 + 49 + base = r.start; 50 nvram_as1 = 0; 51 nvram_as0 = base; 52 nvram_data = base + 1;