kernel: bump 5.15 to 5.15.75
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0307-dwc_otg-Minimise-header-and-fix-build-warnings.patch
1 From dcc649e165ea83abb3fb441a54292fef6481a6c5 Mon Sep 17 00:00:00 2001
2 From: Phil Elwell <phil@raspberrypi.com>
3 Date: Tue, 27 Oct 2020 09:59:49 +0000
4 Subject: [PATCH] dwc_otg: Minimise header and fix build warnings
5
6 Delete a large amount of unused declaration from "usb.h", some of which
7 were causing build warnings, and get the module building cleanly.
8
9 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
10 ---
11 drivers/usb/host/dwc_common_port/usb.h | 664 -------------------
12 drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c | 10 +-
13 drivers/usb/host/dwc_otg/dwc_otg_hcd.c | 23 +-
14 drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c | 3 +-
15 drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c | 8 +-
16 drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 4 +-
17 drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c | 2 +-
18 7 files changed, 30 insertions(+), 684 deletions(-)
19
20 --- a/drivers/usb/host/dwc_common_port/usb.h
21 +++ b/drivers/usb/host/dwc_common_port/usb.h
22 @@ -55,12 +55,6 @@ typedef u_int8_t uByte;
23 typedef u_int8_t uWord[2];
24 typedef u_int8_t uDWord[4];
25
26 -#define USETW2(w,h,l) ((w)[0] = (u_int8_t)(l), (w)[1] = (u_int8_t)(h))
27 -#define UCONSTW(x) { (x) & 0xff, ((x) >> 8) & 0xff }
28 -#define UCONSTDW(x) { (x) & 0xff, ((x) >> 8) & 0xff, \
29 - ((x) >> 16) & 0xff, ((x) >> 24) & 0xff }
30 -
31 -#if 1
32 #define UGETW(w) ((w)[0] | ((w)[1] << 8))
33 #define USETW(w,v) ((w)[0] = (u_int8_t)(v), (w)[1] = (u_int8_t)((v) >> 8))
34 #define UGETDW(w) ((w)[0] | ((w)[1] << 8) | ((w)[2] << 16) | ((w)[3] << 24))
35 @@ -68,31 +62,6 @@ typedef u_int8_t uDWord[4];
36 (w)[1] = (u_int8_t)((v) >> 8), \
37 (w)[2] = (u_int8_t)((v) >> 16), \
38 (w)[3] = (u_int8_t)((v) >> 24))
39 -#else
40 -/*
41 - * On little-endian machines that can handle unanliged accesses
42 - * (e.g. i386) these macros can be replaced by the following.
43 - */
44 -#define UGETW(w) (*(u_int16_t *)(w))
45 -#define USETW(w,v) (*(u_int16_t *)(w) = (v))
46 -#define UGETDW(w) (*(u_int32_t *)(w))
47 -#define USETDW(w,v) (*(u_int32_t *)(w) = (v))
48 -#endif
49 -
50 -/*
51 - * Macros for accessing UAS IU fields, which are big-endian
52 - */
53 -#define IUSETW2(w,h,l) ((w)[0] = (u_int8_t)(h), (w)[1] = (u_int8_t)(l))
54 -#define IUCONSTW(x) { ((x) >> 8) & 0xff, (x) & 0xff }
55 -#define IUCONSTDW(x) { ((x) >> 24) & 0xff, ((x) >> 16) & 0xff, \
56 - ((x) >> 8) & 0xff, (x) & 0xff }
57 -#define IUGETW(w) (((w)[0] << 8) | (w)[1])
58 -#define IUSETW(w,v) ((w)[0] = (u_int8_t)((v) >> 8), (w)[1] = (u_int8_t)(v))
59 -#define IUGETDW(w) (((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3])
60 -#define IUSETDW(w,v) ((w)[0] = (u_int8_t)((v) >> 24), \
61 - (w)[1] = (u_int8_t)((v) >> 16), \
62 - (w)[2] = (u_int8_t)((v) >> 8), \
63 - (w)[3] = (u_int8_t)(v))
64
65 #define UPACKED __attribute__((__packed__))
66
67 @@ -119,29 +88,6 @@ typedef struct {
68 #define UT_ENDPOINT 0x02
69 #define UT_OTHER 0x03
70
71 -#define UT_READ_DEVICE (UT_READ | UT_STANDARD | UT_DEVICE)
72 -#define UT_READ_INTERFACE (UT_READ | UT_STANDARD | UT_INTERFACE)
73 -#define UT_READ_ENDPOINT (UT_READ | UT_STANDARD | UT_ENDPOINT)
74 -#define UT_WRITE_DEVICE (UT_WRITE | UT_STANDARD | UT_DEVICE)
75 -#define UT_WRITE_INTERFACE (UT_WRITE | UT_STANDARD | UT_INTERFACE)
76 -#define UT_WRITE_ENDPOINT (UT_WRITE | UT_STANDARD | UT_ENDPOINT)
77 -#define UT_READ_CLASS_DEVICE (UT_READ | UT_CLASS | UT_DEVICE)
78 -#define UT_READ_CLASS_INTERFACE (UT_READ | UT_CLASS | UT_INTERFACE)
79 -#define UT_READ_CLASS_OTHER (UT_READ | UT_CLASS | UT_OTHER)
80 -#define UT_READ_CLASS_ENDPOINT (UT_READ | UT_CLASS | UT_ENDPOINT)
81 -#define UT_WRITE_CLASS_DEVICE (UT_WRITE | UT_CLASS | UT_DEVICE)
82 -#define UT_WRITE_CLASS_INTERFACE (UT_WRITE | UT_CLASS | UT_INTERFACE)
83 -#define UT_WRITE_CLASS_OTHER (UT_WRITE | UT_CLASS | UT_OTHER)
84 -#define UT_WRITE_CLASS_ENDPOINT (UT_WRITE | UT_CLASS | UT_ENDPOINT)
85 -#define UT_READ_VENDOR_DEVICE (UT_READ | UT_VENDOR | UT_DEVICE)
86 -#define UT_READ_VENDOR_INTERFACE (UT_READ | UT_VENDOR | UT_INTERFACE)
87 -#define UT_READ_VENDOR_OTHER (UT_READ | UT_VENDOR | UT_OTHER)
88 -#define UT_READ_VENDOR_ENDPOINT (UT_READ | UT_VENDOR | UT_ENDPOINT)
89 -#define UT_WRITE_VENDOR_DEVICE (UT_WRITE | UT_VENDOR | UT_DEVICE)
90 -#define UT_WRITE_VENDOR_INTERFACE (UT_WRITE | UT_VENDOR | UT_INTERFACE)
91 -#define UT_WRITE_VENDOR_OTHER (UT_WRITE | UT_VENDOR | UT_OTHER)
92 -#define UT_WRITE_VENDOR_ENDPOINT (UT_WRITE | UT_VENDOR | UT_ENDPOINT)
93 -
94 /* Requests */
95 #define UR_GET_STATUS 0x00
96 #define USTAT_STANDARD_STATUS 0x00
97 @@ -243,71 +189,6 @@ typedef struct {
98 typedef struct {
99 uByte bLength;
100 uByte bDescriptorType;
101 - uByte bDescriptorSubtype;
102 -} UPACKED usb_descriptor_t;
103 -
104 -typedef struct {
105 - uByte bLength;
106 - uByte bDescriptorType;
107 -} UPACKED usb_descriptor_header_t;
108 -
109 -typedef struct {
110 - uByte bLength;
111 - uByte bDescriptorType;
112 - uWord bcdUSB;
113 -#define UD_USB_2_0 0x0200
114 -#define UD_IS_USB2(d) (UGETW((d)->bcdUSB) >= UD_USB_2_0)
115 - uByte bDeviceClass;
116 - uByte bDeviceSubClass;
117 - uByte bDeviceProtocol;
118 - uByte bMaxPacketSize;
119 - /* The fields below are not part of the initial descriptor. */
120 - uWord idVendor;
121 - uWord idProduct;
122 - uWord bcdDevice;
123 - uByte iManufacturer;
124 - uByte iProduct;
125 - uByte iSerialNumber;
126 - uByte bNumConfigurations;
127 -} UPACKED usb_device_descriptor_t;
128 -#define USB_DEVICE_DESCRIPTOR_SIZE 18
129 -
130 -typedef struct {
131 - uByte bLength;
132 - uByte bDescriptorType;
133 - uWord wTotalLength;
134 - uByte bNumInterface;
135 - uByte bConfigurationValue;
136 - uByte iConfiguration;
137 -#define UC_ATT_ONE (1 << 7) /* must be set */
138 -#define UC_ATT_SELFPOWER (1 << 6) /* self powered */
139 -#define UC_ATT_WAKEUP (1 << 5) /* can wakeup */
140 -#define UC_ATT_BATTERY (1 << 4) /* battery powered */
141 - uByte bmAttributes;
142 -#define UC_BUS_POWERED 0x80
143 -#define UC_SELF_POWERED 0x40
144 -#define UC_REMOTE_WAKEUP 0x20
145 - uByte bMaxPower; /* max current in 2 mA units */
146 -#define UC_POWER_FACTOR 2
147 -} UPACKED usb_config_descriptor_t;
148 -#define USB_CONFIG_DESCRIPTOR_SIZE 9
149 -
150 -typedef struct {
151 - uByte bLength;
152 - uByte bDescriptorType;
153 - uByte bInterfaceNumber;
154 - uByte bAlternateSetting;
155 - uByte bNumEndpoints;
156 - uByte bInterfaceClass;
157 - uByte bInterfaceSubClass;
158 - uByte bInterfaceProtocol;
159 - uByte iInterface;
160 -} UPACKED usb_interface_descriptor_t;
161 -#define USB_INTERFACE_DESCRIPTOR_SIZE 9
162 -
163 -typedef struct {
164 - uByte bLength;
165 - uByte bDescriptorType;
166 uByte bEndpointAddress;
167 #define UE_GET_DIR(a) ((a) & 0x80)
168 #define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7))
169 @@ -332,27 +213,6 @@ typedef struct {
170 } UPACKED usb_endpoint_descriptor_t;
171 #define USB_ENDPOINT_DESCRIPTOR_SIZE 7
172
173 -typedef struct ss_endpoint_companion_descriptor {
174 - uByte bLength;
175 - uByte bDescriptorType;
176 - uByte bMaxBurst;
177 -#define USSE_GET_MAX_STREAMS(a) ((a) & 0x1f)
178 -#define USSE_SET_MAX_STREAMS(a, b) ((a) | ((b) & 0x1f))
179 -#define USSE_GET_MAX_PACKET_NUM(a) ((a) & 0x03)
180 -#define USSE_SET_MAX_PACKET_NUM(a, b) ((a) | ((b) & 0x03))
181 - uByte bmAttributes;
182 - uWord wBytesPerInterval;
183 -} UPACKED ss_endpoint_companion_descriptor_t;
184 -#define USB_SS_ENDPOINT_COMPANION_DESCRIPTOR_SIZE 6
185 -
186 -typedef struct {
187 - uByte bLength;
188 - uByte bDescriptorType;
189 - uWord bString[127];
190 -} UPACKED usb_string_descriptor_t;
191 -#define USB_MAX_STRING_LEN 128
192 -#define USB_LANGUAGE_TABLE 0 /* # of the string language id table */
193 -
194 /* Hub specific request */
195 #define UR_GET_BUS_STATE 0x02
196 #define UR_CLEAR_TT_BUFFER 0x08
197 @@ -411,530 +271,6 @@ typedef struct {
198 } UPACKED usb_hub_descriptor_t;
199 #define USB_HUB_DESCRIPTOR_SIZE 9 /* includes deprecated PortPowerCtrlMask */
200
201 -typedef struct {
202 - uByte bLength;
203 - uByte bDescriptorType;
204 - uWord bcdUSB;
205 - uByte bDeviceClass;
206 - uByte bDeviceSubClass;
207 - uByte bDeviceProtocol;
208 - uByte bMaxPacketSize0;
209 - uByte bNumConfigurations;
210 - uByte bReserved;
211 -} UPACKED usb_device_qualifier_t;
212 -#define USB_DEVICE_QUALIFIER_SIZE 10
213 -
214 -typedef struct {
215 - uByte bLength;
216 - uByte bDescriptorType;
217 - uByte bmAttributes;
218 -#define UOTG_SRP 0x01
219 -#define UOTG_HNP 0x02
220 -} UPACKED usb_otg_descriptor_t;
221 -
222 -/* OTG feature selectors */
223 -#define UOTG_B_HNP_ENABLE 3
224 -#define UOTG_A_HNP_SUPPORT 4
225 -#define UOTG_A_ALT_HNP_SUPPORT 5
226 -
227 -typedef struct {
228 - uWord wStatus;
229 -/* Device status flags */
230 -#define UDS_SELF_POWERED 0x0001
231 -#define UDS_REMOTE_WAKEUP 0x0002
232 -/* Endpoint status flags */
233 -#define UES_HALT 0x0001
234 -} UPACKED usb_status_t;
235 -
236 -typedef struct {
237 - uWord wHubStatus;
238 -#define UHS_LOCAL_POWER 0x0001
239 -#define UHS_OVER_CURRENT 0x0002
240 - uWord wHubChange;
241 -} UPACKED usb_hub_status_t;
242 -
243 -typedef struct {
244 - uWord wPortStatus;
245 -#define UPS_CURRENT_CONNECT_STATUS 0x0001
246 -#define UPS_PORT_ENABLED 0x0002
247 -#define UPS_SUSPEND 0x0004
248 -#define UPS_OVERCURRENT_INDICATOR 0x0008
249 -#define UPS_RESET 0x0010
250 -#define UPS_PORT_POWER 0x0100
251 -#define UPS_LOW_SPEED 0x0200
252 -#define UPS_HIGH_SPEED 0x0400
253 -#define UPS_PORT_TEST 0x0800
254 -#define UPS_PORT_INDICATOR 0x1000
255 - uWord wPortChange;
256 -#define UPS_C_CONNECT_STATUS 0x0001
257 -#define UPS_C_PORT_ENABLED 0x0002
258 -#define UPS_C_SUSPEND 0x0004
259 -#define UPS_C_OVERCURRENT_INDICATOR 0x0008
260 -#define UPS_C_PORT_RESET 0x0010
261 -} UPACKED usb_port_status_t;
262 -
263 -#ifdef _MSC_VER
264 -#include <poppack.h>
265 -#endif
266 -
267 -/* Device class codes */
268 -#define UDCLASS_IN_INTERFACE 0x00
269 -#define UDCLASS_COMM 0x02
270 -#define UDCLASS_HUB 0x09
271 -#define UDSUBCLASS_HUB 0x00
272 -#define UDPROTO_FSHUB 0x00
273 -#define UDPROTO_HSHUBSTT 0x01
274 -#define UDPROTO_HSHUBMTT 0x02
275 -#define UDCLASS_DIAGNOSTIC 0xdc
276 -#define UDCLASS_WIRELESS 0xe0
277 -#define UDSUBCLASS_RF 0x01
278 -#define UDPROTO_BLUETOOTH 0x01
279 -#define UDCLASS_VENDOR 0xff
280 -
281 -/* Interface class codes */
282 -#define UICLASS_UNSPEC 0x00
283 -
284 -#define UICLASS_AUDIO 0x01
285 -#define UISUBCLASS_AUDIOCONTROL 1
286 -#define UISUBCLASS_AUDIOSTREAM 2
287 -#define UISUBCLASS_MIDISTREAM 3
288 -
289 -#define UICLASS_CDC 0x02 /* communication */
290 -#define UISUBCLASS_DIRECT_LINE_CONTROL_MODEL 1
291 -#define UISUBCLASS_ABSTRACT_CONTROL_MODEL 2
292 -#define UISUBCLASS_TELEPHONE_CONTROL_MODEL 3
293 -#define UISUBCLASS_MULTICHANNEL_CONTROL_MODEL 4
294 -#define UISUBCLASS_CAPI_CONTROLMODEL 5
295 -#define UISUBCLASS_ETHERNET_NETWORKING_CONTROL_MODEL 6
296 -#define UISUBCLASS_ATM_NETWORKING_CONTROL_MODEL 7
297 -#define UIPROTO_CDC_AT 1
298 -
299 -#define UICLASS_HID 0x03
300 -#define UISUBCLASS_BOOT 1
301 -#define UIPROTO_BOOT_KEYBOARD 1
302 -
303 -#define UICLASS_PHYSICAL 0x05
304 -
305 -#define UICLASS_IMAGE 0x06
306 -
307 -#define UICLASS_PRINTER 0x07
308 -#define UISUBCLASS_PRINTER 1
309 -#define UIPROTO_PRINTER_UNI 1
310 -#define UIPROTO_PRINTER_BI 2
311 -#define UIPROTO_PRINTER_1284 3
312 -
313 -#define UICLASS_MASS 0x08
314 -#define UISUBCLASS_RBC 1
315 -#define UISUBCLASS_SFF8020I 2
316 -#define UISUBCLASS_QIC157 3
317 -#define UISUBCLASS_UFI 4
318 -#define UISUBCLASS_SFF8070I 5
319 -#define UISUBCLASS_SCSI 6
320 -#define UIPROTO_MASS_CBI_I 0
321 -#define UIPROTO_MASS_CBI 1
322 -#define UIPROTO_MASS_BBB_OLD 2 /* Not in the spec anymore */
323 -#define UIPROTO_MASS_BBB 80 /* 'P' for the Iomega Zip drive */
324 -
325 -#define UICLASS_HUB 0x09
326 -#define UISUBCLASS_HUB 0
327 -#define UIPROTO_FSHUB 0
328 -#define UIPROTO_HSHUBSTT 0 /* Yes, same as previous */
329 -#define UIPROTO_HSHUBMTT 1
330 -
331 -#define UICLASS_CDC_DATA 0x0a
332 -#define UISUBCLASS_DATA 0
333 -#define UIPROTO_DATA_ISDNBRI 0x30 /* Physical iface */
334 -#define UIPROTO_DATA_HDLC 0x31 /* HDLC */
335 -#define UIPROTO_DATA_TRANSPARENT 0x32 /* Transparent */
336 -#define UIPROTO_DATA_Q921M 0x50 /* Management for Q921 */
337 -#define UIPROTO_DATA_Q921 0x51 /* Data for Q921 */
338 -#define UIPROTO_DATA_Q921TM 0x52 /* TEI multiplexer for Q921 */
339 -#define UIPROTO_DATA_V42BIS 0x90 /* Data compression */
340 -#define UIPROTO_DATA_Q931 0x91 /* Euro-ISDN */
341 -#define UIPROTO_DATA_V120 0x92 /* V.24 rate adaption */
342 -#define UIPROTO_DATA_CAPI 0x93 /* CAPI 2.0 commands */
343 -#define UIPROTO_DATA_HOST_BASED 0xfd /* Host based driver */
344 -#define UIPROTO_DATA_PUF 0xfe /* see Prot. Unit Func. Desc.*/
345 -#define UIPROTO_DATA_VENDOR 0xff /* Vendor specific */
346 -
347 -#define UICLASS_SMARTCARD 0x0b
348 -
349 -/*#define UICLASS_FIRM_UPD 0x0c*/
350 -
351 -#define UICLASS_SECURITY 0x0d
352 -
353 -#define UICLASS_DIAGNOSTIC 0xdc
354 -
355 -#define UICLASS_WIRELESS 0xe0
356 -#define UISUBCLASS_RF 0x01
357 -#define UIPROTO_BLUETOOTH 0x01
358 -
359 -#define UICLASS_APPL_SPEC 0xfe
360 -#define UISUBCLASS_FIRMWARE_DOWNLOAD 1
361 -#define UISUBCLASS_IRDA 2
362 -#define UIPROTO_IRDA 0
363 -
364 -#define UICLASS_VENDOR 0xff
365 -
366 -#define USB_HUB_MAX_DEPTH 5
367 -
368 -/*
369 - * Minimum time a device needs to be powered down to go through
370 - * a power cycle. XXX Are these time in the spec?
371 - */
372 -#define USB_POWER_DOWN_TIME 200 /* ms */
373 -#define USB_PORT_POWER_DOWN_TIME 100 /* ms */
374 -
375 -#if 0
376 -/* These are the values from the spec. */
377 -#define USB_PORT_RESET_DELAY 10 /* ms */
378 -#define USB_PORT_ROOT_RESET_DELAY 50 /* ms */
379 -#define USB_PORT_RESET_RECOVERY 10 /* ms */
380 -#define USB_PORT_POWERUP_DELAY 100 /* ms */
381 -#define USB_SET_ADDRESS_SETTLE 2 /* ms */
382 -#define USB_RESUME_DELAY (20*5) /* ms */
383 -#define USB_RESUME_WAIT 10 /* ms */
384 -#define USB_RESUME_RECOVERY 10 /* ms */
385 -#define USB_EXTRA_POWER_UP_TIME 0 /* ms */
386 -#else
387 -/* Allow for marginal (i.e. non-conforming) devices. */
388 -#define USB_PORT_RESET_DELAY 50 /* ms */
389 -#define USB_PORT_ROOT_RESET_DELAY 250 /* ms */
390 -#define USB_PORT_RESET_RECOVERY 250 /* ms */
391 -#define USB_PORT_POWERUP_DELAY 300 /* ms */
392 -#define USB_SET_ADDRESS_SETTLE 10 /* ms */
393 -#define USB_RESUME_DELAY (50*5) /* ms */
394 -#define USB_RESUME_WAIT 50 /* ms */
395 -#define USB_RESUME_RECOVERY 50 /* ms */
396 -#define USB_EXTRA_POWER_UP_TIME 20 /* ms */
397 -#endif
398 -
399 -#define USB_MIN_POWER 100 /* mA */
400 -#define USB_MAX_POWER 500 /* mA */
401 -
402 -#define USB_BUS_RESET_DELAY 100 /* ms XXX?*/
403 -
404 -#define USB_UNCONFIG_NO 0
405 -#define USB_UNCONFIG_INDEX (-1)
406 -
407 -/*** ioctl() related stuff ***/
408 -
409 -struct usb_ctl_request {
410 - int ucr_addr;
411 - usb_device_request_t ucr_request;
412 - void *ucr_data;
413 - int ucr_flags;
414 -#define USBD_SHORT_XFER_OK 0x04 /* allow short reads */
415 - int ucr_actlen; /* actual length transferred */
416 -};
417 -
418 -struct usb_alt_interface {
419 - int uai_config_index;
420 - int uai_interface_index;
421 - int uai_alt_no;
422 -};
423 -
424 -#define USB_CURRENT_CONFIG_INDEX (-1)
425 -#define USB_CURRENT_ALT_INDEX (-1)
426 -
427 -struct usb_config_desc {
428 - int ucd_config_index;
429 - usb_config_descriptor_t ucd_desc;
430 -};
431 -
432 -struct usb_interface_desc {
433 - int uid_config_index;
434 - int uid_interface_index;
435 - int uid_alt_index;
436 - usb_interface_descriptor_t uid_desc;
437 -};
438 -
439 -struct usb_endpoint_desc {
440 - int ued_config_index;
441 - int ued_interface_index;
442 - int ued_alt_index;
443 - int ued_endpoint_index;
444 - usb_endpoint_descriptor_t ued_desc;
445 -};
446 -
447 -struct usb_full_desc {
448 - int ufd_config_index;
449 - u_int ufd_size;
450 - u_char *ufd_data;
451 -};
452 -
453 -struct usb_string_desc {
454 - int usd_string_index;
455 - int usd_language_id;
456 - usb_string_descriptor_t usd_desc;
457 -};
458 -
459 -struct usb_ctl_report_desc {
460 - int ucrd_size;
461 - u_char ucrd_data[1024]; /* filled data size will vary */
462 -};
463 -
464 -typedef struct { u_int32_t cookie; } usb_event_cookie_t;
465 -
466 -#define USB_MAX_DEVNAMES 4
467 -#define USB_MAX_DEVNAMELEN 16
468 -struct usb_device_info {
469 - u_int8_t udi_bus;
470 - u_int8_t udi_addr; /* device address */
471 - usb_event_cookie_t udi_cookie;
472 - char udi_product[USB_MAX_STRING_LEN];
473 - char udi_vendor[USB_MAX_STRING_LEN];
474 - char udi_release[8];
475 - u_int16_t udi_productNo;
476 - u_int16_t udi_vendorNo;
477 - u_int16_t udi_releaseNo;
478 - u_int8_t udi_class;
479 - u_int8_t udi_subclass;
480 - u_int8_t udi_protocol;
481 - u_int8_t udi_config;
482 - u_int8_t udi_speed;
483 -#define USB_SPEED_UNKNOWN 0
484 -#define USB_SPEED_LOW 1
485 -#define USB_SPEED_FULL 2
486 -#define USB_SPEED_HIGH 3
487 -#define USB_SPEED_VARIABLE 4
488 -#define USB_SPEED_SUPER 5
489 - int udi_power; /* power consumption in mA, 0 if selfpowered */
490 - int udi_nports;
491 - char udi_devnames[USB_MAX_DEVNAMES][USB_MAX_DEVNAMELEN];
492 - u_int8_t udi_ports[16];/* hub only: addresses of devices on ports */
493 -#define USB_PORT_ENABLED 0xff
494 -#define USB_PORT_SUSPENDED 0xfe
495 -#define USB_PORT_POWERED 0xfd
496 -#define USB_PORT_DISABLED 0xfc
497 -};
498 -
499 -struct usb_ctl_report {
500 - int ucr_report;
501 - u_char ucr_data[1024]; /* filled data size will vary */
502 -};
503 -
504 -struct usb_device_stats {
505 - u_long uds_requests[4]; /* indexed by transfer type UE_* */
506 -};
507 -
508 -#define WUSB_MIN_IE 0x80
509 -#define WUSB_WCTA_IE 0x80
510 -#define WUSB_WCONNECTACK_IE 0x81
511 -#define WUSB_WHOSTINFO_IE 0x82
512 -#define WUHI_GET_CA(_bmAttributes_) ((_bmAttributes_) & 0x3)
513 -#define WUHI_CA_RECONN 0x00
514 -#define WUHI_CA_LIMITED 0x01
515 -#define WUHI_CA_ALL 0x03
516 -#define WUHI_GET_MLSI(_bmAttributes_) (((_bmAttributes_) & 0x38) >> 3)
517 -#define WUSB_WCHCHANGEANNOUNCE_IE 0x83
518 -#define WUSB_WDEV_DISCONNECT_IE 0x84
519 -#define WUSB_WHOST_DISCONNECT_IE 0x85
520 -#define WUSB_WRELEASE_CHANNEL_IE 0x86
521 -#define WUSB_WWORK_IE 0x87
522 -#define WUSB_WCHANNEL_STOP_IE 0x88
523 -#define WUSB_WDEV_KEEPALIVE_IE 0x89
524 -#define WUSB_WISOCH_DISCARD_IE 0x8A
525 -#define WUSB_WRESETDEVICE_IE 0x8B
526 -#define WUSB_WXMIT_PACKET_ADJUST_IE 0x8C
527 -#define WUSB_MAX_IE 0x8C
528 -
529 -/* Device Notification Types */
530 -
531 -#define WUSB_DN_MIN 0x01
532 -#define WUSB_DN_CONNECT 0x01
533 -# define WUSB_DA_OLDCONN 0x00
534 -# define WUSB_DA_NEWCONN 0x01
535 -# define WUSB_DA_SELF_BEACON 0x02
536 -# define WUSB_DA_DIR_BEACON 0x04
537 -# define WUSB_DA_NO_BEACON 0x06
538 -#define WUSB_DN_DISCONNECT 0x02
539 -#define WUSB_DN_EPRDY 0x03
540 -#define WUSB_DN_MASAVAILCHANGED 0x04
541 -#define WUSB_DN_REMOTEWAKEUP 0x05
542 -#define WUSB_DN_SLEEP 0x06
543 -#define WUSB_DN_ALIVE 0x07
544 -#define WUSB_DN_MAX 0x07
545 -
546 -#ifdef _MSC_VER
547 -#include <pshpack1.h>
548 -#endif
549 -
550 -/* WUSB Handshake Data. Used during the SET/GET HANDSHAKE requests */
551 -typedef struct wusb_hndshk_data {
552 - uByte bMessageNumber;
553 - uByte bStatus;
554 - uByte tTKID[3];
555 - uByte bReserved;
556 - uByte CDID[16];
557 - uByte Nonce[16];
558 - uByte MIC[8];
559 -} UPACKED wusb_hndshk_data_t;
560 -#define WUSB_HANDSHAKE_LEN_FOR_MIC 38
561 -
562 -/* WUSB Connection Context */
563 -typedef struct wusb_conn_context {
564 - uByte CHID [16];
565 - uByte CDID [16];
566 - uByte CK [16];
567 -} UPACKED wusb_conn_context_t;
568 -
569 -/* WUSB Security Descriptor */
570 -typedef struct wusb_security_desc {
571 - uByte bLength;
572 - uByte bDescriptorType;
573 - uWord wTotalLength;
574 - uByte bNumEncryptionTypes;
575 -} UPACKED wusb_security_desc_t;
576 -
577 -/* WUSB Encryption Type Descriptor */
578 -typedef struct wusb_encrypt_type_desc {
579 - uByte bLength;
580 - uByte bDescriptorType;
581 -
582 - uByte bEncryptionType;
583 -#define WUETD_UNSECURE 0
584 -#define WUETD_WIRED 1
585 -#define WUETD_CCM_1 2
586 -#define WUETD_RSA_1 3
587 -
588 - uByte bEncryptionValue;
589 - uByte bAuthKeyIndex;
590 -} UPACKED wusb_encrypt_type_desc_t;
591 -
592 -/* WUSB Key Descriptor */
593 -typedef struct wusb_key_desc {
594 - uByte bLength;
595 - uByte bDescriptorType;
596 - uByte tTKID[3];
597 - uByte bReserved;
598 - uByte KeyData[1]; /* variable length */
599 -} UPACKED wusb_key_desc_t;
600 -
601 -/* WUSB BOS Descriptor (Binary device Object Store) */
602 -typedef struct wusb_bos_desc {
603 - uByte bLength;
604 - uByte bDescriptorType;
605 - uWord wTotalLength;
606 - uByte bNumDeviceCaps;
607 -} UPACKED wusb_bos_desc_t;
608 -
609 -#define USB_DEVICE_CAPABILITY_20_EXTENSION 0x02
610 -typedef struct usb_dev_cap_20_ext_desc {
611 - uByte bLength;
612 - uByte bDescriptorType;
613 - uByte bDevCapabilityType;
614 -#define USB_20_EXT_LPM 0x02
615 - uDWord bmAttributes;
616 -} UPACKED usb_dev_cap_20_ext_desc_t;
617 -
618 -#define USB_DEVICE_CAPABILITY_SS_USB 0x03
619 -typedef struct usb_dev_cap_ss_usb {
620 - uByte bLength;
621 - uByte bDescriptorType;
622 - uByte bDevCapabilityType;
623 -#define USB_DC_SS_USB_LTM_CAPABLE 0x02
624 - uByte bmAttributes;
625 -#define USB_DC_SS_USB_SPEED_SUPPORT_LOW 0x01
626 -#define USB_DC_SS_USB_SPEED_SUPPORT_FULL 0x02
627 -#define USB_DC_SS_USB_SPEED_SUPPORT_HIGH 0x04
628 -#define USB_DC_SS_USB_SPEED_SUPPORT_SS 0x08
629 - uWord wSpeedsSupported;
630 - uByte bFunctionalitySupport;
631 - uByte bU1DevExitLat;
632 - uWord wU2DevExitLat;
633 -} UPACKED usb_dev_cap_ss_usb_t;
634 -
635 -#define USB_DEVICE_CAPABILITY_CONTAINER_ID 0x04
636 -typedef struct usb_dev_cap_container_id {
637 - uByte bLength;
638 - uByte bDescriptorType;
639 - uByte bDevCapabilityType;
640 - uByte bReserved;
641 - uByte containerID[16];
642 -} UPACKED usb_dev_cap_container_id_t;
643 -
644 -/* Device Capability Type Codes */
645 -#define WUSB_DEVICE_CAPABILITY_WIRELESS_USB 0x01
646 -
647 -/* Device Capability Descriptor */
648 -typedef struct wusb_dev_cap_desc {
649 - uByte bLength;
650 - uByte bDescriptorType;
651 - uByte bDevCapabilityType;
652 - uByte caps[1]; /* Variable length */
653 -} UPACKED wusb_dev_cap_desc_t;
654 -
655 -/* Device Capability Descriptor */
656 -typedef struct wusb_dev_cap_uwb_desc {
657 - uByte bLength;
658 - uByte bDescriptorType;
659 - uByte bDevCapabilityType;
660 - uByte bmAttributes;
661 - uWord wPHYRates; /* Bitmap */
662 - uByte bmTFITXPowerInfo;
663 - uByte bmFFITXPowerInfo;
664 - uWord bmBandGroup;
665 - uByte bReserved;
666 -} UPACKED wusb_dev_cap_uwb_desc_t;
667 -
668 -/* Wireless USB Endpoint Companion Descriptor */
669 -typedef struct wusb_endpoint_companion_desc {
670 - uByte bLength;
671 - uByte bDescriptorType;
672 - uByte bMaxBurst;
673 - uByte bMaxSequence;
674 - uWord wMaxStreamDelay;
675 - uWord wOverTheAirPacketSize;
676 - uByte bOverTheAirInterval;
677 - uByte bmCompAttributes;
678 -} UPACKED wusb_endpoint_companion_desc_t;
679 -
680 -/* Wireless USB Numeric Association M1 Data Structure */
681 -typedef struct wusb_m1_data {
682 - uByte version;
683 - uWord langId;
684 - uByte deviceFriendlyNameLength;
685 - uByte sha_256_m3[32];
686 - uByte deviceFriendlyName[256];
687 -} UPACKED wusb_m1_data_t;
688 -
689 -typedef struct wusb_m2_data {
690 - uByte version;
691 - uWord langId;
692 - uByte hostFriendlyNameLength;
693 - uByte pkh[384];
694 - uByte hostFriendlyName[256];
695 -} UPACKED wusb_m2_data_t;
696 -
697 -typedef struct wusb_m3_data {
698 - uByte pkd[384];
699 - uByte nd;
700 -} UPACKED wusb_m3_data_t;
701 -
702 -typedef struct wusb_m4_data {
703 - uDWord _attributeTypeIdAndLength_1;
704 - uWord associationTypeId;
705 -
706 - uDWord _attributeTypeIdAndLength_2;
707 - uWord associationSubTypeId;
708 -
709 - uDWord _attributeTypeIdAndLength_3;
710 - uDWord length;
711 -
712 - uDWord _attributeTypeIdAndLength_4;
713 - uDWord associationStatus;
714 -
715 - uDWord _attributeTypeIdAndLength_5;
716 - uByte chid[16];
717 -
718 - uDWord _attributeTypeIdAndLength_6;
719 - uByte cdid[16];
720 -
721 - uDWord _attributeTypeIdAndLength_7;
722 - uByte bandGroups[2];
723 -} UPACKED wusb_m4_data_t;
724 -
725 #ifdef _MSC_VER
726 #include <poppack.h>
727 #endif
728 --- a/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
729 +++ b/drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c
730 @@ -240,7 +240,8 @@ static int notrace fiq_increment_dma_buf
731 hcdma_data_t hcdma;
732 int i = st->channel[n].dma_info.index;
733 int len;
734 - struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base;
735 + struct fiq_dma_blob *blob =
736 + (struct fiq_dma_blob *)(uintptr_t)st->dma_base;
737
738 len = fiq_get_xfer_len(st, n);
739 fiq_print(FIQDBG_INT, st, "LEN: %03d", len);
740 @@ -249,7 +250,7 @@ static int notrace fiq_increment_dma_buf
741 if (i > 6)
742 BUG();
743
744 - hcdma.d32 = (dma_addr_t) &blob->channel[n].index[i].buf[0];
745 + hcdma.d32 = (u32)(uintptr_t)&blob->channel[n].index[i].buf[0];
746 FIQ_WRITE(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA, hcdma.d32);
747 st->channel[n].dma_info.index = i;
748 return 0;
749 @@ -289,7 +290,8 @@ static int notrace fiq_iso_out_advance(s
750 hcsplt_data_t hcsplt;
751 hctsiz_data_t hctsiz;
752 hcdma_data_t hcdma;
753 - struct fiq_dma_blob *blob = (struct fiq_dma_blob *) st->dma_base;
754 + struct fiq_dma_blob *blob =
755 + (struct fiq_dma_blob *)(uintptr_t)st->dma_base;
756 int last = 0;
757 int i = st->channel[n].dma_info.index;
758
759 @@ -301,7 +303,7 @@ static int notrace fiq_iso_out_advance(s
760 last = 1;
761
762 /* New DMA address - address of bounce buffer referred to in index */
763 - hcdma.d32 = (dma_addr_t) blob->channel[n].index[i].buf;
764 + hcdma.d32 = (u32)(uintptr_t)blob->channel[n].index[i].buf;
765 //hcdma.d32 = FIQ_READ(st->dwc_regs_base + HC_START + (HC_OFFSET * n) + HC_DMA);
766 //hcdma.d32 += st->channel[n].dma_info.slot_len[i];
767 fiq_print(FIQDBG_INT, st, "LAST: %01d ", last);
768 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
769 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd.c
770 @@ -1270,7 +1270,8 @@ static void assign_and_init_hc(dwc_otg_h
771 hc->multi_count = 1;
772
773 if (hcd->core_if->dma_enable) {
774 - hc->xfer_buff = (uint8_t *) urb->dma + urb->actual_length;
775 + hc->xfer_buff =
776 + (uint8_t *)(uintptr_t)urb->dma + urb->actual_length;
777
778 /* For non-dword aligned case */
779 if (((unsigned long)hc->xfer_buff & 0x3)
780 @@ -1314,7 +1315,8 @@ static void assign_and_init_hc(dwc_otg_h
781 hc->ep_is_in = 0;
782 hc->data_pid_start = DWC_OTG_HC_PID_SETUP;
783 if (hcd->core_if->dma_enable) {
784 - hc->xfer_buff = (uint8_t *) urb->setup_dma;
785 + hc->xfer_buff =
786 + (uint8_t *)(uintptr_t)urb->setup_dma;
787 } else {
788 hc->xfer_buff = (uint8_t *) urb->setup_packet;
789 }
790 @@ -1362,7 +1364,8 @@ static void assign_and_init_hc(dwc_otg_h
791
792 hc->xfer_len = 0;
793 if (hcd->core_if->dma_enable) {
794 - hc->xfer_buff = (uint8_t *) hcd->status_buf_dma;
795 + hc->xfer_buff = (uint8_t *)
796 + (uintptr_t)hcd->status_buf_dma;
797 } else {
798 hc->xfer_buff = (uint8_t *) hcd->status_buf;
799 }
800 @@ -1390,7 +1393,7 @@ static void assign_and_init_hc(dwc_otg_h
801 frame_desc->status = 0;
802
803 if (hcd->core_if->dma_enable) {
804 - hc->xfer_buff = (uint8_t *) urb->dma;
805 + hc->xfer_buff = (uint8_t *)(uintptr_t)urb->dma;
806 } else {
807 hc->xfer_buff = (uint8_t *) urb->buf;
808 }
809 @@ -1571,8 +1574,10 @@ int fiq_fsm_setup_periodic_dma(dwc_otg_h
810 * Pointer arithmetic on hcd->fiq_state->dma_base (a dma_addr_t)
811 * to point it to the correct offset in the allocated buffers.
812 */
813 - blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base;
814 - st->hcdma_copy.d32 = (dma_addr_t) blob->channel[hc->hc_num].index[0].buf;
815 + blob = (struct fiq_dma_blob *)
816 + (uintptr_t)hcd->fiq_state->dma_base;
817 + st->hcdma_copy.d32 =(u32)(uintptr_t)
818 + blob->channel[hc->hc_num].index[0].buf;
819
820 /* Calculate the max number of CSPLITS such that the FIQ can time out
821 * a transaction if it fails.
822 @@ -1627,8 +1632,10 @@ int fiq_fsm_setup_periodic_dma(dwc_otg_h
823 * dma_addr_t) to point it to the correct offset in the
824 * allocated buffers.
825 */
826 - blob = (struct fiq_dma_blob *) hcd->fiq_state->dma_base;
827 - st->hcdma_copy.d32 = (dma_addr_t) blob->channel[hc->hc_num].index[0].buf;
828 + blob = (struct fiq_dma_blob *)
829 + (uintptr_t)hcd->fiq_state->dma_base;
830 + st->hcdma_copy.d32 = (u32)(uintptr_t)
831 + blob->channel[hc->hc_num].index[0].buf;
832
833 /* fixup xfersize to the actual packet size */
834 st->hctsiz_copy.b.pid = 0;
835 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
836 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_ddma.c
837 @@ -620,7 +620,8 @@ static void init_non_isoc_dma_desc(dwc_o
838
839 if (n_desc) {
840 /* SG request - more than 1 QTDs */
841 - hc->xfer_buff = (uint8_t *)qtd->urb->dma + qtd->urb->actual_length;
842 + hc->xfer_buff = (uint8_t *)(uintptr_t)qtd->urb->dma +
843 + qtd->urb->actual_length;
844 hc->xfer_len = qtd->urb->length - qtd->urb->actual_length;
845 }
846
847 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
848 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c
849 @@ -1857,10 +1857,10 @@ static int32_t handle_hc_ahberr_intr(dwc
850 DWC_ERROR(" Max packet size: %d\n",
851 dwc_otg_hcd_get_mps(&urb->pipe_info));
852 DWC_ERROR(" Data buffer length: %d\n", urb->length);
853 - DWC_ERROR(" Transfer buffer: %p, Transfer DMA: %p\n",
854 - urb->buf, (void *)urb->dma);
855 - DWC_ERROR(" Setup buffer: %p, Setup DMA: %p\n",
856 - urb->setup_packet, (void *)urb->setup_dma);
857 + DWC_ERROR(" Transfer buffer: %p, Transfer DMA: %pad\n",
858 + urb->buf, &urb->dma);
859 + DWC_ERROR(" Setup buffer: %p, Setup DMA: %pad\n",
860 + urb->setup_packet, &urb->setup_dma);
861 DWC_ERROR(" Interval: %d\n", urb->interval);
862
863 /* Core haltes the channel for Descriptor DMA mode */
864 --- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
865 +++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
866 @@ -482,8 +482,8 @@ static void hcd_init_fiq(void *cookie)
867 otg_dev->os_dep.mphi_base + 0x1f0;
868 dwc_otg_hcd->fiq_state->mphi_regs.swirq_clr =
869 otg_dev->os_dep.mphi_base + 0x1f4;
870 - DWC_WARN("Fake MPHI regs_base at 0x%08x",
871 - (int)dwc_otg_hcd->fiq_state->mphi_regs.base);
872 + DWC_WARN("Fake MPHI regs_base at %px",
873 + dwc_otg_hcd->fiq_state->mphi_regs.base);
874 } else {
875 dwc_otg_hcd->fiq_state->mphi_regs.ctrl =
876 otg_dev->os_dep.mphi_base + 0x4c;
877 --- a/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
878 +++ b/drivers/usb/host/dwc_otg/dwc_otg_pcd_intr.c
879 @@ -3377,7 +3377,7 @@ void predict_nextep_seq( dwc_otg_core_if
880 dtknq1_data_t dtknqr1;
881 uint32_t in_tkn_epnums[4];
882 uint8_t seqnum[MAX_EPS_CHANNELS];
883 - uint8_t intkn_seq[TOKEN_Q_DEPTH];
884 + uint8_t intkn_seq[1 << 5];
885 grstctl_t resetctl = {.d32 = 0 };
886 uint8_t temp;
887 int ndx = 0;