Changeset 7813516 in mainline for uspace/drv/bus/usb/ehci


Ignore:
Timestamp:
2014-01-01T01:19:10Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7191992
Parents:
d1df381
Message:

uhci,ohci,ehci: Use all hw resources to initialize HC

Location:
uspace/drv/bus/usb/ehci
Files:
3 edited

Legend:

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

    rd1df381 r7813516  
    9494                return ret;
    9595        }
    96         addr_range_t regs = hw_res.mem_ranges.ranges[0];
    9796
    9897        /* Initialize generic HCD driver */
     
    127126
    128127        /* Initialize EHCI HC */
    129         ret = hc_init(hc, &regs, interrupts);
     128        ret = hc_init(hc, &hw_res, interrupts);
    130129        hw_res_list_parsed_clean(&hw_res);
    131130        if (ret != EOK) {
  • uspace/drv/bus/usb/ehci/hc.c

    rd1df381 r7813516  
    157157 * @return Error code
    158158 */
    159 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts)
    160 {
    161         assert(instance);
    162 
    163         int ret = pio_enable_range(regs, (void **) &instance->caps);
     159int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     160{
     161        assert(instance);
     162        assert(hw_res);
     163        if (hw_res->mem_ranges.count != 1 ||
     164            hw_res->mem_ranges.ranges[0].size <
     165                (sizeof(ehci_caps_regs_t) + sizeof(ehci_regs_t)))
     166            return EINVAL;
     167
     168        int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
     169            (void **)&instance->caps);
    164170        if (ret != EOK) {
    165171                usb_log_error("Failed to gain access to device registers: %s.\n",
     
    167173                return ret;
    168174        }
     175        usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.\n",
     176            hw_res->mem_ranges.ranges[0].address.absolute,
     177            hw_res->mem_ranges.ranges[0].size);
    169178        instance->registers =
    170179            (void*)instance->caps + EHCI_RD8(instance->caps->caplength);
     
    194203        return EOK;
    195204}
     205
     206/** Safely dispose host controller internal structures
     207 *
     208 * @param[in] instance Host controller structure to use.
     209 */
     210void hc_fini(hc_t *instance)
     211{
     212        assert(instance);
     213        /* TODO: implement*/
     214};
    196215
    197216void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
  • uspace/drv/bus/usb/ehci/hc.h

    rd1df381 r7813516  
    7676int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res);
    7777int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun);
    78 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts);
    79 
    80 /** Safely dispose host controller internal structures
    81  *
    82  * @param[in] instance Host controller structure to use.
    83  */
    84 static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ };
     78int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);
     79void hc_fini(hc_t *instance);
    8580
    8681void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep);
Note: See TracChangeset for help on using the changeset viewer.