Index: linux-2.6.13/drivers/pcmcia/pxa2xx_sharpsl.c
===================================================================
--- linux-2.6.13.orig/drivers/pcmcia/pxa2xx_sharpsl.c	2005-09-09 00:12:20.000000000 +0100
+++ linux-2.6.13/drivers/pcmcia/pxa2xx_sharpsl.c	2005-09-09 00:31:39.000000000 +0100
@@ -16,13 +16,16 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
+#include <linux/config.h>
 #include <linux/device.h>
 
 #include <asm/hardware.h>
 #include <asm/irq.h>
 #include <asm/hardware/scoop.h>
 #include <asm/arch/pxa-regs.h>
-
+#include <asm/mach-types.h>
+#include <asm/arch/spitz.h>
+#include <linux/delay.h>
 #include "soc_common.h"
 
 #define	NO_KEEP_VS 0x0001
@@ -42,25 +45,43 @@
 	 * Setup default state of GPIO outputs
 	 * before we enable them as outputs.
 	 */
+
 	GPSR(GPIO48_nPOE) =
 		GPIO_bit(GPIO48_nPOE) |
 		GPIO_bit(GPIO49_nPWE) |
 		GPIO_bit(GPIO50_nPIOR) |
-		GPIO_bit(GPIO51_nPIOW) |
-		GPIO_bit(GPIO52_nPCE_1) |
-		GPIO_bit(GPIO53_nPCE_2);
+		GPIO_bit(GPIO51_nPIOW);
 
 	pxa_gpio_mode(GPIO48_nPOE_MD);
 	pxa_gpio_mode(GPIO49_nPWE_MD);
 	pxa_gpio_mode(GPIO50_nPIOR_MD);
 	pxa_gpio_mode(GPIO51_nPIOW_MD);
-	pxa_gpio_mode(GPIO52_nPCE_1_MD);
-	pxa_gpio_mode(GPIO53_nPCE_2_MD);
-	pxa_gpio_mode(GPIO54_pSKTSEL_MD);
 	pxa_gpio_mode(GPIO55_nPREG_MD);
 	pxa_gpio_mode(GPIO56_nPWAIT_MD);
 	pxa_gpio_mode(GPIO57_nIOIS16_MD);
 
+
+#ifdef CONFIG_PXA25x
+	GPSR(GPIO48_nPOE) =
+		GPIO_bit(GPIO52_nPCE_1) |
+		GPIO_bit(GPIO53_nPCE_2);
+
+	pxa_gpio_mode(GPIO52_nPCE_1_MD);
+	pxa_gpio_mode(GPIO53_nPCE_2_MD);
+	pxa_gpio_mode(GPIO54_pSKTSEL_MD);
+
+#endif
+#ifdef CONFIG_PXA27x
+	GPSR(GPIO85_nPCE_1) =
+		GPIO_bit(GPIO85_nPCE_1);
+	GPSR(GPIO48_nPOE) =
+		GPIO_bit(GPIO54_nPCE_2);
+
+	pxa_gpio_mode(GPIO85_nPCE_1_MD);
+	pxa_gpio_mode(GPIO54_nPCE_2_MD);
+	pxa_gpio_mode(GPIO104_pSKTSEL_MD);
+#endif
+
 	/* Register interrupts */
 	if (scoop_devs[skt->nr].cd_irq >= 0) {
 		struct pcmcia_irqs cd_irq;
@@ -123,7 +144,11 @@
 	}
 	else {
 		/* card detect */
-		write_scoop_reg(scoop, SCOOP_CDR, 0x0002);
+	        if ((machine_is_spitz() || machine_is_borzoi()) && skt->nr == 1) {
+	                write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
+	        } else {
+		        write_scoop_reg(scoop, SCOOP_CDR, 0x0002);
+	        }
 	}
 
 	state->detect = (csr & 0x0004) ? 0 : 1;
@@ -170,8 +195,15 @@
 	nccr = (ccr = read_scoop_reg(scoop, SCOOP_CCR)) & ~0x0080;
 	nimr = (imr = read_scoop_reg(scoop, SCOOP_IMR)) & ~0x003E;
 
-	ncpr |= (state->Vcc == 33) ? 0x0001 :
-				(state->Vcc == 50) ? 0x0002 : 0;
+	/* Sharp just *had* to wire up the 2 CF slots differently on
+	 * the spitz, didn't they.. */
+	if ((machine_is_spitz() || machine_is_borzoi()) && skt->nr == 0) {
+	        ncpr |= (state->Vcc == 33) ? 0x0002 :
+		        (state->Vcc == 50) ? 0x0002 : 0;
+	} else {
+	        ncpr |= (state->Vcc == 33) ? 0x0001 :
+		        (state->Vcc == 50) ? 0x0002 : 0;
+	}
 	nmcr |= (state->flags&SS_IOCARD) ? 0x0010 : 0;
 	ncpr |= (state->flags&SS_OUTPUT_ENA) ? 0x0080 : 0;
 	nccr |= (state->flags&SS_RESET)? 0x0080: 0;
@@ -193,8 +225,27 @@
 
 	if (mcr != nmcr)
 		write_scoop_reg(scoop, SCOOP_MCR, nmcr);
-	if (cpr != ncpr)
-		write_scoop_reg(scoop, SCOOP_CPR, ncpr);
+	if ((machine_is_spitz() || machine_is_borzoi()) && cpr != ncpr && skt->nr == 0) {
+	        if (ncpr & 0x0002) {
+		        set_scoop_gpio(scoop, SPITZ_SCP_CF_POWER);
+			if (!(cpr & 0x0002)) {
+			        mdelay(5);
+			}
+			if (cpr & 0x0004) {
+			        ncpr |= 0x0004;
+			}
+		} else {
+		        if (cpr & 0x0002) {
+			        write_scoop_reg(scoop, SCOOP_CPR, (cpr &= ~0x0002));
+			}
+			if (!(cpr & 0x0004)) {
+			        mdelay(1);
+			        reset_scoop_gpio(scoop, SPITZ_SCP_CF_POWER);
+			}
+		}
+	        write_scoop_reg(scoop, SCOOP_CPR, ncpr);
+	} else if (cpr != ncpr)
+	        write_scoop_reg(scoop, SCOOP_CPR, ncpr);
 	if (ccr != nccr)
 		write_scoop_reg(scoop, SCOOP_CCR, nccr);
 	if (imr != nimr)

