Subject: Re: au1100fb.c

From: Karl Lessard <[email-masked]> (by way of Karl Lessard <[email-masked]>)
Date: Thu, 2 Dec 2004 10:43:30 -0500

Hi Jørg,

I've modified it a little bit since I've post it on the list, so here's the
.c/.h files I use now, and a patch that should also apply. This should work 
with current linux-mips cvs (actually it do on a 22/11/04 snapshot).

I've never tested it on other boards that the pb1100 though. Also, I use the
same scheme as in Linux 2.4, i.e. panels supported are declared in au1100fb.h.

I hope this will work for you, and don't hesitate to interrupt me if you have
any questions/problems. We personnally decided to work with a different 
graphic chip, so I probably don't need your version of the driver but thanks 
for offering it!

Regards,
Karl

Jørg Ulrich Hansen wrote:

Hi Karl

Sorry to disturb you, but I can see that you have a framebuffer for au1100
for Linux 2.6.
I have also done the same work but I have some problems with nano-X that I
belive is the framebuffers fault.

Your patch that I found on the list I am having problems with to apply.

Do you mind to send me your version of the framebuffer either directly or to
the list.

If you are interrested you can have my version of au1100fb.c/h as well.

Kind regards Jorg

--------------<<<<<<<<<OOOOOOOO>>>>>>>>>--------------
Jorg Hansen               email: [email-masked]
Hansen Telecom            Tel: +45 7342 0220
Ellegaardvej 36           Fax: +45 7342 0221
6400 Sonderborg           Mob: +45 2819 1969
Denmark                   http://www.hansen-telecom.dk

Modules for rapid design of mechatronic products
       http://www.mechatronicbrick.dk
--------------<<<<<<<<<OOOOOOOO>>>>>>>>>--------------

--- drivers/video/Makefile	Wed Dec  1 15:02:33 2004
+++ drivers/video/Makefile.patched	Wed Dec  1 15:01:53 2004
@@ -94,7 +94,7 @@
 obj-$(CONFIG_FB_PMAGB_B)	  += pmagb-b-fb.o  cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_MAXINE)		  += maxinefb.o  cfbfillrect.o cfbcopyarea.o cfbimgblt.o
 obj-$(CONFIG_FB_TX3912)		  += tx3912fb.o  cfbfillrect.o cfbcopyarea.o cfbimgblt.o
-obj-$(CONFIG_FB_AU1100)		  += au1100fb.o fbgen.o
+obj-$(CONFIG_FB_AU1100)		  += au1100fb.o cfbfillrect.o cfbcopyarea.o cfbimgblt.o

 # Platform or fallback drivers go here
--- drivers/video/Kconfig	Wed Dec  1 15:02:33 2004
+++ drivers/video/Kconfig.patched	Wed Dec  1 15:01:53 2004
@@ -970,6 +978,10 @@
 config PB1500_TFT
 	prompt "Use TFT Panel on Pb1100 "
 	depends on FB_E1356 && MIPS_PB1100=y
+
+config FB_AU1100
+	bool "Au1100 LCD Driver"
+	depends on FB && MIPS && MIPS_PB1100=y
 
 config FB_SBUS
 	bool "SBUS and UPA framebuffers"
--- arch/mips/au1000/common/platform.c	Wed Dec  1 14:35:16 2004
+++ arch/mips/au1000/common/platform.c.patched	Wed Dec  1 14:37:45 2004
@@ -58,10 +58,39 @@
 	.resource	= au1xxx_usb_ohci_resources,
 };
 
+/*** AU1100 LCD controller ***/
+
+static struct resource au1100_lcd_resources[] = {
+	[0] = {
+		.start		= AU1100_LCD_BASE,
+		.end		= AU1100_LCD_BASE + AU1100_LCD_LEN - 1,
+		.flags		= IORESOURCE_MEM,
+	},
+	[1] = {
+		.start		= AU1100_LCD_INT,
+		.end		= AU1100_LCD_INT,
+		.flags		= IORESOURCE_IRQ,
+	}
+};
+
+static u64 au1100_lcd_dmamask = ~(u32)0;
+
+static struct platform_device au1100_lcd_device = {
+	.name		= "au1100-lcd",
+	.id		= 0,
+	.dev = {
+		.dma_mask		= &au1100_lcd_dmamask,
+		.coherent_dma_mask	= 0xffffffff,
+	},
+	.num_resources  = ARRAY_SIZE(au1100_lcd_resources),
+	.resource       = au1100_lcd_resources,
+};
+
 /*-------------------------------------------------------------------------*/
 
 static struct platform_device *au1xxx_platform_devices[] __initdata = {
 	&au1xxx_usb_ohci_device,
+	&au1100_lcd_device,
 };
 
 int au1xxx_platform_init(void)
