aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pxa2xx_base.c
diff options
context:
space:
mode:
authorRussell King - ARM Linux <linux@arm.linux.org.uk>2009-03-29 14:23:42 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:11 -0500
commitda4f007375197d6683461b995d404b01a7fdf2f5 (patch)
tree310c773abd405610c2dfcb952c1dead23885e6d9 /drivers/pcmcia/pxa2xx_base.c
parentbe85458edce0f165cff62622f5e73b1d17b1e228 (diff)
PCMCIA: soc_common: push socket probe down into SoC specific support
Move the individual socket probing and initialization down into the SoC specific support files, thereby allowing soc_common_drv_pcmcia_probe to be eliminated. soc_common.c now no longer deals with distinct groups of sockets. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pxa2xx_base.c')
-rw-r--r--drivers/pcmcia/pxa2xx_base.c77
1 files changed, 47 insertions, 30 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c
index 8a91106056fc..3cb4fd21cc2f 100644
--- a/drivers/pcmcia/pxa2xx_base.c
+++ b/drivers/pcmcia/pxa2xx_base.c
@@ -228,6 +228,31 @@ static const char *skt_names[] = {
228#define SKT_DEV_INFO_SIZE(n) \ 228#define SKT_DEV_INFO_SIZE(n) \
229 (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) 229 (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket))
230 230
231static int pxa2xx_drv_pcmcia_add_one(struct soc_pcmcia_socket *skt)
232{
233 skt->res_skt.start = _PCMCIA(skt->nr);
234 skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1;
235 skt->res_skt.name = skt_names[skt->nr];
236 skt->res_skt.flags = IORESOURCE_MEM;
237
238 skt->res_io.start = _PCMCIAIO(skt->nr);
239 skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1;
240 skt->res_io.name = "io";
241 skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
242
243 skt->res_mem.start = _PCMCIAMem(skt->nr);
244 skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
245 skt->res_mem.name = "memory";
246 skt->res_mem.flags = IORESOURCE_MEM;
247
248 skt->res_attr.start = _PCMCIAAttr(skt->nr);
249 skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
250 skt->res_attr.name = "attribute";
251 skt->res_attr.flags = IORESOURCE_MEM;
252
253 return soc_pcmcia_add_one(skt);
254}
255
231int __pxa2xx_drv_pcmcia_probe(struct device *dev) 256int __pxa2xx_drv_pcmcia_probe(struct device *dev)
232{ 257{
233 int i, ret; 258 int i, ret;
@@ -240,6 +265,12 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev)
240 265
241 ops = (struct pcmcia_low_level *)dev->platform_data; 266 ops = (struct pcmcia_low_level *)dev->platform_data;
242 267
268 /* Provide our PXA2xx specific timing routines. */
269 ops->set_timing = pxa2xx_pcmcia_set_timing;
270#ifdef CONFIG_CPU_FREQ
271 ops->frequency_change = pxa2xx_pcmcia_frequency_change;
272#endif
273
243 sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL); 274 sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL);
244 if (!sinfo) 275 if (!sinfo)
245 return -ENOMEM; 276 return -ENOMEM;
@@ -250,40 +281,26 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev)
250 for (i = 0; i < ops->nr; i++) { 281 for (i = 0; i < ops->nr; i++) {
251 skt = &sinfo->skt[i]; 282 skt = &sinfo->skt[i];
252 283
253 skt->nr = ops->first + i; 284 skt->nr = ops->first + i;
254 skt->irq = NO_IRQ; 285 skt->irq = NO_IRQ;
255 286 skt->dev = dev;
256 skt->res_skt.start = _PCMCIA(skt->nr); 287 skt->ops = ops;
257 skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; 288 skt->socket.owner = ops->owner;
258 skt->res_skt.name = skt_names[skt->nr]; 289 skt->socket.dev.parent = dev;
259 skt->res_skt.flags = IORESOURCE_MEM;
260 290
261 skt->res_io.start = _PCMCIAIO(skt->nr); 291 ret = pxa2xx_drv_pcmcia_add_one(skt);
262 skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; 292 if (ret)
263 skt->res_io.name = "io"; 293 break;
264 skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
265
266 skt->res_mem.start = _PCMCIAMem(skt->nr);
267 skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
268 skt->res_mem.name = "memory";
269 skt->res_mem.flags = IORESOURCE_MEM;
270
271 skt->res_attr.start = _PCMCIAAttr(skt->nr);
272 skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
273 skt->res_attr.name = "attribute";
274 skt->res_attr.flags = IORESOURCE_MEM;
275 } 294 }
276 295
277 /* Provide our PXA2xx specific timing routines. */ 296 if (ret) {
278 ops->set_timing = pxa2xx_pcmcia_set_timing; 297 while (--i >= 0)
279#ifdef CONFIG_CPU_FREQ 298 soc_pcmcia_remove_one(&sinfo->skt[i]);
280 ops->frequency_change = pxa2xx_pcmcia_frequency_change; 299 kfree(sinfo);
281#endif 300 } else {
282
283 ret = soc_common_drv_pcmcia_probe(dev, ops, sinfo);
284
285 if (!ret)
286 pxa2xx_configure_sockets(dev); 301 pxa2xx_configure_sockets(dev);
302 dev_set_drvdata(dev, sinfo);
303 }
287 304
288 return ret; 305 return ret;
289} 306}