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

--- linux-2.6.10/arch/arm/boot/compressed/head-xscale.S~corgi_base-r4.patch
+++ linux-2.6.10/arch/arm/boot/compressed/head-xscale.S
@@ -59,3 +59,18 @@
 #ifdef CONFIG_MACH_POODLE
 		mov	r7, #MACH_TYPE_POODLE
 #endif
+
+#ifdef CONFIG_MACH_CORGI
+		mov	r7, #(MACH_TYPE_CORGI & 0xff)
+		orr	r7, r7, #(MACH_TYPE_CORGI & 0xff00)
+#endif
+
+#ifdef CONFIG_MACH_SHEPHERD
+		mov	r7, #(MACH_TYPE_SHEPHERD & 0xff)
+		orr	r7, r7, #(MACH_TYPE_SHEPHERD & 0xff00)
+#endif
+
+#ifdef CONFIG_MACH_HUSKY
+		mov	r7, #(MACH_TYPE_HUSKY & 0xff)
+		orr	r7, r7, #(MACH_TYPE_HUSKY & 0xff00)
+#endif
--- linux-2.6.10/arch/arm/mach-pxa/Kconfig~corgi_base-r4.patch
+++ linux-2.6.10/arch/arm/mach-pxa/Kconfig
@@ -22,6 +22,17 @@
 	bool "SHARP Poodle"
 	select PXA25x
 
+config PXA_SHARPSL
+	bool "SHARP SL-C7xx Models (Corgi, Shepherd and Husky)"
+	select PXA25x
+	select MACH_CORGI
+	select MACH_SHEPHERD
+	select MACH_HUSKY
+	help
+	  Say Y here if you intend to run this kernel on a 
+	  Sharp SL-C700 (Corgi), SL-C750 (Shepherd) or a
+	  Sharp SL-C760 (Husky) handheld computer.
+
 config SHARP_LOCOMO
 	bool "SHARP LoCoMo support"
 	default Y
@@ -29,9 +40,23 @@
 
 endchoice
 
-
 endmenu
 
+config MACH_CORGI
+	bool 
+	help
+	  Sharp SL-C700 handheld computer (also known as Corgi).
+
+config MACH_SHEPHERD
+	bool
+	help
+	  Sharp SL-C750 handheld computer (also known as Shepherd).
+
+config MACH_HUSKY
+	bool
+	help
+	  Sharp SL-C760 handheld computer (also known as Husky).
+
 config PXA25x
 	bool
 	help
--- linux-2.6.10/arch/arm/mach-pxa/Makefile~corgi_base-r4.patch
+++ linux-2.6.10/arch/arm/mach-pxa/Makefile
@@ -12,6 +12,9 @@
 obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
 obj-$(CONFIG_ARCH_PXA_IDP)	+= idp.o
 obj-$(CONFIG_MACH_POODLE)	+= poodle.o
+obj-$(CONFIG_MACH_CORGI)	+= corgi.o corgi_ssp.o corgi_backlight.o corgi_param.o ssp.o
+obj-$(CONFIG_MACH_SHEPHERD)	+= corgi.o corgi_ssp.o corgi_backlight.o corgi_param.o ssp.o
+obj-$(CONFIG_MACH_HUSKY)	+= corgi.o corgi_ssp.o corgi_backlight.o corgi_param.o ssp.o
 
 # Support for blinky lights
 led-y := leds.o
