X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=drivers%2Fvideo%2Fxilinxfb.c;h=e63cbd1acfd2f024776a430488665fb259b8e47c;hb=3cb3ec2c26473d8123a468abfaca1e926344b1c2;hp=1d29a89a86b468da702c56f5d22372ae285ee57c;hpb=ec4883b015c3212f6f6d04fb2ff45f528492f598;p=~andy%2Flinux diff --git a/drivers/video/xilinxfb.c b/drivers/video/xilinxfb.c index 1d29a89a86b..e63cbd1acfd 100644 --- a/drivers/video/xilinxfb.c +++ b/drivers/video/xilinxfb.c @@ -18,6 +18,7 @@ * Geert Uytterhoeven. */ +#include #include #include #include @@ -30,7 +31,7 @@ #include #include -#include +#include #define DRIVER_NAME "xilinxfb" #define DRIVER_DESCRIPTION "Xilinx TFT LCD frame buffer driver" @@ -79,7 +80,7 @@ /* * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures */ -static struct fb_fix_screeninfo xilinx_fb_fix __initdata = { +static struct fb_fix_screeninfo xilinx_fb_fix = { .id = "Xilinx", .type = FB_TYPE_PACKED_PIXELS, .visual = FB_VISUAL_TRUECOLOR, @@ -88,7 +89,7 @@ static struct fb_fix_screeninfo xilinx_fb_fix __initdata = { .accel = FB_ACCEL_NONE }; -static struct fb_var_screeninfo xilinx_fb_var __initdata = { +static struct fb_var_screeninfo xilinx_fb_var = { .xres = XRES, .yres = YRES, .xres_virtual = XRES_VIRTUAL, @@ -212,14 +213,9 @@ xilinxfb_drv_probe(struct device *dev) pdev = to_platform_device(dev); pdata = pdev->dev.platform_data; - if (pdata == NULL) { - printk(KERN_ERR "Couldn't find platform data.\n"); - return -EFAULT; - } - drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL); if (!drvdata) { - printk(KERN_ERR "Couldn't allocate device private record\n"); + dev_err(dev, "Couldn't allocate device private record\n"); return -ENOMEM; } dev_set_drvdata(dev, drvdata); @@ -227,14 +223,13 @@ xilinxfb_drv_probe(struct device *dev) /* Map the control registers in */ regs_res = platform_get_resource(pdev, IORESOURCE_IO, 0); if (!regs_res || (regs_res->end - regs_res->start + 1 < 8)) { - printk(KERN_ERR "Couldn't get registers resource\n"); + dev_err(dev, "Couldn't get registers resource\n"); retval = -EFAULT; goto failed1; } if (!request_mem_region(regs_res->start, 8, DRIVER_NAME)) { - printk(KERN_ERR - "Couldn't lock memory region at 0x%08X\n", + dev_err(dev, "Couldn't lock memory region at 0x%08X\n", regs_res->start); retval = -EBUSY; goto failed1; @@ -246,7 +241,7 @@ xilinxfb_drv_probe(struct device *dev) drvdata->fb_virt = dma_alloc_coherent(dev, PAGE_ALIGN(FB_SIZE), &drvdata->fb_phys, GFP_KERNEL); if (!drvdata->fb_virt) { - printk(KERN_ERR "Could not allocate frame buffer memory\n"); + dev_err(dev, "Could not allocate frame buffer memory\n"); retval = -ENOMEM; goto failed2; } @@ -258,11 +253,9 @@ xilinxfb_drv_probe(struct device *dev) xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys); /* Turn on the display */ - if (pdata->rotate_screen) { - drvdata->reg_ctrl_default = REG_CTRL_ENABLE | REG_CTRL_ROTATE; - } else { - drvdata->reg_ctrl_default = REG_CTRL_ENABLE; - } + drvdata->reg_ctrl_default = REG_CTRL_ENABLE; + if (pdata && pdata->rotate_screen) + drvdata->reg_ctrl_default |= REG_CTRL_ROTATE; xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default); /* Fill struct fb_info */ @@ -274,24 +267,31 @@ xilinxfb_drv_probe(struct device *dev) drvdata->info.pseudo_palette = drvdata->pseudo_palette; if (fb_alloc_cmap(&drvdata->info.cmap, PALETTE_ENTRIES_NO, 0) < 0) { - printk(KERN_ERR "Fail to allocate colormap (%d entries)\n", + dev_err(dev, "Fail to allocate colormap (%d entries)\n", PALETTE_ENTRIES_NO); retval = -EFAULT; goto failed3; } drvdata->info.flags = FBINFO_DEFAULT; - xilinx_fb_var.height = pdata->screen_height_mm; - xilinx_fb_var.width = pdata->screen_width_mm; + if (pdata) { + xilinx_fb_var.height = pdata->screen_height_mm; + xilinx_fb_var.width = pdata->screen_width_mm; + } drvdata->info.var = xilinx_fb_var; /* Register new frame buffer */ if (register_framebuffer(&drvdata->info) < 0) { - printk(KERN_ERR "Could not register frame buffer\n"); + dev_err(dev, "Could not register frame buffer\n"); retval = -EINVAL; goto failed4; } + /* Put a banner in the log (for DEBUG) */ + dev_dbg(dev, "regs: phys=%x, virt=%p\n", + drvdata->regs_phys, drvdata->regs); + dev_dbg(dev, "fb: phys=%p, virt=%p, size=%x\n", + (void*)drvdata->fb_phys, drvdata->fb_virt, FB_SIZE); return 0; /* success */ failed4: