diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/usb/host/hc_crisv10.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 'drivers/usb/host/hc_crisv10.h')
-rw-r--r-- | drivers/usb/host/hc_crisv10.h | 289 |
1 files changed, 289 insertions, 0 deletions
diff --git a/drivers/usb/host/hc_crisv10.h b/drivers/usb/host/hc_crisv10.h new file mode 100644 index 000000000000..62f77111d418 --- /dev/null +++ b/drivers/usb/host/hc_crisv10.h | |||
@@ -0,0 +1,289 @@ | |||
1 | #ifndef __LINUX_ETRAX_USB_H | ||
2 | #define __LINUX_ETRAX_USB_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/list.h> | ||
6 | |||
7 | typedef struct USB_IN_Desc { | ||
8 | volatile __u16 sw_len; | ||
9 | volatile __u16 command; | ||
10 | volatile unsigned long next; | ||
11 | volatile unsigned long buf; | ||
12 | volatile __u16 hw_len; | ||
13 | volatile __u16 status; | ||
14 | } USB_IN_Desc_t; | ||
15 | |||
16 | typedef struct USB_SB_Desc { | ||
17 | volatile __u16 sw_len; | ||
18 | volatile __u16 command; | ||
19 | volatile unsigned long next; | ||
20 | volatile unsigned long buf; | ||
21 | __u32 dummy; | ||
22 | } USB_SB_Desc_t; | ||
23 | |||
24 | typedef struct USB_EP_Desc { | ||
25 | volatile __u16 hw_len; | ||
26 | volatile __u16 command; | ||
27 | volatile unsigned long sub; | ||
28 | volatile unsigned long next; | ||
29 | __u32 dummy; | ||
30 | } USB_EP_Desc_t; | ||
31 | |||
32 | struct virt_root_hub { | ||
33 | int devnum; | ||
34 | void *urb; | ||
35 | void *int_addr; | ||
36 | int send; | ||
37 | int interval; | ||
38 | int numports; | ||
39 | struct timer_list rh_int_timer; | ||
40 | volatile __u16 wPortChange_1; | ||
41 | volatile __u16 wPortChange_2; | ||
42 | volatile __u16 prev_wPortStatus_1; | ||
43 | volatile __u16 prev_wPortStatus_2; | ||
44 | }; | ||
45 | |||
46 | struct etrax_usb_intr_traffic { | ||
47 | int sleeping; | ||
48 | int error; | ||
49 | struct wait_queue *wq; | ||
50 | }; | ||
51 | |||
52 | typedef struct etrax_usb_hc { | ||
53 | struct usb_bus *bus; | ||
54 | struct virt_root_hub rh; | ||
55 | struct etrax_usb_intr_traffic intr; | ||
56 | } etrax_hc_t; | ||
57 | |||
58 | typedef enum { | ||
59 | STARTED, | ||
60 | NOT_STARTED, | ||
61 | UNLINK, | ||
62 | TRANSFER_DONE, | ||
63 | WAITING_FOR_DESCR_INTR | ||
64 | } etrax_usb_urb_state_t; | ||
65 | |||
66 | |||
67 | |||
68 | typedef struct etrax_usb_urb_priv { | ||
69 | /* The first_sb field is used for freeing all SB descriptors belonging | ||
70 | to an urb. The corresponding ep descriptor's sub pointer cannot be | ||
71 | used for this since the DMA advances the sub pointer as it processes | ||
72 | the sb list. */ | ||
73 | USB_SB_Desc_t *first_sb; | ||
74 | /* The last_sb field referes to the last SB descriptor that belongs to | ||
75 | this urb. This is important to know so we can free the SB descriptors | ||
76 | that ranges between first_sb and last_sb. */ | ||
77 | USB_SB_Desc_t *last_sb; | ||
78 | |||
79 | /* The rx_offset field is used in ctrl and bulk traffic to keep track | ||
80 | of the offset in the urb's transfer_buffer where incoming data should be | ||
81 | copied to. */ | ||
82 | __u32 rx_offset; | ||
83 | |||
84 | /* Counter used in isochronous transfers to keep track of the | ||
85 | number of packets received/transmitted. */ | ||
86 | __u32 isoc_packet_counter; | ||
87 | |||
88 | /* This field is used to pass information about the urb's current state between | ||
89 | the various interrupt handlers (thus marked volatile). */ | ||
90 | volatile etrax_usb_urb_state_t urb_state; | ||
91 | |||
92 | /* Connection between the submitted urb and ETRAX epid number */ | ||
93 | __u8 epid; | ||
94 | |||
95 | /* The rx_data_list field is used for periodic traffic, to hold | ||
96 | received data for later processing in the the complete_urb functions, | ||
97 | where the data us copied to the urb's transfer_buffer. Basically, we | ||
98 | use this intermediate storage because we don't know when it's safe to | ||
99 | reuse the transfer_buffer (FIXME?). */ | ||
100 | struct list_head rx_data_list; | ||
101 | } etrax_urb_priv_t; | ||
102 | |||
103 | /* This struct is for passing data from the top half to the bottom half. */ | ||
104 | typedef struct usb_interrupt_registers | ||
105 | { | ||
106 | etrax_hc_t *hc; | ||
107 | __u32 r_usb_epid_attn; | ||
108 | __u8 r_usb_status; | ||
109 | __u16 r_usb_rh_port_status_1; | ||
110 | __u16 r_usb_rh_port_status_2; | ||
111 | __u32 r_usb_irq_mask_read; | ||
112 | __u32 r_usb_fm_number; | ||
113 | struct work_struct usb_bh; | ||
114 | } usb_interrupt_registers_t; | ||
115 | |||
116 | /* This struct is for passing data from the isoc top half to the isoc bottom half. */ | ||
117 | typedef struct usb_isoc_complete_data | ||
118 | { | ||
119 | struct urb *urb; | ||
120 | struct work_struct usb_bh; | ||
121 | } usb_isoc_complete_data_t; | ||
122 | |||
123 | /* This struct holds data we get from the rx descriptors for DMA channel 9 | ||
124 | for periodic traffic (intr and isoc). */ | ||
125 | typedef struct rx_data | ||
126 | { | ||
127 | void *data; | ||
128 | int length; | ||
129 | struct list_head list; | ||
130 | } rx_data_t; | ||
131 | |||
132 | typedef struct urb_entry | ||
133 | { | ||
134 | struct urb *urb; | ||
135 | struct list_head list; | ||
136 | } urb_entry_t; | ||
137 | |||
138 | /* --------------------------------------------------------------------------- | ||
139 | Virtual Root HUB | ||
140 | ------------------------------------------------------------------------- */ | ||
141 | /* destination of request */ | ||
142 | #define RH_INTERFACE 0x01 | ||
143 | #define RH_ENDPOINT 0x02 | ||
144 | #define RH_OTHER 0x03 | ||
145 | |||
146 | #define RH_CLASS 0x20 | ||
147 | #define RH_VENDOR 0x40 | ||
148 | |||
149 | /* Requests: bRequest << 8 | bmRequestType */ | ||
150 | #define RH_GET_STATUS 0x0080 | ||
151 | #define RH_CLEAR_FEATURE 0x0100 | ||
152 | #define RH_SET_FEATURE 0x0300 | ||
153 | #define RH_SET_ADDRESS 0x0500 | ||
154 | #define RH_GET_DESCRIPTOR 0x0680 | ||
155 | #define RH_SET_DESCRIPTOR 0x0700 | ||
156 | #define RH_GET_CONFIGURATION 0x0880 | ||
157 | #define RH_SET_CONFIGURATION 0x0900 | ||
158 | #define RH_GET_STATE 0x0280 | ||
159 | #define RH_GET_INTERFACE 0x0A80 | ||
160 | #define RH_SET_INTERFACE 0x0B00 | ||
161 | #define RH_SYNC_FRAME 0x0C80 | ||
162 | /* Our Vendor Specific Request */ | ||
163 | #define RH_SET_EP 0x2000 | ||
164 | |||
165 | |||
166 | /* Hub port features */ | ||
167 | #define RH_PORT_CONNECTION 0x00 | ||
168 | #define RH_PORT_ENABLE 0x01 | ||
169 | #define RH_PORT_SUSPEND 0x02 | ||
170 | #define RH_PORT_OVER_CURRENT 0x03 | ||
171 | #define RH_PORT_RESET 0x04 | ||
172 | #define RH_PORT_POWER 0x08 | ||
173 | #define RH_PORT_LOW_SPEED 0x09 | ||
174 | #define RH_C_PORT_CONNECTION 0x10 | ||
175 | #define RH_C_PORT_ENABLE 0x11 | ||
176 | #define RH_C_PORT_SUSPEND 0x12 | ||
177 | #define RH_C_PORT_OVER_CURRENT 0x13 | ||
178 | #define RH_C_PORT_RESET 0x14 | ||
179 | |||
180 | /* Hub features */ | ||
181 | #define RH_C_HUB_LOCAL_POWER 0x00 | ||
182 | #define RH_C_HUB_OVER_CURRENT 0x01 | ||
183 | |||
184 | #define RH_DEVICE_REMOTE_WAKEUP 0x00 | ||
185 | #define RH_ENDPOINT_STALL 0x01 | ||
186 | |||
187 | /* Our Vendor Specific feature */ | ||
188 | #define RH_REMOVE_EP 0x00 | ||
189 | |||
190 | |||
191 | #define RH_ACK 0x01 | ||
192 | #define RH_REQ_ERR -1 | ||
193 | #define RH_NACK 0x00 | ||
194 | |||
195 | /* Field definitions for */ | ||
196 | |||
197 | #define USB_IN_command__eol__BITNR 0 /* command macros */ | ||
198 | #define USB_IN_command__eol__WIDTH 1 | ||
199 | #define USB_IN_command__eol__no 0 | ||
200 | #define USB_IN_command__eol__yes 1 | ||
201 | |||
202 | #define USB_IN_command__intr__BITNR 3 | ||
203 | #define USB_IN_command__intr__WIDTH 1 | ||
204 | #define USB_IN_command__intr__no 0 | ||
205 | #define USB_IN_command__intr__yes 1 | ||
206 | |||
207 | #define USB_IN_status__eop__BITNR 1 /* status macros. */ | ||
208 | #define USB_IN_status__eop__WIDTH 1 | ||
209 | #define USB_IN_status__eop__no 0 | ||
210 | #define USB_IN_status__eop__yes 1 | ||
211 | |||
212 | #define USB_IN_status__eot__BITNR 5 | ||
213 | #define USB_IN_status__eot__WIDTH 1 | ||
214 | #define USB_IN_status__eot__no 0 | ||
215 | #define USB_IN_status__eot__yes 1 | ||
216 | |||
217 | #define USB_IN_status__error__BITNR 6 | ||
218 | #define USB_IN_status__error__WIDTH 1 | ||
219 | #define USB_IN_status__error__no 0 | ||
220 | #define USB_IN_status__error__yes 1 | ||
221 | |||
222 | #define USB_IN_status__nodata__BITNR 7 | ||
223 | #define USB_IN_status__nodata__WIDTH 1 | ||
224 | #define USB_IN_status__nodata__no 0 | ||
225 | #define USB_IN_status__nodata__yes 1 | ||
226 | |||
227 | #define USB_IN_status__epid__BITNR 8 | ||
228 | #define USB_IN_status__epid__WIDTH 5 | ||
229 | |||
230 | #define USB_EP_command__eol__BITNR 0 | ||
231 | #define USB_EP_command__eol__WIDTH 1 | ||
232 | #define USB_EP_command__eol__no 0 | ||
233 | #define USB_EP_command__eol__yes 1 | ||
234 | |||
235 | #define USB_EP_command__eof__BITNR 1 | ||
236 | #define USB_EP_command__eof__WIDTH 1 | ||
237 | #define USB_EP_command__eof__no 0 | ||
238 | #define USB_EP_command__eof__yes 1 | ||
239 | |||
240 | #define USB_EP_command__intr__BITNR 3 | ||
241 | #define USB_EP_command__intr__WIDTH 1 | ||
242 | #define USB_EP_command__intr__no 0 | ||
243 | #define USB_EP_command__intr__yes 1 | ||
244 | |||
245 | #define USB_EP_command__enable__BITNR 4 | ||
246 | #define USB_EP_command__enable__WIDTH 1 | ||
247 | #define USB_EP_command__enable__no 0 | ||
248 | #define USB_EP_command__enable__yes 1 | ||
249 | |||
250 | #define USB_EP_command__hw_valid__BITNR 5 | ||
251 | #define USB_EP_command__hw_valid__WIDTH 1 | ||
252 | #define USB_EP_command__hw_valid__no 0 | ||
253 | #define USB_EP_command__hw_valid__yes 1 | ||
254 | |||
255 | #define USB_EP_command__epid__BITNR 8 | ||
256 | #define USB_EP_command__epid__WIDTH 5 | ||
257 | |||
258 | #define USB_SB_command__eol__BITNR 0 /* command macros. */ | ||
259 | #define USB_SB_command__eol__WIDTH 1 | ||
260 | #define USB_SB_command__eol__no 0 | ||
261 | #define USB_SB_command__eol__yes 1 | ||
262 | |||
263 | #define USB_SB_command__eot__BITNR 1 | ||
264 | #define USB_SB_command__eot__WIDTH 1 | ||
265 | #define USB_SB_command__eot__no 0 | ||
266 | #define USB_SB_command__eot__yes 1 | ||
267 | |||
268 | #define USB_SB_command__intr__BITNR 3 | ||
269 | #define USB_SB_command__intr__WIDTH 1 | ||
270 | #define USB_SB_command__intr__no 0 | ||
271 | #define USB_SB_command__intr__yes 1 | ||
272 | |||
273 | #define USB_SB_command__tt__BITNR 4 | ||
274 | #define USB_SB_command__tt__WIDTH 2 | ||
275 | #define USB_SB_command__tt__zout 0 | ||
276 | #define USB_SB_command__tt__in 1 | ||
277 | #define USB_SB_command__tt__out 2 | ||
278 | #define USB_SB_command__tt__setup 3 | ||
279 | |||
280 | |||
281 | #define USB_SB_command__rem__BITNR 8 | ||
282 | #define USB_SB_command__rem__WIDTH 6 | ||
283 | |||
284 | #define USB_SB_command__full__BITNR 6 | ||
285 | #define USB_SB_command__full__WIDTH 1 | ||
286 | #define USB_SB_command__full__no 0 | ||
287 | #define USB_SB_command__full__yes 1 | ||
288 | |||
289 | #endif | ||