]> err.no Git - linux-2.6/commitdiff
[ARM] 3093/1: SharpSL PCMCIA Updates for Cxx00 models
authorRichard Purdie <rpurdie@rpsys.net>
Tue, 8 Nov 2005 19:15:43 +0000 (19:15 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Nov 2005 19:15:43 +0000 (19:15 +0000)
Patch from Richard Purdie

The Sharp SL-Cxx00 models have a combined power control for the SD
and CF slot 0. This patch adds hooks to the scoop driver to allow
machines to provide a custom control function for this and such a
function is added for spitz/akita/borzoi.

It also moves the gpio init code into the machine files as this
is machine dependent and differs between some models. A couple of
warnings when compiling for collie are also fixed.

Signed-off-by: Richard Purdie
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/common/scoop.c
arch/arm/mach-pxa/corgi.c
arch/arm/mach-pxa/poodle.c
arch/arm/mach-pxa/spitz.c
drivers/pcmcia/pxa2xx_sharpsl.c
include/asm-arm/hardware/scoop.h

index bb4eff61441307458f92a104b0fa655542e118b7..c7fdf390cef9cbf20325431ea092d07c658f7f18 100644 (file)
 
 #define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr)))
 
-/* PCMCIA to Scoop linkage structures for pxa2xx_sharpsl.c
-   There is no easy way to link multiple scoop devices into one
-   single entity for the pxa2xx_pcmcia device */
-int scoop_num;
-struct scoop_pcmcia_dev *scoop_devs;
-
 struct  scoop_dev {
        void  *base;
        spinlock_t scoop_lock;
index eb5f6d744a4a77778d290ba063b18cccd01973d5..100fb31b5156df4a9cb3e6b0372ef2736d23d7e0 100644 (file)
@@ -62,6 +62,37 @@ static struct scoop_config corgi_scoop_setup = {
        .io_out         = CORGI_SCOOP_IO_OUT,
 };
 
+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 void corgi_pcmcia_init(void)
+{
+       /* 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);
+
+       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(GPIO55_nPREG_MD);
+       pxa_gpio_mode(GPIO56_nPWAIT_MD);
+       pxa_gpio_mode(GPIO57_nIOIS16_MD);
+       pxa_gpio_mode(GPIO52_nPCE_1_MD);
+       pxa_gpio_mode(GPIO53_nPCE_2_MD);
+       pxa_gpio_mode(GPIO54_pSKTSEL_MD);
+}
+
 static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = {
 {
        .dev        = &corgiscoop_device.dev,
@@ -71,16 +102,14 @@ static struct scoop_pcmcia_dev corgi_pcmcia_scoop[] = {
 },
 };
 
-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 scoop_pcmcia_config corgi_pcmcia_config = {
+       .devs         = &corgi_pcmcia_scoop[0],
+       .num_devs     = 1,
+       .pcmcia_init  = corgi_pcmcia_init,
 };
 
+EXPORT_SYMBOL(corgiscoop_device);
+
 
 /*
  * Corgi SSP Device
@@ -294,8 +323,7 @@ static void __init corgi_init(void)
        pxa_set_mci_info(&corgi_mci_platform_data);
        pxa_set_ficp_info(&corgi_ficp_platform_data);
 
-       scoop_num = 1;
-       scoop_devs = &corgi_pcmcia_scoop[0];
+       platform_scoop_config = &corgi_pcmcia_config;
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
 }
index ad6a13f95a62cfcae51bc94ffc2fd1f243f17be7..eef3de26ad3704dba4604255abcf13bb3942b16a 100644 (file)
@@ -65,6 +65,27 @@ struct platform_device poodle_scoop_device = {
        .resource       = poodle_scoop_resources,
 };
 
+static void poodle_pcmcia_init(void)
+{
+       /* 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);
+
+       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(GPIO55_nPREG_MD);
+       pxa_gpio_mode(GPIO56_nPWAIT_MD);
+       pxa_gpio_mode(GPIO57_nIOIS16_MD);
+       pxa_gpio_mode(GPIO52_nPCE_1_MD);
+       pxa_gpio_mode(GPIO53_nPCE_2_MD);
+       pxa_gpio_mode(GPIO54_pSKTSEL_MD);
+}
+
 static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
 {
        .dev        = &poodle_scoop_device.dev,
@@ -74,6 +95,14 @@ static struct scoop_pcmcia_dev poodle_pcmcia_scoop[] = {
 },
 };
 
+static struct scoop_pcmcia_config poodle_pcmcia_config = {
+       .devs         = &poodle_pcmcia_scoop[0],
+       .num_devs     = 1,
+       .pcmcia_init  = poodle_pcmcia_init,
+};
+
+EXPORT_SYMBOL(poodle_scoop_device);
+
 
 /* LoCoMo device */
 static struct resource locomo_resources[] = {
@@ -268,8 +297,7 @@ static void __init poodle_init(void)
        pxa_set_mci_info(&poodle_mci_platform_data);
        pxa_set_ficp_info(&poodle_ficp_platform_data);
 
-       scoop_num = 1;
-       scoop_devs = &poodle_pcmcia_scoop[0];
+       platform_scoop_config = &poodle_pcmcia_config;
 
        ret = platform_add_devices(devices, ARRAY_SIZE(devices));
        if (ret) {
index 6c6878cd2207db94f3b70343beef634fbb6491f2..4e9a699ee4280e61560a5672e9bd6c276c36a284 100644 (file)
@@ -104,6 +104,66 @@ struct platform_device spitzscoop2_device = {
        .resource       = spitz_scoop2_resources,
 };
 
+#define SPITZ_PWR_SD 0x01
+#define SPITZ_PWR_CF 0x02
+
+/* Power control is shared with between one of the CF slots and SD */
+static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
+{
+       unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
+
+       if (new_cpr & 0x0007) {
+               set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
+               if (!(cpr & 0x0002) && !(cpr & 0x0004))
+                       mdelay(5);
+               if (device == SPITZ_PWR_CF)
+                       cpr |= 0x0002;
+               if (device == SPITZ_PWR_SD)
+                       cpr |= 0x0004;
+               write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
+       } else {
+               if (device == SPITZ_PWR_CF)
+                       cpr &= ~0x0002;
+               if (device == SPITZ_PWR_SD)
+                       cpr &= ~0x0004;
+               write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
+               if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
+                       mdelay(1);
+                       reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
+               }
+       }
+}
+
+static void spitz_pcmcia_init(void)
+{
+       /* 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(GPIO54_nPCE_2);
+       GPSR(GPIO85_nPCE_1) = GPIO_bit(GPIO85_nPCE_1);
+
+       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(GPIO55_nPREG_MD);
+       pxa_gpio_mode(GPIO56_nPWAIT_MD);
+       pxa_gpio_mode(GPIO57_nIOIS16_MD);
+       pxa_gpio_mode(GPIO85_nPCE_1_MD);
+       pxa_gpio_mode(GPIO54_nPCE_2_MD);
+       pxa_gpio_mode(GPIO104_pSKTSEL_MD);
+}
+
+static void spitz_pcmcia_pwr(struct device *scoop, unsigned short cpr, int nr)
+{
+       /* Only need to override behaviour for slot 0 */
+       if (nr == 0)
+               spitz_card_pwr_ctrl(SPITZ_PWR_CF, cpr);
+       else
+               write_scoop_reg(scoop, SCOOP_CPR, cpr);
+}
+
 static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
 {
        .dev        = &spitzscoop_device.dev,
@@ -117,6 +177,16 @@ static struct scoop_pcmcia_dev spitz_pcmcia_scoop[] = {
 },
 };
 
+static struct scoop_pcmcia_config spitz_pcmcia_config = {
+       .devs         = &spitz_pcmcia_scoop[0],
+       .num_devs     = 2,
+       .pcmcia_init  = spitz_pcmcia_init,
+       .power_ctrl   = spitz_pcmcia_pwr,
+};
+
+EXPORT_SYMBOL(spitzscoop_device);
+EXPORT_SYMBOL(spitzscoop2_device);
+
 
 /*
  * Spitz SSP Device
@@ -235,27 +305,14 @@ static int spitz_mci_init(struct device *dev, irqreturn_t (*spitz_detect_int)(in
        return 0;
 }
 
-/* Power control is shared with one of the CF slots so we have a mess */
 static void spitz_mci_setpower(struct device *dev, unsigned int vdd)
 {
        struct pxamci_platform_data* p_d = dev->platform_data;
 
-       unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
-
-       if (( 1 << vdd) & p_d->ocr_mask) {
-               /* printk(KERN_DEBUG "%s: on\n", __FUNCTION__); */
-               set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
-               mdelay(2);
-               write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | 0x04);
-       } else {
-               /* printk(KERN_DEBUG "%s: off\n", __FUNCTION__); */
-               write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr & ~0x04);
-
-               if (!(cpr | 0x02)) {
-                       mdelay(1);
-                       reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
-               }
-       }
+       if (( 1 << vdd) & p_d->ocr_mask)
+               spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0004);
+       else
+               spitz_card_pwr_ctrl(SPITZ_PWR_SD, 0x0000);
 }
 
 static int spitz_mci_get_ro(struct device *dev)
@@ -351,8 +408,8 @@ static void __init common_init(void)
 
 static void __init spitz_init(void)
 {
-       scoop_num = 2;
-       scoop_devs = &spitz_pcmcia_scoop[0];
+       platform_scoop_config = &spitz_pcmcia_config;
+
        spitz_bl_machinfo.set_bl_intensity = spitz_bl_set_intensity;
 
        common_init();
index fe5ea36e7de3878e63b7819cab7872c89d8acd49..56c58831e80e593eae62c2e33744fcd508ad7cd2 100644 (file)
 #include <asm/hardware.h>
 #include <asm/irq.h>
 #include <asm/hardware/scoop.h>
-#ifdef CONFIG_SA1100_COLLIE
-#include <asm/arch-sa1100/collie.h>
-#else
-#include <asm/arch-pxa/pxa-regs.h>
-#endif
 
 #include "soc_common.h"
 
 #define        NO_KEEP_VS 0x0001
 
+/* PCMCIA to Scoop linkage
+
+   There is no easy way to link multiple scoop devices into one
+   single entity for the pxa2xx_pcmcia device so this structure
+   is used which is setup by the platform code
+*/
+struct scoop_pcmcia_config *platform_scoop_config;
+#define SCOOP_DEV platform_scoop_config->devs
+
 static void sharpsl_pcmcia_init_reset(struct scoop_pcmcia_dev *scoopdev)
 {
        reset_scoop(scoopdev->dev);
@@ -43,38 +47,16 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
        int ret;
 
-#ifndef CONFIG_SA1100_COLLIE
-       /*
-        * 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);
-
-       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);
-#endif
+       if (platform_scoop_config->pcmcia_init)
+               platform_scoop_config->pcmcia_init();
 
        /* Register interrupts */
-       if (scoop_devs[skt->nr].cd_irq >= 0) {
+       if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
                struct pcmcia_irqs cd_irq;
 
                cd_irq.sock = skt->nr;
-               cd_irq.irq  = scoop_devs[skt->nr].cd_irq;
-               cd_irq.str  = scoop_devs[skt->nr].cd_irq_str;
+               cd_irq.irq  = SCOOP_DEV[skt->nr].cd_irq;
+               cd_irq.str  = SCOOP_DEV[skt->nr].cd_irq_str;
                ret = soc_pcmcia_request_irqs(skt, &cd_irq, 1);
 
                if (ret) {
@@ -83,19 +65,19 @@ static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
                }
        }
 
-       skt->irq = scoop_devs[skt->nr].irq;
+       skt->irq = SCOOP_DEV[skt->nr].irq;
 
        return 0;
 }
 
 static void sharpsl_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-       if (scoop_devs[skt->nr].cd_irq >= 0) {
+       if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
                struct pcmcia_irqs cd_irq;
 
                cd_irq.sock = skt->nr;
-               cd_irq.irq  = scoop_devs[skt->nr].cd_irq;
-               cd_irq.str  = scoop_devs[skt->nr].cd_irq_str;
+               cd_irq.irq  = SCOOP_DEV[skt->nr].cd_irq;
+               cd_irq.str  = SCOOP_DEV[skt->nr].cd_irq_str;
                soc_pcmcia_free_irqs(skt, &cd_irq, 1);
        }
 }
@@ -105,9 +87,9 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
                                    struct pcmcia_state *state)
 {
        unsigned short cpr, csr;
-       struct device *scoop = scoop_devs[skt->nr].dev;
+       struct device *scoop = SCOOP_DEV[skt->nr].dev;
 
-       cpr = read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR);
+       cpr = read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR);
 
        write_scoop_reg(scoop, SCOOP_IRM, 0x00FF);
        write_scoop_reg(scoop, SCOOP_ISR, 0x0000);
