Skip to content

Commit 575e321

Browse files
dwmw2paulusmack
authored andcommitted
[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>
1 parent 91dc182 commit 575e321

3 files changed

Lines changed: 26 additions & 15 deletions

File tree

‎arch/powerpc/platforms/chrp/pci.c‎

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,13 @@ int __init
135135
hydra_init(void)
136136
{
137137
struct device_node *np;
138+
struct resource r;
138139

139140
np = find_devices("mac-io");
140-
if (np == NULL || np->n_addrs == 0)
141+
if (np == NULL || of_address_to_resource(np, 0, &r))
141142
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);
143+
Hydra = ioremap(r.start, r.end-r.start);
144+
printk("Hydra Mac I/O at %lx\n", r.start);
144145
printk("Hydra Feature_Control was %x",
145146
in_le32(&Hydra->Feature_Control));
146147
out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
@@ -177,18 +178,24 @@ setup_python(struct pci_controller *hose, struct device_node *dev)
177178
{
178179
u32 __iomem *reg;
179180
u32 val;
180-
unsigned long addr = dev->addrs[0].address;
181+
struct resource r;
181182

182-
setup_indirect_pci(hose, addr + 0xf8000, addr + 0xf8010);
183+
if (of_address_to_resource(dev, 0, &r)) {
184+
printk(KERN_ERR "No address for Python PCI controller\n");
185+
return;
186+
}
183187

184188
/* Clear the magic go-slow bit */
185-
reg = ioremap(dev->addrs[0].address + 0xf6000, 0x40);
189+
reg = ioremap(r.start + 0xf6000, 0x40);
190+
BUG_ON(!reg);
186191
val = in_be32(&reg[12]);
187192
if (val & PRG_CL_RESET_VALID) {
188193
out_be32(&reg[12], val & ~PRG_CL_RESET_VALID);
189194
in_be32(&reg[12]);
190195
}
191196
iounmap(reg);
197+
198+
setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010);
192199
}
193200

194201
/* Marvell Discovery II based Pegasos 2 */
@@ -218,7 +225,7 @@ chrp_find_bridges(void)
218225
char *model, *machine;
219226
int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
220227
struct device_node *root = find_path_device("/");
221-
228+
struct resource r;
222229
/*
223230
* The PCI host bridge nodes on some machines don't have
224231
* properties to adequately identify them, so we have to
@@ -238,7 +245,7 @@ chrp_find_bridges(void)
238245
continue;
239246
++index;
240247
/* The GG2 bridge on the LongTrail doesn't have an address */
241-
if (dev->n_addrs < 1 && !is_longtrail) {
248+
if (of_address_to_resource(dev, 0, &r) && !is_longtrail) {
242249
printk(KERN_WARNING "Can't use %s: no address\n",
243250
dev->full_name);
244251
continue;
@@ -255,8 +262,8 @@ chrp_find_bridges(void)
255262
printk(KERN_INFO "PCI buses %d..%d",
256263
bus_range[0], bus_range[1]);
257264
printk(" controlled by %s", dev->type);
258-
if (dev->n_addrs > 0)
259-
printk(" at %lx", dev->addrs[0].address);
265+
if (!is_longtrail)
266+
printk(" at %lx", r.start);
260267
printk("\n");
261268

262269
hose = pcibios_alloc_controller();

‎arch/powerpc/platforms/chrp/setup.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,10 @@ static void __init chrp_find_openpic(void)
352352
opaddr = opprop[na-1]; /* assume 32-bit */
353353
oplen /= na * sizeof(unsigned int);
354354
} else {
355-
if (np->n_addrs == 0)
355+
struct resource r;
356+
if (of_address_to_resource(np, 0, &r))
356357
return;
357-
opaddr = np->addrs[0].address;
358+
opaddr = r.start;
358359
oplen = 0;
359360
}
360361

@@ -377,7 +378,7 @@ static void __init chrp_find_openpic(void)
377378
*/
378379
if (oplen < len) {
379380
printk(KERN_ERR "Insufficient addresses for distributed"
380-
" OpenPIC (%d < %d)\n", np->n_addrs, len);
381+
" OpenPIC (%d < %d)\n", oplen, len);
381382
len = oplen;
382383
}
383384

‎arch/powerpc/platforms/chrp/time.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/mc146818rtc.h>
2222
#include <linux/init.h>
2323
#include <linux/bcd.h>
24+
#include <linux/ioport.h>
2425

2526
#include <asm/io.h>
2627
#include <asm/nvram.h>
@@ -37,14 +38,16 @@ static int nvram_data = NVRAM_DATA;
3738
long __init chrp_time_init(void)
3839
{
3940
struct device_node *rtcs;
41+
struct resource r;
4042
int base;
4143

4244
rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
4345
if (rtcs == NULL)
4446
rtcs = find_compatible_devices("rtc", "ds1385-rtc");
45-
if (rtcs == NULL || rtcs->addrs == NULL)
47+
if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r))
4648
return 0;
47-
base = rtcs->addrs[0].address;
49+
50+
base = r.start;
4851
nvram_as1 = 0;
4952
nvram_as0 = base;
5053
nvram_data = base + 1;

0 commit comments

Comments
 (0)