Merge branch 'for-linus' of git://neil.brown.name/md
[safe/jmp/linux-2.6] / drivers / pcmcia / sa11xx_base.c
index 59c5d96..e15d59f 100644 (file)
 
 #include <linux/module.h>
 #include <linux/init.h>
-#include <linux/config.h>
 #include <linux/cpufreq.h>
 #include <linux/ioport.h>
 #include <linux/kernel.h>
 #include <linux/spinlock.h>
+#include <linux/io.h>
 
-#include <asm/hardware.h>
-#include <asm/io.h>
+#include <mach/hardware.h>
 #include <asm/irq.h>
 #include <asm/system.h>
 
@@ -164,9 +163,55 @@ sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
        return p - buf;
 }
 
+static const char *skt_names[] = {
+       "PCMCIA socket 0",
+       "PCMCIA socket 1",
+};
+
+#define SKT_DEV_INFO_SIZE(n) \
+       (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket))
+
 int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
                            int first, int nr)
 {
+       struct skt_dev_info *sinfo;
+       struct soc_pcmcia_socket *skt;
+       int i;
+
+       sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
+       if (!sinfo)
+               return -ENOMEM;
+
+       sinfo->nskt = nr;
+
+       /* Initiliaze processor specific parameters */
+       for (i = 0; i < nr; i++) {
+               skt = &sinfo->skt[i];
+
+               skt->nr         = first + i;
+               skt->irq        = NO_IRQ;
+
+               skt->res_skt.start      = _PCMCIA(skt->nr);
+               skt->res_skt.end        = _PCMCIA(skt->nr) + PCMCIASp - 1;
+               skt->res_skt.name       = skt_names[skt->nr];
+               skt->res_skt.flags      = IORESOURCE_MEM;
+
+               skt->res_io.start       = _PCMCIAIO(skt->nr);
+               skt->res_io.end         = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1;
+               skt->res_io.name        = "io";
+               skt->res_io.flags       = IORESOURCE_MEM | IORESOURCE_BUSY;
+
+               skt->res_mem.start      = _PCMCIAMem(skt->nr);
+               skt->res_mem.end        = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
+               skt->res_mem.name       = "memory";
+               skt->res_mem.flags      = IORESOURCE_MEM;
+
+               skt->res_attr.start     = _PCMCIAAttr(skt->nr);
+               skt->res_attr.end       = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
+               skt->res_attr.name      = "attribute";
+               skt->res_attr.flags     = IORESOURCE_MEM;
+       }
+
        /*
         * set default MECR calculation if the board specific
         * code did not specify one...
@@ -181,7 +226,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
        ops->frequency_change = sa1100_pcmcia_frequency_change;
 #endif
 
-       return soc_common_drv_pcmcia_probe(dev, ops, first, nr);
+       return soc_common_drv_pcmcia_probe(dev, ops, sinfo);
 }
 EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);