Subject: Re: [PATCH] Xilinx framebuffer device driver - 3d version

From: Andrei Konovalov <[email-masked]>
Date: Thu, 03 May 2007 21:29:16 +0400

Hello,

Andrei Konovalov wrote:
> Add support for the video controller IP block included into Xilinx ML300
> and ML403 reference designs.
> 
> Signed-off-by: Andrei Konovalov <[email-masked]>
> 
> -----
> The driver has been tested with Xilinx ML300 and ML403 reference designs.
> 
> The two first version has been posted to linuxppc-embedded, and this
> version tries to address all the comments and criticism received.
> 
> The platform device registration for Xilinx ML300 and ML403
> moved into separate patch (will be posted to linuxppc-embedded
> in couple minutes).

Here is the platform device registration part.

Thanks,
Andrei
Index: linux-2.6.20/arch/ppc/platforms/4xx/xilinx_ml403.c
===================================================================
--- linux-2.6.20.orig/arch/ppc/platforms/4xx/xilinx_ml403.c
+++ linux-2.6.20/arch/ppc/platforms/4xx/xilinx_ml403.c
@@ -118,3 +118,20 @@ platform_init(unsigned long r3, unsigned
 #endif
 }
 
+static struct xilinxfb_platform_data xilinxfb_ml403_pdata = {
+	.rotate_screen = 0,
+	.screen_height_mm = -1,
+	.screen_width_mm = -1,
+};
+
+int __init virtex_device_fixup(struct platform_device *dev)
+{
+	if (strcmp(dev->name, "xilinxfb") == 0) {
+		if (dev->id != 0) /* paranoic */
+			return 1;
+		dev->dev.platform_data = &xilinxfb_ml403_pdata;
+		return 0;
+	}
+	return 0;
+}
+
Index: linux-2.6.20/arch/ppc/platforms/4xx/xilinx_ml300.c
===================================================================
--- linux-2.6.20.orig/arch/ppc/platforms/4xx/xilinx_ml300.c
+++ linux-2.6.20/arch/ppc/platforms/4xx/xilinx_ml300.c
@@ -116,3 +116,20 @@ platform_init(unsigned long r3, unsigned
 #endif
 }
 
+static struct xilinxfb_platform_data xilinxfb_ml300_pdata = {
+	.rotate_screen = 1,
+	.screen_height_mm = 99,
+	.screen_width_mm = 132,
+};
+
+int __init virtex_device_fixup(struct platform_device *dev)
+{
+	if (strcmp(dev->name, "xilinxfb") == 0) {
+		if (dev->id != 0) /* paranoic */
+			return 1;
+		dev->dev.platform_data = &xilinxfb_ml300_pdata;
+		return 0;
+	}
+	return 0;
+}
+
Index: linux-2.6.20/arch/ppc/syslib/virtex_devices.c
===================================================================
--- linux-2.6.20.orig/arch/ppc/syslib/virtex_devices.c
+++ linux-2.6.20/arch/ppc/syslib/virtex_devices.c
@@ -71,7 +71,23 @@
 	}, \
 }
 
+/*
+ * ML300/ML403 Video Device: shortcut macro for single instance
+ */
+#define XPAR_TFT(num) { \
+	.name = "xilinxfb", \
+	.id = num, \
+	.num_resources = 1, \
+	.resource = (struct resource[]) { \
+		{ \
+			.start = XPAR_TFT_##num##_BASEADDR, \
+			.end = XPAR_TFT_##num##_BASEADDR+7, \
+			.flags = IORESOURCE_IO, \
+		}, \
+	}, \
+}
 
+ 
 /* UART 8250 driver platform data table */
 struct plat_serial8250_port virtex_serial_platform_data[] = {
 #if defined(XPAR_UARTNS550_0_BASEADDR)
@@ -146,20 +162,12 @@ struct platform_device virtex_platform_d
 	XPAR_SYSACE(1),
 #endif
 
-	/* ML300/403 reference design framebuffer */
+	/* ML300/ML403 reference design framebuffer */
 #if defined(XPAR_TFT_0_BASEADDR)
-	{
-		.name		= "xilinxfb",
-		.id		= 0,
-		.num_resources	= 1,
-		.resource = (struct resource[]) {
-			{
-				.start	= XPAR_TFT_0_BASEADDR,
-				.end	= XPAR_TFT_0_BASEADDR+7,
-				.flags	= IORESOURCE_IO,
-			},
-		},
-	},
+	XPAR_TFT(0),
+#endif
+#if defined(XPAR_TFT_1_BASEADDR)
+	XPAR_TFT(1),
 #endif
 };