aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/soc_common.c
diff options
context:
space:
mode:
authorEric Miao <eric.miao@marvell.com>2009-01-19 04:34:27 -0500
committerEric Miao <eric.miao@marvell.com>2009-03-09 09:22:39 -0400
commitb393c69652333be31ad7a8205761c0d5b7f3e167 (patch)
tree92fb162efe41532bc9867f3f7cf2c269b5ce0129 /drivers/pcmcia/soc_common.c
parent5742964e916269e01a3467d2bff2601180b7da3d (diff)
[ARM] pxa: move PCMCIA definitions out of pxa-regs.h into pxa2xx_base.c
Move the processor specific initialization (largely resources initialization) out of soc_common_drv_pcmcia_probe() into dedicated sa11xx_drv_pcmcia_probe() and __pxa2xx_drv_pcmcia_probe(). By doing this, we are now able to move the PCMCIA related definitions out of pxa-regs.h and back into pxa2xx_base.c. As a result, remove that reference of _PCMCIA1IO in arch/arm/mach-pxa/viper.c. Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'drivers/pcmcia/soc_common.c')
-rw-r--r--drivers/pcmcia/soc_common.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c
index f49ac6666153..163cf98e2386 100644
--- a/drivers/pcmcia/soc_common.c
+++ b/drivers/pcmcia/soc_common.c
@@ -49,11 +49,6 @@
49 49
50#include "soc_common.h" 50#include "soc_common.h"
51 51
52/* FIXME: platform dependent resource declaration has to move out of this file */
53#ifdef CONFIG_ARCH_PXA
54#include <mach/pxa-regs.h>
55#endif
56
57#ifdef CONFIG_PCMCIA_DEBUG 52#ifdef CONFIG_PCMCIA_DEBUG
58 53
59static int pc_debug; 54static int pc_debug;
@@ -581,19 +576,6 @@ EXPORT_SYMBOL(soc_pcmcia_enable_irqs);
581LIST_HEAD(soc_pcmcia_sockets); 576LIST_HEAD(soc_pcmcia_sockets);
582static DEFINE_MUTEX(soc_pcmcia_sockets_lock); 577static DEFINE_MUTEX(soc_pcmcia_sockets_lock);
583 578
584static const char *skt_names[] = {
585 "PCMCIA socket 0",
586 "PCMCIA socket 1",
587};
588
589struct skt_dev_info {
590 int nskt;
591 struct soc_pcmcia_socket skt[0];
592};
593
594#define SKT_DEV_INFO_SIZE(n) \
595 (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket))
596
597#ifdef CONFIG_CPU_FREQ 579#ifdef CONFIG_CPU_FREQ
598static int 580static int
599soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data) 581soc_pcmcia_notifier(struct notifier_block *nb, unsigned long val, void *data)
@@ -637,26 +619,18 @@ static int soc_pcmcia_cpufreq_register(void) { return 0; }
637static void soc_pcmcia_cpufreq_unregister(void) {} 619static void soc_pcmcia_cpufreq_unregister(void) {}
638#endif 620#endif
639 621
640int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr) 622int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops,
623 struct skt_dev_info *sinfo)
641{ 624{
642 struct skt_dev_info *sinfo;
643 struct soc_pcmcia_socket *skt; 625 struct soc_pcmcia_socket *skt;
644 int ret, i; 626 int ret, i;
645 627
646 mutex_lock(&soc_pcmcia_sockets_lock); 628 mutex_lock(&soc_pcmcia_sockets_lock);
647 629
648 sinfo = kzalloc(SKT_DEV_INFO_SIZE(nr), GFP_KERNEL);
649 if (!sinfo) {
650 ret = -ENOMEM;
651 goto out;
652 }
653
654 sinfo->nskt = nr;
655
656 /* 630 /*
657 * Initialise the per-socket structure. 631 * Initialise the per-socket structure.
658 */ 632 */
659 for (i = 0; i < nr; i++) { 633 for (i = 0; i < sinfo->nskt; i++) {
660 skt = &sinfo->skt[i]; 634 skt = &sinfo->skt[i];
661 635
662 skt->socket.ops = &soc_common_pcmcia_operations; 636 skt->socket.ops = &soc_common_pcmcia_operations;
@@ -668,43 +642,21 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
668 skt->poll_timer.data = (unsigned long)skt; 642 skt->poll_timer.data = (unsigned long)skt;
669 skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD; 643 skt->poll_timer.expires = jiffies + SOC_PCMCIA_POLL_PERIOD;
670 644
671 skt->nr = first + i;
672 skt->irq = NO_IRQ;
673 skt->dev = dev; 645 skt->dev = dev;
674 skt->ops = ops; 646 skt->ops = ops;
675 647
676 skt->res_skt.start = _PCMCIA(skt->nr);
677 skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1;
678 skt->res_skt.name = skt_names[skt->nr];
679 skt->res_skt.flags = IORESOURCE_MEM;
680
681 ret = request_resource(&iomem_resource, &skt->res_skt); 648 ret = request_resource(&iomem_resource, &skt->res_skt);
682 if (ret) 649 if (ret)
683 goto out_err_1; 650 goto out_err_1;
684 651
685 skt->res_io.start = _PCMCIAIO(skt->nr);
686 skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1;
687 skt->res_io.name = "io";
688 skt->res_io.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
689
690 ret = request_resource(&skt->res_skt, &skt->res_io); 652 ret = request_resource(&skt->res_skt, &skt->res_io);
691 if (ret) 653 if (ret)
692 goto out_err_2; 654 goto out_err_2;
693 655
694 skt->res_mem.start = _PCMCIAMem(skt->nr);
695 skt->res_mem.end = _PCMCIAMem(skt->nr) + PCMCIAMemSp - 1;
696 skt->res_mem.name = "memory";
697 skt->res_mem.flags = IORESOURCE_MEM;
698
699 ret = request_resource(&skt->res_skt, &skt->res_mem); 656 ret = request_resource(&skt->res_skt, &skt->res_mem);
700 if (ret) 657 if (ret)
701 goto out_err_3; 658 goto out_err_3;
702 659
703 skt->res_attr.start = _PCMCIAAttr(skt->nr);
704 skt->res_attr.end = _PCMCIAAttr(skt->nr) + PCMCIAAttrSp - 1;
705 skt->res_attr.name = "attribute";
706 skt->res_attr.flags = IORESOURCE_MEM;
707
708 ret = request_resource(&skt->res_skt, &skt->res_attr); 660 ret = request_resource(&skt->res_skt, &skt->res_attr);
709 if (ret) 661 if (ret)
710 goto out_err_4; 662 goto out_err_4;