diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2007-09-19 00:50:22 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-09-22 00:49:22 -0400 |
commit | 4c2a54b09ba35a409afc34bd331a57a994921664 (patch) | |
tree | c38fa05e908d11b2837be2636ea13a707f57ae63 /drivers | |
parent | 8fd7675c092f79f240246c76728477ec4e7f7f09 (diff) |
[POWERPC] Fix platinumfb framebuffer
Current kernels have a non-working platinumfb due to some resource
management issues. This fixes it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/platinumfb.c | 48 |
1 files changed, 26 insertions, 22 deletions
diff --git a/drivers/video/platinumfb.c b/drivers/video/platinumfb.c index 8503e733a172..cbe71a5338d0 100644 --- a/drivers/video/platinumfb.c +++ b/drivers/video/platinumfb.c | |||
@@ -17,6 +17,8 @@ | |||
17 | * more details. | 17 | * more details. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #undef DEBUG | ||
21 | |||
20 | #include <linux/module.h> | 22 | #include <linux/module.h> |
21 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
22 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
@@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(struct of_device* odev, | |||
535 | volatile __u8 *fbuffer; | 537 | volatile __u8 *fbuffer; |
536 | int bank0, bank1, bank2, bank3, rc; | 538 | int bank0, bank1, bank2, bank3, rc; |
537 | 539 | ||
538 | printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n"); | 540 | dev_info(&odev->dev, "Found Apple Platinum video hardware\n"); |
539 | 541 | ||
540 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); | 542 | info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); |
541 | if (info == NULL) | 543 | if (info == NULL) { |
544 | dev_err(&odev->dev, "Failed to allocate fbdev !\n"); | ||
542 | return -ENOMEM; | 545 | return -ENOMEM; |
546 | } | ||
543 | pinfo = info->par; | 547 | pinfo = info->par; |
544 | 548 | ||
545 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || | 549 | if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || |
546 | of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { | 550 | of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { |
547 | printk(KERN_ERR "platinumfb: Can't get resources\n"); | 551 | dev_err(&odev->dev, "Can't get resources\n"); |
548 | framebuffer_release(info); | ||
549 | return -ENXIO; | ||
550 | } | ||
551 | if (!request_mem_region(pinfo->rsrc_reg.start, | ||
552 | pinfo->rsrc_reg.start - | ||
553 | pinfo->rsrc_reg.end + 1, | ||
554 | "platinumfb registers")) { | ||
555 | framebuffer_release(info); | 552 | framebuffer_release(info); |
556 | return -ENXIO; | 553 | return -ENXIO; |
557 | } | 554 | } |
555 | dev_dbg(&odev->dev, " registers : 0x%llx...0x%llx\n", | ||
556 | (unsigned long long)pinfo->rsrc_reg.start, | ||
557 | (unsigned long long)pinfo->rsrc_reg.end); | ||
558 | dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n", | ||
559 | (unsigned long long)pinfo->rsrc_fb.start, | ||
560 | (unsigned long long)pinfo->rsrc_fb.end); | ||
561 | |||
562 | /* Do not try to request register space, they overlap with the | ||
563 | * northbridge and that can fail. Only request framebuffer | ||
564 | */ | ||
558 | if (!request_mem_region(pinfo->rsrc_fb.start, | 565 | if (!request_mem_region(pinfo->rsrc_fb.start, |
559 | pinfo->rsrc_fb.start | 566 | pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1, |
560 | - pinfo->rsrc_fb.end + 1, | ||
561 | "platinumfb framebuffer")) { | 567 | "platinumfb framebuffer")) { |
562 | release_mem_region(pinfo->rsrc_reg.start, | 568 | printk(KERN_ERR "platinumfb: Can't request framebuffer !\n"); |
563 | pinfo->rsrc_reg.end - | ||
564 | pinfo->rsrc_reg.start + 1); | ||
565 | framebuffer_release(info); | 569 | framebuffer_release(info); |
566 | return -ENXIO; | 570 | return -ENXIO; |
567 | } | 571 | } |
@@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(struct of_device* odev, | |||
600 | bank2 = fbuffer[0x200000] == 0x56; | 604 | bank2 = fbuffer[0x200000] == 0x56; |
601 | bank3 = fbuffer[0x300000] == 0x78; | 605 | bank3 = fbuffer[0x300000] == 0x78; |
602 | pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000; | 606 | pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000; |
603 | printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", (int) (pinfo->total_vram / 1024 / 1024), | 607 | printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", |
608 | (unsigned int) (pinfo->total_vram / 1024 / 1024), | ||
604 | bank3, bank2, bank1, bank0); | 609 | bank3, bank2, bank1, bank0); |
605 | 610 | ||
606 | /* | 611 | /* |
@@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(struct of_device* odev) | |||
644 | unregister_framebuffer (info); | 649 | unregister_framebuffer (info); |
645 | 650 | ||
646 | /* Unmap frame buffer and registers */ | 651 | /* Unmap frame buffer and registers */ |
652 | iounmap(pinfo->frame_buffer); | ||
653 | iounmap(pinfo->platinum_regs); | ||
654 | iounmap(pinfo->cmap_regs); | ||
655 | |||
647 | release_mem_region(pinfo->rsrc_fb.start, | 656 | release_mem_region(pinfo->rsrc_fb.start, |
648 | pinfo->rsrc_fb.end - | 657 | pinfo->rsrc_fb.end - |
649 | pinfo->rsrc_fb.start + 1); | 658 | pinfo->rsrc_fb.start + 1); |
650 | release_mem_region(pinfo->rsrc_reg.start, | 659 | |
651 | pinfo->rsrc_reg.end - | ||
652 | pinfo->rsrc_reg.start + 1); | ||
653 | iounmap(pinfo->frame_buffer); | ||
654 | iounmap(pinfo->platinum_regs); | ||
655 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); | 660 | release_mem_region(pinfo->cmap_regs_phys, 0x1000); |
656 | iounmap(pinfo->cmap_regs); | ||
657 | 661 | ||
658 | framebuffer_release(info); | 662 | framebuffer_release(info); |
659 | 663 | ||