diff options
Diffstat (limited to 'include/pcmcia/ds.h')
-rw-r--r-- | include/pcmcia/ds.h | 87 |
1 files changed, 61 insertions, 26 deletions
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 70c58ed2278c..8479b66c067b 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h | |||
@@ -24,9 +24,11 @@ | |||
24 | 24 | ||
25 | #ifdef __KERNEL__ | 25 | #ifdef __KERNEL__ |
26 | #include <linux/device.h> | 26 | #include <linux/device.h> |
27 | #include <linux/interrupt.h> | ||
27 | #include <pcmcia/ss.h> | 28 | #include <pcmcia/ss.h> |
28 | #include <asm/atomic.h> | 29 | #include <asm/atomic.h> |
29 | 30 | ||
31 | |||
30 | /* | 32 | /* |
31 | * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus | 33 | * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus |
32 | * a.k.a. PCI drivers | 34 | * a.k.a. PCI drivers |
@@ -36,8 +38,6 @@ struct pcmcia_device; | |||
36 | struct config_t; | 38 | struct config_t; |
37 | struct net_device; | 39 | struct net_device; |
38 | 40 | ||
39 | typedef struct resource *window_handle_t; | ||
40 | |||
41 | /* dynamic device IDs for PCMCIA device drivers. See | 41 | /* dynamic device IDs for PCMCIA device drivers. See |
42 | * Documentation/pcmcia/driver.txt for details. | 42 | * Documentation/pcmcia/driver.txt for details. |
43 | */ | 43 | */ |
@@ -47,6 +47,8 @@ struct pcmcia_dynids { | |||
47 | }; | 47 | }; |
48 | 48 | ||
49 | struct pcmcia_driver { | 49 | struct pcmcia_driver { |
50 | const char *name; | ||
51 | |||
50 | int (*probe) (struct pcmcia_device *dev); | 52 | int (*probe) (struct pcmcia_device *dev); |
51 | void (*remove) (struct pcmcia_device *dev); | 53 | void (*remove) (struct pcmcia_device *dev); |
52 | 54 | ||
@@ -90,15 +92,17 @@ struct pcmcia_device { | |||
90 | 92 | ||
91 | struct list_head socket_device_list; | 93 | struct list_head socket_device_list; |
92 | 94 | ||
93 | /* deprecated, will be cleaned up soon */ | ||
94 | config_req_t conf; | ||
95 | window_handle_t win; | ||
96 | |||
97 | /* device setup */ | 95 | /* device setup */ |
98 | unsigned int irq; | 96 | unsigned int irq; |
99 | struct resource *resource[PCMCIA_NUM_RESOURCES]; | 97 | struct resource *resource[PCMCIA_NUM_RESOURCES]; |
98 | resource_size_t card_addr; /* for the 1st IOMEM resource */ | ||
99 | unsigned int vpp; | ||
100 | 100 | ||
101 | unsigned int io_lines; /* number of I/O lines */ | 101 | unsigned int config_flags; /* CONF_ENABLE_ flags below */ |
102 | unsigned int config_base; | ||
103 | unsigned int config_index; | ||
104 | unsigned int config_regs; /* PRESENT_ flags below */ | ||
105 | unsigned int io_lines; /* number of I/O lines */ | ||
102 | 106 | ||
103 | /* Is the device suspended? */ | 107 | /* Is the device suspended? */ |
104 | u16 suspended:1; | 108 | u16 suspended:1; |
@@ -174,9 +178,6 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); | |||
174 | /* loop CIS entries for valid configuration */ | 178 | /* loop CIS entries for valid configuration */ |
175 | int pcmcia_loop_config(struct pcmcia_device *p_dev, | 179 | int pcmcia_loop_config(struct pcmcia_device *p_dev, |
176 | int (*conf_check) (struct pcmcia_device *p_dev, | 180 | int (*conf_check) (struct pcmcia_device *p_dev, |
177 | cistpl_cftable_entry_t *cf, | ||
178 | cistpl_cftable_entry_t *dflt, | ||
179 | unsigned int vcc, | ||
180 | void *priv_data), | 181 | void *priv_data), |
181 | void *priv_data); | 182 | void *priv_data); |
182 | 183 | ||
@@ -206,16 +207,17 @@ pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, | |||
206 | int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, | 207 | int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, |
207 | irq_handler_t handler); | 208 | irq_handler_t handler); |
208 | 209 | ||
209 | int pcmcia_request_configuration(struct pcmcia_device *p_dev, | 210 | int pcmcia_enable_device(struct pcmcia_device *p_dev); |
210 | config_req_t *req); | ||
211 | 211 | ||
212 | int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, | 212 | int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, |
213 | window_handle_t *wh); | 213 | unsigned int speed); |
214 | int pcmcia_release_window(struct pcmcia_device *p_dev, window_handle_t win); | 214 | int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); |
215 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t win, | 215 | int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, |
216 | unsigned int offset); | 216 | unsigned int offset); |
217 | 217 | ||
218 | int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); | 218 | int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp); |
219 | int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev); | ||
220 | |||
219 | void pcmcia_disable_device(struct pcmcia_device *p_dev); | 221 | void pcmcia_disable_device(struct pcmcia_device *p_dev); |
220 | 222 | ||
221 | /* IO ports */ | 223 | /* IO ports */ |
@@ -224,15 +226,48 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev); | |||
224 | #define IO_DATA_PATH_WIDTH_16 0x08 | 226 | #define IO_DATA_PATH_WIDTH_16 0x08 |
225 | #define IO_DATA_PATH_WIDTH_AUTO 0x10 | 227 | #define IO_DATA_PATH_WIDTH_AUTO 0x10 |
226 | 228 | ||
227 | /* convert flag found in cfgtable to data path width parameter */ | 229 | /* IO memory */ |
228 | static inline int pcmcia_io_cfg_data_width(unsigned int flags) | 230 | #define WIN_MEMORY_TYPE_CM 0x00 /* default */ |
229 | { | 231 | #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ |
230 | if (!(flags & CISTPL_IO_8BIT)) | 232 | #define WIN_DATA_WIDTH_8 0x00 /* default */ |
231 | return IO_DATA_PATH_WIDTH_16; | 233 | #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ |
232 | if (!(flags & CISTPL_IO_16BIT)) | 234 | #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ |
233 | return IO_DATA_PATH_WIDTH_8; | 235 | #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ |
234 | return IO_DATA_PATH_WIDTH_AUTO; | 236 | |
235 | } | 237 | #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | |
238 | MAP_USE_WAIT */ | ||
239 | #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: | ||
240 | 0x04 -> 0 | ||
241 | 0x08 -> 1 | ||
242 | 0x0c -> 2 | ||
243 | 0x10 -> 3 */ | ||
244 | |||
245 | /* config_reg{ister}s present for this PCMCIA device */ | ||
246 | #define PRESENT_OPTION 0x001 | ||
247 | #define PRESENT_STATUS 0x002 | ||
248 | #define PRESENT_PIN_REPLACE 0x004 | ||
249 | #define PRESENT_COPY 0x008 | ||
250 | #define PRESENT_EXT_STATUS 0x010 | ||
251 | #define PRESENT_IOBASE_0 0x020 | ||
252 | #define PRESENT_IOBASE_1 0x040 | ||
253 | #define PRESENT_IOBASE_2 0x080 | ||
254 | #define PRESENT_IOBASE_3 0x100 | ||
255 | #define PRESENT_IOSIZE 0x200 | ||
256 | |||
257 | /* flags to be passed to pcmcia_enable_device() */ | ||
258 | #define CONF_ENABLE_IRQ 0x0001 | ||
259 | #define CONF_ENABLE_SPKR 0x0002 | ||
260 | #define CONF_ENABLE_PULSE_IRQ 0x0004 | ||
261 | #define CONF_ENABLE_ESR 0x0008 | ||
262 | #define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ | ||
263 | * (CONF_ENABLE_IRQ) in use */ | ||
264 | |||
265 | /* flags used by pcmcia_loop_config() autoconfiguration */ | ||
266 | #define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ | ||
267 | #define CONF_AUTO_SET_VPP 0x0200 /* set Vpp? */ | ||
268 | #define CONF_AUTO_AUDIO 0x0400 /* enable audio line? */ | ||
269 | #define CONF_AUTO_SET_IO 0x0800 /* set ->resource[0,1] */ | ||
270 | #define CONF_AUTO_SET_IOMEM 0x1000 /* set ->resource[2] */ | ||
236 | 271 | ||
237 | #endif /* __KERNEL__ */ | 272 | #endif /* __KERNEL__ */ |
238 | 273 | ||