[Commit] mq1100 mq1100fb.c,NONE,1.1 Makefile,1.1.1.1,1.2 mq1100.h,1.1.1.1,1.2 mqinit.c,1.1.1.1,1.2

Keith Packard commit@keithp.com
Fri, 09 May 2003 19:26:21 -0700


Committed by: keithp

Update of /local/src/CVS/mq1100
In directory home.keithp.com:/tmp/cvs-serv20254

Modified Files:
	Makefile mq1100.h mqinit.c 
Added Files:
	mq1100fb.c 
Log Message:
Build a fbdev driver

--- NEW FILE: mq1100fb.c ---
(This appears to be a binary file; contents omitted.)

Index: Makefile
===================================================================
RCS file: /local/src/CVS/mq1100/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- Makefile	8 May 2003 21:58:36 -0000	1.1.1.1
+++ Makefile	10 May 2003 02:26:19 -0000	1.2
@@ -1,8 +1,23 @@
-CFLAGS=-g
-OBJS=mq.o mqinit.o
+CDEBUGFLAGS=-g -O2
+DFLAGS=-D__KERNEL__ -DMODULE
+IFLAGS=-I/usr/src/linux/include
+WFLAGS=-Wall -Wstrict-prototypes -Wno-trigraphs 
+FFLAGS=-fno-strict-aliasing -fno-common -fomit-frame-pointer
+MFLAGS=-mpreferred-stack-boundary=2 -march=i586
+CFLAGS=$(CDEBUGFLAGS) $(DFLAGS) $(IFLAGS) $(WFLAGS) $(FFLAGS) $(MFLAGS)
+OBJS=mq1100fb.o mqinit.o
+MODULE=mq.o
+VERSION=2.4.20
+DEST=/lib/modules/$(VERSION)/kernel/drivers/video
 
-mq: $(OBJS)
-	$(CC) $(CFLAGS) -o $@ $(OBJS)
+$(MODULE): $(OBJS)
+	ld -m elf_i386 -r -o $@ $(OBJS)
 
 $(OBJS): mq1100.h
 
+install: $(MODULE) $(DEST)
+	cp $(MODULE) $(DEST)
+	depmod -e -a
+
+$(DEST):
+	mkdir -p $(DEST)

Index: mq1100.h
===================================================================
RCS file: /local/src/CVS/mq1100/mq1100.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- mq1100.h	8 May 2003 21:58:36 -0000	1.1.1.1
+++ mq1100.h	10 May 2003 02:26:19 -0000	1.2
@@ -25,7 +25,32 @@
 #ifndef _MQ1100_H_
 #define _MQ1100_H_
 
-#include <endian.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/mm.h>
+#include <linux/tty.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+
+#include <video/fbcon.h>
+#include <video/fbcon-cfb16.h>
+
+#ifndef MQ1100FB_DEBUG
+#define MQ1100FB_DEBUG 1
+#endif
+
+#if MQ1100FB_DEBUG
+#define debug(f,a...)	printk("%s:" f,  __FUNCTION__ , ## a)
+#else
+#define debug(f,a...)
+#endif
+
+#define output(f, a...) printk("mq1100fb: " f, ## a)
 
 typedef unsigned char	mq8;
 typedef unsigned short	mq16;
@@ -577,6 +602,9 @@
     } USBDevice;
 } MqReg;
 
+#define MQ1100_REG_SIZE	(8*1024)
+#define MQ1100_FB_SIZE	(256*1024)
+
 /*
  * Instead of attempting to figure out how to program this device,
  * just use canned values for the known display types.
@@ -615,5 +643,14 @@
 
 #define MqTrue	1
 #define MqFalse	0
+
+extern MqInitData   mqInitSharp;
+extern MqInitData   mqInitH5400;
+
+MqBool
+MqPowerGC (MqMap *mq, MqBool on);
+
+MqBool
+MqInit (MqMap *mq, MqInitData *md);
 
 #endif /* _MQ1100_H_ */

Index: mqinit.c
===================================================================
RCS file: /local/src/CVS/mq1100/mqinit.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- mqinit.c	8 May 2003 21:58:36 -0000	1.1.1.1
+++ mqinit.c	10 May 2003 02:26:19 -0000	1.2
@@ -282,19 +282,146 @@
     },
 };
 
