Commit 287e5d6f authored by Grant Likely's avatar Grant Likely Committed by Paul Mackerras

[POWERPC] XilinxFB: Allow fixed framebuffer base address

Allow a fixed framebuffer address to be assigned to the framebuffer device
instead of allocating the framebuffer from the consistent memory pool.
Signed-off-by: default avatarGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent b4d6a726
...@@ -117,6 +117,7 @@ struct xilinxfb_drvdata { ...@@ -117,6 +117,7 @@ struct xilinxfb_drvdata {
void *fb_virt; /* virt. address of the frame buffer */ void *fb_virt; /* virt. address of the frame buffer */
dma_addr_t fb_phys; /* phys. address of the frame buffer */ dma_addr_t fb_phys; /* phys. address of the frame buffer */
int fb_alloced; /* Flag, was the fb memory alloced? */
u32 reg_ctrl_default; u32 reg_ctrl_default;
...@@ -235,8 +236,15 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr, ...@@ -235,8 +236,15 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
} }
/* Allocate the framebuffer memory */ /* Allocate the framebuffer memory */
if (pdata->fb_phys) {
drvdata->fb_phys = pdata->fb_phys;
drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize);
} else {
drvdata->fb_alloced = 1;
drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
&drvdata->fb_phys, GFP_KERNEL); &drvdata->fb_phys, GFP_KERNEL);
}
if (!drvdata->fb_virt) { if (!drvdata->fb_virt) {
dev_err(dev, "Could not allocate frame buffer memory\n"); dev_err(dev, "Could not allocate frame buffer memory\n");
rc = -ENOMEM; rc = -ENOMEM;
...@@ -300,6 +308,7 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr, ...@@ -300,6 +308,7 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
fb_dealloc_cmap(&drvdata->info.cmap); fb_dealloc_cmap(&drvdata->info.cmap);
err_cmap: err_cmap:
if (drvdata->fb_alloced)
dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
drvdata->fb_phys); drvdata->fb_phys);
/* Turn off the display */ /* Turn off the display */
...@@ -330,6 +339,7 @@ static int xilinxfb_release(struct device *dev) ...@@ -330,6 +339,7 @@ static int xilinxfb_release(struct device *dev)
fb_dealloc_cmap(&drvdata->info.cmap); fb_dealloc_cmap(&drvdata->info.cmap);
if (drvdata->fb_alloced)
dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
drvdata->fb_virt, drvdata->fb_phys); drvdata->fb_virt, drvdata->fb_phys);
......
...@@ -20,6 +20,11 @@ struct xilinxfb_platform_data { ...@@ -20,6 +20,11 @@ struct xilinxfb_platform_data {
u32 screen_width_mm; u32 screen_width_mm;
u32 xres, yres; /* resolution of screen in pixels */ u32 xres, yres; /* resolution of screen in pixels */
u32 xvirt, yvirt; /* resolution of memory buffer */ u32 xvirt, yvirt; /* resolution of memory buffer */
/* Physical address of framebuffer memory; If non-zero, driver
* will use provided memory address instead of allocating one from
* the consistent pool. */
u32 fb_phys;
}; };
#endif /* __XILINXFB_H__ */ #endif /* __XILINXFB_H__ */
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