Skip to contentSkip to conversation

Xilinx framebuffer device driver - 4th version

PATCH In review Andrei Konovalov 2 participants 3 messages May 4, 2007 – May 5, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Xilinx framebuffer device driver - 4th version

Add support for the video controller IP block included into Xilinx ML300 and ML403 reference designs.

-----

The patch is against 2.6.21-git4 snapshot.

Fixed the issues pointed out by Antonino A. Daplas. Thanks Antonino!

Here is the interdiff against the previous version:

===8<===

drivers/video/xilinxfb.c +9 -17
diff -u linux-2.6.20/drivers/video/xilinxfb.c linux-2.6.20/drivers/video/xilinxfb.c
@@ -167,14 +167,15 @@
 	struct xilinxfb_drvdata *drvdata = to_xilinxfb_drvdata(fbi);
 
 	switch (blank_mode) {
-	case VESA_NO_BLANKING:
+	case FB_BLANK_UNBLANK:
 		/* turn on panel */
 		xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
 		break;
 
-	case VESA_VSYNC_SUSPEND:
-	case VESA_HSYNC_SUSPEND:
-	case VESA_POWERDOWN:
+	case FB_BLANK_NORMAL:
+	case FB_BLANK_VSYNC_SUSPEND:
+	case FB_BLANK_HSYNC_SUSPEND:
+	case FB_BLANK_POWERDOWN:
 		/* turn off panel */
 		xilinx_fb_out_be32(drvdata, REG_CTRL, 0);
 	default:
@@ -184,21 +185,11 @@
 	return 0; /* success */
 }
 
-static int
-xilinx_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *fbi)
-{
-	if (var->xoffset != 0 || var->yoffset != 0)
-		return -EINVAL;
-
-	return 0;
-}
-
 static struct fb_ops xilinxfb_ops =
 {
 	.owner			= THIS_MODULE,
 	.fb_setcolreg		= xilinx_fb_setcolreg,
 	.fb_blank		= xilinx_fb_blank,
-	.fb_pan_display		= xilinx_fb_pan_display,
 	.fb_fillrect		= cfb_fillrect,
 	.fb_copyarea		= cfb_copyarea,
 	.fb_imageblit		= cfb_imageblit,
@@ -219,7 +210,7 @@
 		return -EINVAL;
 
 	pdev = to_platform_device(dev);
-	pdata = (struct xilinxfb_platform_data *)pdev->dev.platform_data;
+	pdata = pdev->dev.platform_data;
 
 	if (pdata == NULL) {
 		printk(KERN_ERR "Couldn't find platform data.\n");
@@ -231,7 +222,7 @@
 		printk(KERN_ERR "Couldn't allocate device private record\n");
 		return -ENOMEM;
 	}
-	dev_set_drvdata(dev, (void *)drvdata);
+	dev_set_drvdata(dev, drvdata);
 
 	/* Map the control registers in */
 	regs_res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -261,7 +252,7 @@
 	}
 
 	/* Clear (turn to black) the framebuffer */
-	memset((void *) drvdata->fb_virt, 0, FB_SIZE);
+	memset_io((void *) drvdata->fb_virt, 0, FB_SIZE);
 
 	/* Tell the hardware where the frame buffer is */
 	xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
@@ -275,6 +266,7 @@
 	xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
 
 	/* Fill struct fb_info */
+	drvdata->info.device = dev;
 	drvdata->info.screen_base = drvdata->fb_virt;
 	drvdata->info.fbops = &xilinxfb_ops;
 	drvdata->info.fix = xilinx_fb_fix;

===8<===

And here is the patch itself:
===8<===
Add support for the video controller IP block included into Xilinx ML300 and ML403 reference designs.

 arch/ppc/syslib/virtex_devices.h |    7
 drivers/video/Kconfig            |   11 +
 drivers/video/Makefile           |    1
 drivers/video/xilinxfb.c         |  381 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 400 insertions(+)
drivers/video/Kconfig +11 -0
Index: linux-2.6.20/drivers/video/Kconfig
===================================================================
@@ -1633,6 +1633,17 @@ config FB_PS3_DEFAULT_SIZE_M
 	  The default value can be overridden on the kernel command line
 	  using the "ps3fb" option (e.g. "ps3fb=9M");
 
+config FB_XILINX
+	tristate "Xilinx frame buffer support"
+	depends on FB && XILINX_VIRTEX
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	---help---
+	  Include support for the Xilinx ML300/ML403 reference design
+	  framebuffer. ML300 carries a 640*480 LCD display on the board,
+	  ML403 uses a standard DB15 VGA connector.
+
 config FB_VIRTUAL
 	tristate "Virtual Frame Buffer support (ONLY FOR TESTING!)"
 	depends on FB
drivers/video/Makefile +1 -0
Index: linux-2.6.20/drivers/video/Makefile
===================================================================
@@ -99,6 +99,7 @@ obj-$(CONFIG_FB_PNX4008_DUM_RGB)  += pnx
 obj-$(CONFIG_FB_IBM_GXT4500)	  += gxt4500.o
 obj-$(CONFIG_FB_PS3)		  += ps3fb.o
 obj-$(CONFIG_FB_SM501)            += sm501fb.o
+obj-$(CONFIG_FB_XILINX)           += xilinxfb.o
 
 # Platform or fallback drivers go here
 obj-$(CONFIG_FB_VESA)             += vesafb.o
drivers/video/xilinxfb.c new file +381 -0

381 lines not on this page · raw message

arch/ppc/syslib/virtex_devices.h +7 -0
Index: linux-2.6.20/arch/ppc/syslib/virtex_devices.h
===================================================================
@@ -13,6 +13,13 @@
 
 #include <linux/platform_device.h>
 
+/* ML300/403 reference design framebuffer driver platform data struct */
+struct xilinxfb_platform_data {
+	u32 rotate_screen;
+	u32 screen_height_mm;
+	u32 screen_width_mm;
+};
+
 void __init virtex_early_serial_map(void);
 
 /* Prototype for device fixup routine.  Implement this routine in the

===8<===

Thanks,
Andrei

Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Andrei Konovalov

Add support for the video controller IP block included into Xilinx ML300 and ML403 reference designs.

My tree does not have arch/ppc/syslib/virtex_devices.h. Either I wait for that to be merged to the -mm or mainline tree, or you can submit this driver yourself with the platform-specific changes. Either way:

Quoted 1 line

Tony

#2 lore raw
Quoted 8 lines · Antonino A. Daplas
Quoted 3 lines · Andrei Konovalov

Add support for the video controller IP block included into Xilinx ML300 and ML403 reference designs.

My tree does not have arch/ppc/syslib/virtex_devices.h. Either I wait for that to be merged to the -mm or mainline tree, or you can submit this driver yourself with the platform-specific changes. Either way:

Okay, the platform-specific parts are in 2.6.21-mm1 already. I'll push this patch upstairs.

Tony

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/