diff options
Diffstat (limited to 'drivers/pcmcia/pxa2xx_base.c')
-rw-r--r-- | drivers/pcmcia/pxa2xx_base.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index 1b07af5a2ed3..13f1e0fd3f31 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <asm/system.h> | 30 | #include <asm/system.h> |
31 | #include <mach/pxa-regs.h> | 31 | #include <mach/pxa-regs.h> |
32 | #include <mach/pxa2xx-regs.h> | 32 | #include <mach/pxa2xx-regs.h> |
33 | #include <asm/mach-types.h> | ||
33 | 34 | ||
34 | #include <pcmcia/cs_types.h> | 35 | #include <pcmcia/cs_types.h> |
35 | #include <pcmcia/ss.h> | 36 | #include <pcmcia/ss.h> |
@@ -166,18 +167,32 @@ pxa2xx_pcmcia_frequency_change(struct soc_pcmcia_socket *skt, | |||
166 | } | 167 | } |
167 | #endif | 168 | #endif |
168 | 169 | ||
170 | static void pxa2xx_configure_sockets(struct device *dev) | ||
171 | { | ||
172 | struct pcmcia_low_level *ops = dev->platform_data; | ||
173 | |||
174 | /* | ||
175 | * We have at least one socket, so set MECR:CIT | ||
176 | * (Card Is There) | ||
177 | */ | ||
178 | MECR |= MECR_CIT; | ||
179 | |||
180 | /* Set MECR:NOS (Number Of Sockets) */ | ||
181 | if (ops->nr > 1 || machine_is_viper()) | ||
182 | MECR |= MECR_NOS; | ||
183 | else | ||
184 | MECR &= ~MECR_NOS; | ||
185 | } | ||
186 | |||
169 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) | 187 | int __pxa2xx_drv_pcmcia_probe(struct device *dev) |
170 | { | 188 | { |
171 | int ret; | 189 | int ret; |
172 | struct pcmcia_low_level *ops; | 190 | struct pcmcia_low_level *ops; |
173 | int first, nr; | ||
174 | 191 | ||
175 | if (!dev || !dev->platform_data) | 192 | if (!dev || !dev->platform_data) |
176 | return -ENODEV; | 193 | return -ENODEV; |
177 | 194 | ||
178 | ops = (struct pcmcia_low_level *)dev->platform_data; | 195 | ops = (struct pcmcia_low_level *)dev->platform_data; |
179 | first = ops->first; | ||
180 | nr = ops->nr; | ||
181 | 196 | ||
182 | /* Provide our PXA2xx specific timing routines. */ | 197 | /* Provide our PXA2xx specific timing routines. */ |
183 | ops->set_timing = pxa2xx_pcmcia_set_timing; | 198 | ops->set_timing = pxa2xx_pcmcia_set_timing; |
@@ -185,21 +200,10 @@ int __pxa2xx_drv_pcmcia_probe(struct device *dev) | |||
185 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; | 200 | ops->frequency_change = pxa2xx_pcmcia_frequency_change; |
186 | #endif | 201 | #endif |
187 | 202 | ||
188 | ret = soc_common_drv_pcmcia_probe(dev, ops, first, nr); | 203 | ret = soc_common_drv_pcmcia_probe(dev, ops, ops->first, ops->nr); |
189 | 204 | ||
190 | if (ret == 0) { | 205 | if (!ret) |
191 | /* | 206 | pxa2xx_configure_sockets(dev); |
192 | * We have at least one socket, so set MECR:CIT | ||
193 | * (Card Is There) | ||
194 | */ | ||
195 | MECR |= MECR_CIT; | ||
196 | |||
197 | /* Set MECR:NOS (Number Of Sockets) */ | ||
198 | if (nr > 1) | ||
199 | MECR |= MECR_NOS; | ||
200 | else | ||
201 | MECR &= ~MECR_NOS; | ||
202 | } | ||
203 | 207 | ||
204 | return ret; | 208 | return ret; |
205 | } | 209 | } |
@@ -223,11 +227,7 @@ static int pxa2xx_drv_pcmcia_suspend(struct platform_device *dev, pm_message_t s | |||
223 | 227 | ||
224 | static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev) | 228 | static int pxa2xx_drv_pcmcia_resume(struct platform_device *dev) |
225 | { | 229 | { |
226 | struct pcmcia_low_level *ops = dev->dev.platform_data; | 230 | pxa2xx_configure_sockets(&dev->dev); |
227 | int nr = ops ? ops->nr : 0; | ||
228 | |||
229 | MECR = nr > 1 ? MECR_CIT | MECR_NOS : (nr > 0 ? MECR_CIT : 0); | ||
230 | |||
231 | return pcmcia_socket_dev_resume(&dev->dev); | 231 | return pcmcia_socket_dev_resume(&dev->dev); |
232 | } | 232 | } |
233 | 233 | ||