@@ -116,21 +98,25 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
        if (csr & 0x0004) {
                /* card eject */
                write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
-               scoop_devs[skt->nr].keep_vs = NO_KEEP_VS;
+               SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
        }
-       else if (!(scoop_devs[skt->nr].keep_vs & NO_KEEP_VS)) {
+       else if (!(SCOOP_DEV[skt->nr].keep_vs & NO_KEEP_VS)) {
                /* keep vs1,vs2 */
                write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
-               csr |= scoop_devs[skt->nr].keep_vs;
+               csr |= SCOOP_DEV[skt->nr].keep_vs;
        }
        else if (cpr & 0x0003) {
                /* power on */
                write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
-               scoop_devs[skt->nr].keep_vs = (csr & 0x00C0);
+               SCOOP_DEV[skt->nr].keep_vs = (csr & 0x00C0);
        }
        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;
@@ -144,7 +130,6 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
        if ((cpr & 0x0080) && ((cpr & 0x8040) != 0x8040)) {
                printk(KERN_ERR "sharpsl_pcmcia_socket_state(): CPR=%04X, Low voltage!\n", cpr);
        }
-
 }
 
 
@@ -152,7 +137,7 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
                                       const socket_state_t *state)
 {
        unsigned long flags;
-       struct device *scoop = scoop_devs[skt->nr].dev;
+       struct device *scoop = SCOOP_DEV[skt->nr].dev;
 
        unsigned short cpr, ncpr, ccr, nccr, mcr, nmcr, imr, nimr;
 
@@ -177,8 +162,13 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
        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;
+       if ((machine_is_spitz() || machine_is_borzoi() || machine_is_akita()) && 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;
@@ -190,18 +180,22 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
                        ((skt->status&SS_WRPROT) ? 0x0008 : 0);
 
        if (!(ncpr & 0x0003)) {
-               scoop_devs[skt->nr].keep_rd = 0;
-       } else if (!scoop_devs[skt->nr].keep_rd) {
+               SCOOP_DEV[skt->nr].keep_rd = 0;
+       } else if (!SCOOP_DEV[skt->nr].keep_rd) {
                if (nccr & 0x0080)
-                       scoop_devs[skt->nr].keep_rd = 1;
+                       SCOOP_DEV[skt->nr].keep_rd = 1;
                else
                        nccr |= 0x0080;
        }
 
        if (mcr != nmcr)
                write_scoop_reg(scoop, SCOOP_MCR, nmcr);
-       if (cpr != ncpr)
-               write_scoop_reg(scoop, SCOOP_CPR, ncpr);
+       if (cpr != ncpr) {
+               if (platform_scoop_config->power_ctrl)
+                       platform_scoop_config->power_ctrl(scoop, ncpr , skt->nr);
+               else
+                       write_scoop_reg(scoop, SCOOP_CPR, ncpr);
+       }
        if (ccr != nccr)
                write_scoop_reg(scoop, SCOOP_CCR, nccr);
        if (imr != nimr)
@@ -214,43 +208,43 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 
 static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-       sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]);
