summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2001-04-01 03:22:49 +0000
committerRalf Baechle <ralf@linux-mips.org>2001-04-01 03:22:49 +0000
commit1778efcf9088e8669db1012dbd40fefc9a2bf5bf (patch)
tree352e470581341e11a395486740c8308aca36b96d /drivers
parent06b423060071b0e4f3b0cd4fd4b1e6985a9a8e9a (diff)
Frame buffer for the TX3912.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/Config.in18
-rw-r--r--drivers/video/Makefile1
-rw-r--r--drivers/video/fbmem.c4
-rw-r--r--drivers/video/tx3912fb.c527
-rw-r--r--drivers/video/tx3912fb.h128
5 files changed, 674 insertions, 4 deletions
diff --git a/drivers/video/Config.in b/drivers/video/Config.in
index 95ff6ecfe..2f0533412 100644
--- a/drivers/video/Config.in
+++ b/drivers/video/Config.in
@@ -163,6 +163,9 @@ if [ "$CONFIG_FB" = "y" ]; then
bool ' Maxine (Personal DECstation) onboard framebuffer spport' CONFIG_FB_MAXINE
fi
fi
+ if [ "$CONFIG_NINO" = "y" ]; then
+ bool ' TMPTX3912/PR31700 frame buffer support' CONFIG_FB_TX3912
+ fi
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate ' Virtual Frame Buffer support (ONLY FOR TESTING!)' CONFIG_FB_VIRTUAL
fi
@@ -192,24 +195,28 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \
"$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \
"$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
- "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_CLGEN" = "y" ]; then
+ "$CONFIG_FB_BWTWO" = "y" -o "$CONFIG_FB_CLGEN" = "y" -o \
+ "$CONFIG_FB_TX3912" = "y" ]; then
define_tristate CONFIG_FBCON_MFB y
else
if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \
"$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \
"$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \
"$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
- "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_CLGEN" = "m" ]; then
+ "$CONFIG_FB_BWTWO" = "m" -o "$CONFIG_FB_CLGEN" = "m" -o \
+ "$CONFIG_FB_TX3912" = "m" ]; then
define_tristate CONFIG_FBCON_MFB m
fi
fi
if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
- "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then
+ "$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" -o \
+ "$CONFIG_FB_TX3912" = "y" ]; then
define_tristate CONFIG_FBCON_CFB2 y
define_tristate CONFIG_FBCON_CFB4 y
else
if [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \
- "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+ "$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" -o \
+ "$CONFIG_FB_TX3912" = "m" ]; then
define_tristate CONFIG_FBCON_CFB2 m
define_tristate CONFIG_FBCON_CFB4 m
fi
@@ -231,6 +238,7 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_SA1100" = "y" -o "$CONFIG_FB_3DFX" = "y" -o \
"$CONFIG_FB_PMAG_BA" = "y" -o "$CONFIG_FB_PMAGB_B" = "y" -o \
"$CONFIG_FB_MAXINE" = "y" -o \
+ "$CONFIG_FB_TX3912" = "y" -o \
"$CONFIG_FB_SIS" = "y" ]; then
define_tristate CONFIG_FBCON_CFB8 y
else
@@ -250,6 +258,7 @@ if [ "$CONFIG_FB" = "y" ]; then
"$CONFIG_FB_SGIVW" = "m" -o "$CONFIG_FB_CYBER2000" = "m" -o \
"$CONFIG_FB_PMAG_BA" = "m" -o "CONFIG_FB_PMAGB_B" = "m" -o \
"$CONFIG_FB_MAXINE" = "m" -o \
+ "$CONFIG_FB_TX3912" = "m" -o \
"$CONFIG_FB_SA1100" = "m" -o "$CONFIG_FB_SIS" = "m" ]; then
define_tristate CONFIG_FBCON_CFB8 m
fi
@@ -408,4 +417,5 @@ if [ "$CONFIG_FB" = "y" ]; then
fi
fi
fi
+
endmenu
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 38403b55a..b32670753 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -81,6 +81,7 @@ obj-$(CONFIG_FB_LEO) += leofb.o sbusfb.o
obj-$(CONFIG_FB_PMAG_BA) += pmag-ba-fb.o
obj-$(CONFIG_FB_PMAGB_B) += pmagb-b-fb.o
obj-$(CONFIG_FB_MAXINE) += maxinefb.o
+obj-$(CONFIG_FB_TX3912) += tx3912fb.o
subdir-$(CONFIG_FB_MATROX) += matrox
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index ce0f0aae1..344d439bd 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -121,6 +121,7 @@ extern int pmagbbfb_init(void);
extern int pmagbbfb_setup(char *options, int *ints);
extern void maxinefb_init(void);
extern void maxinefb_setup(char *options, int *ints);
+extern int tx3912fb_init(void);
static struct {
const char *name;
@@ -262,6 +263,9 @@ static struct {
#ifdef CONFIG_FB_HIT
{ "hitfb", hitfb_init, NULL },
#endif
+#ifdef CONFIG_FB_TX3912
+ { "tx3912", tx3912fb_init, NULL },
+#endif
/*
* Generic drivers that don't use resource management (yet)
diff --git a/drivers/video/tx3912fb.c b/drivers/video/tx3912fb.c
new file mode 100644
index 000000000..1686852b3
--- /dev/null
+++ b/drivers/video/tx3912fb.c
@@ -0,0 +1,527 @@
+/*
+ * linux/drivers/video/tx3912fb.c
+ *
+ * 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
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/tty.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#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 "tx3912fb.h"
+
+/*
+ * Frame buffer, palette and console structures
+ */
+static struct fb_info fb_info;
+static struct { u_char red, green, blue, pad; } palette[256];
+static struct display global_disp;
+static int currcon = 0;
+
+/*
+ * Interface used by the world
+ */
+static int tx3912fb_get_fix(struct fb_fix_screeninfo *fix, int con,
+ struct fb_info *info);
+static int tx3912fb_get_var(struct fb_var_screeninfo *var, int con,
+ struct fb_info *info);
+static int tx3912fb_set_var(struct fb_var_screeninfo *var, int con,
+ struct fb_info *info);
+static int tx3912fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
+ struct fb_info *info);
+static int tx3912fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
+ struct fb_info *info);
+static int tx3912fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
+ u_long arg, int con, struct fb_info *info);
+
+/*
+ * Interface used by console driver
+ */
+int tx3912fb_init(void);
+static int tx3912fbcon_switch(int con, struct fb_info *info);
+static int tx3912fbcon_updatevar(int con, struct fb_info *info);
+static void tx3912fbcon_blank(int blank, struct fb_info *info);
+
+/*
+ * Macros
+ */
+#define get_line_length(xres_virtual, bpp) \
+ (u_long) (((int) xres_virtual * (int) bpp + 7) >> 3)
+
+/*
+ * Internal routines
+ */
+static int tx3912fb_getcolreg(u_int regno, u_int *red, u_int *green,
+ u_int *blue, u_int *transp, struct fb_info *info);
+static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+ u_int transp, struct fb_info *info);
+static void tx3912fb_install_cmap(int con, struct fb_info *info);
+
+
+/*
+ * Frame buffer operations structure used by console driver
+ */
+static struct fb_ops tx3912fb_ops = {
+ owner: THIS_MODULE,
+ fb_get_fix: tx3912fb_get_fix,
+ fb_get_var: tx3912fb_get_var,
+ fb_set_var: tx3912fb_set_var,
+ fb_get_cmap: tx3912fb_get_cmap,
+ fb_set_cmap: tx3912fb_set_cmap,
+ fb_ioctl: tx3912fb_ioctl,
+};
+
+
+/*
+ * Get fixed display data
+ */
+static int tx3912fb_get_fix(struct fb_fix_screeninfo *fix, int con,
+ struct fb_info *info)
+{
+ struct display *display;
+
+ memset(fix, 0, sizeof(struct fb_fix_screeninfo));
+ strcpy(fix->id, TX3912FB_NAME);
+
+ if (con == -1)
+ display = &global_disp;
+ else
+ display = &fb_display[con];
+
+ fix->smem_start = tx3912fb_vaddr;
+ fix->smem_len = tx3912fb_size;
+ fix->type = display->type;
+ fix->type_aux = display->type_aux;
+ fix->xpanstep = 0;
+ fix->ypanstep = display->ypanstep;
+ fix->ywrapstep = display->ywrapstep;
+ fix->visual = display->visual;
+ fix->line_length = display->line_length;
+ fix->accel = FB_ACCEL_NONE;
+
+ return 0;
+}
+
+/*
+ * Get user display data
+ */
+static int tx3912fb_get_var(struct fb_var_screeninfo *var, int con,
+ struct fb_info *info)
+{
+ if (con == -1)
+ *var = tx3912fb_info;
+ else
+ *var = fb_display[con].var;
+
+ return 0;
+}
+
+/*
+ * Set user display data
+ */
+static int tx3912fb_set_var(struct fb_var_screeninfo *var, int con,
+ struct fb_info *info)
+{
+ int err, activate = var->activate;
+ int oldxres, oldyres, oldvxres, oldvyres, oldbpp;
+ u_long line_length;
+ struct display *display;
+
+ if (con == -1)
+ display = &global_disp;
+ else
+ display = &fb_display[con];
+
+ /*
+ * FB_VMODE_CONUPDATE and FB_VMODE_SMOOTH_XPAN are equal
+ * as FB_VMODE_SMOOTH_XPAN is only used internally
+ */
+ if (var->vmode & FB_VMODE_CONUPDATE) {
+ var->xoffset = display->var.xoffset;
+ var->yoffset = display->var.yoffset;
+ var->vmode |= FB_VMODE_YWRAP;
+ }
+
+ /*
+ * Make sure values are in range
+ */
+ if (!var->xres)
+ var->xres = 1;
+ if (!var->yres)
+ var->yres = 1;
+ if (var->xres > var->xres_virtual)
+ var->xres_virtual = var->xres;
+ if (var->yres > var->yres_virtual)
+ var->yres_virtual = var->yres;
+ if (var->bits_per_pixel <= 1)
+ var->bits_per_pixel = 1;
+ else if (var->bits_per_pixel <= 2)
+ var->bits_per_pixel = 2;
+ else if (var->bits_per_pixel <= 4)
+ var->bits_per_pixel = 4;
+ else if (var->bits_per_pixel <= 8)
+ var->bits_per_pixel = 8;
+ else
+ return -EINVAL;
+
+ /*
+ * Memory limit
+ */
+ line_length = get_line_length(var->xres_virtual, var->bits_per_pixel);
+ if ((line_length * var->yres_virtual) > tx3912fb_size)
+ return -ENOMEM;
+
+ /*
+ * This is only for color and we only support 8-bit color
+ */
+ if (var->bits_per_pixel) {
+ /* RGB 332 */
+ var->red.offset = 5;
+ var->red.length = 3;
+ var->green.offset = 2;
+ var->green.length = 3;
+ var->blue.offset = 0;
+ var->blue.length = 2;
+ var->transp.offset = 0;
+ var->transp.length = 0;
+ }
+ var->red.msb_right = 0;
+ var->green.msb_right = 0;
+ var->blue.msb_right = 0;
+ var->transp.msb_right = 0;
+
+ /*
+ * Make changes if necessary
+ */
+ if ((activate & FB_ACTIVATE_MASK) == FB_ACTIVATE_NOW) {
+
+ oldxres = display->var.xres;
+ oldyres = display->var.yres;
+ oldvxres = display->var.xres_virtual;
+ oldvyres = display->var.yres_virtual;
+ oldbpp = display->var.bits_per_pixel;
+ display->var = *var;
+
+ if (oldxres != var->xres || oldyres != var->yres ||
+ oldvxres != var->xres_virtual ||
+ oldvyres != var->yres_virtual ||
+ oldbpp != var->bits_per_pixel) {
+
+ display->screen_base = (u_char *) tx3912fb_vaddr;
+
+ switch (var->bits_per_pixel) {
+ case 1:
+ display->visual = FB_VISUAL_MONO10;
+ break;
+ case 2:
+ display->visual = FB_VISUAL_PSEUDOCOLOR;
+ case 4:
+ case 8:
+ display->visual = FB_VISUAL_TRUECOLOR;
+ break;
+ }
+
+ display->type = FB_TYPE_PACKED_PIXELS;
+ display->type_aux = 0;
+ display->ypanstep = 0;
+ display->ywrapstep = 0;
+ display->next_line =
+ display->line_length =
+ get_line_length(var->xres_virtual,
+ var->bits_per_pixel);
+ display->can_soft_blank = 0;
+ display->inverse = FB_IS_INVERSE;
+
+ switch (var->bits_per_pixel) {
+#ifdef CONFIG_FBCON_MFB
+ case 1:
+ display->dispsw = &fbcon_mfb;
+ break;
+#endif
+#ifdef CONFIG_FBCON_CFB2
+ case 2:
+ display->dispsw = &fbcon_cfb2;
+ break;
+#endif
+#ifdef CONFIG_FBCON_CFB4
+ case 4:
+ display->dispsw = &fbcon_cfb4;
+ break;
+#endif
+#ifdef CONFIG_FBCON_CFB8
+ case 8:
+ display->dispsw = &fbcon_cfb8;
+ display->dispsw_data = fbcon_cmap.cfb8;
+ break;
+#endif
+ default:
+ display->dispsw = &fbcon_dummy;
+ break;
+ }
+
+ if (fb_info.changevar)
+ (*fb_info.changevar)(con);
+ }
+
+ if (oldbpp != var->bits_per_pixel) {
+ if ((err = fb_alloc_cmap(&display->cmap, 0, 0)))
+ return err;
+ tx3912fb_install_cmap(con, info);
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * Get the colormap
+ */
+static int tx3912fb_get_cmap(struct fb_cmap *cmap, int kspc, int con,
+ struct fb_info *info)
+{
+ if (con == currcon)
+ return fb_get_cmap(cmap, kspc, tx3912fb_getcolreg, info);
+ else if (fb_display[con].cmap.len) /* non default colormap? */
+ fb_copy_cmap(&fb_display[con].cmap, cmap, kspc ? 0 : 2);
+ else
+ fb_copy_cmap(fb_default_cmap(1<<fb_display[con].var.bits_per_pixel), cmap, kspc ? 0 : 2);
+
+ return 0;
+}
+
+/*
+ * Set the Colormap
+ */
+static int tx3912fb_set_cmap(struct fb_cmap *cmap, int kspc, int con,
+ struct fb_info *info)
+{
+ int err;
+
+ if (!fb_display[con].cmap.len)
+ if ((err = fb_alloc_cmap(&fb_display[con].cmap,
+ 1<<fb_display[con].var.bits_per_pixel, 0)))
+ return err;
+
+ if (con == currcon)
+ return fb_set_cmap(cmap, kspc, tx3912fb_setcolreg, info);
+ else
+ fb_copy_cmap(cmap, &fb_display[con].cmap, kspc ? 0 : 1);
+
+ return 0;
+}
+
+/*
+ * Framebuffer ioctl
+ */
+static int tx3912fb_ioctl(struct inode *inode, struct file *file, u_int cmd,
+ u_long arg, int con, struct fb_info *info)
+{
+ return -EINVAL;
+}
+
+/*
+ * Initialization of the framebuffer
+ */
+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);
+ udelay(200);
+
+ /* Set start address for DMA transfer */
+ VidCtrl3 = tx3912fb_paddr &
+ (TX3912_VIDCTRL3_VIDBANK_MASK | TX3912_VIDCTRL3_VIDBASEHI_MASK);
+
+ /* Set end address for DMA transfer */
+ VidCtrl4 = (tx3912fb_paddr + tx3912fb_size + 1) &
+ TX3912_VIDCTRL4_VIDBASELO_MASK;
+
+ /* Set the pixel depth */
+ switch (tx3912fb_info.bits_per_pixel) {
+ case 1:
+ /* Monochrome */
+ VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
+ break;
+ case 4:
+ /* 4-bit gray */
+ VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
+ VidCtrl1 |= TX3912_VIDCTRL1_4BIT_GRAY;
+ break;
+ case 8:
+ /* 8-bit color */
+ VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
+ VidCtrl1 |= TX3912_VIDCTRL1_8BIT_COLOR;
+ break;
+ case 2:
+ default:
+ /* 2-bit gray */
+ VidCtrl1 &= ~TX3912_VIDCTRL1_BITSEL_MASK;
+ VidCtrl1 |= TX3912_VIDCTRL1_2BIT_GRAY;
+ break;
+ }
+
+ /* Unfreeze video logic and enable DF toggle */
+ VidCtrl1 &= ~(ENFREEZEFRAME | DFMODE);
+ udelay(200);
+
+ /* Clear the framebuffer */
+ memset((void *) tx3912fb_vaddr, 0xff, tx3912fb_size);
+ udelay(200);
+
+ /* Enable the video logic */
+ VidCtrl1 |= (DISPON | ENVID);
+
+ strcpy(fb_info.modename, TX3912FB_NAME);
+ fb_info.changevar = NULL;
+ fb_info.node = -1;
+ fb_info.fbops = &tx3912fb_ops;
+ fb_info.disp = &global_disp;
+ fb_info.switch_con = &tx3912fbcon_switch;
+ fb_info.updatevar = &tx3912fbcon_updatevar;
+ fb_info.blank = &tx3912fbcon_blank;
+ fb_info.flags = FBINFO_FLAG_DEFAULT;
+
+ tx3912fb_set_var(&tx3912fb_info, -1, &fb_info);
+
+ if (register_framebuffer(&fb_info) < 0)
+ return -1;
+
+ printk (KERN_INFO "fb%d: TX3912 frame buffer using %uKB.\n",
+ GET_FB_IDX(fb_info.node), (u_int) (tx3912fb_size >> 10));
+
+ return 0;
+}
+
+/*
+ * Switch the console to be the framebuffer
+ */
+static int tx3912fbcon_switch(int con, struct fb_info *info)
+{
+ /* Save off the color map if needed */
+ if (fb_display[currcon].cmap.len)
+ fb_get_cmap(&fb_display[currcon].cmap, 1,
+ tx3912fb_getcolreg, info);
+
+ /* Make the switch */
+ currcon = con;
+
+ /* Install new colormap */
+ tx3912fb_install_cmap(con, info);
+
+ return 0;
+}
+
+/*
+ * Update variable structure
+ */
+static int tx3912fbcon_updatevar(int con, struct fb_info *info)
+{
+ /* Nothing */
+ return 0;
+}
+
+/*
+ * Blank the display
+ */
+static void tx3912fbcon_blank(int blank, struct fb_info *info)
+{
+ /* FIXME */
+ printk("tx3912fbcon_blank\n");
+}
+
+/*
+ * Read a single color register
+ */
+static int tx3912fb_getcolreg(u_int regno, u_int *red, u_int *green,
+ u_int *blue, u_int *transp, struct fb_info *info)
+{
+ if (regno > 255)
+ return 1;
+
+#if FB_IS_GREY
+ {
+ u_int grey;
+
+ grey = regno * 255 / 15;
+
+#if FB_IS_INVERSE
+ grey ^= 255;
+#endif
+ grey |= grey << 8;
+ *red = grey;
+ *green = grey;
+ *blue = grey;
+ }
+#else
+ *red = (palette[regno].red<<8) | palette[regno].red;
+ *green = (palette[regno].green<<8) | palette[regno].green;
+ *blue = (palette[regno].blue<<8) | palette[regno].blue;
+#endif
+ *transp = 0;
+
+ return 0;
+}
+
+/*
+ * Set a single color register
+ */
+static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+ u_int transp, struct fb_info *info)
+{
+ if (regno > 255)
+ return 1;
+
+#ifdef FBCON_HAS_CFB8
+ if( regno < 16 )
+ fbcon_cmap.cfb8[regno] = ((red & 0xe000) >> 8)
+ | ((green & 0xe000) >> 11)
+ | ((blue & 0xc000) >> 14);
+#endif
+
+ red >>= 8;
+ green >>= 8;
+ blue >>= 8;
+ palette[regno].red = red;
+ palette[regno].green = green;
+ palette[regno].blue = blue;
+
+ return 0;
+}
+
+/*
+ * Install the color map
+ */
+static void tx3912fb_install_cmap(int con, struct fb_info *info)
+{
+ if (con != currcon)
+ return;
+
+ if (fb_display[con].cmap.len)
+ fb_set_cmap(&fb_display[con].cmap, 1, tx3912fb_setcolreg, info);
+ else
+ fb_set_cmap(fb_default_cmap(1 << fb_display[con].var.bits_per_pixel), 1, tx3912fb_setcolreg, info);
+}
diff --git a/drivers/video/tx3912fb.h b/drivers/video/tx3912fb.h
new file mode 100644
index 000000000..09d7dd082
--- /dev/null
+++ b/drivers/video/tx3912fb.h
@@ -0,0 +1,128 @@
+/*
+ * linux/drivers/video/tx3912fb.h
+ *
+ * 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.
+ *
+ * Includes for TMPR3912/05 and PR31700 LCD controller registers
+ */
+#include <asm/tx3912.h>
+
+#define VidCtrl1 REG_AT(0x028)
+#define VidCtrl2 REG_AT(0x02C)
+#define VidCtrl3 REG_AT(0x030)
+#define VidCtrl4 REG_AT(0x034)
+#define VidCtrl5 REG_AT(0x038)
+#define VidCtrl6 REG_AT(0x03C)
+#define VidCtrl7 REG_AT(0x040)
+#define VidCtrl8 REG_AT(0x044)
+#define VidCtrl9 REG_AT(0x048)
+#define VidCtrl10 REG_AT(0x04C)
+#define VidCtrl11 REG_AT(0x050)
+#define VidCtrl12 REG_AT(0x054)
+#define VidCtrl13 REG_AT(0x058)
+#define VidCtrl14 REG_AT(0x05C)
+
+/* Video Control 1 Register */
+#define LINECNT 0xffc00000
+#define LINECNT_SHIFT 22
+#define LOADDLY BIT(21)
+#define BAUDVAL (BIT(20) | BIT(19) | BIT(18) | BIT(17) | BIT(16))
+#define BAUDVAL_SHIFT 16
+#define VIDDONEVAL (BIT(15) | BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10) | BIT(9))
+#define VIDDONEVAL_SHIFT 9
+#define ENFREEZEFRAME BIT(8)
+#define TX3912_VIDCTRL1_BITSEL_MASK 0x000000c0
+#define TX3912_VIDCTRL1_2BIT_GRAY 0x00000040
+#define TX3912_VIDCTRL1_4BIT_GRAY 0x00000080
+#define TX3912_VIDCTRL1_8BIT_COLOR 0x000000c0
+#define BITSEL_SHIFT 6
+#define DISPSPLIT BIT(5)
+#define DISP8 BIT(4)
+#define DFMODE BIT(3)
+#define INVVID BIT(2)
+#define DISPON BIT(1)
+#define ENVID BIT(0)
+
+/* Video Control 2 Register */
+#define VIDRATE_MASK 0xffc00000
+#define VIDRATE_SHIFT 22
+#define HORZVAL_MASK 0x001ff000
+#define HORZVAL_SHIFT 12
+#define LINEVAL_MASK 0x000001ff
+
+/* Video Control 3 Register */
+#define TX3912_VIDCTRL3_VIDBANK_MASK 0xfff00000
+#define TX3912_VIDCTRL3_VIDBASEHI_MASK 0x000ffff0
+
+/* Video Control 4 Register */
+#define TX3912_VIDCTRL4_VIDBASELO_MASK 0x000ffff0
+
+
+/*
+ * Begin platform specific configurations
+ */
+#if defined(CONFIG_NINO_4MB) || defined(CONFIG_NINO_8MB)
+#define FB_X_RES 240
+#define FB_Y_RES 320
+#if defined(CONFIG_FBCON_CFB4)
+#define FB_BPP 4
+#else
+#if defined(CONFIG_FBCON_CFB2)
+#define FB_BPP 2
+#else
+#define FB_BPP 1
+#endif
+#endif
+#define FB_IS_GREY 1
+#define FB_IS_INVERSE 0
+#endif
+
+#ifdef CONFIG_NINO_16MB
+#define FB_X_RES 240
+#define FB_Y_RES 320
+#define FB_BPP 8
+#define FB_IS_GREY 0
+#define FB_IS_INVERSE 0
+#endif
+
+/*
+ * Define virtual resolutions if necessary
+ */
+#ifndef FB_X_VIRTUAL_RES
+#define FB_X_VIRTUAL_RES FB_X_RES
+#endif
+#ifndef FB_Y_VIRTUAL_RES
+#define FB_Y_VIRTUAL_RES FB_Y_RES
+#endif
+
+/*
+ * Framebuffer address and size
+ */
+u_long tx3912fb_paddr = 0;
+u_long tx3912fb_vaddr = 0;
+u_long tx3912fb_size = (FB_X_RES * FB_Y_RES * FB_BPP / 8);
+
+/*
+ * Framebuffer info structure
+ */
+static struct fb_var_screeninfo tx3912fb_info = {
+ FB_X_RES, FB_Y_RES,
+ FB_X_VIRTUAL_RES, FB_Y_VIRTUAL_RES,
+ 0, 0,
+ FB_BPP, FB_IS_GREY,
+ {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0},
+ 0, FB_ACTIVATE_NOW,
+ -1, -1, 0, 20000,
+ 64, 64, 32, 32, 64, 2,
+ 0, FB_VMODE_NONINTERLACED,
+ {0,0,0,0,0,0}
+};
+
+/*
+ * Framebuffer name
+ */
+static char TX3912FB_NAME[16] = "tx3912fb";