Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/hc.c

    r741bcdeb r8d2dd7f2  
    8989};
    9090
     91static void hc_start(hc_t *instance);
    9192static int hc_init_memory(hc_t *instance);
    9293
     
    9798 * @return Error code.
    9899 */
    99 int ehci_hc_gen_irq_code(irq_code_t *code, hcd_t *hcd, const hw_res_list_parsed_t *hw_res)
     100int ehci_hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res)
    100101{
    101102        assert(code);
    102103        assert(hw_res);
    103 
    104         hc_t *instance = hcd_get_driver_data(hcd);
    105104
    106105        if (hw_res->irqs.count != 1 || hw_res->mem_ranges.count != 1)
     
    129128
    130129        memcpy(code->cmds, ehci_irq_commands, sizeof(ehci_irq_commands));
     130        ehci_caps_regs_t *caps = NULL;
     131
     132        int ret = pio_enable_range(&regs, (void**)&caps);
     133        if (ret != EOK) {
     134                free(code->ranges);
     135                free(code->cmds);
     136                return ret;
     137        }
    131138
    132139        ehci_regs_t *registers =
    133                 (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(instance->caps->caplength));
     140            (ehci_regs_t *)(RNGABSPTR(regs) + EHCI_RD8(caps->caplength));
    134141        code->cmds[0].addr = (void *) &registers->usbsts;
    135142        code->cmds[3].addr = (void *) &registers->usbsts;
     
    149156 * @return Error code
    150157 */
    151 int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res)
     158int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
    152159{
    153160        assert(instance);
     
    165172                return ret;
    166173        }
    167 
    168174        usb_log_info("HC(%p): Device registers at %"PRIx64" (%zuB) accessible.",
    169175            instance, hw_res->mem_ranges.ranges[0].address.absolute,
     
    189195        ehci_rh_init(
    190196            &instance->rh, instance->caps, instance->registers, "ehci rh");
    191 
    192         ehci_bus_init(&instance->bus, instance);
     197        usb_log_debug("HC(%p): Starting HW.", instance);
     198        hc_start(instance);
     199
    193200        return EOK;
    194201}
     
    215222        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    216223        usb_log_debug("HC(%p) enqueue EP(%d:%d:%s:%s)\n", instance,
    217             ep->target.address, ep->target.endpoint,
     224            ep->address, ep->endpoint,
    218225            usb_str_transfer_type_short(ep->transfer_type),
    219226            usb_str_direction(ep->direction));
     
    239246        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    240247        usb_log_debug("HC(%p) dequeue EP(%d:%d:%s:%s)\n", instance,
    241             ep->target.address, ep->target.endpoint,
     248            ep->address, ep->endpoint,
    242249            usb_str_transfer_type_short(ep->transfer_type),
    243250            usb_str_direction(ep->direction));
     
    291298
    292299        /* Check for root hub communication */
    293         if (batch->ep->target.address == ehci_rh_get_address(&instance->rh)) {
     300        if (batch->ep->address == ehci_rh_get_address(&instance->rh)) {
    294301                usb_log_debug("HC(%p): Scheduling BATCH(%p) for RH(%p)",
    295302                    instance, batch, &instance->rh);
     
    361368 * @param[in] instance EHCI hc driver structure.
    362369 */
    363 int hc_start(hc_t *instance, bool interrupts)
    364 {
    365         assert(instance);
    366         usb_log_debug("HC(%p): Starting HW.", instance);
    367 
     370void hc_start(hc_t *instance)
     371{
     372        assert(instance);
    368373        /* Turn off the HC if it's running, Reseting a running device is
    369374         * undefined */
     
    430435        EHCI_WR(instance->registers->usbsts, EHCI_RD(instance->registers->usbsts));
    431436        EHCI_WR(instance->registers->usbintr, EHCI_USED_INTERRUPTS);
    432 
    433         return EOK;
    434437}
    435438
Note: See TracChangeset for help on using the changeset viewer.