diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/swim3.c | 38 | ||||
-rw-r--r-- | drivers/ide/ppc/pmac.c | 4 | ||||
-rw-r--r-- | drivers/macintosh/macio_asic.c | 26 | ||||
-rw-r--r-- | drivers/macintosh/mediabay.c | 8 | ||||
-rw-r--r-- | drivers/macintosh/via-cuda.c | 4 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu.c | 9 | ||||
-rw-r--r-- | drivers/scsi/mac53c94.c | 22 | ||||
-rw-r--r-- | drivers/scsi/mesh.c | 3 | ||||
-rw-r--r-- | drivers/serial/pmac_zilog.c | 15 | ||||
-rw-r--r-- | drivers/video/controlfb.c | 114 | ||||
-rw-r--r-- | drivers/video/offb.c | 122 | ||||
-rw-r--r-- | drivers/video/platinumfb.c | 86 | ||||
-rw-r--r-- | drivers/video/valkyriefb.c | 12 |
13 files changed, 239 insertions, 224 deletions
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index af7cb2bfd670..01f042f6f1c4 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -1083,23 +1083,33 @@ static int swim3_add_device(struct device_node *swim) | |||
1083 | { | 1083 | { |
1084 | struct device_node *mediabay; | 1084 | struct device_node *mediabay; |
1085 | struct floppy_state *fs = &floppy_states[floppy_count]; | 1085 | struct floppy_state *fs = &floppy_states[floppy_count]; |
1086 | struct resource res_reg, res_dma; | ||
1086 | 1087 | ||
1087 | if (swim->n_addrs < 2) | 1088 | if (of_address_to_resource(swim, 0, &res_reg) || |
1088 | { | 1089 | of_address_to_resource(swim, 1, &res_dma)) { |
1089 | printk(KERN_INFO "swim3: expecting 2 addrs (n_addrs:%d, n_intrs:%d)\n", | 1090 | printk(KERN_ERR "swim3: Can't get addresses\n"); |
1090 | swim->n_addrs, swim->n_intrs); | ||
1091 | return -EINVAL; | 1091 | return -EINVAL; |
1092 | } | 1092 | } |
1093 | 1093 | if (request_mem_region(res_reg.start, res_reg.end - res_reg.start + 1, | |
1094 | if (swim->n_intrs < 2) | 1094 | " (reg)") == NULL) { |
1095 | { | 1095 | printk(KERN_ERR "swim3: Can't request register space\n"); |
1096 | printk(KERN_INFO "swim3: expecting 2 intrs (n_addrs:%d, n_intrs:%d)\n", | 1096 | return -EINVAL; |
1097 | swim->n_addrs, swim->n_intrs); | 1097 | } |
1098 | if (request_mem_region(res_dma.start, res_dma.end - res_dma.start + 1, | ||
1099 | " (dma)") == NULL) { | ||
1100 | release_mem_region(res_reg.start, | ||
1101 | res_reg.end - res_reg.start + 1); | ||
1102 | printk(KERN_ERR "swim3: Can't request DMA space\n"); | ||
1098 | return -EINVAL; | 1103 | return -EINVAL; |
1099 | } | 1104 | } |
1100 | 1105 | ||
1101 | if (!request_OF_resource(swim, 0, NULL)) { | 1106 | if (swim->n_intrs < 2) { |
1102 | printk(KERN_INFO "swim3: can't request IO resource !\n"); | 1107 | printk(KERN_INFO "swim3: expecting 2 intrs (n_intrs:%d)\n", |
1108 | swim->n_intrs); | ||
1109 | release_mem_region(res_reg.start, | ||
1110 | res_reg.end - res_reg.start + 1); | ||
1111 | release_mem_region(res_dma.start, | ||
1112 | res_dma.end - res_dma.start + 1); | ||
1103 | return -EINVAL; | 1113 | return -EINVAL; |
1104 | } | 1114 | } |
1105 | 1115 | ||
@@ -1110,10 +1120,8 @@ static int swim3_add_device(struct device_node *swim) | |||
1110 | memset(fs, 0, sizeof(*fs)); | 1120 | memset(fs, 0, sizeof(*fs)); |
1111 | spin_lock_init(&fs->lock); | 1121 | spin_lock_init(&fs->lock); |
1112 | fs->state = idle; | 1122 | fs->state = idle; |
1113 | fs->swim3 = (struct swim3 __iomem *) | 1123 | fs->swim3 = (struct swim3 __iomem *)ioremap(res_reg.start, 0x200); |
1114 | ioremap(swim->addrs[0].address, 0x200); | 1124 | fs->dma = (struct dbdma_regs __iomem *)ioremap(res_dma.start, 0x200); |
1115 | fs->dma = (struct dbdma_regs __iomem *) | ||
1116 | ioremap(swim->addrs[1].address, 0x200); | ||
1117 | fs->swim3_intr = swim->intrs[0].line; | 1125 | fs->swim3_intr = swim->intrs[0].line; |
1118 | fs->dma_intr = swim->intrs[1].line; | 1126 | fs->dma_intr = swim->intrs[1].line; |
1119 | fs->cur_cyl = -1; | 1127 | fs->cur_cyl = -1; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 16b28357885b..a8d3bc0a9c5c 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1271,7 +1271,7 @@ static int | |||
1271 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) | 1271 | pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) |
1272 | { | 1272 | { |
1273 | struct device_node *np = pmif->node; | 1273 | struct device_node *np = pmif->node; |
1274 | int *bidp, i; | 1274 | int *bidp; |
1275 | 1275 | ||
1276 | pmif->cable_80 = 0; | 1276 | pmif->cable_80 = 0; |
1277 | pmif->broken_dma = pmif->broken_dma_warn = 0; | 1277 | pmif->broken_dma = pmif->broken_dma_warn = 0; |
@@ -1430,7 +1430,7 @@ pmac_ide_macio_attach(struct macio_dev *mdev, const struct of_device_id *match) | |||
1430 | pmif = &pmac_ide[i]; | 1430 | pmif = &pmac_ide[i]; |
1431 | hwif = &ide_hwifs[i]; | 1431 | hwif = &ide_hwifs[i]; |
1432 | 1432 | ||
1433 | if (mdev->ofdev.node->n_addrs == 0) { | 1433 | if (macio_resource_count(mdev) == 0) { |
1434 | printk(KERN_WARNING "ide%d: no address for %s\n", | 1434 | printk(KERN_WARNING "ide%d: no address for %s\n", |
1435 | i, mdev->ofdev.node->full_name); | 1435 | i, mdev->ofdev.node->full_name); |
1436 | return -ENXIO; | 1436 | return -ENXIO; |
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 |
352 | l */ | 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 | ||
299 | int __init find_via_pmu(void) | 299 | int __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"); |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index 932dcf0366eb..311a4122bd70 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -432,11 +432,12 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
432 | struct Scsi_Host *host; | 432 | struct Scsi_Host *host; |
433 | void *dma_cmd_space; | 433 | void *dma_cmd_space; |
434 | unsigned char *clkprop; | 434 | unsigned char *clkprop; |
435 | int proplen; | 435 | int proplen, rc = -ENODEV; |
436 | 436 | ||
437 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { | 437 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { |
438 | printk(KERN_ERR "mac53c94: expected 2 addrs and intrs (got %d/%d)\n", | 438 | printk(KERN_ERR "mac53c94: expected 2 addrs and intrs" |
439 | node->n_addrs, node->n_intrs); | 439 | " (got %d/%d)\n", |
440 | macio_resource_count(mdev), macio_irq_count(mdev)); | ||
440 | return -ENODEV; | 441 | return -ENODEV; |
441 | } | 442 | } |
442 | 443 | ||
@@ -448,6 +449,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
448 | host = scsi_host_alloc(&mac53c94_template, sizeof(struct fsc_state)); | 449 | host = scsi_host_alloc(&mac53c94_template, sizeof(struct fsc_state)); |
449 | if (host == NULL) { | 450 | if (host == NULL) { |
450 | printk(KERN_ERR "mac53c94: couldn't register host"); | 451 | printk(KERN_ERR "mac53c94: couldn't register host"); |
452 | rc = -ENOMEM; | ||
451 | goto out_release; | 453 | goto out_release; |
452 | } | 454 | } |
453 | 455 | ||
@@ -486,6 +488,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
486 | if (dma_cmd_space == 0) { | 488 | if (dma_cmd_space == 0) { |
487 | printk(KERN_ERR "mac53c94: couldn't allocate dma " | 489 | printk(KERN_ERR "mac53c94: couldn't allocate dma " |
488 | "command space for %s\n", node->full_name); | 490 | "command space for %s\n", node->full_name); |
491 | rc = -ENOMEM; | ||
489 | goto out_free; | 492 | goto out_free; |
490 | } | 493 | } |
491 | state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space); | 494 | state->dma_cmds = (struct dbdma_cmd *)DBDMA_ALIGN(dma_cmd_space); |
@@ -495,18 +498,21 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
495 | 498 | ||
496 | mac53c94_init(state); | 499 | mac53c94_init(state); |
497 | 500 | ||
498 | if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94", state)) { | 501 | if (request_irq(state->intr, do_mac53c94_interrupt, 0, "53C94",state)) { |
499 | printk(KERN_ERR "mac53C94: can't get irq %d for %s\n", | 502 | printk(KERN_ERR "mac53C94: can't get irq %d for %s\n", |
500 | state->intr, node->full_name); | 503 | state->intr, node->full_name); |
501 | goto out_free_dma; | 504 | goto out_free_dma; |
502 | } | 505 | } |
503 | 506 | ||
504 | /* XXX FIXME: handle failure */ | 507 | rc = scsi_add_host(host, &mdev->ofdev.dev); |
505 | scsi_add_host(host, &mdev->ofdev.dev); | 508 | if (rc != 0) |
506 | scsi_scan_host(host); | 509 | goto out_release_irq; |
507 | 510 | ||
511 | scsi_scan_host(host); | ||
508 | return 0; | 512 | return 0; |
509 | 513 | ||
514 | out_release_irq: | ||
515 | free_irq(state->intr, state); | ||
510 | out_free_dma: | 516 | out_free_dma: |
511 | kfree(state->dma_cmd_space); | 517 | kfree(state->dma_cmd_space); |
512 | out_free: | 518 | out_free: |
@@ -518,7 +524,7 @@ static int mac53c94_probe(struct macio_dev *mdev, const struct of_device_id *mat | |||
518 | out_release: | 524 | out_release: |
519 | macio_release_resources(mdev); | 525 | macio_release_resources(mdev); |
520 | 526 | ||
521 | return -ENODEV; | 527 | return rc; |
522 | } | 528 | } |
523 | 529 | ||
524 | static int mac53c94_remove(struct macio_dev *mdev) | 530 | static int mac53c94_remove(struct macio_dev *mdev) |
diff --git a/drivers/scsi/mesh.c b/drivers/scsi/mesh.c index bdccf73cf9fe..d6d2125f9044 100644 --- a/drivers/scsi/mesh.c +++ b/drivers/scsi/mesh.c | |||
@@ -1869,7 +1869,8 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match) | |||
1869 | 1869 | ||
1870 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { | 1870 | if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) { |
1871 | printk(KERN_ERR "mesh: expected 2 addrs and 2 intrs" | 1871 | printk(KERN_ERR "mesh: expected 2 addrs and 2 intrs" |
1872 | " (got %d,%d)\n", mesh->n_addrs, mesh->n_intrs); | 1872 | " (got %d,%d)\n", macio_resource_count(mdev), |
1873 | macio_irq_count(mdev)); | ||
1873 | return -ENODEV; | 1874 | return -ENODEV; |
1874 | } | 1875 | } |
1875 | 1876 | ||
diff --git a/drivers/serial/pmac_zilog.c b/drivers/serial/pmac_zilog.c index 5ddd8ab1f108..ea24129eb6b9 100644 --- a/drivers/serial/pmac_zilog.c +++ b/drivers/serial/pmac_zilog.c | |||
@@ -1431,11 +1431,14 @@ static int __init pmz_init_port(struct uart_pmac_port *uap) | |||
1431 | char name[1]; | 1431 | char name[1]; |
1432 | } *slots; | 1432 | } *slots; |
1433 | int len; | 1433 | int len; |
1434 | struct resource r_ports, r_rxdma, r_txdma; | ||
1434 | 1435 | ||
1435 | /* | 1436 | /* |
1436 | * Request & map chip registers | 1437 | * Request & map chip registers |
1437 | */ | 1438 | */ |
1438 | uap->port.mapbase = np->addrs[0].address; | 1439 | if (of_address_to_resource(np, 0, &r_ports)) |
1440 | return -ENODEV; | ||
1441 | uap->port.mapbase = r_ports.start; | ||
1439 | uap->port.membase = ioremap(uap->port.mapbase, 0x1000); | 1442 | uap->port.membase = ioremap(uap->port.mapbase, 0x1000); |
1440 | 1443 | ||
1441 | uap->control_reg = uap->port.membase; | 1444 | uap->control_reg = uap->port.membase; |
@@ -1445,16 +1448,20 @@ static int __init pmz_init_port(struct uart_pmac_port *uap) | |||
1445 | * Request & map DBDMA registers | 1448 | * Request & map DBDMA registers |
1446 | */ | 1449 | */ |
1447 | #ifdef HAS_DBDMA | 1450 | #ifdef HAS_DBDMA |
1448 | if (np->n_addrs >= 3 && np->n_intrs >= 3) | 1451 | if (of_address_to_resource(np, 1, &r_txdma) == 0 && |
1452 | of_address_to_resource(np, 2, &r_rxdma) == 0) | ||
1449 | uap->flags |= PMACZILOG_FLAG_HAS_DMA; | 1453 | uap->flags |= PMACZILOG_FLAG_HAS_DMA; |
1454 | #else | ||
1455 | memset(&r_txdma, 0, sizeof(struct resource)); | ||
1456 | memset(&r_rxdma, 0, sizeof(struct resource)); | ||
1450 | #endif | 1457 | #endif |
1451 | if (ZS_HAS_DMA(uap)) { | 1458 | if (ZS_HAS_DMA(uap)) { |
1452 | uap->tx_dma_regs = ioremap(np->addrs[np->n_addrs - 2].address, 0x1000); | 1459 | uap->tx_dma_regs = ioremap(r_txdma.start, 0x100); |
1453 | if (uap->tx_dma_regs == NULL) { | 1460 | if (uap->tx_dma_regs == NULL) { |
1454 | uap->flags &= ~PMACZILOG_FLAG_HAS_DMA; | 1461 | uap->flags &= ~PMACZILOG_FLAG_HAS_DMA; |
1455 | goto no_dma; | 1462 | goto no_dma; |
1456 | } | 1463 | } |
1457 | uap->rx_dma_regs = ioremap(np->addrs[np->n_addrs - 1].address, 0x1000); | 1464 | uap->rx_dma_regs = ioremap(r_rxdma.start, 0x100); |
1458 | if (uap->rx_dma_regs == NULL) { | 1465 | if (uap->rx_dma_regs == NULL) { |
1459 | iounmap(uap->tx_dma_regs); | 1466 | iounmap(uap->tx_dma_regs); |
1460 | uap->tx_dma_regs = NULL; | 1467 | uap->tx_dma_regs = NULL; |
diff --git a/drivers/video/controlfb.c b/drivers/video/controlfb.c index 403d17377f8d..03798e9c882d 100644 --- a/drivers/video/controlfb.c +++ b/drivers/video/controlfb.c | |||
@@ -133,12 +133,6 @@ static int controlfb_mmap(struct fb_info *info, struct file *file, | |||
133 | static int controlfb_set_par (struct fb_info *info); | 133 | static int controlfb_set_par (struct fb_info *info); |
134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); | 134 | static int controlfb_check_var (struct fb_var_screeninfo *var, struct fb_info *info); |
135 | 135 | ||
136 | /* | ||
137 | * inititialization | ||
138 | */ | ||
139 | int control_init(void); | ||
140 | void control_setup(char *); | ||
141 | |||
142 | /******************** Prototypes for internal functions **********************/ | 136 | /******************** Prototypes for internal functions **********************/ |
143 | 137 | ||
144 | static void set_control_clock(unsigned char *params); | 138 | static void set_control_clock(unsigned char *params); |
@@ -550,9 +544,46 @@ static void control_set_hardware(struct fb_info_control *p, struct fb_par_contro | |||
550 | 544 | ||
551 | 545 | ||
552 | /* | 546 | /* |
553 | * Called from fbmem.c for probing & initializing | 547 | * Parse user speficied options (`video=controlfb:') |
554 | */ | 548 | */ |
555 | int __init control_init(void) | 549 | static void __init control_setup(char *options) |
550 | { | ||
551 | char *this_opt; | ||
552 | |||
553 | if (!options || !*options) | ||
554 | return; | ||
555 | |||
556 | while ((this_opt = strsep(&options, ",")) != NULL) { | ||
557 | if (!strncmp(this_opt, "vmode:", 6)) { | ||
558 | int vmode = simple_strtoul(this_opt+6, NULL, 0); | ||
559 | if (vmode > 0 && vmode <= VMODE_MAX && | ||
560 | control_mac_modes[vmode - 1].m[1] >= 0) | ||
561 | default_vmode = vmode; | ||
562 | } else if (!strncmp(this_opt, "cmode:", 6)) { | ||
563 | int depth = simple_strtoul(this_opt+6, NULL, 0); | ||
564 | switch (depth) { | ||
565 | case CMODE_8: | ||
566 | case CMODE_16: | ||
567 | case CMODE_32: | ||
568 | default_cmode = depth; | ||
569 | break; | ||
570 | case 8: | ||
571 | default_cmode = CMODE_8; | ||
572 | break; | ||
573 | case 15: | ||
574 | case 16: | ||
575 | default_cmode = CMODE_16; | ||
576 | break; | ||
577 | case 24: | ||
578 | case 32: | ||
579 | default_cmode = CMODE_32; | ||
580 | break; | ||
581 | } | ||
582 | } | ||
583 | } | ||
584 | } | ||
585 | |||
586 | static int __init control_init(void) | ||
556 | { | 587 | { |
557 | struct device_node *dp; | 588 | struct device_node *dp; |
558 | char *option = NULL; | 589 | char *option = NULL; |
@@ -651,15 +682,16 @@ static void __init find_vram_size(struct fb_info_control *p) | |||
651 | static int __init control_of_init(struct device_node *dp) | 682 | static int __init control_of_init(struct device_node *dp) |
652 | { | 683 | { |
653 | struct fb_info_control *p; | 684 | struct fb_info_control *p; |
654 | unsigned long addr; | 685 | struct resource fb_res, reg_res; |
655 | int i; | ||
656 | 686 | ||
657 | if (control_fb) { | 687 | if (control_fb) { |
658 | printk(KERN_ERR "controlfb: only one control is supported\n"); | 688 | printk(KERN_ERR "controlfb: only one control is supported\n"); |
659 | return -ENXIO; | 689 | return -ENXIO; |
660 | } | 690 | } |
661 | if(dp->n_addrs != 2) { | 691 | |
662 | printk(KERN_ERR "expecting 2 address for control (got %d)", dp->n_addrs); | 692 | if (of_pci_address_to_resource(dp, 2, &fb_res) || |
693 | of_pci_address_to_resource(dp, 1, ®_res)) { | ||
694 | printk(KERN_ERR "can't get 2 addresses for control\n"); | ||
663 | return -ENXIO; | 695 | return -ENXIO; |
664 | } | 696 | } |
665 | p = kmalloc(sizeof(*p), GFP_KERNEL); | 697 | p = kmalloc(sizeof(*p), GFP_KERNEL); |
@@ -669,18 +701,12 @@ static int __init control_of_init(struct device_node *dp) | |||
669 | memset(p, 0, sizeof(*p)); | 701 | memset(p, 0, sizeof(*p)); |
670 | 702 | ||
671 | /* Map in frame buffer and registers */ | 703 | /* Map in frame buffer and registers */ |
672 | for (i = 0; i < dp->n_addrs; ++i) { | 704 | p->fb_orig_base = fb_res.start; |
673 | addr = dp->addrs[i].address; | 705 | p->fb_orig_size = fb_res.end - fb_res.start + 1; |
674 | if (dp->addrs[i].size >= 0x800000) { | 706 | /* use the big-endian aperture (??) */ |
675 | p->fb_orig_base = addr; | 707 | p->frame_buffer_phys = fb_res.start + 0x800000; |
676 | p->fb_orig_size = dp->addrs[i].size; | 708 | p->control_regs_phys = reg_res.start; |
677 | /* use the big-endian aperture (??) */ | 709 | p->control_regs_size = reg_res.end - reg_res.start + 1; |
678 | p->frame_buffer_phys = addr + 0x800000; | ||
679 | } else { | ||
680 | p->control_regs_phys = addr; | ||
681 | p->control_regs_size = dp->addrs[i].size; | ||
682 | } | ||
683 | } | ||
684 | 710 | ||
685 | if (!p->fb_orig_base || | 711 | if (!p->fb_orig_base || |
686 | !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { | 712 | !request_mem_region(p->fb_orig_base,p->fb_orig_size,"controlfb")) { |
@@ -1059,43 +1085,3 @@ static void control_cleanup(void) | |||
1059 | } | 1085 | } |
1060 | 1086 | ||
1061 | 1087 | ||
1062 | /* | ||
1063 | * Parse user speficied options (`video=controlfb:') | ||
1064 | */ | ||
1065 | void __init control_setup(char *options) | ||
1066 | { | ||
1067 | char *this_opt; | ||
1068 | |||
1069 | if (!options || !*options) | ||
1070 | return; | ||
1071 | |||
1072 | while ((this_opt = strsep(&options, ",")) != NULL) { | ||
1073 | if (!strncmp(this_opt, "vmode:", 6)) { | ||
1074 | int vmode = simple_strtoul(this_opt+6, NULL, 0); | ||
1075 | if (vmode > 0 && vmode <= VMODE_MAX && | ||
1076 | control_mac_modes[vmode - 1].m[1] >= 0) | ||
1077 | default_vmode = vmode; | ||
1078 | } else if (!strncmp(this_opt, "cmode:", 6)) { | ||
1079 | int depth = simple_strtoul(this_opt+6, NULL, 0); | ||
1080 | switch (depth) { | ||
1081 | case CMODE_8: | ||
1082 | case CMODE_16: | ||
1083 | case CMODE_32: | ||
1084 | default_cmode = depth; | ||
1085 | break; | ||
1086 | case 8: | ||
1087 | default_cmode = CMODE_8; | ||
1088 | break; | ||
1089 | case 15: | ||
1090 | case 16: | ||
1091 | default_cmode = CMODE_16; | ||
1092 | break; | ||
1093 | case 24: | ||
1094 | case 32: | ||
1095 | default_cmode = CMODE_32; | ||
1096 | break; | ||
1097 | } | ||
1098 | } | ||
1099 | } | ||
1100 | } | ||
1101 | |||
diff --git a/drivers/video/offb.c b/drivers/video/offb.c index 00d87f5bb7be..ad1434e3f227 100644 --- a/drivers/video/offb.c +++ b/drivers/video/offb.c | |||
@@ -223,6 +223,7 @@ static int offb_blank(int blank, struct fb_info *info) | |||
223 | int __init offb_init(void) | 223 | int __init offb_init(void) |
224 | { | 224 | { |
225 | struct device_node *dp = NULL, *boot_disp = NULL; | 225 | struct device_node *dp = NULL, *boot_disp = NULL; |
226 | |||
226 | #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) | 227 | #if defined(CONFIG_BOOTX_TEXT) && defined(CONFIG_PPC32) |
227 | struct device_node *macos_display = NULL; | 228 | struct device_node *macos_display = NULL; |
228 | #endif | 229 | #endif |
@@ -234,60 +235,54 @@ int __init offb_init(void) | |||
234 | if (boot_infos != 0) { | 235 | if (boot_infos != 0) { |
235 | unsigned long addr = | 236 | unsigned long addr = |
236 | (unsigned long) boot_infos->dispDeviceBase; | 237 | (unsigned long) boot_infos->dispDeviceBase; |
238 | u32 *addrp; | ||
239 | u64 daddr, dsize; | ||
240 | unsigned int flags; | ||
241 | |||
237 | /* find the device node corresponding to the macos display */ | 242 | /* find the device node corresponding to the macos display */ |
238 | while ((dp = of_find_node_by_type(dp, "display"))) { | 243 | while ((dp = of_find_node_by_type(dp, "display"))) { |
239 | int i; | 244 | int i; |
240 | /* | ||
241 | * Grrr... It looks like the MacOS ATI driver | ||
242 | * munges the assigned-addresses property (but | ||
243 | * the AAPL,address value is OK). | ||
244 | */ | ||
245 | if (strncmp(dp->name, "ATY,", 4) == 0 | ||
246 | && dp->n_addrs == 1) { | ||
247 | unsigned int *ap = | ||
248 | (unsigned int *) get_property(dp, | ||
249 | "AAPL,address", | ||
250 | NULL); | ||
251 | if (ap != NULL) { | ||
252 | dp->addrs[0].address = *ap; | ||
253 | dp->addrs[0].size = 0x01000000; | ||
254 | } | ||
255 | } | ||
256 | 245 | ||
257 | /* | 246 | /* |
258 | * The LTPro on the Lombard powerbook has no addresses | 247 | * Look for an AAPL,address property first. |
259 | * on the display nodes, they are on their parent. | ||
260 | */ | 248 | */ |
261 | if (dp->n_addrs == 0 | 249 | unsigned int na; |
262 | && device_is_compatible(dp, "ATY,264LTPro")) { | 250 | unsigned int *ap = |
263 | int na; | 251 | (unsigned int *)get_property(dp, "AAPL,address", |
264 | unsigned int *ap = (unsigned int *) | 252 | &na); |
265 | get_property(dp, "AAPL,address", &na); | 253 | if (ap != 0) { |
266 | if (ap != 0) | 254 | for (na /= sizeof(unsigned int); na > 0; |
267 | for (na /= sizeof(unsigned int); | 255 | --na, ++ap) |
268 | na > 0; --na, ++ap) | 256 | if (*ap <= addr && |
269 | if (*ap <= addr | 257 | addr < *ap + 0x1000000) { |
270 | && addr < | 258 | macos_display = dp; |
271 | *ap + 0x1000000) | 259 | goto foundit; |
272 | goto foundit; | 260 | } |
273 | } | 261 | } |
274 | 262 | ||
275 | /* | 263 | /* |
276 | * See if the display address is in one of the address | 264 | * See if the display address is in one of the address |
277 | * ranges for this display. | 265 | * ranges for this display. |
278 | */ | 266 | */ |
279 | for (i = 0; i < dp->n_addrs; ++i) { | 267 | i = 0; |
280 | if (dp->addrs[i].address <= addr | 268 | for (;;) { |
281 | && addr < | 269 | addrp = of_get_address(dp, i++, &dsize, &flags); |
282 | dp->addrs[i].address + | 270 | if (addrp == NULL) |
283 | dp->addrs[i].size) | ||
284 | break; | 271 | break; |
272 | if (!(flags & IORESOURCE_MEM)) | ||
273 | continue; | ||
274 | daddr = of_translate_address(dp, addrp); | ||
275 | if (daddr == OF_BAD_ADDR) | ||
276 | continue; | ||
277 | if (daddr <= addr && addr < (daddr + dsize)) { | ||
278 | macos_display = dp; | ||
279 | goto foundit; | ||
280 | } | ||
285 | } | 281 | } |
286 | if (i < dp->n_addrs) { | 282 | foundit: |
287 | foundit: | 283 | if (macos_display) { |
288 | printk(KERN_INFO "MacOS display is %s\n", | 284 | printk(KERN_INFO "MacOS display is %s\n", |
289 | dp->full_name); | 285 | dp->full_name); |
290 | macos_display = dp; | ||
291 | break; | 286 | break; |
292 | } | 287 | } |
293 | } | 288 | } |
@@ -326,8 +321,10 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
326 | int *pp, i; | 321 | int *pp, i; |
327 | unsigned int len; | 322 | unsigned int len; |
328 | int width = 640, height = 480, depth = 8, pitch; | 323 | int width = 640, height = 480, depth = 8, pitch; |
329 | unsigned int rsize, *up; | 324 | unsigned int flags, rsize, *up; |
330 | unsigned long address = 0; | 325 | u64 address = OF_BAD_ADDR; |
326 | u32 *addrp; | ||
327 | u64 asize; | ||
331 | 328 | ||
332 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL | 329 | if ((pp = (int *) get_property(dp, "depth", &len)) != NULL |
333 | && len == sizeof(int)) | 330 | && len == sizeof(int)) |
@@ -363,7 +360,7 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
363 | break; | 360 | break; |
364 | } | 361 | } |
365 | if (pdev) { | 362 | if (pdev) { |
366 | for (i = 0; i < 6 && address == 0; i++) { | 363 | for (i = 0; i < 6 && address == OF_BAD_ADDR; i++) { |
367 | if ((pci_resource_flags(pdev, i) & | 364 | if ((pci_resource_flags(pdev, i) & |
368 | IORESOURCE_MEM) && | 365 | IORESOURCE_MEM) && |
369 | (pci_resource_len(pdev, i) >= rsize)) | 366 | (pci_resource_len(pdev, i) >= rsize)) |
@@ -374,27 +371,33 @@ static void __init offb_init_nodriver(struct device_node *dp) | |||
374 | } | 371 | } |
375 | #endif /* CONFIG_PCI */ | 372 | #endif /* CONFIG_PCI */ |
376 | 373 | ||
377 | if (address == 0 && | 374 | /* This one is dodgy, we may drop it ... */ |
378 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && | 375 | if (address == OF_BAD_ADDR && |
379 | len == sizeof(unsigned)) | 376 | (up = (unsigned *) get_property(dp, "address", &len)) != NULL && |
380 | address = (u_long) * up; | 377 | len == sizeof(unsigned int)) |
381 | if (address == 0) { | 378 | address = (u64) * up; |
382 | for (i = 0; i < dp->n_addrs; ++i) | 379 | |
383 | if (dp->addrs[i].size >= | 380 | if (address == OF_BAD_ADDR) { |
384 | pitch * height * depth / 8) | 381 | for (i = 0; (addrp = of_get_address(dp, i, &asize, &flags)) |
385 | break; | 382 | != NULL; i++) { |
386 | if (i >= dp->n_addrs) { | 383 | if (!(flags & IORESOURCE_MEM)) |
384 | continue; | ||
385 | if (asize >= pitch * height * depth / 8) | ||
386 | break; | ||
387 | } | ||
388 | if (addrp == NULL) { | ||
387 | printk(KERN_ERR | 389 | printk(KERN_ERR |
388 | "no framebuffer address found for %s\n", | 390 | "no framebuffer address found for %s\n", |
389 | dp->full_name); | 391 | dp->full_name); |
390 | return; | 392 | return; |
391 | } | 393 | } |
392 | 394 | address = of_translate_address(dp, addrp); | |
393 | address = (u_long) dp->addrs[i].address; | 395 | if (address == OF_BAD_ADDR) { |
394 | 396 | printk(KERN_ERR | |
395 | #ifdef CONFIG_PPC64 | 397 | "can't translate framebuffer address for %s\n", |
396 | address += ((struct pci_dn *)dp->data)->phb->pci_mem_offset; | 398 | dp->full_name); |
397 | #endif | 399 | return; |
400 | } | ||
398 | 401 | ||
399 | /* kludge for valkyrie */ | 402 | /* kludge for valkyrie */ |
400 | if (strcmp(dp->name, "valkyrie") == 0) | 403 | if (strcmp(dp->name, "valkyrie") == 0) |
@@ -459,7 +462,9 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
459 | 462 | ||
460 | par->cmap_type = cmap_unknown; | 463 | par->cmap_type = cmap_unknown; |
461 | if (depth == 8) { | 464 | if (depth == 8) { |
462 | /* XXX kludge for ati */ | 465 | |
466 | /* Palette hacks disabled for now */ | ||
467 | #if 0 | ||
463 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { | 468 | if (dp && !strncmp(name, "ATY,Rage128", 11)) { |
464 | unsigned long regbase = dp->addrs[2].address; | 469 | unsigned long regbase = dp->addrs[2].address; |
465 | par->cmap_adr = ioremap(regbase, 0x1FFF); | 470 | par->cmap_adr = ioremap(regbase, 0x1FFF); |
@@ -490,6 +495,7 @@ static void __init offb_init_fb(const char *name, const char *full_name, | |||
490 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); | 495 | par->cmap_adr = ioremap(regbase + 0x6000, 0x1000); |
491 | par->cmap_type = cmap_gxt2000; | 496 | par->cmap_type = cmap_gxt2000; |
492 | } | 497 | } |
498 | #endif | ||
493 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR | 499 | fix->visual = par->cmap_adr ? FB_VISUAL_PSEUDOCOLOR |
494 | : FB_VISUAL_STATIC_PSEUDOCOLOR; | 500 | : FB_VISUAL_STATIC_PSEUDOCOLOR; |
495 | } else | 501 | } else |
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index ba0af1b66bb6..335e37465559 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -69,6 +69,8 @@ struct fb_info_platinum { | |||
69 | unsigned long total_vram; | 69 | unsigned long total_vram; |
70 | int clktype; | 70 | int clktype; |
71 | int dactype; | 71 | int dactype; |
72 | |||
73 | struct resource rsrc_fb, rsrc_reg; | ||
72 | }; | 74 | }; |
73 | 75 | ||
74 | /* | 76 | /* |
@@ -97,9 +99,6 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
97 | * Interface used by the world | 99 | * Interface used by the world |
98 | */ | 100 | */ |
99 | 101 | ||
100 | int platinumfb_init(void); | ||
101 | int platinumfb_setup(char*); | ||
102 | |||
103 | static struct fb_ops platinumfb_ops = { | 102 | static struct fb_ops platinumfb_ops = { |
104 | .owner = THIS_MODULE, | 103 | .owner = THIS_MODULE, |
105 | .fb_check_var = platinumfb_check_var, | 104 | .fb_check_var = platinumfb_check_var, |
@@ -485,7 +484,7 @@ static int platinum_var_to_par(struct fb_var_screeninfo *var, | |||
485 | /* | 484 | /* |
486 | * Parse user speficied options (`video=platinumfb:') | 485 | * Parse user speficied options (`video=platinumfb:') |
487 | */ | 486 | */ |
488 | int __init platinumfb_setup(char *options) | 487 | static int __init platinumfb_setup(char *options) |
489 | { | 488 | { |
490 | char *this_opt; | 489 | char *this_opt; |
491 | 490 | ||
@@ -526,19 +525,15 @@ int __init platinumfb_setup(char *options) | |||
526 | #define invalidate_cache(addr) | 525 | #define invalidate_cache(addr) |
527 | #endif | 526 | #endif |
528 | 527 | ||
529 | static int __devinit platinumfb_probe(struct of_device* odev, const struct of_device_id *match) | 528 | static int __devinit platinumfb_probe(struct of_device* odev, |
529 | const struct of_device_id *match) | ||
530 | { | 530 | { |
531 | struct device_node *dp = odev->node; | 531 | struct device_node *dp = odev->node; |
532 | struct fb_info *info; | 532 | struct fb_info *info; |
533 | struct fb_info_platinum *pinfo; | 533 | struct fb_info_platinum *pinfo; |
534 | unsigned long addr, size; | ||
535 | volatile __u8 *fbuffer; | 534 | volatile __u8 *fbuffer; |
536 | int i, bank0, bank1, bank2, bank3, rc; | 535 | int bank0, bank1, bank2, bank3, rc; |
537 | 536 | ||
538 | if (dp->n_addrs != 2) { | ||
539 | printk(KERN_ERR "expecting 2 address for platinum (got %d)", dp->n_addrs); | ||
540 | return -ENXIO; | ||
541 | } | ||
542 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); | 537 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); |
543 | 538 | ||
544 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); | 539 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); |
@@ -546,26 +541,39 @@ static int __devinit platinumfb_probe(struct of_device* odev, const struct of_de | |||
546 | return -ENOMEM; | 541 | return -ENOMEM; |
547 | pinfo = info->par; | 542 | pinfo = info->par; |
548 | 543 | ||
549 | /* Map in frame buffer and registers */ | 544 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || |
550 | for (i = 0; i < dp->n_addrs; ++i) { | 545 | of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { |
551 | addr = dp->addrs[i].address; | 546 | printk(KERN_ERR "platinumfb: Can't get resources\n"); |
552 | size = dp->addrs[i].size; | 547 | framebuffer_release(info); |
553 | /* Let's assume we can request either all or nothing */ | 548 | return -ENXIO; |
554 | if (!request_mem_region(addr, size, "platinumfb")) { | ||
555 | framebuffer_release(info); | ||
556 | return -ENXIO; | ||
557 | } | ||
558 | if (size >= 0x400000) { | ||
559 | /* frame buffer - map only 4MB */ | ||
560 | pinfo->frame_buffer_phys = addr; | ||
561 | pinfo->frame_buffer = __ioremap(addr, 0x400000, _PAGE_WRITETHRU); | ||
562 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
563 | } else { | ||
564 | /* registers */ | ||
565 | pinfo->platinum_regs_phys = addr; | ||
566 | pinfo->platinum_regs = ioremap(addr, size); | ||
567 | } | ||
568 | } | 549 | } |
550 | if (!request_mem_region(pinfo->rsrc_reg.start, | ||
551 | pinfo->rsrc_reg.start - | ||
552 | pinfo->rsrc_reg.end + 1, | ||
553 | "platinumfb registers")) { | ||
554 | framebuffer_release(info); | ||
555 | return -ENXIO; | ||
556 | } | ||
557 | if (!request_mem_region(pinfo->rsrc_fb.start, | ||
558 | pinfo->rsrc_fb.start | ||
559 | - pinfo->rsrc_fb.end + 1, | ||
560 | "platinumfb framebuffer")) { | ||
561 | release_mem_region(pinfo->rsrc_reg.start, | ||
562 | pinfo->rsrc_reg.end - | ||
563 | pinfo->rsrc_reg.start + 1); | ||
564 | framebuffer_release(info); | ||
565 | return -ENXIO; | ||
566 | } | ||
567 | |||
568 | /* frame buffer - map only 4MB */ | ||
569 | pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; | ||
570 | pinfo->frame_buffer = __ioremap(pinfo->rsrc_fb.start, 0x400000, | ||
571 | _PAGE_WRITETHRU); | ||
572 | pinfo->base_frame_buffer = pinfo->frame_buffer; | ||
573 | |||
574 | /* registers */ | ||
575 | pinfo->platinum_regs_phys = pinfo->rsrc_reg.start; | ||
576 | pinfo->platinum_regs = ioremap(pinfo->rsrc_reg.start, 0x1000); | ||
569 | 577 | ||
570 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ | 578 | pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ |
571 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); | 579 | request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); |
@@ -628,18 +636,16 @@ static int __devexit platinumfb_remove(struct of_device* odev) | |||
628 | { | 636 | { |
629 | struct fb_info *info = dev_get_drvdata(&odev->dev); | 637 | struct fb_info *info = dev_get_drvdata(&odev->dev); |
630 | struct fb_info_platinum *pinfo = info->par; | 638 | struct fb_info_platinum *pinfo = info->par; |
631 | struct device_node *dp = odev->node; | ||
632 | unsigned long addr, size; | ||
633 | int i; | ||
634 | 639 | ||
635 | unregister_framebuffer (info); | 640 | unregister_framebuffer (info); |
636 | 641 | ||
637 | /* Unmap frame buffer and registers */ | 642 | /* Unmap frame buffer and registers */ |
638 | for (i = 0; i < dp->n_addrs; ++i) { | 643 | release_mem_region(pinfo->rsrc_fb.start, |
639 | addr = dp->addrs[i].address; | 644 | pinfo->rsrc_fb.end - |
640 | size = dp->addrs[i].size; | 645 | pinfo->rsrc_fb.start + 1); |
641 | release_mem_region(addr, size); | 646 | release_mem_region(pinfo->rsrc_reg.start, |
642 | } | 647 | pinfo->rsrc_reg.end - |
648 | pinfo->rsrc_reg.start + 1); | ||
643 | iounmap(pinfo->frame_buffer); | 649 | iounmap(pinfo->frame_buffer); |
644 | iounmap(pinfo->platinum_regs); | 650 | iounmap(pinfo->platinum_regs); |
645 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); | 651 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); |
@@ -666,7 +672,7 @@ static struct of_platform_driver platinum_driver = | |||
666 | .remove = platinumfb_remove, | 672 | .remove = platinumfb_remove, |
667 | }; | 673 | }; |
668 | 674 | ||
669 | int __init platinumfb_init(void) | 675 | static int __init platinumfb_init(void) |
670 | { | 676 | { |
671 | #ifndef MODULE | 677 | #ifndef MODULE |
672 | char *option = NULL; | 678 | char *option = NULL; |
@@ -680,7 +686,7 @@ int __init platinumfb_init(void) | |||
680 | return 0; | 686 | return 0; |
681 | } | 687 | } |
682 | 688 | ||
683 | void __exit platinumfb_exit(void) | 689 | static void __exit platinumfb_exit(void) |
684 | { | 690 | { |
685 | of_unregister_driver(&platinum_driver); | 691 | of_unregister_driver(&platinum_driver); |
686 | } | 692 | } |
diff --git a/drivers/video/valkyriefb.c b/drivers/video/valkyriefb.c index ce97ec8eae97..2bdeb4baa952 100644 --- a/drivers/video/valkyriefb.c +++ b/drivers/video/valkyriefb.c | |||
@@ -342,19 +342,19 @@ int __init valkyriefb_init(void) | |||
342 | #else /* ppc (!CONFIG_MAC) */ | 342 | #else /* ppc (!CONFIG_MAC) */ |
343 | { | 343 | { |
344 | struct device_node *dp; | 344 | struct device_node *dp; |
345 | struct resource r; | ||
345 | 346 | ||
346 | dp = find_devices("valkyrie"); | 347 | dp = of_find_node_by_name(NULL, "valkyrie"); |
347 | if (dp == 0) | 348 | if (dp == 0) |
348 | return 0; | 349 | return 0; |
349 | 350 | ||
350 | if (dp->n_addrs != 1) { | 351 | if (of_address_to_resource(dp, 0, &r)) { |
351 | printk(KERN_ERR "expecting 1 address for valkyrie (got %d)\n", | 352 | printk(KERN_ERR "can't find address for valkyrie\n"); |
352 | dp->n_addrs); | ||
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | frame_buffer_phys = dp->addrs[0].address; | 356 | frame_buffer_phys = r.start; |
357 | cmap_regs_phys = dp->addrs[0].address+0x304000; | 357 | cmap_regs_phys = r.start + 0x304000; |
358 | flags = _PAGE_WRITETHRU; | 358 | flags = _PAGE_WRITETHRU; |
359 | } | 359 | } |
360 | #endif /* ppc (!CONFIG_MAC) */ | 360 | #endif /* ppc (!CONFIG_MAC) */ |