diff options
author | Marc Zyngier <marc.zyngier@altran.com> | 2008-08-19 12:15:53 +0200 |
---|---|---|
committer | Marc Zyngier <maz@young-lust.wild-wind.fr.eu.org> | 2008-09-09 17:41:53 +0200 |
commit | 20f18ff32fe311f60770ac70395b01c06758923b (patch) | |
tree | 4b1c11b306ce8b24d1b735aa4729405bd9818c2d /drivers/pcmcia/pxa2xx_base.c | |
parent | 175ff20f6a681effa82d67e3656c4cc3e7117600 (diff) | |
download | linux-20f18ff32fe311f60770ac70395b01c06758923b.tar.gz linux-20f18ff32fe311f60770ac70395b01c06758923b.tar.bz2 linux-20f18ff32fe311f60770ac70395b01c06758923b.zip |
Add support for the Arcom/Eurotech Viper SBC CompactFlash card slot
The Arcom/Eurotech Viper needs some extra care to run. On this board,
the PC104 connector is actually wired to the second PCMCIA slot.
Therefore, this second socket needs to be enabled, despite not being
managed by the PCMCIA code.
I'd rather have the MECR setup in the platform support code so I could,
for example, use the PC104 bus without having the PCMCIA module loaded.
Signed-off-by: Marc Zyngier <marc.zyngier@altran.com>
Diffstat (limited to 'drivers/pcmcia/pxa2xx_base.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 1b07af5a2ed3..13f1e0fd3f31 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -30,6 +30,7 @@ #include <asm/system.h> #include <mach/pxa-regs.h> #include <mach/pxa2xx-regs.h> +#include <asm/mach-types.h> #include <pcmcia/cs_types.h> #include <pcmcia/ss.h> @@ -166,18 +167,32 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, } #endif +static void pxa2xx_configure_sockets(struct device *dev) +{ + struct pcmcia_low_level *ops = dev->platform_data; + + /* + * We have at least one socket, so set MECR:CIT + * (Card Is There) + */ + MECR |= MECR_CIT; + + /* Set MECR:NOS (Number Of Sockets) */ + if (ops->nr > 1 || machine_is_viper()) + MECR |= MECR_NOS; + else + MECR &= ~MECR_NOS; +} + int __pxa2xx_drv_pcmcia_probe(struct device *dev) { int ret; struct pcmcia_low_level *ops; - int first, nr; if (!dev || !dev->platform_data) return -ENODEV; ops = (struct pcmcia_low_level *)dev->platform_data; - first = ops->first; - nr = ops->nr; /* Provide our PXA2xx specific timing routines. */ ops->set_timing = pxa2xx_pcmcia_set_timing; @@ -185,21 +200,10 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev) ops->frequency_change = pxa2xx_pcmcia_frequency_change; #endif - ret = soc_common_drv_pcmcia_probe(dev, ops, first, nr); + ret = soc_common_drv_pcmcia_probe(dev, ops, ops->first, ops->nr); - if (ret == 0) { - /* - * We have at least one socket, so set MECR:CIT - * (Card Is There) - */ - MECR |= MECR_CIT; - - /* Set MECR:NOS (Number Of Sockets) */ - if (nr > 1) - MECR |= MECR_NOS; - else - MECR &= ~MECR_NOS; - } + if (!ret) + pxa2xx_configure_sockets(dev); return ret; } @@ -223,11 +227,7 @@ static int pxa2xx_drv_pcmcia_suspend(struct platform_device *dev, pm_message_t s static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev) { - struct pcmcia_low_level *ops = dev->dev.platform_data; - int nr = ops ? ops->nr : 0; - - MECR = nr > 1 ? MECR_CIT | MECR_NOS : (nr > 0 ? MECR_CIT : 0); - + pxa2xx_configure_sockets(&dev->dev); return pcmcia_socket_dev_resume(&dev->dev); } |