Index: linux-2.6.12/arch/arm/mach-pxa/generic.c
===================================================================
--- linux-2.6.12.orig/arch/arm/mach-pxa/generic.c	2005-08-12 12:05:36.000000000 +0100
+++ linux-2.6.12/arch/arm/mach-pxa/generic.c	2005-08-12 12:05:45.000000000 +0100
@@ -196,7 +196,7 @@
 
 static u64 fb_dma_mask = ~(u64)0;
 
-static struct platform_device pxafb_device = {
+struct platform_device pxafb_device = {
 	.name		= "pxa2xx-fb",
 	.id		= -1,
 	.dev		= {
Index: linux-2.6.12/drivers/input/touchscreen/corgi_ts.c
===================================================================
--- linux-2.6.12.orig/drivers/input/touchscreen/corgi_ts.c	2005-08-12 12:05:27.000000000 +0100
+++ linux-2.6.12/drivers/input/touchscreen/corgi_ts.c	2005-08-13 22:54:24.000000000 +0100
@@ -1,5 +1,5 @@
 /*
- *  Touchscreen driver for Sharp Corgi models (SL-C7xx)
+ *  Touchscreen driver for Sharp SL-C7xx and SL-Cx000 models
  *
  *  Copyright (c) 2004-2005 Richard Purdie
  *
@@ -47,15 +47,20 @@
 	struct ts_event tc;
 	int pendown;
 	int power_mode;
+	int irq;
 };
 
-#define STATUS_HSYNC		(GPLR(CORGI_GPIO_HSYNC) & GPIO_bit(CORGI_GPIO_HSYNC))
-
-#define SyncHS()	while((STATUS_HSYNC) == 0); while((STATUS_HSYNC) != 0);
+#define SyncHS()	corgi_wait_hsync();
+#ifdef CONFIG_PXA25x
 #define CCNT(a)		asm volatile ("mrc p14, 0, %0, C1, C0, 0" : "=r"(a))
 #define PMNC_GET(x)	asm volatile ("mrc p14, 0, %0, C0, C0, 0" : "=r"(x))
 #define PMNC_SET(x)	asm volatile ("mcr p14, 0, %0, C0, C0, 0" : : "r"(x))
-
+#endif
+#ifdef CONFIG_PXA27x
+#define CCNT(a)		asm volatile ("mrc p14, 0, %0, C1, C1, 0" : "=r"(a))
+#define PMNC_GET(x)	asm volatile ("mrc p14, 0, %0, C0, C1, 0" : "=r"(x))
+#define PMNC_SET(x)	asm volatile ("mcr p14, 0, %0, C0, C1, 0" : : "r"(x))
+#endif
 
 /* ADS7846 Touch Screen Controller bit definitions */
 #define ADSCTRL_PD0		(1u << 0)	/* PD0 */
@@ -66,12 +71,11 @@
 #define ADSCTRL_STS		(1u << 7)	/* Start Bit */
 
 /* External Functions */
-extern unsigned long w100fb_get_hsynclen(struct device *dev);
 extern unsigned int get_clk_frequency_khz(int info);
 
 static unsigned long calc_waittime(void)
 {
-	unsigned long hsync_len = w100fb_get_hsynclen(&corgifb_device.dev);
+	unsigned long hsync_len = corgi_get_hsync_len();
 
 	if (hsync_len)
 		return get_clk_frequency_khz(0)*1000/hsync_len;
@@ -189,9 +193,9 @@
 
 static void ts_interrupt_main(struct corgi_ts *corgi_ts, int isTimer, struct pt_regs *regs)
 {
-	if ((GPLR(CORGI_GPIO_TP_INT) & GPIO_bit(CORGI_GPIO_TP_INT)) == 0) {
+	if ((GPLR(corgi_ts->irq) & GPIO_bit(corgi_ts->irq)) == 0) {
 		/* Disable Interrupt */
-		set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_NOEDGE);
+		set_irq_type(IRQ_GPIO(corgi_ts->irq), IRQT_NOEDGE);
 		if (read_xydata(corgi_ts)) {
 			corgi_ts->pendown = 1;
 			new_data(corgi_ts, regs);
@@ -210,7 +214,7 @@
 		}
 
 		/* Enable Falling Edge */
-		set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_FALLING);
+		set_irq_type(IRQ_GPIO(corgi_ts->irq), IRQT_FALLING);
 		corgi_ts->pendown = 0;
 	}
 }
@@ -254,7 +258,7 @@
 
 		corgi_ssp_ads7846_putget((4u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
 		/* Enable Falling Edge */
-		set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_FALLING);
+		set_irq_type(IRQ_GPIO(corgi_ts->irq), IRQT_FALLING);
 		corgi_ts->power_mode = PWR_MODE_ACTIVE;
 	}
 	return 0;
@@ -267,6 +271,7 @@
 static int __init corgits_probe(struct device *dev)
 {
 	struct corgi_ts *corgi_ts;
+	struct platform_device *pdev = to_platform_device(dev);
 
 	if (!(corgi_ts = kmalloc(sizeof(struct corgi_ts), GFP_KERNEL)))
 		return -ENOMEM;
@@ -275,6 +280,13 @@
 
 	memset(corgi_ts, 0, sizeof(struct corgi_ts));
 
+	corgi_ts->irq = platform_get_irq(pdev, 0);
+
+	if (corgi_ts->irq < 0) {
+		kfree(corgi_ts);
+		return -ENODEV;
+	}
+
 	init_input_dev(&corgi_ts->input);
 	corgi_ts->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
 	corgi_ts->input.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
@@ -293,8 +305,7 @@
 	corgi_ts->input.id.product = 0x0002;
 	corgi_ts->input.id.version = 0x0100;
 
-	pxa_gpio_mode(CORGI_GPIO_TP_INT | GPIO_IN);
-	pxa_gpio_mode(CORGI_GPIO_HSYNC | GPIO_IN);
+	pxa_gpio_mode(corgi_ts->irq | GPIO_IN);
 
 	/* Initiaize ADS7846 Difference Reference mode */
 	corgi_ssp_ads7846_putget((1u << ADSCTRL_ADR_SH) | ADSCTRL_STS);
@@ -313,14 +324,14 @@
 	input_register_device(&corgi_ts->input);
 	corgi_ts->power_mode = PWR_MODE_ACTIVE;
 
-	if (request_irq(CORGI_IRQ_GPIO_TP_INT, ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) {
+	if (request_irq(IRQ_GPIO(corgi_ts->irq), ts_interrupt, SA_INTERRUPT, "ts", corgi_ts)) {
 		input_unregister_device(&corgi_ts->input);
 		kfree(corgi_ts);
 		return -EBUSY;
 	}
 
 	/* Enable Falling Edge */
-	set_irq_type(CORGI_IRQ_GPIO_TP_INT, IRQT_FALLING);
+	set_irq_type(IRQ_GPIO(corgi_ts->irq), IRQT_FALLING);
 
 	printk(KERN_INFO "input: Corgi Touchscreen Registered\n");
 
@@ -331,7 +342,7 @@
 {
 	struct corgi_ts *corgi_ts = dev_get_drvdata(dev);
 
-	free_irq(CORGI_IRQ_GPIO_TP_INT, NULL);
+	free_irq(IRQ_GPIO(corgi_ts->irq), NULL);
 	del_timer_sync(&corgi_ts->timer);
 	input_unregister_device(&corgi_ts->input);
 	kfree(corgi_ts);
Index: linux-2.6.12/drivers/input/touchscreen/Kconfig
===================================================================
--- linux-2.6.12.orig/drivers/input/touchscreen/Kconfig	2005-08-12 12:05:35.000000000 +0100
+++ linux-2.6.12/drivers/input/touchscreen/Kconfig	2005-08-12 12:05:45.000000000 +0100
@@ -24,17 +24,18 @@
 	  module will be called h3600_ts_input.
 
 config TOUCHSCREEN_CORGI
-	tristate "Corgi touchscreen (for Sharp SL-C7xx)"
+	tristate "Corgi and Spitz touchscreen driver"
 	depends on PXA_SHARPSL
 	default y	
 	help
 	  Say Y here to enable the driver for the touchscreen on the 
-	  Sharp SL-C7xx series of PDAs.
+	  for Sharp SL-C7xx, SL-C1000, SL-C3000 and SL-C3100 series 
+	  of PDAs.
 
 	  If unsure, say N.
 
 	  To compile this driver as a module, choose M here: the
-	  module will be called ads7846_ts.
+	  module will be called corgi_ts.
 
 config TOUCHSCREEN_GUNZE
 	tristate "Gunze AHL-51S touchscreen"
Index: linux-2.6.12/drivers/video/pxafb.c
===================================================================
--- linux-2.6.12.orig/drivers/video/pxafb.c	2005-08-12 12:05:00.000000000 +0100
+++ linux-2.6.12/drivers/video/pxafb.c	2005-08-13 22:52:49.000000000 +0100
@@ -468,6 +468,24 @@
 }
 
 /*
+ * Some touchscreens need hsync information from the video driver to
+ * function correctly. We export it here.
+ */
+unsigned long pxafb_get_hsynclen(struct device *dev)
+{
+	struct pxafb_info *fbi = dev_get_drvdata(dev);
+
+	int divider = FExtr(LCCR3,LCCR3_PCD);
+
+	/* If display is blanked/suspended, hsync isn't active */
+	if (fbi->state == C_DISABLE)
+		return 0;
+
+	return get_lcdclk_frequency_10khz() * 10000 / divider / fbi->fb.var.hsync_len;
+}
+EXPORT_SYMBOL(pxafb_get_hsynclen);
+
+/*
  * pxafb_activate_var():
  *	Configures LCD Controller based on entries in var parameter.  Settings are
  *	only written to the controller if changes were made.
Index: linux-2.6.12/arch/arm/mach-pxa/corgi.c
===================================================================
--- linux-2.6.12.orig/arch/arm/mach-pxa/corgi.c	2005-08-12 12:05:29.000000000 +0100
+++ linux-2.6.12/arch/arm/mach-pxa/corgi.c	2005-08-13 22:49:24.000000000 +0100
@@ -120,14 +120,25 @@
 /*
  * Corgi Touch Screen Device
  */
+static struct resource corgits_resources[] = {
+	[0] = {
+		.start		= CORGI_GPIO_TP_INT,
+		.end		= CORGI_GPIO_TP_INT,
+		.flags		= IORESOURCE_IRQ,
+	},
+};
+
 static struct platform_device corgits_device = {
 	.name		= "corgi-ts",
 	.dev		= {
  		.parent = &corgissp_device.dev,
 	},
 	.id		= -1,
+	.num_resources	= ARRAY_SIZE(corgits_resources),
+	.resource	= corgits_resources,
 };
 
+
 /*
  * Irda
  */
@@ -264,6 +275,7 @@
 {
 	pxa_gpio_mode(CORGI_GPIO_USB_PULLUP | GPIO_OUT);
 	pxa_gpio_mode(CORGI_GPIO_IR_ON | GPIO_OUT);
+	pxa_gpio_mode(CORGI_GPIO_HSYNC | GPIO_IN);
  	pxa_set_udc_info(&udc_info);
 	pxa_set_mci_info(&corgi_mci_platform_data);
 	pxa_set_ficp_info(&corgi_ficp_platform_data);
Index: linux-2.6.12/include/asm-arm/arch-pxa/pxafb.h
===================================================================
--- linux-2.6.12.orig/include/asm-arm/arch-pxa/pxafb.h	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12/include/asm-arm/arch-pxa/pxafb.h	2005-08-13 22:50:55.000000000 +0100
@@ -66,3 +66,4 @@
 
 };
 void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
+unsigned long pxafb_get_hsynclen(struct device *dev);
Index: linux-2.6.12/arch/arm/mach-pxa/corgi_lcd.c
===================================================================
--- linux-2.6.12.orig/arch/arm/mach-pxa/corgi_lcd.c	2005-08-12 12:05:11.000000000 +0100
+++ linux-2.6.12/arch/arm/mach-pxa/corgi_lcd.c	2005-08-13 23:01:52.000000000 +0100
@@ -1,10 +1,14 @@
 /*
  * linux/drivers/video/w100fb.c
  *
- * Corgi LCD Specific Code for ATI Imageon w100 (Wallaby)
+ * Corgi/Spitz LCD Specific Code 
  *
  * Copyright (C) 2005 Richard Purdie
  *
+ * Interconnection:
+ *   Corgi - ATI Imageon w100 (Wallaby)
+ *   Spitz - PXA Framebuffer
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -14,9 +18,13 @@
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/device.h>
+#include <asm/mach-types.h>
 #include <asm/arch/corgi.h>
+#include <asm/arch/hardware.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/spitz.h>
 #include <asm/mach/sharpsl_param.h>
-#include <video/w100fb.h>
+#include "generic.h"
 
 #define RESCTL_ADRS     0x00
 #define PHACTRL_ADRS	0x01
@@ -132,10 +140,10 @@
 }
 
 /* Set Phase Adjuct */
-static void lcdtg_set_phadadj(struct w100fb_par *par)
+static void lcdtg_set_phadadj(int mode)
 {
 	int adj;
-	switch(par->xres) {
+	switch(mode) {
 		case 480:
 		case 640:
 			/* Setting for VGA */
@@ -159,7 +167,7 @@
 
 static int lcd_inited;
 
-static void lcdtg_hw_init(struct w100fb_par *par)
+static void lcdtg_hw_init(int mode)
 {
 	if (!lcd_inited) {
 		int comadj;
@@ -213,7 +221,7 @@
 		corgi_ssp_lcdtg_send(PICTRL_ADRS, 0);
 
 		/* Set Phase Adjuct */
-		lcdtg_set_phadadj(par);
+		lcdtg_set_phadadj(mode);
 
 		/* Initialize for Input Signals from ATI */
 		corgi_ssp_lcdtg_send(POLCTRL_ADRS, POLCTRL_SYNC_POL_RISE | POLCTRL_EN_POL_RISE
@@ -222,10 +230,10 @@
 
 		lcd_inited=1;
 	} else {
-		lcdtg_set_phadadj(par);
+		lcdtg_set_phadadj(mode);
 	}
 
-	switch(par->xres) {
+	switch(mode) {
 		case 480:
 		case 640:
 			/* Set Lcd Resolution (VGA) */
@@ -240,7 +248,7 @@
 	}
 }
 
-static void lcdtg_suspend(struct w100fb_par *par)
+static void lcdtg_suspend(void)
 {
 	/* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */
 	mdelay(34);
@@ -274,15 +282,30 @@
 	lcd_inited = 0;
 }
 
-static struct w100_tg_info corgi_lcdtg_info = {
-	.change=lcdtg_hw_init,
-	.suspend=lcdtg_suspend,
-	.resume=lcdtg_hw_init,
-};
 
 /*
  * Corgi w100 Frame Buffer Device
  */
+#ifdef CONFIG_PXA_SHARP_C7xx
+
+#include <video/w100fb.h>
+
+static void w100_lcdtg_suspend(struct w100fb_par *par)
+{
+	lcdtg_suspend();
+}
+
+static void w100_lcdtg_init(struct w100fb_par *par)
+{
+	lcdtg_hw_init(par->xres);
+}
+
+
+static struct w100_tg_info corgi_lcdtg_info = {
+	.change=w100_lcdtg_init,
+	.suspend=w100_lcdtg_suspend,
+	.resume=w100_lcdtg_init,
+};
 
 static struct w100_mem_info corgi_fb_mem = {
 	.ext_cntl          = 0x00040003,
@@ -392,3 +415,52 @@
 	},
 
 };
+#endif
+
+
+/*
+ * Spitz PXA Frame Buffer Device
+ */
+#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_AKITA)
+
+#include <asm/arch/pxafb.h>
+
+void spitz_lcd_power(int on) 
+{
+	if (on) {
+		lcdtg_hw_init(480);
+	} else {
+		lcdtg_suspend();
+	}
+}
+
+#endif
+
+
+/*
+ * Corgi/Spitz Touchscreen to LCD interface
+ */
+unsigned long inline corgi_get_hsync_len(void) 
+{
+	if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()) {
+#ifdef CONFIG_PXA_SHARP_C7xx
+		return w100fb_get_hsynclen(&corgifb_device.dev);
+#endif
+	} else if (machine_is_spitz() || machine_is_akita()) {
+#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_AKITA)
+		return pxafb_get_hsynclen(&pxafb_device.dev);
+#endif
+	}
+	return 0;
+}
+
+#define SyncHS(x)   while((GPLR(x) & GPIO_bit(x)) == 0); while((GPLR(x) & GPIO_bit(x)) != 0);
+
+void inline corgi_wait_hsync(void) 
+{
+	if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()) {
+		SyncHS(CORGI_GPIO_HSYNC);
+	} else if (machine_is_spitz() || machine_is_akita()) {
+		SyncHS(SPITZ_GPIO_HSYNC);
+	}
+}
Index: linux-2.6.12/arch/arm/mach-pxa/generic.h
===================================================================
--- linux-2.6.12.orig/arch/arm/mach-pxa/generic.h	2005-06-17 20:48:29.000000000 +0100
+++ linux-2.6.12/arch/arm/mach-pxa/generic.h	2005-08-13 22:45:14.000000000 +0100
@@ -12,6 +12,8 @@
 struct sys_timer;
 
 extern struct sys_timer pxa_timer;
+extern struct platform_device pxafb_device;
+
 extern void __init pxa_map_io(void);
 extern void __init pxa_init_irq(void);
 
Index: linux-2.6.12/include/video/w100fb.h
===================================================================
--- linux-2.6.12.orig/include/video/w100fb.h	2005-08-12 12:05:23.000000000 +0100
+++ linux-2.6.12/include/video/w100fb.h	2005-08-13 22:55:13.000000000 +0100
@@ -19,6 +19,7 @@
 
 unsigned long w100fb_gpio_read(int port);
 void w100fb_gpio_write(int port, unsigned long value);
+unsigned long w100fb_get_hsynclen(struct device *dev);
 
 /* LCD Specific Routines and Config */
 struct w100_tg_info {

