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