+       sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]);
 
        /* Enable interrupt */
-       write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_IMR, 0x00C0);
-       write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_MCR, 0x0101);
-       scoop_devs[skt->nr].keep_vs = NO_KEEP_VS;
+       write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0);
+       write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101);
+       SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
 
        if (machine_is_collie())
                /* We need to disable SS_OUTPUT_ENA here. */
-               write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080);
+               write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080);
 }
 
 static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
        /* CF_BUS_OFF */
-       sharpsl_pcmcia_init_reset(&scoop_devs[skt->nr]);
+       sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]);
 
        if (machine_is_collie())
                /* We need to disable SS_OUTPUT_ENA here. */
-               write_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR, read_scoop_reg(scoop_devs[skt->nr].dev, SCOOP_CPR) & ~0x0080);
+               write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080);
 }
 
 static struct pcmcia_low_level sharpsl_pcmcia_ops = {
-       .owner                          = THIS_MODULE,
-       .hw_init                        = sharpsl_pcmcia_hw_init,
-       .hw_shutdown            = sharpsl_pcmcia_hw_shutdown,
-       .socket_state           = sharpsl_pcmcia_socket_state,
-       .configure_socket       = sharpsl_pcmcia_configure_socket,
-       .socket_init            = sharpsl_pcmcia_socket_init,
-       .socket_suspend         = sharpsl_pcmcia_socket_suspend,
-       .first                          = 0,
-       .nr                                     = 0,
+       .owner                  = THIS_MODULE,
+       .hw_init                = sharpsl_pcmcia_hw_init,
+       .hw_shutdown            = sharpsl_pcmcia_hw_shutdown,
+       .socket_state           = sharpsl_pcmcia_socket_state,
+       .configure_socket       = sharpsl_pcmcia_configure_socket,
+       .socket_init            = sharpsl_pcmcia_socket_init,
+       .socket_suspend         = sharpsl_pcmcia_socket_suspend,
+       .first                  = 0,
+       .nr                     = 0,
 };
 
