aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/sa11xx_base.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/sa11xx_base.c')
-rw-r--r--drivers/pcmcia/sa11xx_base.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/drivers/pcmcia/sa11xx_base.c b/drivers/pcmcia/sa11xx_base.c
index 7cb1273202cc..e15d59f2d8a9 100644
--- a/drivers/pcmcia/sa11xx_base.c
+++ b/drivers/pcmcia/sa11xx_base.c
@@ -36,9 +36,9 @@
36#include <linux/ioport.h> 36#include <linux/ioport.h>
37#include <linux/kernel.h> 37#include <linux/kernel.h>
38#include <linux/spinlock.h> 38#include <linux/spinlock.h>
39#include <linux/io.h>
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <asm/io.h>
42#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/system.h> 43#include <asm/system.h>
44 44
@@ -163,9 +163,55 @@ sa1100_pcmcia_show_timing(struct soc_pcmcia_socket *skt, char *buf)
163 return p - buf; 163 return p - buf;
164} 164}
165 165
166static const char *skt_names[] = {
167 "PCMCIA socket 0",
168 "PCMCIA socket 1",
169};
170
171#define SKT_DEV_INFO_SIZE(n) \
172 (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket))
173
166int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, 174int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
167 int first, int nr) 175 int first, int nr)
168{ 176{
177 struct skt_dev_info *sinfo;
178 struct soc_pcmcia_socket *skt;
179 int i;
180
181 sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
182 if (!sinfo)
183 return -ENOMEM;
184
185 sinfo->nskt = nr;
186
187 /* Initiliaze processor specific parameters */
188 for (i = 0; i < nr; i++) {
189 skt = &sinfo->skt[i];
190
191 skt->nr = first + i;
192 skt->irq = NO_IRQ;
193
194 skt->res_skt.start = _PCMCIA(skt->nr);
195 skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1;
196 skt->res_skt.name = skt_names[skt->nr];
197 skt->res_skt.flags = IORESOURCE_MEM;
198
199 skt->res_io.start = _PCMCIAIO(skt->nr);
200 skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1;
201 skt->res_io.name = "io";
202 skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
203
204 skt->res_mem.start = _PCMCIAMem(skt->nr);
205 skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
206 skt->res_mem.name = "memory";
207 skt->res_mem.flags = IORESOURCE_MEM;
208
209 skt->res_attr.start = _PCMCIAAttr(skt->nr);
210 skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
211 skt->res_attr.name = "attribute";
212 skt->res_attr.flags = IORESOURCE_MEM;
213 }
214
169 /* 215 /*
170 * set default MECR calculation if the board specific 216 * set default MECR calculation if the board specific
171 * code did not specify one... 217 * code did not specify one...
@@ -180,7 +226,7 @@ int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
180 ops->frequency_change = sa1100_pcmcia_frequency_change; 226 ops->frequency_change = sa1100_pcmcia_frequency_change;
181#endif 227#endif
182 228
183 return soc_common_drv_pcmcia_probe(dev, ops, first, nr); 229 return soc_common_drv_pcmcia_probe(dev, ops, sinfo);
184} 230}
185EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe); 231EXPORT_SYMBOL(sa11xx_drv_pcmcia_probe);
186 232