]> err.no Git - linux-2.6/blobdiff - drivers/video/xilinxfb.c
V4L/DVB (7858): video: build fix for drivers/media/video/mt9v022.c
[linux-2.6] / drivers / video / xilinxfb.c
index c6174125f52b966d7bf5056946542b16f245b6d0..7b3a8423f485e340afffb81d6f0dbc4c933eec83 100644 (file)
@@ -84,7 +84,7 @@ static struct xilinxfb_platform_data xilinx_fb_default_pdata = {
        .xres = 640,
        .yres = 480,
        .xvirt = 1024,
-       .yvirt = 480;
+       .yvirt = 480,
 };
 
 /*
@@ -117,6 +117,7 @@ struct xilinxfb_drvdata {
 
        void            *fb_virt;       /* virt. 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;
 
@@ -235,8 +236,15 @@ static int xilinxfb_assign(struct device *dev, unsigned long physaddr,
        }
 
        /* Allocate the framebuffer memory */
-       drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(fbsize),
-                               &drvdata->fb_phys, GFP_KERNEL);
+       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_phys, GFP_KERNEL);
+       }
+
        if (!drvdata->fb_virt) {
                dev_err(dev, "Could not allocate frame buffer memory\n");
                rc = -ENOMEM;
@@ -300,8 +308,9 @@ err_regfb:
        fb_dealloc_cmap(&drvdata->info.cmap);
 
 err_cmap:
-       dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
-               drvdata->fb_phys);
+       if (drvdata->fb_alloced)
+               dma_free_coherent(dev, PAGE_ALIGN(fbsize), drvdata->fb_virt,
+                       drvdata->fb_phys);
        /* Turn off the display */
        xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
 
@@ -330,8 +339,9 @@ static int xilinxfb_release(struct device *dev)
 
        fb_dealloc_cmap(&drvdata->info.cmap);
 
-       dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
-                         drvdata->fb_virt, drvdata->fb_phys);
+       if (drvdata->fb_alloced)
+               dma_free_coherent(dev, PAGE_ALIGN(drvdata->info.fix.smem_len),
+                                 drvdata->fb_virt, drvdata->fb_phys);
 
        /* Turn off the display */
        xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
@@ -449,8 +459,8 @@ static int __devexit xilinxfb_of_remove(struct of_device *op)
 }
 
 /* Match table for of_platform binding */
-static struct of_device_id __devinit xilinxfb_of_match[] = {
-       { .compatible = "xilinx,ml300-fb", },
+static struct of_device_id xilinxfb_of_match[] __devinitdata = {
+       { .compatible = "xlnx,plb-tft-cntlr-ref-1.00.a", },
        {},
 };
 MODULE_DEVICE_TABLE(of, xilinxfb_of_match);