+MqInitData  mqInitH5400 = {
+    /* DC */
+    {
+	/* dc00 */		0x00000001,
+	/* dc01 */		0x00000003,
+	/* dc02 */		0x00000001,
+	/* dc03 NOT SET */	0x0,
+	/* dc04 */		0x00000004,
+	/* dc05 */		0x00000003,
+    },
+    /* CC */
+    {
+	/* cc00 */		0x00000000,
+	/* cc01 */		0x00001010,
+	/* cc02 */		0x00000a22,
+    },
+    /* MIU */
+    {
+	/* mm00 */		0x00000001,
+	/* mm01 */		0x1b676ca8,
+    },
+    /* GC */
+    {
+	/* gc00 */		0x051100c8, /* powered down */
+	/* gc01 */		0x00000000,
+	/* gc02 */		0x00f8013b,
+	/* gc03 */		0x013f0150,
+	/* gc04 */		0x01370132,
+	/* gc05 */		0x01510150,
+	/* gc06 */		0x00000000,
+	/* gc07 NOT SET */	0x0,
+	/* gc08 */		0x00ef0000,
+	/* gc09 */		0x013f0000,
+	/* gc0a */		0x00000000,
+	/* gc0b */		0x006e0037,
+	/* gc0c */		0x00000000,
+	/* gc0d */		0x00066373,
+	/* gc0e */		0x000001e0,
+	/* gc0f NOT SET */	0x0,
+	/* gc10 NOT SET */	0x0,
+	/* gc11 NOT SET */	0x0,
+	/* gc12 NOT SET */	0x0,
+	/* gc13 NOT SET */	0x0,
+	/* gc14 NOT SET */	0x0,
+	/* gc15 NOT SET */	0x0,
+	/* gc16 NOT SET */	0x0,
+	/* gc17 NOT SET */	0x0,
+	/* gc18 NOT SET */	0x0,
+	/* gc19 NOT SET */	0x0,
+	/* gc1a */		0x00000000,
+    },
+    /* FP */
+    {
+	/* fp00 */		0x00006120,
+	/* fp01 */		0x00bcc02c,
+	/* fp02 */		0xfffcfcfd,
+	/* fp03 */		0x00000002,
+	/* fp04 */		0x80bd0001,
+	/* fp05 */		0xc3000000,
+	/* fp06 */		0xa0000000,
+	/* fp07 */		0x00000000,
+	/* fp08 NOT SET */	0x0,
+	/* fp09 NOT SET */	0x0,
+	/* fp0a */		0x00000000,
+	/* fp0b */		0x00000000,
+	/* fp0c NOT SET */	0x0,
+	/* fp0d NOT SET */	0x0,
+	/* fp0e NOT SET */	0x0,
+	/* fp0f NOT SET */	0x0,
+	/* fp10 */		0x2765a257,
+	/* fp11 */		0x19c1d898,
+	/* fp12 */		0xd2f5b8cc,
+	/* fp13 */		0x611785ff,
+	/* fp14 */		0xbd9d2ec5,
+	/* fp15 */		0xff928b26,
+	/* fp16 */		0x4848ee2a,
+	/* fp17 */		0x6b6da932,
+	/* fp18 */		0xf2d24077,
+	/* fp19 */		0xdd4723de,
+	/* fp1a */		0x350724f4,
+	/* fp1b */		0x3cef467c,
+	/* fp1c */		0x26e3db53,
+	/* fp1d */		0x3c2d710,
+	/* fp1e */		0xb7f7f7d9,
+	/* fp1f */		0x1894640a,
+	/* fp20 */		0x2765a257,
+	/* fp21 */		0x19fdd8bc,
+	/* fp22 */		0xfffdfcfd,
+	/* fp23 */		0x611785ff,
+	/* fp24 */		0xbdbd2ec5,
+	/* fp25 */		0xff928b26,
+	/* fp26 */		0xe848ee2a,
+	/* fp27 */		0x6b6da937,
+	/* fp28 */		0xf2d64077,
+	/* fp29 */		0xffffffff,
+	/* fp2a */		0x350724f4,
+	/* fp2b */		0x3cef467c,
+	/* fp2c */		0x26e3db53,
+	/* fp2d */		0x3c2d710,
+	/* fp2e */		0xb7f7f7d9,
+	/* fp2f */		0x1894f62a,
+	/* fp30 */		0xfbbbfc5b,
+	/* fp31 */		0xfd6779c3,
+	/* fp32 */		0xdfffb7ba,
+	/* fp33 */		0x8c245cf1,
+	/* fp34 */		0x37d671f2,
+	/* fp35 */		0x7af04b8d,
+	/* fp36 */		0x7acb011d,
+	/* fp37 */		0xa21ec1e6,
+    },
+    /* GE */
+    {
+	/* ge00 NOT SET */	0x0,
+	/* ge01 NOT SET */	0x0,
+	/* ge02 NOT SET */	0x0,
+	/* ge03 NOT SET */	0x0,
+	/* ge04 NOT SET */	0x0,
+	/* ge05 NOT SET */	0x0,
+	/* ge06 NOT SET */	0x0,
+	/* ge07 NOT SET */	0x0,
+	/* ge08 NOT SET */	0x0,
+	/* ge09 NOT SET */	0x0,
+	/* ge0a */		0x40000280,
+	/* ge0b */		0x00000000,
+    },
+};
+
 static MqBool
 MqLoad (char *name, volatile mq32 *reg, mq32 *src, mq32 *valid, int n)
 {
     int	t;
 
-    printf ("Load %s\n", name);
+    output ("Load %s\n", name);
     for (t = 0; t < n; t++)
 	if (valid[t] & MQ_INIT_SET)
 	{
 	    reg[t] = src[t];
-	    printf ("\t%s%02x: %08x\n", name, t, reg[t]);
+	    output ("%s%02x: %08x\n", name, t, reg[t]);
 	    if (reg[t] != src[t])
-		printf ("Check   %s%02x: set %08x got %08x\n", name, t, src[t], reg[t]);
+		output ("Check   %s%02x: set %08x got %08x\n", name, t, src[t], reg[t]);
 	}
     return MqTrue;
 }
