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