Revision b62b0828 hw/usb/hcd-xhci.c

b/hw/usb/hcd-xhci.c
2365 2365

  
2366 2366
static void xhci_port_update(XHCIPort *port, int is_detach)
2367 2367
{
2368
    uint32_t pls = PLS_RX_DETECT;
2369

  
2368 2370
    port->portsc = PORTSC_PP;
2369 2371
    if (!is_detach && xhci_port_have_device(port)) {
2370 2372
        port->portsc |= PORTSC_CCS;
2371 2373
        switch (port->uport->dev->speed) {
2372 2374
        case USB_SPEED_LOW:
2373 2375
            port->portsc |= PORTSC_SPEED_LOW;
2376
            pls = PLS_POLLING;
2374 2377
            break;
2375 2378
        case USB_SPEED_FULL:
2376 2379
            port->portsc |= PORTSC_SPEED_FULL;
2380
            pls = PLS_POLLING;
2377 2381
            break;
2378 2382
        case USB_SPEED_HIGH:
2379 2383
            port->portsc |= PORTSC_SPEED_HIGH;
2384
            pls = PLS_POLLING;
2380 2385
            break;
2381 2386
        case USB_SPEED_SUPER:
2382 2387
            port->portsc |= PORTSC_SPEED_SUPER;
2388
            port->portsc |= PORTSC_PED;
2389
            pls = PLS_U0;
2383 2390
            break;
2384 2391
        }
2385 2392
    }
2386

  
2393
    set_field(&port->portsc, pls, PORTSC_PLS);
2387 2394
    xhci_port_notify(port, PORTSC_CSC);
2388 2395
}
2389 2396

  
2390 2397
static void xhci_port_reset(XHCIPort *port)
2391 2398
{
2392 2399
    DPRINTF("xhci: port %d reset\n", port);
2400
    if (!xhci_port_have_device(port)) {
2401
        return;
2402
    }
2403

  
2393 2404
    usb_device_reset(port->uport->dev);
2394
    port->portsc |= PORTSC_PRC | PORTSC_PED;
2405

  
2406
    switch (port->uport->dev->speed) {
2407
    case USB_SPEED_LOW:
2408
    case USB_SPEED_FULL:
2409
    case USB_SPEED_HIGH:
2410
        set_field(&port->portsc, PLS_U0, PORTSC_PLS);
2411
        port->portsc |= PORTSC_PED;
2412
        break;
2413
    }
2414

  
2415
    port->portsc &= ~PORTSC_PR;
2416
    xhci_port_notify(port, PORTSC_PRC);
2395 2417
}
2396 2418

  
2397 2419
static void xhci_reset(DeviceState *dev)

Also available in: Unified diff