aboutsummaryrefslogtreecommitdiffstats
path: root/include/pcmcia/ss.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/pcmcia/ss.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/pcmcia/ss.h')
-rw-r--r--include/pcmcia/ss.h265
1 files changed, 265 insertions, 0 deletions
diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h
new file mode 100644
index 000000000000..6d3413a56708
--- /dev/null
+++ b/include/pcmcia/ss.h
@@ -0,0 +1,265 @@
1/*
2 * ss.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * The initial developer of the original code is David A. Hinds
9 * <dahinds@users.sourceforge.net>. Portions created by David A. Hinds
10 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
11 *
12 * (C) 1999 David A. Hinds
13 */
14
15#ifndef _LINUX_SS_H
16#define _LINUX_SS_H
17
18#include <pcmcia/cs_types.h>
19#include <pcmcia/cs.h>
20#include <pcmcia/bulkmem.h>
21#include <linux/device.h>
22
23/* Definitions for card status flags for GetStatus */
24#define SS_WRPROT 0x0001
25#define SS_CARDLOCK 0x0002
26#define SS_EJECTION 0x0004
27#define SS_INSERTION 0x0008
28#define SS_BATDEAD 0x0010
29#define SS_BATWARN 0x0020
30#define SS_READY 0x0040
31#define SS_DETECT 0x0080
32#define SS_POWERON 0x0100
33#define SS_GPI 0x0200
34#define SS_STSCHG 0x0400
35#define SS_CARDBUS 0x0800
36#define SS_3VCARD 0x1000
37#define SS_XVCARD 0x2000
38#define SS_PENDING 0x4000
39#define SS_ZVCARD 0x8000
40
41/* InquireSocket capabilities */
42#define SS_CAP_PAGE_REGS 0x0001
43#define SS_CAP_VIRTUAL_BUS 0x0002
44#define SS_CAP_MEM_ALIGN 0x0004
45#define SS_CAP_STATIC_MAP 0x0008
46#define SS_CAP_PCCARD 0x4000
47#define SS_CAP_CARDBUS 0x8000
48
49/* for GetSocket, SetSocket */
50typedef struct socket_state_t {
51 u_int flags;
52 u_int csc_mask;
53 u_char Vcc, Vpp;
54 u_char io_irq;
55} socket_state_t;
56
57extern socket_state_t dead_socket;
58
59/* Socket configuration flags */
60#define SS_PWR_AUTO 0x0010
61#define SS_IOCARD 0x0020
62#define SS_RESET 0x0040
63#define SS_DMA_MODE 0x0080
64#define SS_SPKR_ENA 0x0100
65#define SS_OUTPUT_ENA 0x0200
66
67/* Flags for I/O port and memory windows */
68#define MAP_ACTIVE 0x01
69#define MAP_16BIT 0x02
70#define MAP_AUTOSZ 0x04
71#define MAP_0WS 0x08
72#define MAP_WRPROT 0x10
73#define MAP_ATTRIB 0x20
74#define MAP_USE_WAIT 0x40
75#define MAP_PREFETCH 0x80
76
77/* Use this just for bridge windows */
78#define MAP_IOSPACE 0x20
79
80typedef struct pccard_io_map {
81 u_char map;
82 u_char flags;
83 u_short speed;
84 kio_addr_t start, stop;
85} pccard_io_map;
86
87typedef struct pccard_mem_map {
88 u_char map;
89 u_char flags;
90 u_short speed;
91 u_long static_start;
92 u_int card_start;
93 struct resource *res;
94} pccard_mem_map;
95
96typedef struct cb_bridge_map {
97 u_char map;
98 u_char flags;
99 u_int start, stop;
100} cb_bridge_map;
101
102/*
103 * Socket operations.
104 */
105struct pcmcia_socket;
106
107struct pccard_operations {
108 int (*init)(struct pcmcia_socket *sock);
109 int (*suspend)(struct pcmcia_socket *sock);
110 int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
111 int (*get_status)(struct pcmcia_socket *sock, u_int *value);
112 int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
113 int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
114 int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
115 int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
116};
117
118struct pccard_resource_ops {
119 void (*validate_mem) (struct pcmcia_socket *s);
120 int (*adjust_io_region) (struct resource *res,
121 unsigned long r_start,
122 unsigned long r_end,
123 struct pcmcia_socket *s);
124 struct resource* (*find_io) (unsigned long base, int num,
125 unsigned long align,
126 struct pcmcia_socket *s);
127 struct resource* (*find_mem) (unsigned long base, unsigned long num,
128 unsigned long align, int low,
129 struct pcmcia_socket *s);
130 int (*adjust_resource) (struct pcmcia_socket *s,
131 adjust_t *adj);
132 int (*init) (struct pcmcia_socket *s);
133 void (*exit) (struct pcmcia_socket *s);
134};
135/* SS_CAP_STATIC_MAP */
136extern struct pccard_resource_ops pccard_static_ops;
137/* !SS_CAP_STATIC_MAP */
138extern struct pccard_resource_ops pccard_nonstatic_ops;
139
140/*
141 * Calls to set up low-level "Socket Services" drivers
142 */
143struct pcmcia_socket;
144
145typedef struct io_window_t {
146 u_int Attributes;
147 kio_addr_t BasePort, NumPorts;
148 kio_addr_t InUse, Config;
149 struct resource *res;
150} io_window_t;
151
152#define WINDOW_MAGIC 0xB35C
153typedef struct window_t {
154 u_short magic;
155 u_short index;
156 client_handle_t handle;
157 struct pcmcia_socket *sock;
158 pccard_mem_map ctl;
159} window_t;
160
161/* Maximum number of IO windows per socket */
162#define MAX_IO_WIN 2
163
164/* Maximum number of memory windows per socket */
165#define MAX_WIN 4
166
167struct config_t;
168struct pcmcia_callback;
169
170
171struct pcmcia_socket {
172 struct module *owner;
173 spinlock_t lock;
174 socket_state_t socket;
175 u_int state;
176 u_short functions;
177 u_short lock_count;
178 pccard_mem_map cis_mem;
179 void __iomem *cis_virt;
180 struct config_t *config;
181 struct {
182 u_int AssignedIRQ;
183 u_int Config;
184 } irq;
185 io_window_t io[MAX_IO_WIN];
186 window_t win[MAX_WIN];
187 struct list_head cis_cache;
188 u_int fake_cis_len;
189 char *fake_cis;
190
191 struct list_head socket_list;
192 struct completion socket_released;
193
194 /* deprecated */
195 unsigned int sock; /* socket number */
196
197
198 /* socket capabilities */
199 u_int features;
200 u_int irq_mask;
201 u_int map_size;
202 kio_addr_t io_offset;
203 u_char pci_irq;
204 struct pci_dev * cb_dev;
205
206
207 /* socket setup is done so resources should be able to be allocated. Only
208 * if set to 1, calls to find_{io,mem}_region are handled, and insertion
209 * events are actually managed by the PCMCIA layer.*/
210 u8 resource_setup_done:1;
211
212 /* is set to one if resource setup is done using adjust_resource_info() */
213 u8 resource_setup_old:1;
214
215 u8 reserved:6;
216
217 /* socket operations */
218 struct pccard_operations * ops;
219 struct pccard_resource_ops * resource_ops;
220 void * resource_data;
221
222 /* Zoom video behaviour is so chip specific its not worth adding
223 this to _ops */
224 void (*zoom_video)(struct pcmcia_socket *, int);
225
226 /* state thread */
227 struct semaphore skt_sem; /* protects socket h/w state */
228
229 struct task_struct *thread;
230 struct completion thread_done;
231 wait_queue_head_t thread_wait;
232 spinlock_t thread_lock; /* protects thread_events */
233 unsigned int thread_events;
234
235 /* pcmcia (16-bit) */
236 struct pcmcia_bus_socket *pcmcia;
237 struct pcmcia_callback *callback;
238
239 /* cardbus (32-bit) */
240#ifdef CONFIG_CARDBUS
241 struct resource * cb_cis_res;
242 void __iomem *cb_cis_virt;
243#endif
244
245 /* socket device */
246 struct class_device dev;
247 void *driver_data; /* data internal to the socket driver */
248
249};
250
251struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr);
252
253
254
255extern void pcmcia_parse_events(struct pcmcia_socket *socket, unsigned int events);
256extern int pcmcia_register_socket(struct pcmcia_socket *socket);
257extern void pcmcia_unregister_socket(struct pcmcia_socket *socket);
258
259extern struct class pcmcia_socket_class;
260
261/* socket drivers are expected to use these callbacks in their .drv struct */
262extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state);
263extern int pcmcia_socket_dev_resume(struct device *dev);
264
265#endif /* _LINUX_SS_H */