Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4c2a54b09ba35a409afc34bd331a57a994921664
Commit:     4c2a54b09ba35a409afc34bd331a57a994921664
Parent:     8fd7675c092f79f240246c76728477ec4e7f7f09
Author:     Benjamin Herrenschmidt <[EMAIL PROTECTED]>
AuthorDate: Wed Sep 19 14:50:22 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Sat Sep 22 14:49:22 2007 +1000

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 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 8503e73..cbe71a5 100644
--- a/drivers/video/platinumfb.c
+++ b/drivers/video/platinumfb.c
@@ -17,6 +17,8 @@
  *  more details.
  */
 
+#undef DEBUG
+
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(struct of_device* 
odev,
        volatile __u8           *fbuffer;
        int                     bank0, bank1, bank2, bank3, rc;
 
-       printk(KERN_INFO "platinumfb: Found Apple Platinum video hardware\n");
+       dev_info(&odev->dev, "Found Apple Platinum video hardware\n");
 
        info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
-       if (info == NULL)
+       if (info == NULL) {
+               dev_err(&odev->dev, "Failed to allocate fbdev !\n");
                return -ENOMEM;
+       }
        pinfo = info->par;
 
        if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
            of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) {
-               printk(KERN_ERR "platinumfb: Can't get resources\n");
-               framebuffer_release(info);
-               return -ENXIO;
-       }
-       if (!request_mem_region(pinfo->rsrc_reg.start,
-                               pinfo->rsrc_reg.start -
-                               pinfo->rsrc_reg.end + 1,
-                               "platinumfb registers")) {
+               dev_err(&odev->dev, "Can't get resources\n");
                framebuffer_release(info);
                return -ENXIO;
        }
+       dev_dbg(&odev->dev, " registers  : 0x%llx...0x%llx\n",
+               (unsigned long long)pinfo->rsrc_reg.start,
+               (unsigned long long)pinfo->rsrc_reg.end);
+       dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n",
+               (unsigned long long)pinfo->rsrc_fb.start,
+               (unsigned long long)pinfo->rsrc_fb.end);
+
+       /* Do not try to request register space, they overlap with the
+        * northbridge and that can fail. Only request framebuffer
+        */
        if (!request_mem_region(pinfo->rsrc_fb.start,
-                               pinfo->rsrc_fb.start
-                               - pinfo->rsrc_fb.end + 1,
+                               pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1,
                                "platinumfb framebuffer")) {
-               release_mem_region(pinfo->rsrc_reg.start,
-                                  pinfo->rsrc_reg.end -
-                                  pinfo->rsrc_reg.start + 1);
+               printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
                framebuffer_release(info);
                return -ENXIO;
        }
@@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(struct of_device* 
odev,
        bank2 = fbuffer[0x200000] == 0x56;
        bank3 = fbuffer[0x300000] == 0x78;
        pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000;
-       printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n", (int) 
(pinfo->total_vram / 1024 / 1024),
+       printk(KERN_INFO "platinumfb: Total VRAM = %dMB (%d%d%d%d)\n",
+              (unsigned int) (pinfo->total_vram / 1024 / 1024),
               bank3, bank2, bank1, bank0);
 
        /*
@@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(struct of_device* 
odev)
         unregister_framebuffer (info);
        
        /* Unmap frame buffer and registers */
+       iounmap(pinfo->frame_buffer);
+       iounmap(pinfo->platinum_regs);
+       iounmap(pinfo->cmap_regs);
+
        release_mem_region(pinfo->rsrc_fb.start,
                           pinfo->rsrc_fb.end -
                           pinfo->rsrc_fb.start + 1);
-       release_mem_region(pinfo->rsrc_reg.start,
-                          pinfo->rsrc_reg.end -
-                          pinfo->rsrc_reg.start + 1);
-       iounmap(pinfo->frame_buffer);
-       iounmap(pinfo->platinum_regs);
+
        release_mem_region(pinfo->cmap_regs_phys, 0x1000);
-       iounmap(pinfo->cmap_regs);
 
        framebuffer_release(info);
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to