diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-01-19 04:34:27 -0500 |
---|---|---|
committer | Eric Miao <eric.miao@marvell.com> | 2009-03-09 09:22:39 -0400 |
commit | b393c69652333be31ad7a8205761c0d5b7f3e167 (patch) | |
tree | 92fb162efe41532bc9867f3f7cf2c269b5ce0129 /drivers/pcmcia/pxa2xx_base.c | |
parent | 5742964e916269e01a3467d2bff2601180b7da3d (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/pxa2xx_base.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 86 |
1 files changed, 84 insertions, 2 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 0227691860ae..16f84aab6ab3 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -38,6 +38,44 @@ | |||
38 | #include "soc_common.h" | 38 | #include "soc_common.h" |
39 | #include "pxa2xx_base.h" | 39 | #include "pxa2xx_base.h" |
40 | 40 | ||
41 | /* | ||
42 | * Personal Computer Memory Card International Association (PCMCIA) sockets | ||
43 | */ | ||
44 | |||
45 | #define PCMCIAPrtSp 0x04000000 /* PCMCIA Partition Space [byte] */ | ||
46 | #define PCMCIASp (4*PCMCIAPrtSp) /* PCMCIA Space [byte] */ | ||
47 | #define PCMCIAIOSp PCMCIAPrtSp /* PCMCIA I/O Space [byte] */ | ||
48 | #define PCMCIAAttrSp PCMCIAPrtSp /* PCMCIA Attribute Space [byte] */ | ||
49 | #define PCMCIAMemSp PCMCIAPrtSp /* PCMCIA Memory Space [byte] */ | ||
50 | |||
51 | #define PCMCIA0Sp PCMCIASp /* PCMCIA 0 Space [byte] */ | ||
52 | #define PCMCIA0IOSp PCMCIAIOSp /* PCMCIA 0 I/O Space [byte] */ | ||
53 | #define PCMCIA0AttrSp PCMCIAAttrSp /* PCMCIA 0 Attribute Space [byte] */ | ||
54 | #define PCMCIA0MemSp PCMCIAMemSp /* PCMCIA 0 Memory Space [byte] */ | ||
55 | |||
56 | #define PCMCIA1Sp PCMCIASp /* PCMCIA 1 Space [byte] */ | ||
57 | #define PCMCIA1IOSp PCMCIAIOSp /* PCMCIA 1 I/O Space [byte] */ | ||
58 | #define PCMCIA1AttrSp PCMCIAAttrSp /* PCMCIA 1 Attribute Space [byte] */ | ||
59 | #define PCMCIA1MemSp PCMCIAMemSp /* PCMCIA 1 Memory Space [byte] */ | ||
60 | |||
61 | #define _PCMCIA(Nb) /* PCMCIA [0..1] */ \ | ||
62 | (0x20000000 + (Nb) * PCMCIASp) | ||
63 | #define _PCMCIAIO(Nb) _PCMCIA(Nb) /* PCMCIA I/O [0..1] */ | ||
64 | #define _PCMCIAAttr(Nb) /* PCMCIA Attribute [0..1] */ \ | ||
65 | (_PCMCIA(Nb) + 2 * PCMCIAPrtSp) | ||
66 | #define _PCMCIAMem(Nb) /* PCMCIA Memory [0..1] */ \ | ||
67 | (_PCMCIA(Nb) + 3 * PCMCIAPrtSp) | ||
68 | |||
69 | #define _PCMCIA0 _PCMCIA(0) /* PCMCIA 0 */ | ||
70 | #define _PCMCIA0IO _PCMCIAIO(0) /* PCMCIA 0 I/O */ | ||
71 | #define _PCMCIA0Attr _PCMCIAAttr(0) /* PCMCIA 0 Attribute */ | ||
72 | #define _PCMCIA0Mem _PCMCIAMem(0) /* PCMCIA 0 Memory */ | ||
73 | |||
74 | #define _PCMCIA1 _PCMCIA(1) /* PCMCIA 1 */ | ||
75 | #define _PCMCIA1IO _PCMCIAIO(1) /* PCMCIA 1 I/O */ | ||
76 | #define _PCMCIA1Attr _PCMCIAAttr(1) /* PCMCIA 1 Attribute */ | ||
77 | #define _PCMCIA1Mem _PCMCIAMem(1) /* PCMCIA 1 Memory */ | ||
78 | |||
41 | 79 | ||
42 | #define MCXX_SETUP_MASK (0x7f) | 80 | #define MCXX_SETUP_MASK (0x7f) |
43 | #define MCXX_ASST_MASK (0x1f) | 81 | #define MCXX_ASST_MASK (0x1f) |
@@ -182,23 +220,67 @@ static void pxa2xx_configure_sockets(struct device *dev) | |||
182 | MECR &= ~MECR_NOS; | 220 | MECR &= ~MECR_NOS; |
183 | } | 221 | } |
184 | 222 | ||
223 | static const char *skt_names[] = { | ||
224 | "PCMCIA socket 0", | ||
225 | "PCMCIA socket 1", | ||
226 | }; | ||
227 | |||
228 | #define SKT_DEV_INFO_SIZE(n) \ | ||
229 | (sizeof(struct skt_dev_info) + (n)*sizeof(struct soc_pcmcia_socket)) | ||
230 | |||
185 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) | 231 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) |
186 | { | 232 | { |
187 | int ret; | 233 | int i, ret; |
188 | struct pcmcia_low_level *ops; | 234 | struct pcmcia_low_level *ops; |
235 | struct skt_dev_info *sinfo; | ||
236 | struct soc_pcmcia_socket *skt; | ||
189 | 237 | ||
190 | if (!dev || !dev->platform_data) | 238 | if (!dev || !dev->platform_data) |
191 | return -ENODEV; | 239 | return -ENODEV; |
192 | 240 | ||
193 | ops = (struct pcmcia_low_level *)dev->platform_data; | 241 | ops = (struct pcmcia_low_level *)dev->platform_data; |
194 | 242 | ||
243 | sinfo = kzalloc(SKT_DEV_INFO_SIZE(ops->nr), GFP_KERNEL); | ||
244 | if (!sinfo) | ||
245 | return -ENOMEM; | ||
246 | |||
247 | sinfo->nskt = ops->nr; | ||
248 | |||
249 | /* Initialize processor specific parameters */ | ||
250 | for (i = 0; i < ops->nr; i++) { | ||
251 | skt = &sinfo->skt[i]; | ||
252 | |||
253 | skt->nr = i; | ||
254 | skt->irq = NO_IRQ; | ||
255 | |||
256 | skt->res_skt.start = _PCMCIA(skt->nr); | ||
257 | skt->res_skt.end = _PCMCIA(skt->nr) + PCMCIASp - 1; | ||
258 | skt->res_skt.name = skt_names[skt->nr]; | ||
259 | skt->res_skt.flags = IORESOURCE_MEM; | ||
260 | |||
261 | skt->res_io.start = _PCMCIAIO(skt->nr); | ||
262 | skt->res_io.end = _PCMCIAIO(skt->nr) + PCMCIAIOSp - 1; | ||
263 | skt->res_io.name = "io"; | ||
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 | } | ||
276 | |||
195 | /* Provide our PXA2xx specific timing routines. */ | 277 | /* Provide our PXA2xx specific timing routines. */ |
196 | ops->set_timing = pxa2xx_pcmcia_set_timing; | 278 | ops->set_timing = pxa2xx_pcmcia_set_timing; |
197 | #ifdef CONFIG_CPU_FREQ | 279 | #ifdef CONFIG_CPU_FREQ |
198 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | 280 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; |
199 | #endif | 281 | #endif |
200 | 282 | ||
201 | ret = soc_common_drv_pcmcia_probe(dev, ops, ops->first, ops->nr); | 283 | ret = soc_common_drv_pcmcia_probe(dev, ops, sinfo); |
202 | 284 | ||
203 | if (!ret) | 285 | if (!ret) |
204 | pxa2xx_configure_sockets(dev); | 286 | pxa2xx_configure_sockets(dev); |