diff -u -r1.11 au1000.h
--- include/asm-mips/mach-au1x00/au1000.h	23 Sep 2004 06:06:50 -0000	1.11
+++ include/asm-mips/mach-au1x00/au1000.h	28 Oct 2004 15:11:37 -0000
@@ -494,6 +494,9 @@
 #define AU1100_ETH0_BASE	  0xB0500000
 #define AU1100_MAC0_ENABLE       0xB0520000
 #define NUM_ETH_INTERFACES 1
+
+#define AU1100_LCD_BASE           0x15000000
+#define AU1100_LCD_LEN            0x00000800
 #endif // CONFIG_SOC_AU1100
 
 #ifdef CONFIG_SOC_AU1550
@@ -1237,6 +1240,12 @@
   #define SYS_CS_MI2_MASK           (0x7<<SYS_CS_MI2_BIT)
   #define SYS_CS_DI2                (1<<16)
   #define SYS_CS_CI2                (1<<15)
+#ifdef CONFIG_SOC_AU1100
+  #define SYS_CS_ML_BIT             7
+  #define SYS_CS_ML_MASK            (0x7<<SYS_CS_ML_BIT)
+  #define SYS_CS_DL                 (1<<6)
+  #define SYS_CS_CL                 (1<<5)
+#else
   #define SYS_CS_MUH_BIT            12
   #define SYS_CS_MUH_MASK           (0x7<<SYS_CS_MUH_BIT)
   #define SYS_CS_DUH                (1<<11)
@@ -1245,6 +1254,7 @@
   #define SYS_CS_MUD_MASK           (0x7<<SYS_CS_MUD_BIT)
   #define SYS_CS_DUD                (1<<6)
   #define SYS_CS_CUD                (1<<5)
+#endif
   #define SYS_CS_MIR_BIT            2
   #define SYS_CS_MIR_MASK           (0x7<<SYS_CS_MIR_BIT)
   #define SYS_CS_DIR                (1<<1)
Index: include/asm/mach-pb1x00/pb1100.h
===================================================================
RCS file: /home/cvs/linux/include/asm-mips/mach-pb1x00/pb1100.h,v
retrieving revision 1.1
diff -u -r1.1 pb1100.h
--- include/asm/mach-pb1x00/pb1100.h	13 Jan 2004 08:09:22 -0000	1.1
+++ include/asm/mach-pb1x00/pb1100.h	2 Dec 2004 15:22:51 -0000
@@ -45,6 +45,21 @@
   #define PB1100_RS232_DSR        (1<<1)
   #define PB1100_RS232_RI         (1<<0)
 
+#define BCSR_SWITCHES_REG     0xAE000008
+  #define BCSR_SWITCHES_DIP_BIT   0
+  #define BCSR_SWITCHES_DIP_MASK  (0xFF<<BCSR_SWITCHES_DIP_BIT)
+  #define BCSR_SWITCHES_DIP_1	  (1<<7)
+  #define BCSR_SWITCHES_DIP_2	  (1<<6)
+  #define BCSR_SWITCHES_DIP_3	  (1<<5)
+  #define BCSR_SWITCHES_DIP_4	  (1<<4)
+  #define BCSR_SWITCHES_DIP_5	  (1<<3)
+  #define BCSR_SWITCHES_DIP_6	  (1<<2)
+  #define BCSR_SWITCHES_DIP_7     (1<<1)
+  #define BCSR_SWITCHES_DIP_8     (1<<0)
+  #define BCSR_SWITCHES_ROTARY_BIT 8
+  #define BCSR_SWITCHES_ROTARY_MASK (0xF<<BCSR_SWITCHES_ROTARY_BIT)
+  #define BCSR_SWITCHES_DOC_LOCK  (1<<15)
+
 #define PB1100_IRDA_RS232     0xAE00000C
   #define PB1100_IRDA_FULL       (0<<14) /* full power */
   #define PB1100_IRDA_SHUTDOWN   (1<<14)
@@ -63,6 +78,11 @@
   #define PC_DRV_EN               (1<<4)
 
 #define PB1100_G_CONTROL      0xAE000014 /* graphics control */
+  #define PB1100_G_CONTROL_RST	  (1<<7)
+  #define PB1100_G_CONTROL_BE 	  (1<<5)
+  #define PB1100_G_CONTROL_SM_PASS (1<<4)
+  #define PB1100_G_CONTROL_BL	  (1<<2)
+  #define PB1100_G_CONTROL_VDD	  (1<<1)
 
 #define PB1100_RST_VDDI       0xAE00001C
   #define PB1100_SOFT_RESET      (1<<15) /* clear to reset the board */