@@ -305,7 +432,9 @@
 static MqBool
 MqInitDC (MqMap *mq, MqInitData *md)
 {
+#if 0
     mq32    v;
+#endif
     
     MqLoad ("dc", mq->reg->DC.a, md->dc, mqInitValid.dc, count (md->dc));
 
@@ -325,13 +454,16 @@
 /*
  * CPU Control (CC) module
  */
-MqBool
+static MqBool
 MqInitCC (MqMap *mq, MqInitData *md)
 {
     return MqLoad ("cc", mq->reg->CC.a, md->cc, mqInitValid.cc, count (md->cc));
 }
 
-MqBool
+/*
+ * Interrupt controller (IC) module
+ */
+static MqBool
 MqInitIC (MqMap *mq, MqInitData *md)
 {
 #if 0
@@ -341,9 +473,13 @@
     mq->reg->IC.s.global_interrupt_control = 0;
     mq->reg->IC.s.interrupt_mask = 0;
 #endif
+    return MqTrue;
 }
 
-void
+/*
+ * draw a line
+ */
+static void
 MqLine (mq16 *base, int step, mq16 value, int len)
 {
     while (len--)
@@ -353,7 +489,10 @@
     }
 }
 
-void
+/*
+ * Dump an ascii representation of the frame buffer
+ */
+static void
 MqShow (mq16 *base, int stride, int width, int height)
 {
     int	x, y;
@@ -363,15 +502,18 @@
 	for (x = 0; x < width; x++)
 	{
 	    if (base[y*stride+x])
-		printf ("*");
+		printk ("*");
 	    else
-		printf (" ");
+		printk (" ");
 	}
-	printf ("\n");
+	printk ("\n");
     }
 }
 
-MqBool
+/*
+ * Memory Interface Unit (MIU)
+ */
+static MqBool
 MqInitMIU (MqMap *mq, MqInitData *md)
 {
     if (!MqLoad ("mm", mq->reg->MIU.a, md->miu, mqInitValid.miu, count (md->miu)))
@@ -382,7 +524,10 @@
     return MqTrue;
 }
 
-MqBool
+/*
+ * Graphics Controller (GC)
+ */
+static MqBool
 MqInitGC (MqMap *mq, MqInitData *md)
 {
     return MqLoad ("gc", mq->reg->GC.a, md->gc, mqInitValid.gc, count (md->gc));
@@ -393,32 +538,36 @@
  * and flat panel interface
  */
 MqBool
-MqPowerGC (MqMap *mq, MqInitData *md)
+MqPowerGC (MqMap *mq, MqBool on)
 {
-    mq->reg->GC.s.control = md->gc[0] | MQ_GC_CONTROL_ENABLE;
-    printf ("Power up GC %08x\n", mq->reg->GC.s.control);
+    mq32    v = mq->reg->GC.s.control;
+    
+    if (on)
+	v |= MQ_GC_CONTROL_ENABLE;
+    else
+	v &= ~MQ_GC_CONTROL_ENABLE;
+    mq->reg->GC.s.control = v;
+    return MqTrue;
 }
 
 /*
  * Flat Panel Interface (FP)
  */
-MqBool
+static MqBool
 MqInitFP (MqMap *mq, MqInitData *md)
 {
     return MqLoad ("fp", mq->reg->FP.a, md->fp, mqInitValid.fp, count (md->fp));
 }
 
-MqBool
+static MqBool
 MqInitGE (MqMap *mq, MqInitData *md)
 {
     return MqLoad ("ge", mq->reg->GE.a, md->ge, mqInitValid.ge, count (md->ge));
 }
 
 MqBool
-MqInit (MqMap *mq)
+MqInit (MqMap *mq, MqInitData *md)
 {
-    MqInitData	*md = &mqInitSharp;
-
     if (!MqInitDC (mq, md))
 	return MqFalse;
     if (!MqInitCC (mq, md))