diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2007-10-10 14:31:56 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-12 00:05:17 -0400 |
commit | 287e5d6fcccfa38b953cebe307e1ddfd32363355 (patch) | |
tree | f06b288f7f2e5a1eecc093ba977141c9035d3534 /drivers/video/xilinxfb.c | |
parent | b4d6a7268fc754eefb196cabc0ccfa2e97022af2 (diff) |
[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: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/video/xilinxfb.c')
-rw-r--r-- | drivers/video/xilinxfb.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index c6174125f52b..6ef99b2d13ca 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c | |||
@@ -117,6 +117,7 @@ struct xilinxfb_drvdata { | |||
117 | 117 | ||
118 | void *fb_virt; /* virt. address of the frame buffer */ | 118 | void *fb_virt; /* virt. address of the frame buffer */ |
119 | dma_addr_t fb_phys; /* phys. address of the frame buffer */ | 119 | dma_addr_t fb_phys; /* phys. address of the frame buffer */ |
120 | int fb_alloced; /* Flag, was the fb memory alloced? */ | ||
120 | 121 | ||
121 | u32 reg_ctrl_default; | 122 | u32 reg_ctrl_default; |
122 | 123 | ||
@@ -235,8 +236,15 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr, | |||
235 | } | 236 | } |
236 | 237 | ||
237 | /* Allocate the framebuffer memory */ | 238 | /* Allocate the framebuffer memory */ |
238 | drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), | 239 | if (pdata->fb_phys) { |
239 | &drvdata->fb_phys, GFP_KERNEL); | 240 | drvdata->fb_phys = pdata->fb_phys; |
241 | drvdata->fb_virt = ioremap(pdata->fb_phys, fbsize); | ||
242 | } else { | ||
243 | drvdata->fb_alloced = 1; | ||
244 | drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize), | ||
245 | &drvdata->fb_phys, GFP_KERNEL); | ||
246 | } | ||
247 | |||
240 | if (!drvdata->fb_virt) { | 248 | if (!drvdata->fb_virt) { |
241 | dev_err(dev, "Could not allocate frame buffer memory\n"); | 249 | dev_err(dev, "Could not allocate frame buffer memory\n"); |
242 | rc = -ENOMEM; | 250 | rc = -ENOMEM; |
@@ -300,8 +308,9 @@ err_regfb: | |||
300 | fb_dealloc_cmap(&drvdata->info.cmap); | 308 | fb_dealloc_cmap(&drvdata->info.cmap); |
301 | 309 | ||
302 | err_cmap: | 310 | err_cmap: |
303 | dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, | 311 | if (drvdata->fb_alloced) |
304 | drvdata->fb_phys); | 312 | dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt, |
313 | drvdata->fb_phys); | ||
305 | /* Turn off the display */ | 314 | /* Turn off the display */ |
306 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); | 315 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); |
307 | 316 | ||
@@ -330,8 +339,9 @@ static int xilinxfb_release(struct device *dev) | |||
330 | 339 | ||
331 | fb_dealloc_cmap(&drvdata->info.cmap); | 340 | fb_dealloc_cmap(&drvdata->info.cmap); |
332 | 341 | ||
333 | dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), | 342 | if (drvdata->fb_alloced) |
334 | drvdata->fb_virt, drvdata->fb_phys); | 343 | dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len), |
344 | drvdata->fb_virt, drvdata->fb_phys); | ||
335 | 345 | ||
336 | /* Turn off the display */ | 346 | /* Turn off the display */ |
337 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); | 347 | xilinx_fb_out_be32(drvdata, REG_CTRL, 0); |