Changeset 0fd82c9 in mainline for uspace/drv/uhci-hcd/uhci_hc.c


Ignore:
Timestamp:
2011-03-17T13:49:41Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1614ce3, 4fa05a32
Parents:
039c66c (diff), fcc525d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

HW error handling

minor fix in TD debug output

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/uhci_hc.c

    r039c66c r0fd82c9  
    9797
    9898        instance->hw_interrupts = interrupts;
     99        instance->hw_failures = 0;
     100
    99101        /* Setup UHCI function. */
    100102        instance->ddf_instance = fun;
     
    149151        while ((pio_read_16(&registers->usbcmd) & UHCI_CMD_HCRESET) != 0);
    150152
    151         /* Set framelist pointer */
     153        /* Set frame to exactly 1ms */
     154        pio_write_8(&registers->sofmod, 64);
     155
     156        /* Set frame list pointer */
    152157        const uint32_t pa = addr_to_phys(instance->frame_list);
    153158        pio_write_32(&registers->flbaseadd, pa);
     
    347352{
    348353        assert(instance);
    349         /* TODO: Check interrupt cause here */
     354        /* TODO: Resume interrupts are not supported */
    350355        /* Lower 2 bits are transaction error and transaction complete */
    351356        if (status & 0x3) {
     
    354359                transfer_list_remove_finished(&instance->transfers_control_full);
    355360                transfer_list_remove_finished(&instance->transfers_bulk_full);
     361        }
     362        /* bits 4 and 5 indicate hc error */
     363        if (status & 0x18) {
     364                usb_log_error("UHCI hardware failure!.\n");
     365                ++instance->hw_failures;
     366                transfer_list_abort_all(&instance->transfers_interrupt);
     367                transfer_list_abort_all(&instance->transfers_control_slow);
     368                transfer_list_abort_all(&instance->transfers_control_full);
     369                transfer_list_abort_all(&instance->transfers_bulk_full);
     370
     371                if (instance->hw_failures < UHCI_ALLOWED_HW_FAIL) {
     372                        /* reinitialize hw, this triggers virtual disconnect*/
     373                        uhci_hc_init_hw(instance);
     374                } else {
     375                        usb_log_fatal("Too many UHCI hardware failures!.\n");
     376                        uhci_hc_fini(instance);
     377                }
    356378        }
    357379}
Note: See TracChangeset for help on using the changeset viewer.