diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-12-13 02:01:21 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-01-08 22:53:55 -0500 |
commit | cc5d0189b9ba95260857a5018a1c2fef90008507 (patch) | |
tree | 1202c94b6b3cb81a96d0a0e54424cad10eef68bb /drivers/video/platinumfb.c | |
parent | 9cf84d7c97992dbe5360b241327341c07ce30fc9 (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/video/platinumfb.c')
-rw-r--r-- | drivers/video/platinumfb.c | 86 |
1 files changed, 46 insertions, 40 deletions
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 | } |