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


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/ohci
Files:
3 edited

Legend:

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

    rd1df381 r7813516  
    148148 *
    149149 * @param[in] instance Memory place for the structure.
    150  * @param[in] regs Device's I/O registers range.
     150 * @param[in] regs Device's resources
    151151 * @param[in] interrupts True if w interrupts should be used
    152152 * @return Error code
    153153 */
    154 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts)
    155 {
    156         assert(instance);
    157 
    158         int ret = pio_enable_range(regs, (void **) &instance->registers);
     154int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts)
     155{
     156        assert(instance);
     157        assert(hw_res);
     158        if (hw_res->mem_ranges.count != 1 ||
     159            hw_res->mem_ranges.ranges[0].size < sizeof(ohci_regs_t))
     160            return EINVAL;
     161
     162        int ret = pio_enable_range(&hw_res->mem_ranges.ranges[0],
     163            (void **) &instance->registers);
    159164        if (ret != EOK) {
    160                 usb_log_error("Failed to gain access to device registers: %s.\n",
     165                usb_log_error("Failed to gain access to registers: %s.\n",
    161166                    str_error(ret));
    162167                return ret;
    163168        }
     169        usb_log_debug("Device registers at %" PRIx64 " (%zuB) accessible.\n",
     170            hw_res->mem_ranges.ranges[0].address.absolute,
     171            hw_res->mem_ranges.ranges[0].size);
    164172
    165173        list_initialize(&instance->pending_batches);
     
    186194        return EOK;
    187195}
     196
     197/** Safely dispose host controller internal structures
     198 *
     199 * @param[in] instance Host controller structure to use.
     200 */
     201void hc_fini(hc_t *instance)
     202{
     203        assert(instance);
     204        /* TODO: implement*/
     205};
    188206
    189207void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
  • uspace/drv/bus/usb/ohci/hc.h

    rd1df381 r7813516  
    7777int hc_gen_irq_code(irq_code_t *code, const hw_res_list_parsed_t *hw_res);
    7878int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun);
    79 int hc_init(hc_t *instance, addr_range_t *regs, bool interrupts);
    80 
    81 /** Safely dispose host controller internal structures
    82  *
    83  * @param[in] instance Host controller structure to use.
    84  */
    85 static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ };
     79int hc_init(hc_t *instance, const hw_res_list_parsed_t *hw_res, bool interrupts);
     80void hc_fini(hc_t *instance);
    8681
    8782void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep);
  • uspace/drv/bus/usb/ohci/ohci.c

    rd1df381 r7813516  
    8787        hw_res_list_parsed_t hw_res;
    8888        int ret = hcd_ddf_get_registers(device, &hw_res);
    89         if (ret != EOK ||
    90             hw_res.irqs.count != 1 || hw_res.mem_ranges.count != 1) {
     89        if (ret != EOK) {
    9190                usb_log_error("Failed to get register memory addresses "
    9291                    "for %" PRIun ": %s.\n", ddf_dev_get_handle(device),
     
    9493                return ret;
    9594        }
    96         addr_range_t regs = hw_res.mem_ranges.ranges[0];
    9795
    9896        /* Initialize generic HCD driver */
     
    127125
    128126        /* Initialize OHCI HC */
    129         ret = hc_init(hc, &regs, interrupts);
     127        ret = hc_init(hc, &hw_res, interrupts);
    130128        hw_res_list_parsed_clean(&hw_res);
    131129        if (ret != EOK) {
Note: See TracChangeset for help on using the changeset viewer.