Commit e494b240 authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Greg Kroah-Hartman

POWERPC: Fix platinumfb framebuffer

Patch 4c2a54b0 in mailine.

Current kernels have a non-working platinumfb due to some resource
management issues.  This fixes it.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 2f7ef872
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
* more details. * more details.
*/ */
#undef DEBUG
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
...@@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(struct of_device* odev, ...@@ -535,33 +537,35 @@ static int __devinit platinumfb_probe(struct of_device* odev,
volatile __u8 *fbuffer; volatile __u8 *fbuffer;
int bank0, bank1, bank2, bank3, rc; 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); info = framebuffer_alloc(sizeof(*pinfo), &odev->dev);
if (info == NULL) if (info == NULL) {
dev_err(&odev->dev, "Failed to allocate fbdev !\n");
return -ENOMEM; return -ENOMEM;
}
pinfo = info->par; pinfo = info->par;
if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) ||
of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) {
printk(KERN_ERR "platinumfb: Can't get resources\n"); dev_err(&odev->dev, "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")) {
framebuffer_release(info); framebuffer_release(info);
return -ENXIO; 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, if (!request_mem_region(pinfo->rsrc_fb.start,
pinfo->rsrc_fb.start pinfo->rsrc_fb.end - pinfo->rsrc_fb.start + 1,
- pinfo->rsrc_fb.end + 1,
"platinumfb framebuffer")) { "platinumfb framebuffer")) {
release_mem_region(pinfo->rsrc_reg.start, printk(KERN_ERR "platinumfb: Can't request framebuffer !\n");
pinfo->rsrc_reg.end -
pinfo->rsrc_reg.start + 1);
framebuffer_release(info); framebuffer_release(info);
return -ENXIO; return -ENXIO;
} }
...@@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(struct of_device* odev, ...@@ -600,7 +604,8 @@ static int __devinit platinumfb_probe(struct of_device* odev,
bank2 = fbuffer[0x200000] == 0x56; bank2 = fbuffer[0x200000] == 0x56;
bank3 = fbuffer[0x300000] == 0x78; bank3 = fbuffer[0x300000] == 0x78;
pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000; 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); bank3, bank2, bank1, bank0);
/* /*
...@@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(struct of_device* odev) ...@@ -644,16 +649,15 @@ static int __devexit platinumfb_remove(struct of_device* odev)
unregister_framebuffer (info); unregister_framebuffer (info);
/* Unmap frame buffer and registers */ /* Unmap frame buffer and registers */
iounmap(pinfo->frame_buffer);
iounmap(pinfo->platinum_regs);
iounmap(pinfo->cmap_regs);
release_mem_region(pinfo->rsrc_fb.start, release_mem_region(pinfo->rsrc_fb.start,
pinfo->rsrc_fb.end - pinfo->rsrc_fb.end -
pinfo->rsrc_fb.start + 1); 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); release_mem_region(pinfo->cmap_regs_phys, 0x1000);
iounmap(pinfo->cmap_regs);
framebuffer_release(info); framebuffer_release(info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment