aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_resource.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/pcmcia_resource.c')
-rw-r--r--drivers/pcmcia/pcmcia_resource.c81
1 files changed, 10 insertions, 71 deletions
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 1d128fbd1a92..4884a18cf9e6 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -21,11 +21,9 @@
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/device.h> 22#include <linux/device.h>
23 23
24#define IN_CARD_SERVICES
25#include <pcmcia/cs_types.h> 24#include <pcmcia/cs_types.h>
26#include <pcmcia/ss.h> 25#include <pcmcia/ss.h>
27#include <pcmcia/cs.h> 26#include <pcmcia/cs.h>
28#include <pcmcia/bulkmem.h>
29#include <pcmcia/cistpl.h> 27#include <pcmcia/cistpl.h>
30#include <pcmcia/cisreg.h> 28#include <pcmcia/cisreg.h>
31#include <pcmcia/ds.h> 29#include <pcmcia/ds.h>
@@ -311,74 +309,6 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle,
311EXPORT_SYMBOL(pcmcia_get_window); 309EXPORT_SYMBOL(pcmcia_get_window);
312 310
313 311
314/** pccard_get_status
315 *
316 * Get the current socket state bits. We don't support the latched
317 * SocketState yet: I haven't seen any point for it.
318 */
319
320int pccard_get_status(struct pcmcia_socket *s, struct pcmcia_device *p_dev,
321 cs_status_t *status)
322{
323 config_t *c;
324 int val;
325
326 s->ops->get_status(s, &val);
327 status->CardState = status->SocketState = 0;
328 status->CardState |= (val & SS_DETECT) ? CS_EVENT_CARD_DETECT : 0;
329 status->CardState |= (val & SS_CARDBUS) ? CS_EVENT_CB_DETECT : 0;
330 status->CardState |= (val & SS_3VCARD) ? CS_EVENT_3VCARD : 0;
331 status->CardState |= (val & SS_XVCARD) ? CS_EVENT_XVCARD : 0;
332 if (s->state & SOCKET_SUSPEND)
333 status->CardState |= CS_EVENT_PM_SUSPEND;
334 if (!(s->state & SOCKET_PRESENT))
335 return CS_NO_CARD;
336
337 c = (p_dev) ? p_dev->function_config : NULL;
338
339 if ((c != NULL) && (c->state & CONFIG_LOCKED) &&
340 (c->IntType & (INT_MEMORY_AND_IO | INT_ZOOMED_VIDEO))) {
341 u_char reg;
342 if (c->CardValues & PRESENT_PIN_REPLACE) {
343 pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_PRR)>>1, 1, &reg);
344 status->CardState |=
345 (reg & PRR_WP_STATUS) ? CS_EVENT_WRITE_PROTECT : 0;
346 status->CardState |=
347 (reg & PRR_READY_STATUS) ? CS_EVENT_READY_CHANGE : 0;
348 status->CardState |=
349 (reg & PRR_BVD2_STATUS) ? CS_EVENT_BATTERY_LOW : 0;
350 status->CardState |=
351 (reg & PRR_BVD1_STATUS) ? CS_EVENT_BATTERY_DEAD : 0;
352 } else {
353 /* No PRR? Then assume we're always ready */
354 status->CardState |= CS_EVENT_READY_CHANGE;
355 }
356 if (c->CardValues & PRESENT_EXT_STATUS) {
357 pcmcia_read_cis_mem(s, 1, (c->ConfigBase+CISREG_ESR)>>1, 1, &reg);
358 status->CardState |=
359 (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0;
360 }
361 return CS_SUCCESS;
362 }
363 status->CardState |=
364 (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0;
365 status->CardState |=
366 (val & SS_BATDEAD) ? CS_EVENT_BATTERY_DEAD : 0;
367 status->CardState |=
368 (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0;
369 status->CardState |=
370 (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0;
371 return CS_SUCCESS;
372} /* pccard_get_status */
373
374int pcmcia_get_status(struct pcmcia_device *p_dev, cs_status_t *status)
375{
376 return pccard_get_status(p_dev->socket, p_dev, status);
377}
378EXPORT_SYMBOL(pcmcia_get_status);
379
380
381
382/** pcmcia_get_mem_page 312/** pcmcia_get_mem_page
383 * 313 *
384 * Change the card address of an already open memory window. 314 * Change the card address of an already open memory window.
@@ -812,6 +742,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
812 type = IRQF_SHARED; 742 type = IRQF_SHARED;
813 743
814#ifdef CONFIG_PCMCIA_PROBE 744#ifdef CONFIG_PCMCIA_PROBE
745
746#ifdef IRQ_NOAUTOEN
747 /* if the underlying IRQ infrastructure allows for it, only allocate
748 * the IRQ, but do not enable it
749 */
750 if (!(req->Attributes & IRQ_HANDLE_PRESENT))
751 type |= IRQ_NOAUTOEN;
752#endif /* IRQ_NOAUTOEN */
753
815 if (s->irq.AssignedIRQ != 0) { 754 if (s->irq.AssignedIRQ != 0) {
816 /* If the interrupt is already assigned, it must be the same */ 755 /* If the interrupt is already assigned, it must be the same */
817 irq = s->irq.AssignedIRQ; 756 irq = s->irq.AssignedIRQ;
@@ -966,7 +905,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) {
966 pcmcia_release_configuration(p_dev); 905 pcmcia_release_configuration(p_dev);
967 pcmcia_release_io(p_dev, &p_dev->io); 906 pcmcia_release_io(p_dev, &p_dev->io);
968 pcmcia_release_irq(p_dev, &p_dev->irq); 907 pcmcia_release_irq(p_dev, &p_dev->irq);
969 if (&p_dev->win) 908 if (p_dev->win)
970 pcmcia_release_window(p_dev->win); 909 pcmcia_release_window(p_dev->win);
971} 910}
972EXPORT_SYMBOL(pcmcia_disable_device); 911EXPORT_SYMBOL(pcmcia_disable_device);