diff options
Diffstat (limited to 'drivers/pcmcia/pxa2xx_base.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 89 |
1 files changed, 85 insertions, 4 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index bb9ddb9532e3..c49a7269f6d1 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <asm/io.h> | 28 | #include <asm/io.h> |
29 | #include <asm/irq.h> | 29 | #include <asm/irq.h> |
30 | #include <asm/system.h> | 30 | #include <asm/system.h> |
31 | #include <mach/pxa-regs.h> | ||
32 | #include <mach/pxa2xx-regs.h> | 31 | #include <mach/pxa2xx-regs.h> |
33 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
34 | 33 | ||
@@ -39,6 +38,44 @@ | |||
39 | #include "soc_common.h" | 38 | #include "soc_common.h" |
40 | #include "pxa2xx_base.h" | 39 | #include "pxa2xx_base.h" |
41 | 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 | |||
42 | 79 | ||
43 | #define MCXX_SETUP_MASK (0x7f) | 80 | #define MCXX_SETUP_MASK (0x7f) |
44 | #define MCXX_ASST_MASK (0x1f) | 81 | #define MCXX_ASST_MASK (0x1f) |
@@ -177,29 +214,73 @@ static void pxa2xx_configure_sockets(struct device *dev) | |||
177 | MECR |= MECR_CIT; | 214 | MECR |= MECR_CIT; |
178 | 215 | ||
179 | /* Set MECR:NOS (Number Of Sockets) */ | 216 | /* Set MECR:NOS (Number Of Sockets) */ |
180 | if (ops->nr > 1 || machine_is_viper()) | 217 | if ((ops->first + ops->nr) > 1 || machine_is_viper()) |
181 | MECR |= MECR_NOS; | 218 | MECR |= MECR_NOS; |
182 | else | 219 | else |
183 | MECR &= ~MECR_NOS; | 220 | MECR &= ~MECR_NOS; |
184 | } | 221 | } |
185 | 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 | |||
186 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) | 231 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) |
187 | { | 232 | { |
188 | int ret; | 233 | int i, ret; |
189 | struct pcmcia_low_level *ops; | 234 | struct pcmcia_low_level *ops; |
235 | struct skt_dev_info *sinfo; | ||
236 | struct soc_pcmcia_socket *skt; | ||
190 | 237 | ||
191 | if (!dev || !dev->platform_data) | 238 | if (!dev || !dev->platform_data) |
192 | return -ENODEV; | 239 | return -ENODEV; |
193 | 240 | ||
194 | ops = (struct pcmcia_low_level *)dev->platform_data; | 241 | ops = (struct pcmcia_low_level *)dev->platform_data; |
195 | 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 = ops->first + 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 | |||
196 | /* Provide our PXA2xx specific timing routines. */ | 277 | /* Provide our PXA2xx specific timing routines. */ |
197 | ops->set_timing = pxa2xx_pcmcia_set_timing; | 278 | ops->set_timing = pxa2xx_pcmcia_set_timing; |
198 | #ifdef CONFIG_CPU_FREQ | 279 | #ifdef CONFIG_CPU_FREQ |
199 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | 280 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; |
200 | #endif | 281 | #endif |
201 | 282 | ||
202 | ret = soc_common_drv_pcmcia_probe(dev, ops, ops->first, ops->nr); | 283 | ret = soc_common_drv_pcmcia_probe(dev, ops, sinfo); |
203 | 284 | ||
204 | if (!ret) | 285 | if (!ret) |
205 | pxa2xx_configure_sockets(dev); | 286 | pxa2xx_configure_sockets(dev); |