[41b96b4] | 1 | /*
|
---|
| 2 | * Copyright (c) 2011 Jan Vesely
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 | /** @addtogroup drvusbohci
|
---|
| 29 | * @{
|
---|
| 30 | */
|
---|
| 31 | /** @file
|
---|
[81dce9f] | 32 | * @brief OHCI driver
|
---|
[41b96b4] | 33 | */
|
---|
| 34 | #include <assert.h>
|
---|
| 35 | #include <errno.h>
|
---|
| 36 | #include <str_error.h>
|
---|
| 37 |
|
---|
| 38 | #include <usb/debug.h>
|
---|
| 39 |
|
---|
[bab71635] | 40 | #include "root_hub.h"
|
---|
[7d521e24] | 41 | #include <usb/classes/classes.h>
|
---|
[40c6cdf] | 42 | #include <usb/classes/hub.h>
|
---|
[7d521e24] | 43 | #include <usb/dev/driver.h>
|
---|
[3476be8] | 44 | #include "ohci_regs.h"
|
---|
| 45 |
|
---|
[7d521e24] | 46 | #include <usb/dev/request.h>
|
---|
[4d0c40b] | 47 | #include <usb/classes/hub.h>
|
---|
| 48 |
|
---|
[0368669c] | 49 | /**
|
---|
[95285378] | 50 | * standart device descriptor for ohci root hub
|
---|
[0368669c] | 51 | */
|
---|
[8b74997f] | 52 | static const usb_standard_device_descriptor_t ohci_rh_device_descriptor = {
|
---|
| 53 | .configuration_count = 1,
|
---|
| 54 | .descriptor_type = USB_DESCTYPE_DEVICE,
|
---|
| 55 | .device_class = USB_CLASS_HUB,
|
---|
| 56 | .device_protocol = 0,
|
---|
| 57 | .device_subclass = 0,
|
---|
| 58 | .device_version = 0,
|
---|
[7d5708d] | 59 | .length = sizeof(usb_standard_device_descriptor_t),
|
---|
[00694c5] | 60 | .max_packet_size = 64,
|
---|
[7d5708d] | 61 | .vendor_id = 0x16db, /* HelenOS does not have USB vendor ID assigned.*/
|
---|
[8b74997f] | 62 | .product_id = 0x0001,
|
---|
| 63 | .str_serial_number = 0,
|
---|
| 64 | .usb_spec_version = 0x110,
|
---|
[b3f655f] | 65 | };
|
---|
| 66 |
|
---|
[0368669c] | 67 | /**
|
---|
| 68 | * standart configuration descriptor with filled common values
|
---|
| 69 | * for ohci root hubs
|
---|
| 70 | */
|
---|
[8b74997f] | 71 | static const usb_standard_configuration_descriptor_t ohci_rh_conf_descriptor = {
|
---|
| 72 | .attributes = 1 << 7,
|
---|
[b3f655f] | 73 | .configuration_number = 1,
|
---|
| 74 | .descriptor_type = USB_DESCTYPE_CONFIGURATION,
|
---|
| 75 | .interface_count = 1,
|
---|
[7d5708d] | 76 | .length = sizeof(usb_standard_configuration_descriptor_t),
|
---|
[01bbbb2] | 77 | .max_power = 0, /* root hubs don't need no power */
|
---|
[b3f655f] | 78 | .str_configuration = 0,
|
---|
| 79 | };
|
---|
| 80 |
|
---|
[0368669c] | 81 | /**
|
---|
| 82 | * standart ohci root hub interface descriptor
|
---|
| 83 | */
|
---|
[8b74997f] | 84 | static const usb_standard_interface_descriptor_t ohci_rh_iface_descriptor = {
|
---|
[b3f655f] | 85 | .alternate_setting = 0,
|
---|
| 86 | .descriptor_type = USB_DESCTYPE_INTERFACE,
|
---|
| 87 | .endpoint_count = 1,
|
---|
| 88 | .interface_class = USB_CLASS_HUB,
|
---|
| 89 | .interface_number = 1,
|
---|
| 90 | .interface_protocol = 0,
|
---|
| 91 | .interface_subclass = 0,
|
---|
[7d5708d] | 92 | .length = sizeof(usb_standard_interface_descriptor_t),
|
---|
[b3f655f] | 93 | .str_interface = 0,
|
---|
| 94 | };
|
---|
| 95 |
|
---|
[0368669c] | 96 | /**
|
---|
| 97 | * standart ohci root hub endpoint descriptor
|
---|
| 98 | */
|
---|
[8b74997f] | 99 | static const usb_standard_endpoint_descriptor_t ohci_rh_ep_descriptor = {
|
---|
[b3f655f] | 100 | .attributes = USB_TRANSFER_INTERRUPT,
|
---|
| 101 | .descriptor_type = USB_DESCTYPE_ENDPOINT,
|
---|
[8b74997f] | 102 | .endpoint_address = 1 + (1 << 7),
|
---|
[00694c5] | 103 | .length = sizeof(usb_standard_endpoint_descriptor_t),
|
---|
| 104 | .max_packet_size = 2,
|
---|
[b3f655f] | 105 | .poll_interval = 255,
|
---|
| 106 | };
|
---|
[41b96b4] | 107 |
|
---|
[062b25f] | 108 | static void create_serialized_hub_descriptor(rh_t *instance);
|
---|
[b7c2757] | 109 | static void rh_init_descriptors(rh_t *instance);
|
---|
[14426a0] | 110 | static uint16_t create_interrupt_mask(rh_t *instance);
|
---|
[7d5708d] | 111 | static int get_status(rh_t *instance, usb_transfer_batch_t *request);
|
---|
| 112 | static int get_descriptor(rh_t *instance, usb_transfer_batch_t *request);
|
---|
| 113 | static int set_feature(rh_t *instance, usb_transfer_batch_t *request);
|
---|
| 114 | static int clear_feature(rh_t *instance, usb_transfer_batch_t *request);
|
---|
| 115 | static int set_feature_port(rh_t *instance, uint16_t feature, uint16_t port);
|
---|
| 116 | static int clear_feature_port(rh_t *instance, uint16_t feature, uint16_t port);
|
---|
| 117 | static int control_request(rh_t *instance, usb_transfer_batch_t *request);
|
---|
| 118 | static inline void interrupt_request(
|
---|
| 119 | usb_transfer_batch_t *request, uint16_t mask, size_t size)
|
---|
| 120 | {
|
---|
| 121 | assert(request);
|
---|
| 122 |
|
---|
| 123 | request->transfered_size = size;
|
---|
[9c10e51] | 124 | usb_transfer_batch_finish_error(request, &mask, size, EOK);
|
---|
[7d5708d] | 125 | }
|
---|
[bb58dc0b] | 126 |
|
---|
| 127 | #define TRANSFER_OK(bytes) \
|
---|
| 128 | do { \
|
---|
| 129 | request->transfered_size = bytes; \
|
---|
| 130 | return EOK; \
|
---|
[56c6b88] | 131 | } while (0)
|
---|
[8123695a] | 132 |
|
---|
[7d5708d] | 133 | /** Root Hub driver structure initialization.
|
---|
| 134 | *
|
---|
| 135 | * Reads info registers and prepares descriptors. Sets power mode.
|
---|
[8b74997f] | 136 | */
|
---|
[b7c2757] | 137 | void rh_init(rh_t *instance, ohci_regs_t *regs)
|
---|
[ece7f78] | 138 | {
|
---|
[8b74997f] | 139 | assert(instance);
|
---|
[062b25f] | 140 | assert(regs);
|
---|
[ece7f78] | 141 |
|
---|
[8b74997f] | 142 | instance->registers = regs;
|
---|
[112d159] | 143 | instance->port_count =
|
---|
| 144 | (instance->registers->rh_desc_a >> RHDA_NDS_SHIFT) & RHDA_NDS_MASK;
|
---|
[c85804f] | 145 | if (instance->port_count > 15) {
|
---|
[7d5708d] | 146 | usb_log_warning("OHCI specification does not allow more than 15"
|
---|
[ece7f78] | 147 | " ports. Max 15 ports will be used");
|
---|
| 148 | instance->port_count = 15;
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | /* Don't forget the hub status bit and round up */
|
---|
[7d5708d] | 152 | instance->interrupt_mask_size = 1 + (instance->port_count / 8);
|
---|
[c85804f] | 153 | instance->unfinished_interrupt_transfer = NULL;
|
---|
[7d5708d] | 154 |
|
---|
[b4f291d] | 155 | #ifdef OHCI_POWER_SWITCH_no
|
---|
[01bbbb2] | 156 | /* Set port power mode to no power-switching. (always on) */
|
---|
[c85804f] | 157 | instance->registers->rh_desc_a |= RHDA_NPS_FLAG;
|
---|
[b4f291d] | 158 | /* Set to no over-current reporting */
|
---|
[2fe28ca1] | 159 | instance->registers->rh_desc_a |= RHDA_NOCP_FLAG;
|
---|
[b4f291d] | 160 | #elif defined OHCI_POWER_SWITCH_ganged
|
---|
[7372a9a0] | 161 | /* Set port power mode to no ganged power-switching. */
|
---|
| 162 | instance->registers->rh_desc_a &= ~RHDA_NPS_FLAG;
|
---|
| 163 | instance->registers->rh_desc_a &= ~RHDA_PSM_FLAG;
|
---|
[302f9b2] | 164 | instance->registers->rh_status = RHS_CLEAR_GLOBAL_POWER;
|
---|
[2fe28ca1] | 165 | /* Set to global over-current */
|
---|
| 166 | instance->registers->rh_desc_a &= ~RHDA_NOCP_FLAG;
|
---|
| 167 | instance->registers->rh_desc_a &= ~RHDA_OCPM_FLAG;
|
---|
[7372a9a0] | 168 | #else
|
---|
| 169 | /* Set port power mode to no per port power-switching. */
|
---|
| 170 | instance->registers->rh_desc_a &= ~RHDA_NPS_FLAG;
|
---|
| 171 | instance->registers->rh_desc_a |= RHDA_PSM_FLAG;
|
---|
| 172 |
|
---|
[302f9b2] | 173 | /* Control all ports by global switch and turn them off */
|
---|
| 174 | instance->registers->rh_desc_b &= (RHDB_PCC_MASK << RHDB_PCC_SHIFT);
|
---|
| 175 | instance->registers->rh_status = RHS_CLEAR_GLOBAL_POWER;
|
---|
| 176 | /* Return control to per port state */
|
---|
| 177 | instance->registers->rh_desc_b |=
|
---|
| 178 | ((1 << (instance->port_count + 1)) - 1) << RHDB_PCC_SHIFT;
|
---|
[2fe28ca1] | 179 | /* Set per port over-current */
|
---|
| 180 | instance->registers->rh_desc_a &= ~RHDA_NOCP_FLAG;
|
---|
| 181 | instance->registers->rh_desc_a |= RHDA_OCPM_FLAG;
|
---|
[7372a9a0] | 182 | #endif
|
---|
[d0c060b] | 183 |
|
---|
[b7c2757] | 184 | rh_init_descriptors(instance);
|
---|
[01bbbb2] | 185 |
|
---|
[c4fb5ecd] | 186 | usb_log_info("Root hub (%zu ports) initialized.\n",
|
---|
[95285378] | 187 | instance->port_count);
|
---|
[8b74997f] | 188 | }
|
---|
| 189 | /*----------------------------------------------------------------------------*/
|
---|
| 190 | /**
|
---|
[a00768c] | 191 | * Process root hub request.
|
---|
[8b74997f] | 192 | *
|
---|
[a00768c] | 193 | * @param instance Root hub instance
|
---|
| 194 | * @param request Structure containing both request and response information
|
---|
| 195 | * @return Error code
|
---|
[8b74997f] | 196 | */
|
---|
[7d5708d] | 197 | void rh_request(rh_t *instance, usb_transfer_batch_t *request)
|
---|
[a00768c] | 198 | {
|
---|
[8b74997f] | 199 | assert(instance);
|
---|
| 200 | assert(request);
|
---|
[a00768c] | 201 |
|
---|
| 202 | switch (request->ep->transfer_type)
|
---|
| 203 | {
|
---|
| 204 | case USB_TRANSFER_CONTROL:
|
---|
[65c3794] | 205 | usb_log_debug("Root hub got CONTROL packet\n");
|
---|
[7d5708d] | 206 | const int ret = control_request(instance, request);
|
---|
[9c10e51] | 207 | usb_transfer_batch_finish_error(request, NULL, 0, ret);
|
---|
[a00768c] | 208 | break;
|
---|
| 209 | case USB_TRANSFER_INTERRUPT:
|
---|
[65c3794] | 210 | usb_log_debug("Root hub got INTERRUPT packet\n");
|
---|
[14426a0] | 211 | const uint16_t mask = create_interrupt_mask(instance);
|
---|
[f20bc82] | 212 | if (mask == 0) {
|
---|
[049a16f] | 213 | usb_log_debug("No changes..\n");
|
---|
[7d5708d] | 214 | assert(instance->unfinished_interrupt_transfer == NULL);
|
---|
[361fcec] | 215 | instance->unfinished_interrupt_transfer = request;
|
---|
[9c10e51] | 216 | return;
|
---|
[3a85a2b] | 217 | }
|
---|
[7d5708d] | 218 | usb_log_debug("Processing changes...\n");
|
---|
| 219 | interrupt_request(request, mask, instance->interrupt_mask_size);
|
---|
[a00768c] | 220 | break;
|
---|
[7d5708d] | 221 |
|
---|
[a00768c] | 222 | default:
|
---|
| 223 | usb_log_error("Root hub got unsupported request.\n");
|
---|
[9c10e51] | 224 | usb_transfer_batch_finish_error(request, NULL, 0, EINVAL);
|
---|
[8b74997f] | 225 | }
|
---|
[9c10e51] | 226 | usb_transfer_batch_dispose(request);
|
---|
[8b74997f] | 227 | }
|
---|
| 228 | /*----------------------------------------------------------------------------*/
|
---|
[361fcec] | 229 | /**
|
---|
[7d5708d] | 230 | * Process interrupt on a hub device.
|
---|
[361fcec] | 231 | *
|
---|
| 232 | * If there is no pending interrupt transfer, nothing happens.
|
---|
| 233 | * @param instance
|
---|
| 234 | */
|
---|
[a00768c] | 235 | void rh_interrupt(rh_t *instance)
|
---|
| 236 | {
|
---|
[7d5708d] | 237 | assert(instance);
|
---|
| 238 |
|
---|
[a00768c] | 239 | if (!instance->unfinished_interrupt_transfer)
|
---|
[3a85a2b] | 240 | return;
|
---|
[a00768c] | 241 |
|
---|
[049a16f] | 242 | usb_log_debug("Finalizing interrupt transfer\n");
|
---|
[14426a0] | 243 | const uint16_t mask = create_interrupt_mask(instance);
|
---|
[7d5708d] | 244 | interrupt_request(instance->unfinished_interrupt_transfer,
|
---|
| 245 | mask, instance->interrupt_mask_size);
|
---|
[9c10e51] | 246 | usb_transfer_batch_dispose(instance->unfinished_interrupt_transfer);
|
---|
[f20bc82] | 247 |
|
---|
| 248 | instance->unfinished_interrupt_transfer = NULL;
|
---|
[8b74997f] | 249 | }
|
---|
| 250 | /*----------------------------------------------------------------------------*/
|
---|
[66a54cc] | 251 | /**
|
---|
[c85804f] | 252 | * Create hub descriptor.
|
---|
[66a54cc] | 253 | *
|
---|
[c85804f] | 254 | * For descriptor format see USB hub specification (chapter 11.15.2.1, pg. 263)
|
---|
[66a54cc] | 255 | *
|
---|
[a00768c] | 256 | * @param instance Root hub instance
|
---|
| 257 | * @return Error code
|
---|
[66a54cc] | 258 | */
|
---|
[062b25f] | 259 | void create_serialized_hub_descriptor(rh_t *instance)
|
---|
[a00768c] | 260 | {
|
---|
| 261 | assert(instance);
|
---|
| 262 |
|
---|
[c85804f] | 263 | /* 7 bytes + 2 port bit fields (port count + global bit) */
|
---|
[7d5708d] | 264 | const size_t size = 7 + (instance->interrupt_mask_size * 2);
|
---|
[062b25f] | 265 | assert(size <= HUB_DESCRIPTOR_MAX_SIZE);
|
---|
[1368a6b] | 266 | instance->hub_descriptor_size = size;
|
---|
[c85804f] | 267 |
|
---|
[062b25f] | 268 | const uint32_t hub_desc = instance->registers->rh_desc_a;
|
---|
| 269 | const uint32_t port_desc = instance->registers->rh_desc_b;
|
---|
[361fcec] | 270 |
|
---|
[c85804f] | 271 | /* bDescLength */
|
---|
[1368a6b] | 272 | instance->descriptors.hub[0] = size;
|
---|
[c85804f] | 273 | /* bDescriptorType */
|
---|
[1368a6b] | 274 | instance->descriptors.hub[1] = USB_DESCTYPE_HUB;
|
---|
[c85804f] | 275 | /* bNmbrPorts */
|
---|
[1368a6b] | 276 | instance->descriptors.hub[2] = instance->port_count;
|
---|
[c85804f] | 277 | /* wHubCharacteristics */
|
---|
[1368a6b] | 278 | instance->descriptors.hub[3] = 0 |
|
---|
[c85804f] | 279 | /* The lowest 2 bits indicate power switching mode */
|
---|
| 280 | (((hub_desc & RHDA_PSM_FLAG) ? 1 : 0) << 0) |
|
---|
| 281 | (((hub_desc & RHDA_NPS_FLAG) ? 1 : 0) << 1) |
|
---|
| 282 | /* Bit 3 indicates device type (compound device) */
|
---|
| 283 | (((hub_desc & RHDA_DT_FLAG) ? 1 : 0) << 2) |
|
---|
| 284 | /* Bits 4,5 indicate over-current protection mode */
|
---|
| 285 | (((hub_desc & RHDA_OCPM_FLAG) ? 1 : 0) << 3) |
|
---|
| 286 | (((hub_desc & RHDA_NOCP_FLAG) ? 1 : 0) << 4);
|
---|
| 287 |
|
---|
| 288 | /* Reserved */
|
---|
[1368a6b] | 289 | instance->descriptors.hub[4] = 0;
|
---|
[c85804f] | 290 | /* bPwrOn2PwrGood */
|
---|
[1368a6b] | 291 | instance->descriptors.hub[5] =
|
---|
[062b25f] | 292 | (hub_desc >> RHDA_POTPGT_SHIFT) & RHDA_POTPGT_MASK;
|
---|
[c85804f] | 293 | /* bHubContrCurrent, root hubs don't need no power. */
|
---|
[1368a6b] | 294 | instance->descriptors.hub[6] = 0;
|
---|
[c85804f] | 295 |
|
---|
| 296 | /* Device Removable and some legacy 1.0 stuff*/
|
---|
[1368a6b] | 297 | instance->descriptors.hub[7] =
|
---|
[062b25f] | 298 | (port_desc >> RHDB_DR_SHIFT) & RHDB_DR_MASK & 0xff;
|
---|
[1368a6b] | 299 | instance->descriptors.hub[8] = 0xff;
|
---|
[7d5708d] | 300 | if (instance->interrupt_mask_size == 2) {
|
---|
[1368a6b] | 301 | instance->descriptors.hub[8] =
|
---|
[062b25f] | 302 | (port_desc >> RHDB_DR_SHIFT) & RHDB_DR_MASK >> 8;
|
---|
[1368a6b] | 303 | instance->descriptors.hub[9] = 0xff;
|
---|
| 304 | instance->descriptors.hub[10] = 0xff;
|
---|
[66a54cc] | 305 | }
|
---|
| 306 | }
|
---|
[8b74997f] | 307 | /*----------------------------------------------------------------------------*/
|
---|
[a00768c] | 308 | /** Initialize hub descriptors.
|
---|
[66a54cc] | 309 | *
|
---|
[7d5708d] | 310 | * A full configuration descriptor is assembled. The configuration and endpoint
|
---|
| 311 | * descriptors have local modifications.
|
---|
[a00768c] | 312 | * @param instance Root hub instance
|
---|
| 313 | * @return Error code
|
---|
[66a54cc] | 314 | */
|
---|
[b7c2757] | 315 | void rh_init_descriptors(rh_t *instance)
|
---|
[a00768c] | 316 | {
|
---|
| 317 | assert(instance);
|
---|
| 318 |
|
---|
[1368a6b] | 319 | instance->descriptors.configuration = ohci_rh_conf_descriptor;
|
---|
| 320 | instance->descriptors.interface = ohci_rh_iface_descriptor;
|
---|
| 321 | instance->descriptors.endpoint = ohci_rh_ep_descriptor;
|
---|
[062b25f] | 322 | create_serialized_hub_descriptor(instance);
|
---|
[c85804f] | 323 |
|
---|
[7d5708d] | 324 | instance->descriptors.endpoint.max_packet_size =
|
---|
| 325 | instance->interrupt_mask_size;
|
---|
| 326 |
|
---|
[1368a6b] | 327 | instance->descriptors.configuration.total_length =
|
---|
[c85804f] | 328 | sizeof(usb_standard_configuration_descriptor_t) +
|
---|
| 329 | sizeof(usb_standard_endpoint_descriptor_t) +
|
---|
| 330 | sizeof(usb_standard_interface_descriptor_t) +
|
---|
[1368a6b] | 331 | instance->hub_descriptor_size;
|
---|
[66a54cc] | 332 | }
|
---|
[41b96b4] | 333 | /*----------------------------------------------------------------------------*/
|
---|
[7d5708d] | 334 | /**
|
---|
| 335 | * Create bitmap of changes to answer status interrupt.
|
---|
| 336 | *
|
---|
| 337 | * Result contains bitmap where bit 0 indicates change on hub and
|
---|
| 338 | * bit i indicates change on i`th port (i>0). For more info see
|
---|
| 339 | * Hub and Port status bitmap specification in USB specification
|
---|
| 340 | * (chapter 11.13.4).
|
---|
| 341 | * @param instance root hub instance
|
---|
| 342 | * @return Mask of changes.
|
---|
| 343 | */
|
---|
| 344 | uint16_t create_interrupt_mask(rh_t *instance)
|
---|
| 345 | {
|
---|
| 346 | assert(instance);
|
---|
| 347 | uint16_t mask = 0;
|
---|
| 348 |
|
---|
| 349 | /* Only local power source change and over-current change can happen */
|
---|
| 350 | if (instance->registers->rh_status & (RHS_LPSC_FLAG | RHS_OCIC_FLAG)) {
|
---|
| 351 | mask |= 1;
|
---|
| 352 | }
|
---|
| 353 | size_t port = 1;
|
---|
| 354 | for (; port <= instance->port_count; ++port) {
|
---|
| 355 | /* Write-clean bits are those that indicate change */
|
---|
| 356 | if (RHPS_CHANGE_WC_MASK
|
---|
| 357 | & instance->registers->rh_port_status[port - 1]) {
|
---|
| 358 |
|
---|
| 359 | mask |= (1 << port);
|
---|
| 360 | }
|
---|
| 361 | }
|
---|
| 362 | /* USB is little endian */
|
---|
| 363 | return host2uint32_t_le(mask);
|
---|
| 364 | }
|
---|
| 365 | /*----------------------------------------------------------------------------*/
|
---|
[f3da9b2] | 366 | /**
|
---|
[a00768c] | 367 | * Create answer to status request.
|
---|
[f3da9b2] | 368 | *
|
---|
| 369 | * This might be either hub status or port status request. If neither,
|
---|
| 370 | * ENOTSUP is returned.
|
---|
| 371 | * @param instance root hub instance
|
---|
| 372 | * @param request structure containing both request and response information
|
---|
| 373 | * @return error code
|
---|
| 374 | */
|
---|
[7d5708d] | 375 | int get_status(rh_t *instance, usb_transfer_batch_t *request)
|
---|
[a00768c] | 376 | {
|
---|
| 377 | assert(instance);
|
---|
| 378 | assert(request);
|
---|
[d8421c4] | 379 |
|
---|
[a00768c] | 380 | const usb_device_request_setup_packet_t *request_packet =
|
---|
| 381 | (usb_device_request_setup_packet_t*)request->setup_buffer;
|
---|
| 382 |
|
---|
| 383 | if (request->buffer_size < 4) {
|
---|
| 384 | usb_log_error("Buffer too small for get status request.\n");
|
---|
| 385 | return EOVERFLOW;
|
---|
[d8421c4] | 386 | }
|
---|
[4d0c40b] | 387 |
|
---|
[00694c5] | 388 | /* Hub status: just filter relevant info from rh_status reg */
|
---|
[c3bc8a8] | 389 | if (request_packet->request_type == USB_HUB_REQ_TYPE_GET_HUB_STATUS) {
|
---|
| 390 | const uint32_t data = instance->registers->rh_status &
|
---|
| 391 | (RHS_LPS_FLAG | RHS_LPSC_FLAG | RHS_OCI_FLAG | RHS_OCIC_FLAG);
|
---|
[9c10e51] | 392 | memcpy(request->buffer, &data, sizeof(data));
|
---|
| 393 | TRANSFER_OK(sizeof(data));
|
---|
[c3bc8a8] | 394 | }
|
---|
| 395 |
|
---|
[00694c5] | 396 | /* Copy appropriate rh_port_status register, OHCI designers were
|
---|
| 397 | * kind enough to make those bit values match USB specification */
|
---|
[c3bc8a8] | 398 | if (request_packet->request_type == USB_HUB_REQ_TYPE_GET_PORT_STATUS) {
|
---|
[00694c5] | 399 | const unsigned port = request_packet->index;
|
---|
[c3bc8a8] | 400 | if (port < 1 || port > instance->port_count)
|
---|
| 401 | return EINVAL;
|
---|
| 402 |
|
---|
| 403 | const uint32_t data =
|
---|
| 404 | instance->registers->rh_port_status[port - 1];
|
---|
[9c10e51] | 405 | memcpy(request->buffer, &data, sizeof(data));
|
---|
| 406 | TRANSFER_OK(sizeof(data));
|
---|
[c3bc8a8] | 407 | }
|
---|
[d0c060b] | 408 |
|
---|
[4d0c40b] | 409 | return ENOTSUP;
|
---|
| 410 | }
|
---|
[8b74997f] | 411 | /*----------------------------------------------------------------------------*/
|
---|
[f3da9b2] | 412 | /**
|
---|
[a00768c] | 413 | * Create answer to a descriptor request.
|
---|
[f3da9b2] | 414 | *
|
---|
| 415 | * This might be a request for standard (configuration, device, endpoint or
|
---|
| 416 | * interface) or device specific (hub) descriptor.
|
---|
[a00768c] | 417 | * @param instance Root hub instance
|
---|
| 418 | * @param request Structure containing both request and response information
|
---|
| 419 | * @return Error code
|
---|
[f3da9b2] | 420 | */
|
---|
[7d5708d] | 421 | int get_descriptor(rh_t *instance, usb_transfer_batch_t *request)
|
---|
[a00768c] | 422 | {
|
---|
| 423 | assert(instance);
|
---|
| 424 | assert(request);
|
---|
| 425 |
|
---|
| 426 | const usb_device_request_setup_packet_t *setup_request =
|
---|
| 427 | (usb_device_request_setup_packet_t *) request->setup_buffer;
|
---|
[d8421c4] | 428 | size_t size;
|
---|
[7d5708d] | 429 | const void *descriptor = NULL;
|
---|
[b3f655f] | 430 | const uint16_t setup_request_value = setup_request->value_high;
|
---|
[8b74997f] | 431 | //(setup_request->value_low << 8);
|
---|
[a00768c] | 432 | switch (setup_request_value)
|
---|
| 433 | {
|
---|
| 434 | case USB_DESCTYPE_HUB:
|
---|
| 435 | usb_log_debug2("USB_DESCTYPE_HUB\n");
|
---|
[7d5708d] | 436 | /* Hub descriptor was generated locally */
|
---|
| 437 | descriptor = instance->descriptors.hub;
|
---|
[1368a6b] | 438 | size = instance->hub_descriptor_size;
|
---|
[a00768c] | 439 | break;
|
---|
| 440 |
|
---|
| 441 | case USB_DESCTYPE_DEVICE:
|
---|
| 442 | usb_log_debug2("USB_DESCTYPE_DEVICE\n");
|
---|
[7d5708d] | 443 | /* Device descriptor is shared (No one should ask for it)*/
|
---|
| 444 | descriptor = &ohci_rh_device_descriptor;
|
---|
[a00768c] | 445 | size = sizeof(ohci_rh_device_descriptor);
|
---|
| 446 | break;
|
---|
| 447 |
|
---|
| 448 | case USB_DESCTYPE_CONFIGURATION:
|
---|
| 449 | usb_log_debug2("USB_DESCTYPE_CONFIGURATION\n");
|
---|
[7d5708d] | 450 | /* Start with configuration and add others depending on
|
---|
| 451 | * request size */
|
---|
| 452 | descriptor = &instance->descriptors;
|
---|
[1368a6b] | 453 | size = instance->descriptors.configuration.total_length;
|
---|
[a00768c] | 454 | break;
|
---|
| 455 |
|
---|
| 456 | case USB_DESCTYPE_INTERFACE:
|
---|
| 457 | usb_log_debug2("USB_DESCTYPE_INTERFACE\n");
|
---|
[7d5708d] | 458 | /* Use local interface descriptor. There is one and it
|
---|
| 459 | * might be modified */
|
---|
| 460 | descriptor = &instance->descriptors.interface;
|
---|
| 461 | size = sizeof(instance->descriptors.interface);
|
---|
[a00768c] | 462 | break;
|
---|
| 463 |
|
---|
| 464 | case USB_DESCTYPE_ENDPOINT:
|
---|
[7d5708d] | 465 | /* Use local endpoint descriptor. There is one
|
---|
| 466 | * it might have max_packet_size field modified*/
|
---|
[a00768c] | 467 | usb_log_debug2("USB_DESCTYPE_ENDPOINT\n");
|
---|
[7d5708d] | 468 | descriptor = &instance->descriptors.endpoint;
|
---|
| 469 | size = sizeof(instance->descriptors.endpoint);
|
---|
[a00768c] | 470 | break;
|
---|
| 471 |
|
---|
| 472 | default:
|
---|
| 473 | usb_log_debug2("USB_DESCTYPE_EINVAL %d \n"
|
---|
| 474 | "\ttype %d\n\trequest %d\n\tvalue "
|
---|
| 475 | "%d\n\tindex %d\n\tlen %d\n ",
|
---|
| 476 | setup_request->value,
|
---|
| 477 | setup_request->request_type, setup_request->request,
|
---|
| 478 | setup_request_value, setup_request->index,
|
---|
| 479 | setup_request->length);
|
---|
| 480 | return EINVAL;
|
---|
[4d0c40b] | 481 | }
|
---|
[8b74997f] | 482 | if (request->buffer_size < size) {
|
---|
[d8421c4] | 483 | size = request->buffer_size;
|
---|
| 484 | }
|
---|
[d0c060b] | 485 |
|
---|
[9c10e51] | 486 | memcpy(request->buffer, descriptor, size);
|
---|
[56c6b88] | 487 | TRANSFER_OK(size);
|
---|
[4d0c40b] | 488 | }
|
---|
[8b74997f] | 489 | /*----------------------------------------------------------------------------*/
|
---|
[8123695a] | 490 | /**
|
---|
| 491 | * process feature-enabling request on hub
|
---|
[8b74997f] | 492 | *
|
---|
[f3da9b2] | 493 | * @param instance root hub instance
|
---|
| 494 | * @param feature feature selector
|
---|
| 495 | * @param port port number, counted from 1
|
---|
| 496 | * @param enable enable or disable the specified feature
|
---|
| 497 | * @return error code
|
---|
| 498 | */
|
---|
[7d5708d] | 499 | int set_feature_port(rh_t *instance, uint16_t feature, uint16_t port)
|
---|
[a00768c] | 500 | {
|
---|
| 501 | assert(instance);
|
---|
| 502 |
|
---|
[8b74997f] | 503 | if (port < 1 || port > instance->port_count)
|
---|
[4d0c40b] | 504 | return EINVAL;
|
---|
[a00768c] | 505 |
|
---|
[735236a] | 506 | switch (feature)
|
---|
| 507 | {
|
---|
| 508 | case USB_HUB_FEATURE_PORT_POWER: //8
|
---|
| 509 | /* No power switching */
|
---|
| 510 | if (instance->registers->rh_desc_a & RHDA_NPS_FLAG)
|
---|
| 511 | return EOK;
|
---|
| 512 | /* Ganged power switching */
|
---|
| 513 | if (!(instance->registers->rh_desc_a & RHDA_PSM_FLAG)) {
|
---|
| 514 | instance->registers->rh_status = RHS_SET_GLOBAL_POWER;
|
---|
| 515 | return EOK;
|
---|
| 516 | }
|
---|
| 517 | case USB_HUB_FEATURE_PORT_ENABLE: //1
|
---|
| 518 | case USB_HUB_FEATURE_PORT_SUSPEND: //2
|
---|
| 519 | case USB_HUB_FEATURE_PORT_RESET: //4
|
---|
| 520 | /* Nice thing is that these shifts correspond to the position
|
---|
| 521 | * of control bits in register */
|
---|
| 522 | instance->registers->rh_port_status[port - 1] = (1 << feature);
|
---|
| 523 | return EOK;
|
---|
| 524 | default:
|
---|
| 525 | return ENOTSUP;
|
---|
| 526 | }
|
---|
[8123695a] | 527 | }
|
---|
[8b74997f] | 528 | /*----------------------------------------------------------------------------*/
|
---|
[8123695a] | 529 | /**
|
---|
[7d5708d] | 530 | * Process feature clear request.
|
---|
[8123695a] | 531 | *
|
---|
| 532 | * @param instance root hub instance
|
---|
| 533 | * @param feature feature selector
|
---|
| 534 | * @param port port number, counted from 1
|
---|
| 535 | * @param enable enable or disable the specified feature
|
---|
| 536 | * @return error code
|
---|
| 537 | */
|
---|
[7d5708d] | 538 | int clear_feature_port(rh_t *instance, uint16_t feature, uint16_t port)
|
---|
[a00768c] | 539 | {
|
---|
| 540 | assert(instance);
|
---|
| 541 |
|
---|
[8b74997f] | 542 | if (port < 1 || port > instance->port_count)
|
---|
[8123695a] | 543 | return EINVAL;
|
---|
[a00768c] | 544 |
|
---|
[735236a] | 545 | /* Enabled features to clear: see page 269 of USB specs */
|
---|
| 546 | switch (feature)
|
---|
| 547 | {
|
---|
| 548 | case USB_HUB_FEATURE_PORT_POWER: //8
|
---|
| 549 | /* No power switching */
|
---|
| 550 | if (instance->registers->rh_desc_a & RHDA_NPS_FLAG)
|
---|
| 551 | return ENOTSUP;
|
---|
| 552 | /* Ganged power switching */
|
---|
| 553 | if (!(instance->registers->rh_desc_a & RHDA_PSM_FLAG)) {
|
---|
| 554 | instance->registers->rh_status = RHS_CLEAR_GLOBAL_POWER;
|
---|
| 555 | return EOK;
|
---|
| 556 | }
|
---|
| 557 | instance->registers->rh_port_status[port - 1] =
|
---|
| 558 | RHPS_CLEAR_PORT_POWER;
|
---|
| 559 | return EOK;
|
---|
| 560 |
|
---|
| 561 | case USB_HUB_FEATURE_PORT_ENABLE: //1
|
---|
| 562 | instance->registers->rh_port_status[port - 1] =
|
---|
| 563 | RHPS_CLEAR_PORT_ENABLE;
|
---|
| 564 | return EOK;
|
---|
| 565 |
|
---|
| 566 | case USB_HUB_FEATURE_PORT_SUSPEND: //2
|
---|
| 567 | instance->registers->rh_port_status[port - 1] =
|
---|
| 568 | RHPS_CLEAR_PORT_SUSPEND;
|
---|
| 569 | return EOK;
|
---|
| 570 |
|
---|
| 571 | case USB_HUB_FEATURE_C_PORT_CONNECTION: //16
|
---|
| 572 | case USB_HUB_FEATURE_C_PORT_ENABLE: //17
|
---|
| 573 | case USB_HUB_FEATURE_C_PORT_SUSPEND: //18
|
---|
| 574 | case USB_HUB_FEATURE_C_PORT_OVER_CURRENT: //19
|
---|
| 575 | case USB_HUB_FEATURE_C_PORT_RESET: //20
|
---|
| 576 | /* Nice thing is that these shifts correspond to the position
|
---|
| 577 | * of control bits in register */
|
---|
| 578 | instance->registers->rh_port_status[port - 1] = (1 << feature);
|
---|
| 579 | return EOK;
|
---|
[7d5708d] | 580 |
|
---|
[735236a] | 581 | default:
|
---|
| 582 | return ENOTSUP;
|
---|
| 583 | }
|
---|
[d8421c4] | 584 | }
|
---|
[8b74997f] | 585 | /*----------------------------------------------------------------------------*/
|
---|
[f3da9b2] | 586 | /**
|
---|
[7d5708d] | 587 | * process one of requests that do not request nor carry additional data
|
---|
[f3da9b2] | 588 | *
|
---|
[7d5708d] | 589 | * Request can be one of USB_DEVREQ_CLEAR_FEATURE, USB_DEVREQ_SET_FEATURE or
|
---|
| 590 | * USB_DEVREQ_SET_ADDRESS.
|
---|
[f3da9b2] | 591 | * @param instance root hub instance
|
---|
| 592 | * @param request structure containing both request and response information
|
---|
| 593 | * @return error code
|
---|
| 594 | */
|
---|
[7d5708d] | 595 | int set_feature(rh_t *instance, usb_transfer_batch_t *request)
|
---|
[a00768c] | 596 | {
|
---|
| 597 | assert(instance);
|
---|
| 598 | assert(request);
|
---|
| 599 |
|
---|
| 600 | const usb_device_request_setup_packet_t *setup_request =
|
---|
| 601 | (usb_device_request_setup_packet_t *) request->setup_buffer;
|
---|
[7d5708d] | 602 | switch (setup_request->request_type)
|
---|
[a00768c] | 603 | {
|
---|
[7d5708d] | 604 | case USB_HUB_REQ_TYPE_SET_PORT_FEATURE:
|
---|
| 605 | usb_log_debug("USB_HUB_REQ_TYPE_SET_PORT_FEATURE\n");
|
---|
| 606 | return set_feature_port(instance,
|
---|
| 607 | setup_request->value, setup_request->index);
|
---|
| 608 |
|
---|
| 609 | case USB_HUB_REQ_TYPE_SET_HUB_FEATURE:
|
---|
| 610 | /* Chapter 11.16.2 specifies that hub can be recipient
|
---|
| 611 | * only for C_HUB_LOCAL_POWER and C_HUB_OVER_CURRENT
|
---|
| 612 | * features. It makes no sense to SET either. */
|
---|
| 613 | usb_log_error("Invalid HUB set feature request.\n");
|
---|
| 614 | return ENOTSUP;
|
---|
| 615 | default:
|
---|
| 616 | usb_log_error("Invalid set feature request type: %d\n",
|
---|
| 617 | setup_request->request_type);
|
---|
| 618 | return EINVAL;
|
---|
[4d0c40b] | 619 | }
|
---|
| 620 | }
|
---|
[8b74997f] | 621 | /*----------------------------------------------------------------------------*/
|
---|
[f3da9b2] | 622 | /**
|
---|
| 623 | * process one of requests that do not request nor carry additional data
|
---|
| 624 | *
|
---|
| 625 | * Request can be one of USB_DEVREQ_CLEAR_FEATURE, USB_DEVREQ_SET_FEATURE or
|
---|
| 626 | * USB_DEVREQ_SET_ADDRESS.
|
---|
| 627 | * @param instance root hub instance
|
---|
| 628 | * @param request structure containing both request and response information
|
---|
| 629 | * @return error code
|
---|
| 630 | */
|
---|
[7d5708d] | 631 | int clear_feature(rh_t *instance, usb_transfer_batch_t *request)
|
---|
[a00768c] | 632 | {
|
---|
| 633 | assert(instance);
|
---|
| 634 | assert(request);
|
---|
| 635 |
|
---|
| 636 | const usb_device_request_setup_packet_t *setup_request =
|
---|
| 637 | (usb_device_request_setup_packet_t *) request->setup_buffer;
|
---|
[d8421c4] | 638 | request->transfered_size = 0;
|
---|
[7d5708d] | 639 | switch (setup_request->request_type)
|
---|
[a00768c] | 640 | {
|
---|
[7d5708d] | 641 | case USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE:
|
---|
| 642 | usb_log_debug("USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE\n");
|
---|
| 643 | return clear_feature_port(instance,
|
---|
| 644 | setup_request->value, setup_request->index);
|
---|
| 645 |
|
---|
| 646 | case USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE:
|
---|
| 647 | usb_log_debug("USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE\n");
|
---|
| 648 | /*
|
---|
| 649 | * Chapter 11.16.2 specifies that only C_HUB_LOCAL_POWER and
|
---|
| 650 | * C_HUB_OVER_CURRENT are supported. C_HUB_OVER_CURRENT is represented
|
---|
| 651 | * by OHCI RHS_OCIC_FLAG. C_HUB_LOCAL_POWER is not supported
|
---|
| 652 | * as root hubs do not support local power status feature.
|
---|
| 653 | * (OHCI pg. 127) */
|
---|
| 654 | if (setup_request->value == USB_HUB_FEATURE_C_HUB_OVER_CURRENT) {
|
---|
| 655 | instance->registers->rh_status = RHS_OCIC_FLAG;
|
---|
| 656 | TRANSFER_OK(0);
|
---|
[8123695a] | 657 | }
|
---|
[a00768c] | 658 | default:
|
---|
[7d5708d] | 659 | usb_log_error("Invalid clear feature request type: %d\n",
|
---|
| 660 | setup_request->request_type);
|
---|
| 661 | return EINVAL;
|
---|
[a00768c] | 662 | }
|
---|
[4d0c40b] | 663 | }
|
---|
[8b74997f] | 664 | /*----------------------------------------------------------------------------*/
|
---|
[f3da9b2] | 665 | /**
|
---|
[a00768c] | 666 | * Process hub control request.
|
---|
[f3da9b2] | 667 | *
|
---|
| 668 | * If needed, writes answer into the request structure.
|
---|
| 669 | * Request can be one of
|
---|
| 670 | * USB_DEVREQ_GET_STATUS,
|
---|
| 671 | * USB_DEVREQ_GET_DESCRIPTOR,
|
---|
| 672 | * USB_DEVREQ_GET_CONFIGURATION,
|
---|
| 673 | * USB_DEVREQ_CLEAR_FEATURE,
|
---|
| 674 | * USB_DEVREQ_SET_FEATURE,
|
---|
| 675 | * USB_DEVREQ_SET_ADDRESS,
|
---|
| 676 | * USB_DEVREQ_SET_DESCRIPTOR or
|
---|
| 677 | * USB_DEVREQ_SET_CONFIGURATION.
|
---|
| 678 | *
|
---|
| 679 | * @param instance root hub instance
|
---|
| 680 | * @param request structure containing both request and response information
|
---|
| 681 | * @return error code
|
---|
| 682 | */
|
---|
[7d5708d] | 683 | int control_request(rh_t *instance, usb_transfer_batch_t *request)
|
---|
[a00768c] | 684 | {
|
---|
| 685 | assert(instance);
|
---|
| 686 | assert(request);
|
---|
| 687 |
|
---|
[8b74997f] | 688 | if (!request->setup_buffer) {
|
---|
[a00768c] | 689 | usb_log_error("Root hub received empty transaction!");
|
---|
[8b74997f] | 690 | return EINVAL;
|
---|
| 691 | }
|
---|
[7d5708d] | 692 |
|
---|
[a00768c] | 693 | if (sizeof(usb_device_request_setup_packet_t) > request->setup_size) {
|
---|
[049a16f] | 694 | usb_log_error("Setup packet too small\n");
|
---|
[a00768c] | 695 | return EOVERFLOW;
|
---|
[8b74997f] | 696 | }
|
---|
[7d5708d] | 697 |
|
---|
[a00768c] | 698 | usb_log_debug2("CTRL packet: %s.\n",
|
---|
| 699 | usb_debug_str_buffer((uint8_t *) request->setup_buffer, 8, 8));
|
---|
| 700 | const usb_device_request_setup_packet_t *setup_request =
|
---|
| 701 | (usb_device_request_setup_packet_t *) request->setup_buffer;
|
---|
| 702 | switch (setup_request->request)
|
---|
| 703 | {
|
---|
| 704 | case USB_DEVREQ_GET_STATUS:
|
---|
[7d5708d] | 705 | usb_log_debug("USB_DEVREQ_GET_STATUS\n");
|
---|
| 706 | return get_status(instance, request);
|
---|
| 707 |
|
---|
[a00768c] | 708 | case USB_DEVREQ_GET_DESCRIPTOR:
|
---|
[7d5708d] | 709 | usb_log_debug("USB_DEVREQ_GET_DESCRIPTOR\n");
|
---|
| 710 | return get_descriptor(instance, request);
|
---|
| 711 |
|
---|
[a00768c] | 712 | case USB_DEVREQ_GET_CONFIGURATION:
|
---|
[7d5708d] | 713 | usb_log_debug("USB_DEVREQ_GET_CONFIGURATION\n");
|
---|
| 714 | if (request->buffer_size != 1)
|
---|
| 715 | return EINVAL;
|
---|
[9c10e51] | 716 | request->buffer[0] = 1;
|
---|
[7d5708d] | 717 | TRANSFER_OK(1);
|
---|
| 718 |
|
---|
[a00768c] | 719 | case USB_DEVREQ_CLEAR_FEATURE:
|
---|
[7d5708d] | 720 | usb_log_debug2("Processing request without "
|
---|
| 721 | "additional data\n");
|
---|
| 722 | return clear_feature(instance, request);
|
---|
[a00768c] | 723 | case USB_DEVREQ_SET_FEATURE:
|
---|
| 724 | usb_log_debug2("Processing request without "
|
---|
| 725 | "additional data\n");
|
---|
[7d5708d] | 726 | return set_feature(instance, request);
|
---|
| 727 |
|
---|
| 728 | case USB_DEVREQ_SET_ADDRESS:
|
---|
| 729 | usb_log_debug("USB_DEVREQ_SET_ADDRESS\n");
|
---|
| 730 | instance->address = setup_request->value;
|
---|
| 731 | TRANSFER_OK(0);
|
---|
| 732 |
|
---|
| 733 | case USB_DEVREQ_SET_CONFIGURATION:
|
---|
| 734 | usb_log_debug("USB_DEVREQ_SET_CONFIGURATION\n");
|
---|
| 735 | /* We don't need to do anything */
|
---|
| 736 | TRANSFER_OK(0);
|
---|
| 737 |
|
---|
[56c6b88] | 738 | case USB_DEVREQ_SET_DESCRIPTOR: /* Not supported by OHCI RH */
|
---|
[a00768c] | 739 | default:
|
---|
| 740 | usb_log_error("Received unsupported request: %d.\n",
|
---|
| 741 | setup_request->request);
|
---|
| 742 | return ENOTSUP;
|
---|
[f3da9b2] | 743 | }
|
---|
| 744 | }
|
---|
[4d0c40b] | 745 |
|
---|
[41b96b4] | 746 | /**
|
---|
| 747 | * @}
|
---|
| 748 | */
|
---|