Changeset ff34e5a in mainline


Ignore:
Timestamp:
2011-03-14T14:04:15Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9370884
Parents:
6298d80
Message:

Try to enable hw interrupts

Location:
uspace/drv/uhci-hcd
Files:
3 edited

Legend:

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

    r6298d80 rff34e5a  
    174174            "Failed(%d) to disable legacy USB: %s.\n", ret, str_error(ret));
    175175
    176 #if 0
     176        bool interrupts = false;
    177177        ret = pci_enable_interrupts(device);
    178178        if (ret != EOK) {
     
    180180                    "Failed(%d) to enable interrupts, fall back to polling.\n",
    181181                    ret);
     182        } else {
     183                usb_log_debug("Hw interrupts enabled.\n");
     184                interrupts = true;
    182185        }
    183 #endif
    184186
    185187        instance->hc_fun = ddf_fun_create(device, fun_exposed, "uhci-hc");
    186188        ret = (instance->hc_fun == NULL) ? ENOMEM : EOK;
    187         CHECK_RET_DEST_FUN_RETURN(ret, "Failed(%d) to create HC function.\n", ret);
    188 
    189         ret = uhci_hc_init(
    190             &instance->hc, instance->hc_fun, (void*)io_reg_base, io_reg_size);
     189        CHECK_RET_DEST_FUN_RETURN(ret,
     190            "Failed(%d) to create HC function.\n", ret);
     191
     192        ret = uhci_hc_init(&instance->hc, instance->hc_fun,
     193            (void*)io_reg_base, io_reg_size, interrupts);
    191194        CHECK_RET_DEST_FUN_RETURN(ret, "Failed(%d) to init uhci-hcd.\n", ret);
    192195        instance->hc_fun->ops = &uhci_hc_ops;
     
    234237#undef CHECK_RET_FINI_RETURN
    235238}
    236 
    237239/**
    238240 * @}
  • uspace/drv/uhci-hcd/uhci_hc.c

    r6298d80 rff34e5a  
    8282 * interrupt fibrils.
    8383 */
    84 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size)
     84int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun,
     85    void *regs, size_t reg_size, bool interrupts)
    8586{
    8687        assert(reg_size >= sizeof(regs_t));
     
    9596        } else (void) 0
    9697
     98        instance->hw_interrupts = interrupts;
    9799        /* Setup UHCI function. */
    98100        instance->ddf_instance = fun;
     
    113115
    114116        uhci_hc_init_hw(instance);
    115         instance->cleaner =
    116             fibril_create(uhci_hc_interrupt_emulator, instance);
    117         fibril_add_ready(instance->cleaner);
     117        if (!interrupts) {
     118                instance->cleaner =
     119                    fibril_create(uhci_hc_interrupt_emulator, instance);
     120                fibril_add_ready(instance->cleaner);
     121        }
    118122
    119123        instance->debug_checker = fibril_create(uhci_hc_debug_checker, instance);
     
    149153        pio_write_32(&registers->flbaseadd, pa);
    150154
    151         /* Enable all interrupts, but resume interrupt */
    152         pio_write_16(&instance->registers->usbintr,
    153             UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET);
     155        if (instance->hw_interrupts) {
     156                /* Enable all interrupts, but resume interrupt */
     157                pio_write_16(&instance->registers->usbintr,
     158                    UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET);
     159        }
    154160
    155161        uint16_t status = pio_read_16(&registers->usbcmd);
  • uspace/drv/uhci-hcd/uhci_hc.h

    r6298d80 rff34e5a  
    9999        fid_t cleaner;
    100100        fid_t debug_checker;
     101        bool hw_interrupts;
    101102
    102103        ddf_fun_t *ddf_instance;
    103104} uhci_hc_t;
    104105
    105 int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun, void *regs, size_t reg_size);
     106int uhci_hc_init(uhci_hc_t *instance, ddf_fun_t *fun,
     107    void *regs, size_t reg_size, bool interupts);
    106108
    107109int uhci_hc_schedule(uhci_hc_t *instance, batch_t *batch);
Note: See TracChangeset for help on using the changeset viewer.