Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[cris-mirror.git] / include / linux / usb / wusb-wa.h
blob64a840b5106e51d7c3a3490b21a32cc3239cdff5
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Wireless USB Wire Adapter constants and structures.
5 * Copyright (C) 2005-2006 Intel Corporation.
6 * Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License version
10 * 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
23 * FIXME: docs
24 * FIXME: organize properly, group logically
26 * All the event structures are defined in uwb/spec.h, as they are
27 * common to the WHCI and WUSB radio control interfaces.
29 * References:
30 * [WUSB] Wireless Universal Serial Bus Specification, revision 1.0, ch8
32 #ifndef __LINUX_USB_WUSB_WA_H
33 #define __LINUX_USB_WUSB_WA_H
35 /**
36 * Radio Command Request for the Radio Control Interface
38 * Radio Control Interface command and event codes are the same as
39 * WHCI, and listed in include/linux/uwb.h:UWB_RC_{CMD,EVT}_*
41 enum {
42 WA_EXEC_RC_CMD = 40, /* Radio Control command Request */
45 /* Wireless Adapter Requests ([WUSB] table 8-51) */
46 enum {
47 WUSB_REQ_ADD_MMC_IE = 20,
48 WUSB_REQ_REMOVE_MMC_IE = 21,
49 WUSB_REQ_SET_NUM_DNTS = 22,
50 WUSB_REQ_SET_CLUSTER_ID = 23,
51 WUSB_REQ_SET_DEV_INFO = 24,
52 WUSB_REQ_GET_TIME = 25,
53 WUSB_REQ_SET_STREAM_IDX = 26,
54 WUSB_REQ_SET_WUSB_MAS = 27,
55 WUSB_REQ_CHAN_STOP = 28,
59 /* Wireless Adapter WUSB Channel Time types ([WUSB] table 8-52) */
60 enum {
61 WUSB_TIME_ADJ = 0,
62 WUSB_TIME_BPST = 1,
63 WUSB_TIME_WUSB = 2,
66 enum {
67 WA_ENABLE = 0x01,
68 WA_RESET = 0x02,
69 RPIPE_PAUSE = 0x1,
70 RPIPE_STALL = 0x2,
73 /* Responses from Get Status request ([WUSB] section 8.3.1.6) */
74 enum {
75 WA_STATUS_ENABLED = 0x01,
76 WA_STATUS_RESETTING = 0x02
79 enum rpipe_crs {
80 RPIPE_CRS_CTL = 0x01,
81 RPIPE_CRS_ISO = 0x02,
82 RPIPE_CRS_BULK = 0x04,
83 RPIPE_CRS_INTR = 0x08
86 /**
87 * RPipe descriptor ([WUSB] section 8.5.2.11)
89 * FIXME: explain rpipes
91 struct usb_rpipe_descriptor {
92 u8 bLength;
93 u8 bDescriptorType;
94 __le16 wRPipeIndex;
95 __le16 wRequests;
96 __le16 wBlocks; /* rw if 0 */
97 __le16 wMaxPacketSize; /* rw */
98 union {
99 u8 dwa_bHSHubAddress; /* rw: DWA. */
100 u8 hwa_bMaxBurst; /* rw: HWA. */
102 union {
103 u8 dwa_bHSHubPort; /* rw: DWA. */
104 u8 hwa_bDeviceInfoIndex; /* rw: HWA. */
106 u8 bSpeed; /* rw: xfer rate 'enum uwb_phy_rate' */
107 union {
108 u8 dwa_bDeviceAddress; /* rw: DWA Target device address. */
109 u8 hwa_reserved; /* rw: HWA. */
111 u8 bEndpointAddress; /* rw: Target EP address */
112 u8 bDataSequence; /* ro: Current Data sequence */
113 __le32 dwCurrentWindow; /* ro */
114 u8 bMaxDataSequence; /* ro?: max supported seq */
115 u8 bInterval; /* rw: */
116 u8 bOverTheAirInterval; /* rw: */
117 u8 bmAttribute; /* ro? */
118 u8 bmCharacteristics; /* ro? enum rpipe_attr, supported xsactions */
119 u8 bmRetryOptions; /* rw? */
120 __le16 wNumTransactionErrors; /* rw */
121 } __attribute__ ((packed));
124 * Wire Adapter Notification types ([WUSB] sections 8.4.5 & 8.5.4)
126 * These are the notifications coming on the notification endpoint of
127 * an HWA and a DWA.
129 enum wa_notif_type {
130 DWA_NOTIF_RWAKE = 0x91,
131 DWA_NOTIF_PORTSTATUS = 0x92,
132 WA_NOTIF_TRANSFER = 0x93,
133 HWA_NOTIF_BPST_ADJ = 0x94,
134 HWA_NOTIF_DN = 0x95,
138 * Wire Adapter notification header
140 * Notifications coming from a wire adapter use a common header
141 * defined in [WUSB] sections 8.4.5 & 8.5.4.
143 struct wa_notif_hdr {
144 u8 bLength;
145 u8 bNotifyType; /* enum wa_notif_type */
146 } __packed;
149 * HWA DN Received notification [(WUSB] section 8.5.4.2)
151 * The DNData is specified in WUSB1.0[7.6]. For each device
152 * notification we received, we just need to dispatch it.
154 * @dndata: this is really an array of notifications, but all start
155 * with the same header.
157 struct hwa_notif_dn {
158 struct wa_notif_hdr hdr;
159 u8 bSourceDeviceAddr; /* from errata 2005/07 */
160 u8 bmAttributes;
161 struct wusb_dn_hdr dndata[];
162 } __packed;
164 /* [WUSB] section 8.3.3 */
165 enum wa_xfer_type {
166 WA_XFER_TYPE_CTL = 0x80,
167 WA_XFER_TYPE_BI = 0x81, /* bulk/interrupt */
168 WA_XFER_TYPE_ISO = 0x82,
169 WA_XFER_RESULT = 0x83,
170 WA_XFER_ABORT = 0x84,
171 WA_XFER_ISO_PACKET_INFO = 0xA0,
172 WA_XFER_ISO_PACKET_STATUS = 0xA1,
175 /* [WUSB] section 8.3.3 */
176 struct wa_xfer_hdr {
177 u8 bLength; /* 0x18 */
178 u8 bRequestType; /* 0x80 WA_REQUEST_TYPE_CTL */
179 __le16 wRPipe; /* RPipe index */
180 __le32 dwTransferID; /* Host-assigned ID */
181 __le32 dwTransferLength; /* Length of data to xfer */
182 u8 bTransferSegment;
183 } __packed;
185 struct wa_xfer_ctl {
186 struct wa_xfer_hdr hdr;
187 u8 bmAttribute;
188 __le16 wReserved;
189 struct usb_ctrlrequest baSetupData;
190 } __packed;
192 struct wa_xfer_bi {
193 struct wa_xfer_hdr hdr;
194 u8 bReserved;
195 __le16 wReserved;
196 } __packed;
198 /* [WUSB] section 8.5.5 */
199 struct wa_xfer_hwaiso {
200 struct wa_xfer_hdr hdr;
201 u8 bReserved;
202 __le16 wPresentationTime;
203 __le32 dwNumOfPackets;
204 } __packed;
206 struct wa_xfer_packet_info_hwaiso {
207 __le16 wLength;
208 u8 bPacketType;
209 u8 bReserved;
210 __le16 PacketLength[0];
211 } __packed;
213 struct wa_xfer_packet_status_len_hwaiso {
214 __le16 PacketLength;
215 __le16 PacketStatus;
216 } __packed;
218 struct wa_xfer_packet_status_hwaiso {
219 __le16 wLength;
220 u8 bPacketType;
221 u8 bReserved;
222 struct wa_xfer_packet_status_len_hwaiso PacketStatus[0];
223 } __packed;
225 /* [WUSB] section 8.3.3.5 */
226 struct wa_xfer_abort {
227 u8 bLength;
228 u8 bRequestType;
229 __le16 wRPipe; /* RPipe index */
230 __le32 dwTransferID; /* Host-assigned ID */
231 } __packed;
234 * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
237 struct wa_notif_xfer {
238 struct wa_notif_hdr hdr;
239 u8 bEndpoint;
240 u8 Reserved;
241 } __packed;
243 /** Transfer result basic codes [WUSB] table 8-15 */
244 enum {
245 WA_XFER_STATUS_SUCCESS,
246 WA_XFER_STATUS_HALTED,
247 WA_XFER_STATUS_DATA_BUFFER_ERROR,
248 WA_XFER_STATUS_BABBLE,
249 WA_XFER_RESERVED,
250 WA_XFER_STATUS_NOT_FOUND,
251 WA_XFER_STATUS_INSUFFICIENT_RESOURCE,
252 WA_XFER_STATUS_TRANSACTION_ERROR,
253 WA_XFER_STATUS_ABORTED,
254 WA_XFER_STATUS_RPIPE_NOT_READY,
255 WA_XFER_INVALID_FORMAT,
256 WA_XFER_UNEXPECTED_SEGMENT_NUMBER,
257 WA_XFER_STATUS_RPIPE_TYPE_MISMATCH,
260 /** [WUSB] section 8.3.3.4 */
261 struct wa_xfer_result {
262 struct wa_notif_hdr hdr;
263 __le32 dwTransferID;
264 __le32 dwTransferLength;
265 u8 bTransferSegment;
266 u8 bTransferStatus;
267 __le32 dwNumOfPackets;
268 } __packed;
271 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
273 * NOTE: u16 fields are read Little Endian from the hardware.
275 * @bNumPorts is the original max number of devices that the host can
276 * connect; we might chop this so the stack can handle
277 * it. In case you need to access it, use wusbhc->ports_max
278 * if it is a Wireless USB WA.
280 struct usb_wa_descriptor {
281 u8 bLength;
282 u8 bDescriptorType;
283 __le16 bcdWAVersion;
284 u8 bNumPorts; /* don't use!! */
285 u8 bmAttributes; /* Reserved == 0 */
286 __le16 wNumRPipes;
287 __le16 wRPipeMaxBlock;
288 u8 bRPipeBlockSize;
289 u8 bPwrOn2PwrGood;
290 u8 bNumMMCIEs;
291 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
292 } __packed;
295 * HWA Device Information Buffer (WUSB1.0[T8.54])
297 struct hwa_dev_info {
298 u8 bmDeviceAvailability[32]; /* FIXME: ignored for now */
299 u8 bDeviceAddress;
300 __le16 wPHYRates;
301 u8 bmDeviceAttribute;
302 } __packed;
304 #endif /* #ifndef __LINUX_USB_WUSB_WA_H */