-static struct platform_device *sharpsl_pcmcia_device;
-
 #ifdef CONFIG_SA1100_COLLIE
+#include "sa11xx_base.h"
+
 int __init pcmcia_collie_init(struct device *dev)
 {
        int ret = -ENODEV;
@@ -263,11 +257,13 @@ int __init pcmcia_collie_init(struct device *dev)
 
 #else
 
+static struct platform_device *sharpsl_pcmcia_device;
+
 static int __init sharpsl_pcmcia_init(void)
 {
        int ret;
 
-       sharpsl_pcmcia_ops.nr=scoop_num;
+       sharpsl_pcmcia_ops.nr=platform_scoop_config->num_devs;
        sharpsl_pcmcia_device = kmalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL);
        if (!sharpsl_pcmcia_device)
                return -ENOMEM;
@@ -275,7 +271,7 @@ static int __init sharpsl_pcmcia_init(void)
        memset(sharpsl_pcmcia_device, 0, sizeof(*sharpsl_pcmcia_device));
        sharpsl_pcmcia_device->name = "pxa2xx-pcmcia";
        sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
-       sharpsl_pcmcia_device->dev.parent=scoop_devs[0].dev;
+       sharpsl_pcmcia_device->dev.parent=platform_scoop_config->devs[0].dev;
 
        ret = platform_device_register(sharpsl_pcmcia_device);
        if (ret)
index a8f1013930e363140381c9f9385b63885b0dd774..d37bf7443264c347141ae9550dfbda9d59dedd85 100644 (file)
@@ -52,8 +52,14 @@ struct scoop_pcmcia_dev {
        unsigned char keep_rd;
 };
 
-extern int scoop_num;
-extern struct scoop_pcmcia_dev *scoop_devs;
+struct scoop_pcmcia_config {
+       struct scoop_pcmcia_dev *devs;
+       int num_devs;
+       void (*pcmcia_init)(void);
+       void (*power_ctrl)(struct device *scoop, unsigned short cpr, int nr);
+};
+
+extern struct scoop_pcmcia_config *platform_scoop_config;
 
 void reset_scoop(struct device *dev);
 unsigned short set_scoop_gpio(struct device *dev, unsigned short bit);