Changeset 5b89d43b in mainline


Ignore:
Timestamp:
2013-12-14T11:54:29Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f5ceb18
Parents:
3558ba93
Message:

Unbreak USB UHCI support.

  • Support PIO_WINDOW_DEV_IFACE in the uhci driver.
  • Do not base the UHCI RH resources on the address obtained from pio_enable_range().
  • Provide a restricted PIO window instead, based on the UHCI IO range. The UHCI RH resources are then relative to this window.
Location:
uspace/drv/bus/usb
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/res.c

    r3558ba93 r5b89d43b  
    6262        hw_res_list_parsed_t hw_res;
    6363        hw_res_list_parsed_init(&hw_res);
    64         const int ret =  hw_res_get_list_parsed(parent_sess, &hw_res, 0);
     64        const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
    6565        async_hangup(parent_sess);
    6666        if (ret != EOK) {
  • uspace/drv/bus/usb/uhci/root_hub.c

    r3558ba93 r5b89d43b  
    3636#include <str_error.h>
    3737#include <stdio.h>
     38#include <device/hw_res_parsed.h>
    3839
    3940#include <usb/debug.h>
     
    4849 * @return Error code.
    4950 */
    50 int rh_init(rh_t *instance, ddf_fun_t *fun, uintptr_t reg_addr, size_t reg_size)
     51int
     52rh_init(rh_t *instance, ddf_fun_t *fun, addr_range_t *regs, uintptr_t reg_addr,
     53    size_t reg_size)
    5154{
    5255        assert(instance);
    5356        assert(fun);
     57
     58        /* Crop the PIO window to the absolute address range of UHCI I/O. */
     59        instance->pio_window.mem.base = 0;
     60        instance->pio_window.mem.size = 0;
     61        instance->pio_window.io.base = RNGABS(*regs);
     62        instance->pio_window.io.size = RNGSZ(*regs);
    5463
    5564        /* Initialize resource structure */
     
    6069        instance->io_regs.res.io_range.address = reg_addr;
    6170        instance->io_regs.res.io_range.size = reg_size;
     71        instance->io_regs.res.io_range.relative = true;
    6272        instance->io_regs.res.io_range.endianness = LITTLE_ENDIAN;
    6373
  • uspace/drv/bus/usb/uhci/root_hub.h

    r3558ba93 r5b89d43b  
    3838#include <ddf/driver.h>
    3939#include <ops/hw_res.h>
     40#include <ops/pio_window.h>
    4041
    4142/** DDF support structure for uhci_rhd driver, provides I/O resources */
     
    4546        /** The only resource in the RH resource list */
    4647        hw_resource_t io_regs;
     48        /** PIO window in which the RH will operate. */
     49        pio_window_t pio_window;       
    4750} rh_t;
    4851
    49 int rh_init(
    50     rh_t *instance, ddf_fun_t *fun, uintptr_t reg_addr, size_t reg_size);
     52extern int rh_init(rh_t *, ddf_fun_t *, addr_range_t *, uintptr_t, size_t);
    5153
    5254#endif
  • uspace/drv/bus/usb/uhci/uhci.c

    r3558ba93 r5b89d43b  
    132132};
    133133
     134static pio_window_t *get_pio_window(ddf_fun_t *fun)
     135{
     136        rh_t *rh = ddf_fun_data_get(fun);
     137       
     138        if (rh == NULL)
     139                return NULL;
     140        return &rh->pio_window;
     141}
     142
     143static pio_window_ops_t pio_window_iface = {
     144        .get_pio_window = get_pio_window
     145};
     146
    134147/** RH function support for uhci_rhd */
    135148static ddf_dev_ops_t rh_ops = {
    136149        .interfaces[USB_DEV_IFACE] = &usb_iface,
    137         .interfaces[HW_RES_DEV_IFACE] = &hw_res_iface
     150        .interfaces[HW_RES_DEV_IFACE] = &hw_res_iface,
     151        .interfaces[PIO_WINDOW_DEV_IFACE] = &pio_window_iface
    138152};
    139153
     
    246260        }
    247261
    248         rc = rh_init(&instance->rh, instance->rh_fun,
    249             (uintptr_t)instance->hc.registers + 0x10, 4);
     262        rc = rh_init(&instance->rh, instance->rh_fun, &regs, 0x10, 4);
    250263        if (rc != EOK) {
    251264                usb_log_error("Failed to setup UHCI root hub: %s.\n",
  • uspace/drv/bus/usb/uhcirh/main.c

    r3558ba93 r5b89d43b  
    138138        hw_res_list_parsed_t hw_res;
    139139        hw_res_list_parsed_init(&hw_res);
    140         const int ret =  hw_res_get_list_parsed(parent_sess, &hw_res, 0);
     140        const int ret = hw_res_get_list_parsed(parent_sess, &hw_res, 0);
    141141        async_hangup(parent_sess);
    142142        if (ret != EOK) {
Note: See TracChangeset for help on using the changeset viewer.