This commit was manufactured by cvs2svn to create branch 'vserver'.
[linux-2.6.git] / drivers / pcmcia / sa11xx_core.h
1 /*
2  * linux/include/asm/arch/pcmcia.h
3  *
4  * Copyright (C) 2000 John G Dorsey <john+@cs.cmu.edu>
5  *
6  * This file contains definitions for the low-level SA-1100 kernel PCMCIA
7  * interface. Please see linux/Documentation/arm/SA1100/PCMCIA for details.
8  */
9 #ifndef _ASM_ARCH_PCMCIA
10 #define _ASM_ARCH_PCMCIA
11
12 /* include the world */
13 #include <pcmcia/version.h>
14 #include <pcmcia/cs_types.h>
15 #include <pcmcia/cs.h>
16 #include <pcmcia/ss.h>
17 #include <pcmcia/bulkmem.h>
18 #include <pcmcia/cistpl.h>
19 #include "cs_internal.h"
20
21 struct device;
22
23 /* Ideally, we'd support up to MAX_SOCK sockets, but the SA-1100 only
24  * has support for two. This shows up in lots of hardwired ways, such
25  * as the fact that MECR only has enough bits to configure two sockets.
26  * Since it's so entrenched in the hardware, limiting the software
27  * in this way doesn't seem too terrible.
28  */
29 #define SA1100_PCMCIA_MAX_SOCK   (2)
30
31 struct pcmcia_state {
32   unsigned detect: 1,
33             ready: 1,
34              bvd1: 1,
35              bvd2: 1,
36            wrprot: 1,
37             vs_3v: 1,
38             vs_Xv: 1;
39 };
40
41 /*
42  * This structure encapsulates per-socket state which we might need to
43  * use when responding to a Card Services query of some kind.
44  */
45 struct sa1100_pcmcia_socket {
46         struct pcmcia_socket    socket;
47
48         /*
49          * Info from low level handler
50          */
51         struct device           *dev;
52         unsigned int            nr;
53         unsigned int            irq;
54
55         /*
56          * Core PCMCIA state
57          */
58         struct pcmcia_low_level *ops;
59
60         unsigned int            status;
61         socket_state_t          cs_state;
62
63         unsigned short          spd_io[MAX_IO_WIN];
64         unsigned short          spd_mem[MAX_WIN];
65         unsigned short          spd_attr[MAX_WIN];
66
67         struct resource         res_skt;
68         struct resource         res_io;
69         struct resource         res_mem;
70         struct resource         res_attr;
71         void                    *virt_io;
72
73         unsigned int            irq_state;
74
75         struct timer_list       poll_timer;
76         struct list_head        node;
77 };
78
79 struct pcmcia_low_level {
80         struct module *owner;
81
82         int (*hw_init)(struct sa1100_pcmcia_socket *);
83         void (*hw_shutdown)(struct sa1100_pcmcia_socket *);
84
85         void (*socket_state)(struct sa1100_pcmcia_socket *, struct pcmcia_state *);
86         int (*configure_socket)(struct sa1100_pcmcia_socket *, const socket_state_t *);
87
88         /*
89          * Enable card status IRQs on (re-)initialisation.  This can
90          * be called at initialisation, power management event, or
91          * pcmcia event.
92          */
93         void (*socket_init)(struct sa1100_pcmcia_socket *);
94
95         /*
96          * Disable card status IRQs and PCMCIA bus on suspend.
97          */
98         void (*socket_suspend)(struct sa1100_pcmcia_socket *);
99
100         /*
101          * Calculate MECR timing clock wait states
102          */
103         unsigned int (*socket_get_timing)(struct sa1100_pcmcia_socket *,
104                         unsigned int cpu_speed, unsigned int cmd_time);
105 };
106
107 struct pcmcia_irqs {
108         int sock;
109         int irq;
110         const char *str;
111 };
112
113 int sa11xx_request_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
114 void sa11xx_free_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
115 void sa11xx_disable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
116 void sa11xx_enable_irqs(struct sa1100_pcmcia_socket *skt, struct pcmcia_irqs *irqs, int nr);
117
118 extern int sa11xx_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr);
119 extern int sa11xx_drv_pcmcia_remove(struct device *dev);
120
121 #endif