
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

Index: linux-2.6.11-rc1/arch/arm/mach-pxa/corgi.c
===================================================================
--- linux-2.6.11-rc1.orig/arch/arm/mach-pxa/corgi.c	2005-01-20 16:50:01.000000000 +0000
+++ linux-2.6.11-rc1/arch/arm/mach-pxa/corgi.c	2005-01-20 17:50:14.269970808 +0000
@@ -34,6 +34,7 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/irq.h>
 #include <asm/arch/mmc.h>
+#include <asm/arch/udc.h>
 #include <asm/arch/corgi.h>
 
 #include <asm/hardware/scoop.h>
@@ -76,8 +77,6 @@
  * also use scoop functions and this makes the power up/down order
  * work correctly.
  */
-extern void corgi_ssp_lcdtg_send (u8 adrs, u8 data);
-
 static struct platform_device corgissp_device = {
 	.name		= "corgi-ssp",
 	.dev		= {
@@ -117,6 +116,48 @@
 
 
 /*
+ * Corgi Backlight Device
+ */
+static struct platform_device corgibl_device = {
+	.name		= "corgi-bl",
+	.dev		= {
+ 		.parent = &corgifb_device.dev,
+	},	
+	.id		= -1,
+};
+
+
+/*
+ * Corgi Battery and Power Device
+ */
+static struct platform_device corgibattery_device = {
+	.name		= "corgi-battery",
+	.id		= -1,
+};
+
+
+/*
+ * Corgi Keyboard Device
+ */
+static struct platform_device corgikbd_device = {
+	.name		= "corgi-keyboard",
+	.id		= -1,
+};
+
+
+/*
+ * Corgi Touch Screen Device
+ */
+static struct platform_device corgits_device = {
+	.name		= "corgi-ts",
+	.dev		= {
+ 		.parent = &corgissp_device.dev,
+	},		
+	.id		= -1,
+};
+
+
+/*
  * MMC/SD Device
  *
  * The card detect interrupt isn't debounced so we delay it by HZ/4
@@ -149,6 +190,10 @@
 	pxa_gpio_mode(CORGI_GPIO_nSD_DETECT | GPIO_IN);
 	pxa_gpio_mode(CORGI_GPIO_SD_PWR | GPIO_OUT);
 
+	init_timer(&mmc_detect.detect_timer);
+	mmc_detect.detect_timer.function = mmc_detect_callback;
+	mmc_detect.detect_timer.data = (unsigned long) &mmc_detect;
+
 	err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_mmc_detect_int, SA_INTERRUPT,
 			     "MMC card detect", data);
 	if (err) {
@@ -156,10 +201,6 @@
 		return -1;
 	}
 
-	init_timer(&mmc_detect.detect_timer);
-	mmc_detect.detect_timer.function = mmc_detect_callback;
-	mmc_detect.detect_timer.data = (unsigned long) &mmc_detect;
-
 	set_irq_type(CORGI_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
 
 	return 0;
@@ -192,10 +233,35 @@
 };
 
 
+/*
+ * USB Device Controller
+ */
+static void corgi_udc_command(int cmd)
+{
+	switch(cmd)	{
+	case PXA2XX_UDC_CMD_CONNECT:
+		GPSR(CORGI_GPIO_USB_PULLUP) = GPIO_bit(CORGI_GPIO_USB_PULLUP);
+		break;
+	case PXA2XX_UDC_CMD_DISCONNECT:
+		GPCR(CORGI_GPIO_USB_PULLUP) = GPIO_bit(CORGI_GPIO_USB_PULLUP);
+		break;
+	}
+}
+ 
+static struct pxa2xx_udc_mach_info udc_info __initdata = {
+	/* no connect GPIO; corgi can't tell connection status */
+	.udc_command		= corgi_udc_command,
+};
+ 
+
 static struct platform_device *devices[] __initdata = {
 	&corgiscoop_device,
 	&corgissp_device,
 	&corgifb_device,
+ 	&corgikbd_device,
+	&corgibl_device,	
+ 	&corgibattery_device,
+ 	&corgits_device,	
 };
 
 static struct sharpsl_flash_param_info sharpsl_flash_param;
@@ -221,6 +287,8 @@
 	else
 		corgi_fb_info.phadadj=-1;
 
+	pxa_gpio_mode(CORGI_GPIO_USB_PULLUP | GPIO_OUT);
+ 	pxa_set_udc_info(&udc_info);
 	pxa_set_mci_info(&corgi_mci_platform_data);
 
 	platform_add_devices(devices, ARRAY_SIZE(devices));
Index: linux-2.6.11-rc1/include/asm-arm/arch-pxa/corgi.h
===================================================================
--- linux-2.6.11-rc1.orig/include/asm-arm/arch-pxa/corgi.h	2005-01-20 16:50:01.000000000 +0000
+++ linux-2.6.11-rc1/include/asm-arm/arch-pxa/corgi.h	2005-01-20 20:25:35.965824920 +0000
@@ -18,29 +18,30 @@
  * Corgi (Non Standard) GPIO Definitions
  */
 #define CORGI_GPIO_KEY_INT			(0)	/* Keyboard Interrupt */
-#define CORGI_GPIO_AC_IN			(1)
-#define CORGI_GPIO_WAKEUP			(3)
-#define CORGI_GPIO_AK_INT			(4)	/* IR Controller Interrupt */
+#define CORGI_GPIO_AC_IN			(1) /* Charger Detection */
+#define CORGI_GPIO_WAKEUP			(3) /* System wakeup notification? */
+#define CORGI_GPIO_AK_INT			(4)	/* Headphone Jack Control Interrupt */
 #define CORGI_GPIO_TP_INT			(5)	/* Touch Panel Interrupt */
-#define CORGI_GPIO_nSD_WP			(7)
+#define CORGI_GPIO_nSD_WP			(7) /* SD Write Protect? */
 #define CORGI_GPIO_nSD_DETECT		(9) /* MMC/SD Card Detect */
-#define CORGI_GPIO_nSD_INT			(10)
-#define CORGI_GPIO_MAIN_BAT_LOW		(11)
-#define CORGI_GPIO_BAT_COVER		(11)
-#define CORGI_GPIO_LED_ORANGE		(13)
+#define CORGI_GPIO_nSD_INT			(10) /* SD Interrupt for SDIO? */
+#define CORGI_GPIO_MAIN_BAT_LOW		(11) /* Main Battery Low Notification */
+#define CORGI_GPIO_BAT_COVER		(11) /* Battery Cover Detect */
+#define CORGI_GPIO_LED_ORANGE		(13) /* Orange LED Control */
 #define CORGI_GPIO_CF_CD			(14) /* Compact Flash Card Detect */
-#define CORGI_GPIO_CHRG_FULL		(16)
+#define CORGI_GPIO_CHRG_FULL		(16) /* Charging Complete Notification */
 #define CORGI_GPIO_CF_IRQ			(17) /* Compact Flash Interrupt */
 #define CORGI_GPIO_LCDCON_CS		(19) /* LCD Control Chip Select */
-#define CORGI_GPIO_MAX1111_CS		(20) /* MAX111 Chip Select */
-#define CORGI_GPIO_ADC_TEMP_ON		(21)
-#define CORGI_GPIO_IR_ON			(22)
+#define CORGI_GPIO_MAX1111_CS		(20) /* MAX1111 Chip Select */
+#define CORGI_GPIO_ADC_TEMP_ON		(21) /* Select battery voltage or temperature */
+#define CORGI_GPIO_IR_ON			(22) /* Enable IR Transciever */
 #define CORGI_GPIO_ADS7846_CS		(24) /* ADS7846 Chip Select */
 #define CORGI_GPIO_SD_PWR			(33) /* MMC/SD Power */
-#define CORGI_GPIO_CHRG_ON			(38)
-#define CORGI_GPIO_DISCHARGE_ON		(42)
+#define CORGI_GPIO_CHRG_ON			(38) /* Enable battery Charging */
+#define CORGI_GPIO_DISCHARGE_ON		(42) /* Enable battery Discharge */
+#define CORGI_GPIO_CHRG_UKN			(43) /* Unknown Charging (Bypass Control?) */
 #define CORGI_GPIO_HSYNC			(44) /* LCD HSync Pulse */
-#define CORGI_GPIO_USB_PULLUP		(45)
+#define CORGI_GPIO_USB_PULLUP		(45) /* USB show presence to host */
 
 
 /*
@@ -97,6 +98,7 @@
 			CORGI_SCP_MIC_BIAS )
 #define CORGI_SCOOP_IO_OUT	( CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R )
 
+
 /*
  * Corgi Parameter Area Definitions
  */
@@ -131,5 +133,18 @@
   unsigned int phadadj;
 };
 
+
+/*
+ * External Functions
+ */
+extern unsigned long corgi_ssp_ads7846_putget(unsigned long);
+extern unsigned long corgi_ssp_ads7846_get(void);
+extern void corgi_ssp_ads7846_put(ulong data);
+extern void corgi_ssp_ads7846_lock(void);
+extern void corgi_ssp_ads7846_unlock(void);
+extern void corgi_ssp_lcdtg_send (u8 adrs, u8 data);
+extern void corgi_ssp_blduty_set(int duty);
+extern int corgi_ssp_max1111_get(ulong data);
+
 #endif /* __ASM_ARCH_CORGI_H  */
 

