patch-2.4.19 linux-2.4.19/drivers/video/tx3912fb.c

Next file: linux-2.4.19/drivers/video/tx3912fb.h
Previous file: linux-2.4.19/drivers/video/tridentfb.h
Back to the patch index
Back to the overall index

diff -urN linux-2.4.18/drivers/video/tx3912fb.c linux-2.4.19/drivers/video/tx3912fb.c
@@ -1,14 +1,14 @@
 /*
- * linux/drivers/video/tx3912fb.c
+ *  drivers/video/tx3912fb.c
  *
- * Copyright (C) 1999 Harald Koerfgen
- * Copyright (C) 2001 Steven Hill (sjhill@realitydiluted.com)
+ *  Copyright (C) 1999 Harald Koerfgen
+ *  Copyright (C) 2001 Steven Hill (sjhill@realitydiluted.com)
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License. See the file COPYING in the main directory of this archive for
  * more details.
  *
- * Framebuffer for LCD controller in TMPR3912/05 and PR31700 processors
+ *  Framebuffer for LCD controller in TMPR3912/05 and PR31700 processors
  */
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -20,13 +20,15 @@
 #include <linux/init.h>
 #include <linux/pm.h>
 #include <linux/fb.h>
-#include <asm/bootinfo.h>
-#include <asm/uaccess.h>
 #include <video/fbcon.h>
 #include <video/fbcon-mfb.h>
 #include <video/fbcon-cfb2.h>
 #include <video/fbcon-cfb4.h>
 #include <video/fbcon-cfb8.h>
+#include <asm/io.h>
+#include <asm/bootinfo.h>
+#include <asm/uaccess.h>
+#include <asm/tx3912.h>
 #include "tx3912fb.h"
 
 /*
@@ -34,6 +36,9 @@
  */
 static struct fb_info fb_info;
 static struct { u_char red, green, blue, pad; } palette[256];
+#ifdef FBCON_HAS_CFB8
+static union { u16 cfb8[16]; } fbcon_cmap;
+#endif
 static struct display global_disp;
 static int currcon = 0;
 
@@ -343,49 +348,60 @@
  */
 int __init tx3912fb_init(void)
 {
-	/* Stop the video logic when frame completes */
-	VidCtrl1 |= ENFREEZEFRAME;
-	IntClear1 |= INT1_LCDINT;
-	while (!(IntStatus1 & INT1_LCDINT));
-
 	/* Disable the video logic */
-	VidCtrl1 &= ~(ENVID | DISPON);
+	outl(inl(TX3912_VIDEO_CTRL1) &
+		~(TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON),
+		TX3912_VIDEO_CTRL1);
 	udelay(200);
 
 	/* Set start address for DMA transfer */
-	VidCtrl3 = tx3912fb_paddr &
-		(TX3912_VIDCTRL3_VIDBANK_MASK | TX3912_VIDCTRL3_VIDBASEHI_MASK);
+	outl(tx3912fb_paddr, TX3912_VIDEO_CTRL3);
 
 	/* Set end address for DMA transfer */
-	VidCtrl4 = (tx3912fb_paddr + tx3912fb_size + 1) &
-		TX3912_VIDCTRL4_VIDBASELO_MASK;
+	outl((tx3912fb_paddr + tx3912fb_size + 1), TX3912_VIDEO_CTRL4);
 
 	/* Set the pixel depth */
 	switch (tx3912fb_info.bits_per_pixel) {
 	case 1:
 		/* Monochrome */
-		VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
+		outl(inl(TX3912_VIDEO_CTRL1) & ~TX3912_VIDEO_CTRL1_BITSEL_MASK,
+			TX3912_VIDEO_CTRL1);
 		break;
 	case 4:
 		/* 4-bit gray */
-		VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
-		VidCtrl1 |= TX3912_VIDCTRL1_4BIT_GRAY;
+		outl(inl(TX3912_VIDEO_CTRL1) & ~TX3912_VIDEO_CTRL1_BITSEL_MASK,
+			TX3912_VIDEO_CTRL1);
+		outl(inl(TX3912_VIDEO_CTRL1) |
+			TX3912_VIDEO_CTRL1_BITSEL_4BIT_GRAY,
+			TX3912_VIDEO_CTRL1);
 		break;
 	case 8:
 		/* 8-bit color */
-		VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
-		VidCtrl1 |= TX3912_VIDCTRL1_8BIT_COLOR;
+		outl(inl(TX3912_VIDEO_CTRL1) & ~TX3912_VIDEO_CTRL1_BITSEL_MASK,
+			TX3912_VIDEO_CTRL1);
+		outl(inl(TX3912_VIDEO_CTRL1) |
+			TX3912_VIDEO_CTRL1_BITSEL_8BIT_COLOR,
+			TX3912_VIDEO_CTRL1);
 		break;
 	case 2:
 	default:
 		/* 2-bit gray */
-		VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
-		VidCtrl1 |= TX3912_VIDCTRL1_2BIT_GRAY;
+		outl(inl(TX3912_VIDEO_CTRL1) & ~TX3912_VIDEO_CTRL1_BITSEL_MASK,
+			TX3912_VIDEO_CTRL1);
+		outl(inl(TX3912_VIDEO_CTRL1) |
+			TX3912_VIDEO_CTRL1_BITSEL_2BIT_GRAY,
+			TX3912_VIDEO_CTRL1);
 		break;
 	}
 
+	/* Enable the video clock */
+	outl(inl(TX3912_CLK_CTRL) | TX3912_CLK_CTRL_ENVIDCLK,
+		TX3912_CLK_CTRL);
+
 	/* Unfreeze video logic and enable DF toggle */
-	VidCtrl1 &= ~(ENFREEZEFRAME | DFMODE);
+	outl(inl(TX3912_VIDEO_CTRL1) &
+		~(TX3912_VIDEO_CTRL1_ENFREEZEFRAME | TX3912_VIDEO_CTRL1_DFMODE),
+		TX3912_VIDEO_CTRL1);
 	udelay(200);
 
 	/* Clear the framebuffer */
@@ -393,7 +409,9 @@
 	udelay(200);
 
 	/* Enable the video logic */
-	VidCtrl1 |= (DISPON | ENVID);
+	outl(inl(TX3912_VIDEO_CTRL1) |
+		(TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON),
+		TX3912_VIDEO_CTRL1);
 
 	strcpy(fb_info.modename, TX3912FB_NAME);
 	fb_info.changevar = NULL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)