aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-12-13 02:01:21 -0500
committerPaul Mackerras <paulus@samba.org>2006-01-08 22:53:55 -0500
commitcc5d0189b9ba95260857a5018a1c2fef90008507 (patch)
tree1202c94b6b3cb81a96d0a0e54424cad10eef68bb /drivers/macintosh
parent9cf84d7c97992dbe5360b241327341c07ce30fc9 (diff)
[PATCH] powerpc: Remove device_node addrs/n_addr
The pre-parsed addrs/n_addrs fields in struct device_node are finally gone. Remove the dodgy heuristics that did that parsing at boot and remove the fields themselves since we now have a good replacement with the new OF parsing code. This patch also fixes a bunch of drivers to use the new code instead, so that at least pmac32, pseries, iseries and g5 defconfigs build. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/macio_asic.c26
-rw-r--r--drivers/macintosh/mediabay.c8
-rw-r--r--drivers/macintosh/via-cuda.c4
-rw-r--r--drivers/macintosh/via-pmu.c9
4 files changed, 21 insertions, 26 deletions
diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index 0137ff239f13..2a545ceb523b 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -256,42 +256,42 @@ static int macio_resource_quirks(struct device_node *np, struct resource *res,
256{ 256{
257 if (res->flags & IORESOURCE_MEM) { 257 if (res->flags & IORESOURCE_MEM) {
258 /* Grand Central has too large resource 0 on some machines */ 258 /* Grand Central has too large resource 0 on some machines */
259 if (index == 0 && !strcmp(np->name, "gc")) { 259 if (index == 0 && !strcmp(np->name, "gc"))
260 np->addrs[0].size = 0x20000;
261 res->end = res->start + 0x1ffff; 260 res->end = res->start + 0x1ffff;
262 } 261
263 /* Airport has bogus resource 2 */ 262 /* Airport has bogus resource 2 */
264 if (index >= 2 && !strcmp(np->name, "radio")) 263 if (index >= 2 && !strcmp(np->name, "radio"))
265 return 1; 264 return 1;
265
266#ifndef CONFIG_PPC64
266 /* DBDMAs may have bogus sizes */ 267 /* DBDMAs may have bogus sizes */
267 if ((res->start & 0x0001f000) == 0x00008000) { 268 if ((res->start & 0x0001f000) == 0x00008000)
268 np->addrs[index].size = 0x100;
269 res->end = res->start + 0xff; 269 res->end = res->start + 0xff;
270 } 270#endif /* CONFIG_PPC64 */
271
271 /* ESCC parent eats child resources. We could have added a 272 /* ESCC parent eats child resources. We could have added a
272 * level of hierarchy, but I don't really feel the need 273 * level of hierarchy, but I don't really feel the need
273 * for it 274 * for it
274 */ 275 */
275 if (!strcmp(np->name, "escc")) 276 if (!strcmp(np->name, "escc"))
276 return 1; 277 return 1;
278
277 /* ESCC has bogus resources >= 3 */ 279 /* ESCC has bogus resources >= 3 */
278 if (index >= 3 && !(strcmp(np->name, "ch-a") && 280 if (index >= 3 && !(strcmp(np->name, "ch-a") &&
279 strcmp(np->name, "ch-b"))) 281 strcmp(np->name, "ch-b")))
280 return 1; 282 return 1;
283
281 /* Media bay has too many resources, keep only first one */ 284 /* Media bay has too many resources, keep only first one */
282 if (index > 0 && !strcmp(np->name, "media-bay")) 285 if (index > 0 && !strcmp(np->name, "media-bay"))
283 return 1; 286 return 1;
287
284 /* Some older IDE resources have bogus sizes */ 288 /* Some older IDE resources have bogus sizes */
285 if (!(strcmp(np->name, "IDE") && strcmp(np->name, "ATA") && 289 if (!(strcmp(np->name, "IDE") && strcmp(np->name, "ATA") &&
286 strcmp(np->type, "ide") && strcmp(np->type, "ata"))) { 290 strcmp(np->type, "ide") && strcmp(np->type, "ata"))) {
287 if (index == 0 && np->addrs[0].size > 0x1000) { 291 if (index == 0 && (res->end - res->start) > 0xfff)
288 np->addrs[0].size = 0x1000;
289 res->end = res->start + 0xfff; 292 res->end = res->start + 0xfff;
290 } 293 if (index == 1 && (res->end - res->start) > 0xff)
291 if (index == 1 && np->addrs[1].size > 0x100) {
292 np->addrs[1].size = 0x100;
293 res->end = res->start + 0xff; 294 res->end = res->start + 0xff;
294 }
295 } 295 }
296 } 296 }
297 return 0; 297 return 0;
@@ -349,7 +349,7 @@ static void macio_setup_resources(struct macio_dev *dev,
349 /* Currently, we consider failure as harmless, this may 349 /* Currently, we consider failure as harmless, this may
350 * change in the future, once I've found all the device 350 * change in the future, once I've found all the device
351 * tree bugs in older machines & worked around them 351 * tree bugs in older machines & worked around them
352l */ 352 */
353 if (insert_resource(parent_res, res)) { 353 if (insert_resource(parent_res, res)) {
354 printk(KERN_WARNING "Can't request resource " 354 printk(KERN_WARNING "Can't request resource "
355 "%d for MacIO device %s\n", 355 "%d for MacIO device %s\n",
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index b856bb67169c..8dbf2852bae0 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -647,6 +647,7 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de
647 struct media_bay_info* bay; 647 struct media_bay_info* bay;
648 u32 __iomem *regbase; 648 u32 __iomem *regbase;
649 struct device_node *ofnode; 649 struct device_node *ofnode;
650 unsigned long base;
650 int i; 651 int i;
651 652
652 ofnode = mdev->ofdev.node; 653 ofnode = mdev->ofdev.node;
@@ -656,10 +657,11 @@ static int __devinit media_bay_attach(struct macio_dev *mdev, const struct of_de
656 if (macio_request_resources(mdev, "media-bay")) 657 if (macio_request_resources(mdev, "media-bay"))
657 return -EBUSY; 658 return -EBUSY;
658 /* Media bay registers are located at the beginning of the 659 /* Media bay registers are located at the beginning of the
659 * mac-io chip, we get the parent address for now (hrm...) 660 * mac-io chip, for now, we trick and align down the first
661 * resource passed in
660 */ 662 */
661 regbase = (u32 __iomem *) 663 base = macio_resource_start(mdev, 0) & 0xffff0000u;
662 ioremap(ofnode->parent->addrs[0].address, 0x100); 664 regbase = (u32 __iomem *)ioremap(base, 0x100);
663 if (regbase == NULL) { 665 if (regbase == NULL) {
664 macio_release_resources(mdev); 666 macio_release_resources(mdev);
665 return -ENOMEM; 667 return -ENOMEM;
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 18ff770ea668..2d9d79150403 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -193,10 +193,6 @@ static int __init via_cuda_start(void)
193 if (via == NULL) 193 if (via == NULL)
194 return -ENODEV; 194 return -ENODEV;
195 195
196#ifdef CONFIG_PPC
197 request_OF_resource(vias, 0, NULL);
198#endif
199
200 if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) { 196 if (request_irq(CUDA_IRQ, cuda_interrupt, 0, "ADB", cuda_interrupt)) {
201 printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ); 197 printk(KERN_ERR "cuda_init: can't get irq %d\n", CUDA_IRQ);
202 return -EAGAIN; 198 return -EAGAIN;
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index d6dabee55f2f..79c7b44a94ee 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -298,7 +298,7 @@ static struct backlight_controller pmu_backlight_controller = {
298 298
299int __init find_via_pmu(void) 299int __init find_via_pmu(void)
300{ 300{
301 phys_addr_t taddr; 301 u64 taddr;
302 u32 *reg; 302 u32 *reg;
303 303
304 if (via != 0) 304 if (via != 0)
@@ -337,7 +337,7 @@ int __init find_via_pmu(void)
337 else if (device_is_compatible(vias->parent, "Keylargo") 337 else if (device_is_compatible(vias->parent, "Keylargo")
338 || device_is_compatible(vias->parent, "K2-Keylargo")) { 338 || device_is_compatible(vias->parent, "K2-Keylargo")) {
339 struct device_node *gpiop; 339 struct device_node *gpiop;
340 phys_addr_t gaddr = 0; 340 u64 gaddr = OF_BAD_ADDR;
341 341
342 pmu_kind = PMU_KEYLARGO_BASED; 342 pmu_kind = PMU_KEYLARGO_BASED;
343 pmu_has_adb = (find_type_devices("adb") != NULL); 343 pmu_has_adb = (find_type_devices("adb") != NULL);
@@ -352,7 +352,7 @@ int __init find_via_pmu(void)
352 reg = (u32 *)get_property(gpiop, "reg", NULL); 352 reg = (u32 *)get_property(gpiop, "reg", NULL);
353 if (reg) 353 if (reg)
354 gaddr = of_translate_address(gpiop, reg); 354 gaddr = of_translate_address(gpiop, reg);
355 if (gaddr != 0) 355 if (gaddr != OF_BAD_ADDR)
356 gpio_reg = ioremap(gaddr, 0x10); 356 gpio_reg = ioremap(gaddr, 0x10);
357 } 357 }
358 if (gpio_reg == NULL) 358 if (gpio_reg == NULL)
@@ -479,9 +479,6 @@ static int __init via_pmu_dev_init(void)
479 if (vias == NULL) 479 if (vias == NULL)
480 return -ENODEV; 480 return -ENODEV;
481 481
482#ifndef CONFIG_PPC64
483 request_OF_resource(vias, 0, NULL);
484#endif
485#ifdef CONFIG_PMAC_BACKLIGHT 482#ifdef CONFIG_PMAC_BACKLIGHT
486 /* Enable backlight */ 483 /* Enable backlight */
487 register_backlight_controller(&pmu_backlight_controller, NULL, "pmu"); 484 register_backlight_controller(&pmu_backlight_controller, NULL, "pmu");