--- /dev/null
+++ linux-2.6.10/arch/arm/mach-pxa/corgi.c
@@ -0,0 +1,188 @@
+/*
+ *  Support for Sharp SL-C7xx PDAs
+ *  Models: SL-C700 (Corgi), SL-C750 (Shepherd), SL-C760 (Husky)
+ *  
+ *  Copyright (c) 2004 Richard Purdie
+ *
+ *  Originally based on lubbock.c
+ *  
+ *  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.
+ *
+ */
+ 
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/major.h>
+#include <linux/fs.h>
+#include <linux/interrupt.h>
+
+#include <asm/setup.h>
+#include <asm/memory.h>
+#include <asm/mach-types.h>
+#include <asm/hardware.h>
+#include <asm/irq.h>
+
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+#include <asm/mach/irq.h>
+
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/irq.h>
+#include <asm/arch/corgi.h>
+
+#include <asm/hardware/scoop.h>
+#include <video/w100fb.h>
+
+#include "generic.h"
+
+extern void corgi_get_param(void);
+extern void corgi_ssp_lcdtg_send (u8 adrs, u8 data);
+extern int corgi_get_comadj(void);
+extern int corgi_get_phadadj(void);
+
+static void __init corgi_init_irq(void)
+{
+	pxa_init_irq();
+}
+
+static struct w100fb_mach_info corgi_fb_info = {
+	.w100fb_ssp_send 	= corgi_ssp_lcdtg_send,
+	.comadj 			= -1,
+	.phadadj 			= -1,
+};
+
+static struct platform_device corgifb_device = {
+	.name		= "w100fb",
+	.id		= -1,
+	.dev		= {
+ 		.platform_data	= &corgi_fb_info,
+	},
+};
+
+static struct platform_device corgibl_device = {
+	.name		= "corgi-bl",
+	.id		= -1,
+};
+
+static struct platform_device corgissp_device = {
+	.name		= "corgi-ssp",
+	.id		= -1,
+};
+
+static struct platform_device corgibattery_device = {
+	.name		= "corgi-battery",
+	.id		= -1,
+};
+
+static struct platform_device corgikbd_device = {
+	.name		= "corgi-keyboard",
+	.id		= -1,
+};
+
+static struct platform_device corgits_device = {
+	.name		= "corgi-ts",
+	.id		= -1,
+};
+
+static struct resource corgi_scoop_resources[] = {
+	[0] = {
+		.start		= 0x10800000,
+		.end		= 0x10800fff,
+		.flags		= IORESOURCE_MEM,
+	},
+};
+
+static struct scoop_config corgi_scoop_setup = {
+	.io_dir 	= CORGI_SCOOP_IO_DIR,
+	.io_out		= CORGI_SCOOP_IO_OUT,
+};
+
+static struct platform_device corgiscoop_device = {
+	.name		= "sharp-scoop",
+	.id		= -1,
+	.dev		= {
+ 		.platform_data	= &corgi_scoop_setup,
+	},
+	.num_resources	= ARRAY_SIZE(corgi_scoop_resources),
+	.resource	= corgi_scoop_resources,
+};
+
+static struct platform_device *devices[] __initdata = {
+	&corgifb_device,
+	&corgibl_device,
+	&corgissp_device,
+	&corgibattery_device,
+	&corgikbd_device,
+	&corgiscoop_device,
+	&corgits_device,
+};
+
+static void __init corgi_init(void)
+{
+	corgi_fb_info.comadj=corgi_get_comadj();
+	corgi_fb_info.phadadj=corgi_get_phadadj();
+	platform_add_devices(devices, ARRAY_SIZE(devices));	
+}
+
+static void __init fixup_corgi(struct machine_desc *desc, 
+		struct tag *tags, char **cmdline, struct meminfo *mi)
+{
+	corgi_get_param();
+	if (machine_is_corgi()) SET_BANK (0, 0xa0000000, 32*1024*1024);
+	else SET_BANK (0, 0xa0000000, 64*1024*1024);
+}
+
+
+static struct map_desc corgi_io_desc[] __initdata = {
+ /* virtual     physical    length      */
+/*	{ 0xf1000000, 0x08000000, 0x01000000, MT_DEVICE },*/ /* LCDC (readable for Qt driver) */
+/*	{ 0xef700000, 0x10800000, 0x00001000, MT_DEVICE },*/  /* SCOOP */ 
+	{ 0xef800000, 0x00000000, 0x00800000, MT_DEVICE }, /* Boot Flash */
+};
+
+static void __init corgi_map_io(void)
+{
+	pxa_map_io();
+	iotable_init(corgi_io_desc,ARRAY_SIZE(corgi_io_desc));
+	
+	/* setup sleep mode values */
+	PWER  = 0x00000002;
+	PFER  = 0x00000000;
+	PRER  = 0x00000002;
+	PGSR0 = 0x0158C000;
+	PGSR1 = 0x00FF0080;
+	PGSR2 = 0x0001C004;
+	/* Stop 3.6MHz and drive HIGH to PCMCIA and CS */
+	PCFR |= PCFR_OPDE;	
+}
+
+MACHINE_START(CORGI, "SHARP Corgi")
+	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
+	FIXUP(fixup_corgi)
+	MAPIO(corgi_map_io)
+	INITIRQ(corgi_init_irq)
+	.init_machine = corgi_init,
+	.timer = &pxa_timer,
+MACHINE_END
+
+MACHINE_START(SHEPHERD, "SHARP Shepherd")
+	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
+	FIXUP(fixup_corgi)
+	MAPIO(corgi_map_io)
+	INITIRQ(corgi_init_irq)
+	.init_machine = corgi_init,
+	.timer = &pxa_timer,
+MACHINE_END
+
+MACHINE_START(HUSKY, "SHARP Husky")
+	BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
+	FIXUP(fixup_corgi)
+	MAPIO(corgi_map_io)
+	INITIRQ(corgi_init_irq)
+	.init_machine = corgi_init,
+	.timer = &pxa_timer,
+MACHINE_END
+
--- /dev/null
+++ linux-2.6.10/include/asm-arm/arch-pxa/corgi.h
@@ -0,0 +1,107 @@
+/*
+ * linux/include/asm-arm/arch-pxa/corgi.h
+ *
+ * This file contains the hardware specific definitions for Corgi
+ *
+ * May be copied or modified under the terms of the GNU General Public
+ * License.  See linux/COPYING for more information.
+ * 
+ */
+#ifndef __ASM_ARCH_CORGI_H
+#define __ASM_ARCH_CORGI_H  1
+
+/*
+ * GPIOs
+ */
+/* PXA GPIOs */
+#define CORGI_GPIO_KEY_INT			(0)	/* key interrupt */
+#define CORGI_GPIO_AC_IN			(1)
+#define CORGI_GPIO_WAKEUP			(3)
+#define CORGI_GPIO_AK_INT			(4)	// Remote Controller
+#define CORGI_GPIO_HP_IN			CORGI_GPIO_AK_INT
+#define CORGI_GPIO_TP_INT			(5)	/* Touch Panel interrupt */
+#define CORGI_GPIO_nSD_CLK			(6)
+#define CORGI_GPIO_nSD_WP			(7)
+#define CORGI_GPIO_nSD_DETECT		(9)
+#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_CF_CD			(14)
+#define CORGI_GPIO_CHRG_FULL		(16)
+#define CORGI_GPIO_CO		16
+#define CORGI_GPIO_CF_IRQ			(17)
+#define CORGI_GPIO_ADC_TEMP_ON		(21)
+#define CORGI_GPIO_IR_ON			(22)
+#define CORGI_GPIO_SD_PWR			(33)
+#define CORGI_GPIO_CHRG_ON			(38)
+#define CORGI_GPIO_DISCHARGE_ON		(42)
+#define CORGI_GPIO_HSYNC			(44)
+#define CORGI_GPIO_USB_PULLUP		(45)
+
+/* KeyBoard */
+#define CORGI_KEY_STROBE_NUM		(12)
+#define CORGI_KEY_SENSE_NUM			(8)
+#define CORGI_GPIO_ALL_STROBE_BIT	(0x00003ffc)
+#define CORGI_GPIO_HIGH_SENSE_BIT	(0xfc000000)
+#define CORGI_GPIO_HIGH_SENSE_RSHIFT	(26)
+#define CORGI_GPIO_LOW_SENSE_BIT	(0x00000003)
+#define CORGI_GPIO_LOW_SENSE_LSHIFT	(6)
+#define CORGI_GPIO_STROBE_BIT(a)	GPIO_bit(66+(a))
+#define CORGI_GPIO_SENSE_BIT(a)		GPIO_bit(58+(a))
+#define CORGI_GAFR_ALL_STROBE_BIT	(0x0ffffff0)
+#define CORGI_GAFR_HIGH_SENSE_BIT	(0xfff00000)
+#define CORGI_GAFR_LOW_SENSE_BIT	(0x0000000f)
+#define CORGI_GPIO_KEY_SENSE(a)		(58+(a))
+#define CORGI_GPIO_KEY_STROBE(a)	(66+(a))
+
+
+/*
+ * Interrupts
+ */
+/* PXA GPIOs */
+#define CORGI_IRQ_GPIO_KEY_INT		IRQ_GPIO(0)
+#define CORGI_IRQ_GPIO_AC_IN		IRQ_GPIO(1)
+#define CORGI_IRQ_GPIO_WAKEUP		IRQ_GPIO(3)
+#define CORGI_IRQ_GPIO_AK_INT		IRQ_GPIO(4)
+#define CORGI_IRQ_GPIO_HP_IN		CORGI_IRQ_GPIO_AK_INT
+#define CORGI_IRQ_GPIO_TP_INT		IRQ_GPIO(5)
+#define CORGI_IRQ_GPIO_nSD_DETECT	IRQ_GPIO(9)
+#define CORGI_IRQ_GPIO_nSD_INT		IRQ_GPIO(10)
+#define CORGI_IRQ_GPIO_MAIN_BAT_LOW	IRQ_GPIO(11)
+#define CORGI_IRQ_GPIO_CF_CD		IRQ_GPIO(14)
+#define CORGI_IRQ_GPIO_CO			IRQ_GPIO(16)	/* Battery fully charged */
+#define CORGI_IRQ_GPIO_CF_IRQ		IRQ_GPIO(17)
+#define CORGI_IRQ_GPIO_KEY_SENSE(a)	IRQ_GPIO(58+(a))	/* Keyboard Sense lines */
+
+/*
+ * SCOOP GPIOs and Config
+ */
+#define CORGI_SCP_LED_GREEN		SCOOP_GPCR_PA11
+#define CORGI_SCP_SWA			SCOOP_GPCR_PA12  // Hinge Switch A
+#define CORGI_SCP_SWB			SCOOP_GPCR_PA13  // Hinge Switch B
+#define CORGI_SCP_MUTE_L		SCOOP_GPCR_PA14
+#define CORGI_SCP_MUTE_R		SCOOP_GPCR_PA15
+#define CORGI_SCP_AKIN_PULLUP	SCOOP_GPCR_PA16
+#define CORGI_SCP_APM_ON		SCOOP_GPCR_PA17
+#define CORGI_SCP_BACKLIGHT_CONT	SCOOP_GPCR_PA18
+#define CORGI_SCP_MIC_BIAS		SCOOP_GPCR_PA19
+
+
+#define CORGI_SCOOP_IO_DIR	( CORGI_SCP_LED_GREEN | CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R | \
+				  CORGI_SCP_AKIN_PULLUP | CORGI_SCP_APM_ON | CORGI_SCP_BACKLIGHT_CONT | \
+				  CORGI_SCP_MIC_BIAS )
+#define CORGI_SCOOP_IO_OUT	( CORGI_SCP_MUTE_L | CORGI_SCP_MUTE_R )
+
+
+
+/*
+CORGI_ * LED
+ */
+//#define CORGI_GPIO_LED_ORANGE		(13)
+//#define CORGI_SCP_LED_GREEN		CORGI_SCP_GPCR_PA11
+
+
+
+#endif /* __ASM_ARCH_CORGI_H  */
+

