Blame view
include/pcmcia/ds.h
7.46 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 6 7 8 9 10 11 12 |
/* * ds.h -- 16-bit PCMCIA core support * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * The initial developer of the original code is David A. Hinds * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * (C) 1999 David A. Hinds |
a58357862 pcmcia: cleanup d... |
13 |
* (C) 2003 - 2008 Dominik Brodowski |
1da177e4c Linux-2.6.12-rc2 |
14 15 16 17 |
*/ #ifndef _LINUX_DS_H #define _LINUX_DS_H |
8e2f3b70e [PATCH] pcmcia: f... |
18 19 20 |
#ifdef __KERNEL__ #include <linux/mod_devicetable.h> #endif |
1ad275e3e [PATCH] pcmcia: d... |
21 |
#include <pcmcia/device_id.h> |
1da177e4c Linux-2.6.12-rc2 |
22 |
|
1da177e4c Linux-2.6.12-rc2 |
23 24 |
#ifdef __KERNEL__ #include <linux/device.h> |
1ac71e5a3 pcmcia: convert p... |
25 |
#include <linux/interrupt.h> |
e2d409636 [PATCH] pcmcia: u... |
26 |
#include <pcmcia/ss.h> |
60063497a atomic: use <linu... |
27 |
#include <linux/atomic.h> |
1da177e4c Linux-2.6.12-rc2 |
28 |
|
1ac71e5a3 pcmcia: convert p... |
29 |
|
a58357862 pcmcia: cleanup d... |
30 31 32 33 |
/* * PCMCIA device drivers (16-bit cards only; 32-bit cards require CardBus * a.k.a. PCI drivers */ |
1da177e4c Linux-2.6.12-rc2 |
34 |
struct pcmcia_socket; |
a58357862 pcmcia: cleanup d... |
35 |
struct pcmcia_device; |
dbb22f0d6 [PATCH] pcmcia: a... |
36 |
struct config_t; |
91284224d pcmcia: add new C... |
37 |
struct net_device; |
1da177e4c Linux-2.6.12-rc2 |
38 |
|
a58357862 pcmcia: cleanup d... |
39 40 41 |
/* dynamic device IDs for PCMCIA device drivers. See * Documentation/pcmcia/driver.txt for details. */ |
6179b5562 add new_id to PCM... |
42 |
struct pcmcia_dynids { |
3f565232c pcmcia: use mutex... |
43 |
struct mutex lock; |
6179b5562 add new_id to PCM... |
44 45 |
struct list_head list; }; |
1da177e4c Linux-2.6.12-rc2 |
46 |
struct pcmcia_driver { |
2e9b981a7 pcmcia: move driv... |
47 |
const char *name; |
f8cfa618d [PATCH] pcmcia: u... |
48 |
int (*probe) (struct pcmcia_device *dev); |
cc3b4866b [PATCH] pcmcia: u... |
49 |
void (*remove) (struct pcmcia_device *dev); |
98e4c28b7 [PATCH] pcmcia: n... |
50 51 |
int (*suspend) (struct pcmcia_device *dev); int (*resume) (struct pcmcia_device *dev); |
1da177e4c Linux-2.6.12-rc2 |
52 |
struct module *owner; |
e9fb13bfe pcmcia: Make decl... |
53 |
const struct pcmcia_device_id *id_table; |
1da177e4c Linux-2.6.12-rc2 |
54 |
struct device_driver drv; |
6179b5562 add new_id to PCM... |
55 |
struct pcmcia_dynids dynids; |
1da177e4c Linux-2.6.12-rc2 |
56 57 58 59 60 |
}; /* driver registration */ int pcmcia_register_driver(struct pcmcia_driver *driver); void pcmcia_unregister_driver(struct pcmcia_driver *driver); |
0ca724d37 pcmcia: use struc... |
61 62 63 64 65 66 67 68 69 70 |
/* for struct resource * array embedded in struct pcmcia_device */ enum { PCMCIA_IOPORT_0, PCMCIA_IOPORT_1, PCMCIA_IOMEM_0, PCMCIA_IOMEM_1, PCMCIA_IOMEM_2, PCMCIA_IOMEM_3, PCMCIA_NUM_RESOURCES, }; |
1da177e4c Linux-2.6.12-rc2 |
71 72 73 74 |
struct pcmcia_device { /* the socket and the device_no [for multifunction devices] uniquely define a pcmcia_device */ struct pcmcia_socket *socket; |
bd65a6857 [PATCH] pcmcia: a... |
75 |
char *devname; |
1da177e4c Linux-2.6.12-rc2 |
76 77 78 79 80 |
u8 device_no; /* the hardware "function" device; certain subdevices can * share one hardware "function" device. */ u8 func; |
9fea84f46 pcmcia: CodingSty... |
81 |
struct config_t *function_config; |
1da177e4c Linux-2.6.12-rc2 |
82 83 |
struct list_head socket_device_list; |
6f0f38c45 pcmcia: setup IRQ... |
84 |
/* device setup */ |
eb14120f7 pcmcia: re-work p... |
85 |
unsigned int irq; |
0ca724d37 pcmcia: use struc... |
86 |
struct resource *resource[PCMCIA_NUM_RESOURCES]; |
00990e7ce pcmcia: use autoc... |
87 |
resource_size_t card_addr; /* for the 1st IOMEM resource */ |
e8405f0f6 pcmcia: move Vpp ... |
88 |
unsigned int vpp; |
6f0f38c45 pcmcia: setup IRQ... |
89 |
|
1ac71e5a3 pcmcia: convert p... |
90 |
unsigned int config_flags; /* CONF_ENABLE_ flags below */ |
7feabb641 pcmcia: move conf... |
91 92 93 |
unsigned int config_base; unsigned int config_index; unsigned int config_regs; /* PRESENT_ flags below */ |
1ac71e5a3 pcmcia: convert p... |
94 |
unsigned int io_lines; /* number of I/O lines */ |
90abdc3b9 pcmcia: do not us... |
95 |
|
04de08161 pcmcia: pcmcia_de... |
96 |
/* Is the device suspended? */ |
e2d409636 [PATCH] pcmcia: u... |
97 98 99 100 101 102 103 104 |
u16 suspended:1; /* Flags whether io, irq, win configurations were * requested, and whether the configuration is "locked" */ u16 _irq:1; u16 _io:1; u16 _win:4; u16 _locked:1; |
1da177e4c Linux-2.6.12-rc2 |
105 |
|
e2d409636 [PATCH] pcmcia: u... |
106 107 108 |
/* Flag whether a "fuzzy" func_id based match is * allowed. */ u16 allow_func_id_match:1; |
f6fbe01ac [PATCH] pcmcia: r... |
109 |
|
1da177e4c Linux-2.6.12-rc2 |
110 |
/* information about this device */ |
e2d409636 [PATCH] pcmcia: u... |
111 112 113 |
u16 has_manf_id:1; u16 has_card_id:1; u16 has_func_id:1; |
1ad275e3e [PATCH] pcmcia: d... |
114 |
|
04de08161 pcmcia: pcmcia_de... |
115 |
u16 reserved:4; |
1da177e4c Linux-2.6.12-rc2 |
116 117 118 119 |
u8 func_id; u16 manf_id; u16 card_id; |
9fea84f46 pcmcia: CodingSty... |
120 |
char *prod_id[4]; |
1da177e4c Linux-2.6.12-rc2 |
121 |
|
43d9f7fda pcmcia: use DMA_M... |
122 |
u64 dma_mask; |
0e0fad8f7 [PATCH] pcmcia: s... |
123 |
struct device dev; |
e2d409636 [PATCH] pcmcia: u... |
124 125 |
/* data private to drivers */ void *priv; |
2ce4905e4 pcmcia: use struc... |
126 |
unsigned int open; |
1da177e4c Linux-2.6.12-rc2 |
127 128 129 130 |
}; #define to_pcmcia_dev(n) container_of(n, struct pcmcia_device, dev) #define to_pcmcia_drv(n) container_of(n, struct pcmcia_driver, drv) |
a58357862 pcmcia: cleanup d... |
131 |
|
91284224d pcmcia: add new C... |
132 133 134 135 136 137 138 139 140 141 |
/* * CIS access. * * Please use the following functions to access CIS tuples: * - pcmcia_get_tuple() * - pcmcia_loop_tuple() * - pcmcia_get_mac_from_cis() * * To parse a tuple_t, pcmcia_parse_tuple() exists. Its interface * might change in future. |
272433e08 pcmcia: cistpl he... |
142 |
*/ |
272433e08 pcmcia: cistpl he... |
143 |
|
91284224d pcmcia: add new C... |
144 145 146 147 |
/* get the very first CIS entry of type @code. Note that buf is pointer * to u8 *buf; and that you need to kfree(buf) afterwards. */ size_t pcmcia_get_tuple(struct pcmcia_device *p_dev, cisdata_t code, u8 **buf); |
272433e08 pcmcia: cistpl he... |
148 |
|
91284224d pcmcia: add new C... |
149 150 151 152 153 154 |
/* loop over CIS entries */ int pcmcia_loop_tuple(struct pcmcia_device *p_dev, cisdata_t code, int (*loop_tuple) (struct pcmcia_device *p_dev, tuple_t *tuple, void *priv_data), void *priv_data); |
272433e08 pcmcia: cistpl he... |
155 |
|
91284224d pcmcia: add new C... |
156 157 158 |
/* get the MAC address from CISTPL_FUNCE */ int pcmcia_get_mac_from_cis(struct pcmcia_device *p_dev, struct net_device *dev); |
272433e08 pcmcia: cistpl he... |
159 |
|
91284224d pcmcia: add new C... |
160 161 |
/* parse a tuple_t */ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); |
272433e08 pcmcia: cistpl he... |
162 163 164 |
/* loop CIS entries for valid configuration */ int pcmcia_loop_config(struct pcmcia_device *p_dev, int (*conf_check) (struct pcmcia_device *p_dev, |
272433e08 pcmcia: cistpl he... |
165 166 |
void *priv_data), void *priv_data); |
1da177e4c Linux-2.6.12-rc2 |
167 |
|
994917f8b pcmcia: card serv... |
168 169 170 171 172 173 174 |
/* is the device still there? */ struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev); /* low-level interface reset */ int pcmcia_reset_card(struct pcmcia_socket *skt); /* CIS config */ |
1d5cc192d pcmcia: use pcmic... |
175 176 |
int pcmcia_read_config_byte(struct pcmcia_device *p_dev, off_t where, u8 *val); int pcmcia_write_config_byte(struct pcmcia_device *p_dev, off_t where, u8 val); |
994917f8b pcmcia: card serv... |
177 178 |
/* device configuration */ |
90abdc3b9 pcmcia: do not us... |
179 |
int pcmcia_request_io(struct pcmcia_device *p_dev); |
eb14120f7 pcmcia: re-work p... |
180 |
|
b19a7275d pcmcia: clarify a... |
181 182 |
int __must_check __pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, |
eb14120f7 pcmcia: re-work p... |
183 |
irq_handler_t handler); |
b19a7275d pcmcia: clarify a... |
184 185 186 187 188 189 |
static inline __must_check __deprecated int pcmcia_request_exclusive_irq(struct pcmcia_device *p_dev, irq_handler_t handler) { return __pcmcia_request_exclusive_irq(p_dev, handler); } |
eb14120f7 pcmcia: re-work p... |
190 191 |
int __must_check pcmcia_request_irq(struct pcmcia_device *p_dev, irq_handler_t handler); |
1ac71e5a3 pcmcia: convert p... |
192 |
int pcmcia_enable_device(struct pcmcia_device *p_dev); |
994917f8b pcmcia: card serv... |
193 |
|
cdb138080 pcmcia: do not us... |
194 195 196 197 |
int pcmcia_request_window(struct pcmcia_device *p_dev, struct resource *res, unsigned int speed); int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res); int pcmcia_map_mem_page(struct pcmcia_device *p_dev, struct resource *res, |
b5cb259e7 pcmcia: remove me... |
198 |
unsigned int offset); |
994917f8b pcmcia: card serv... |
199 |
|
fb49fa533 pcmcia: split up ... |
200 201 |
int pcmcia_fixup_vpp(struct pcmcia_device *p_dev, unsigned char new_vpp); int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev); |
994917f8b pcmcia: card serv... |
202 |
void pcmcia_disable_device(struct pcmcia_device *p_dev); |
90abdc3b9 pcmcia: do not us... |
203 204 205 206 207 |
/* IO ports */ #define IO_DATA_PATH_WIDTH 0x18 #define IO_DATA_PATH_WIDTH_8 0x00 #define IO_DATA_PATH_WIDTH_16 0x08 #define IO_DATA_PATH_WIDTH_AUTO 0x10 |
cdb138080 pcmcia: do not us... |
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
/* IO memory */ #define WIN_MEMORY_TYPE_CM 0x00 /* default */ #define WIN_MEMORY_TYPE_AM 0x20 /* MAP_ATTRIB */ #define WIN_DATA_WIDTH_8 0x00 /* default */ #define WIN_DATA_WIDTH_16 0x02 /* MAP_16BIT */ #define WIN_ENABLE 0x01 /* MAP_ACTIVE */ #define WIN_USE_WAIT 0x40 /* MAP_USE_WAIT */ #define WIN_FLAGS_MAP 0x63 /* MAP_ATTRIB | MAP_16BIT | MAP_ACTIVE | MAP_USE_WAIT */ #define WIN_FLAGS_REQ 0x1c /* mapping to socket->win[i]: 0x04 -> 0 0x08 -> 1 0x0c -> 2 0x10 -> 3 */ |
7feabb641 pcmcia: move conf... |
223 224 225 226 227 228 229 230 231 232 233 |
/* config_reg{ister}s present for this PCMCIA device */ #define PRESENT_OPTION 0x001 #define PRESENT_STATUS 0x002 #define PRESENT_PIN_REPLACE 0x004 #define PRESENT_COPY 0x008 #define PRESENT_EXT_STATUS 0x010 #define PRESENT_IOBASE_0 0x020 #define PRESENT_IOBASE_1 0x040 #define PRESENT_IOBASE_2 0x080 #define PRESENT_IOBASE_3 0x100 #define PRESENT_IOSIZE 0x200 |
cdb138080 pcmcia: do not us... |
234 |
|
1ac71e5a3 pcmcia: convert p... |
235 |
/* flags to be passed to pcmcia_enable_device() */ |
00990e7ce pcmcia: use autoc... |
236 237 238 239 |
#define CONF_ENABLE_IRQ 0x0001 #define CONF_ENABLE_SPKR 0x0002 #define CONF_ENABLE_PULSE_IRQ 0x0004 #define CONF_ENABLE_ESR 0x0008 |
ff10fca5c pcmcia: IOCARD is... |
240 241 |
#define CONF_ENABLE_IOCARD 0x0010 /* auto-enabled if IO resources or IRQ * (CONF_ENABLE_IRQ) in use */ |
33619f0d3 pcmcia: re-enable... |
242 |
#define CONF_ENABLE_ZVCARD 0x0020 |
1ac71e5a3 pcmcia: convert p... |
243 |
|
440eed43e pcmcia: introduce... |
244 |
/* flags used by pcmcia_loop_config() autoconfiguration */ |
00990e7ce pcmcia: use autoc... |
245 246 247 248 249 |
#define CONF_AUTO_CHECK_VCC 0x0100 /* check for matching Vcc? */ #define CONF_AUTO_SET_VPP 0x0200 /* set Vpp? */ #define CONF_AUTO_AUDIO 0x0400 /* enable audio line? */ #define CONF_AUTO_SET_IO 0x0800 /* set ->resource[0,1] */ #define CONF_AUTO_SET_IOMEM 0x1000 /* set ->resource[2] */ |
440eed43e pcmcia: introduce... |
250 |
|
1da177e4c Linux-2.6.12-rc2 |
251 |
#endif /* __KERNEL__ */ |
a58357862 pcmcia: cleanup d... |
252 |
|
1da177e4c Linux-2.6.12-rc2 |
253 |
#endif /* _LINUX_DS_H */ |