Changes in / [02804e1:df0bbe1] in mainline


Ignore:
Location:
uspace
Files:
3 added
2 deleted
5 edited

Legend:

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

    r02804e1 rdf0bbe1  
    4949static int interrupt_emulator(hc_t *instance);
    5050static void hc_gain_control(hc_t *instance);
     51static void hc_init_hw(hc_t *instance);
    5152static int hc_init_transfer_lists(hc_t *instance);
    5253static int hc_init_memory(hc_t *instance);
     
    9192                usb_log_error("Failed add root hub match-id.\n");
    9293        }
    93         ret = ddf_fun_bind(hub_fun);
    9494        return ret;
    9595}
     
    111111            ret, str_error(ret));
    112112
    113         list_initialize(&instance->pending_batches);
    114113        usb_device_keeper_init(&instance->manager);
    115114        ret = usb_endpoint_manager_init(&instance->ep_manager,
     
    118117            str_error(ret));
    119118
     119        hc_gain_control(instance);
    120120        ret = hc_init_memory(instance);
    121121        CHECK_RET_RETURN(ret, "Failed to create OHCI memory structures: %s.\n",
    122122            str_error(ret));
    123 #undef CHECK_RET_RETURN
    124 
    125 
    126 //      hc_init_hw(instance);
    127         hc_gain_control(instance);
     123        hc_init_hw(instance);
    128124        fibril_mutex_initialize(&instance->guard);
    129125
     
    136132        }
    137133
     134        list_initialize(&instance->pending_batches);
     135#undef CHECK_RET_RETURN
    138136        return EOK;
    139137}
     
    289287{
    290288        assert(instance);
    291         usb_log_debug("OHCI(%p) interrupt: %x.\n", instance, status);
     289        usb_log_debug("OHCI interrupt: %x.\n", status);
    292290        if ((status & ~I_SF) == 0) /* ignore sof status */
    293291                return;
     
    341339            (uint32_t*)((char*)instance->registers + 0x100);
    342340        usb_log_debug("OHCI legacy register %p: %x.\n",
    343             ohci_emulation_reg, *ohci_emulation_reg);
    344         /* Do not change A20 state */
    345         *ohci_emulation_reg &= 0x100;
    346         usb_log_debug("OHCI legacy register %p: %x.\n",
    347             ohci_emulation_reg, *ohci_emulation_reg);
     341                ohci_emulation_reg, *ohci_emulation_reg);
     342        *ohci_emulation_reg &= ~0x1;
    348343
    349344        /* Interrupt routing enabled => smm driver is active */
     
    355350                }
    356351                usb_log_info("SMM driver: Ownership taken.\n");
    357                 instance->registers->control &= (C_HCFS_RESET << C_HCFS_SHIFT);
    358                 async_usleep(50000);
    359352                return;
    360353        }
     
    382375}
    383376/*----------------------------------------------------------------------------*/
    384 void hc_start_hw(hc_t *instance)
     377void hc_init_hw(hc_t *instance)
    385378{
    386379        /* OHCI guide page 42 */
     
    481474{
    482475        assert(instance);
    483 
    484         bzero(&instance->rh, sizeof(instance->rh));
    485476        /* Init queues */
    486477        hc_init_transfer_lists(instance);
  • uspace/drv/ohci/hc.h

    r02804e1 rdf0bbe1  
    8080     uintptr_t regs, size_t reg_size, bool interrupts);
    8181
    82 void hc_start_hw(hc_t *instance);
    83 
    8482/** Safely dispose host controller internal structures
    8583 *
  • uspace/drv/ohci/main.c

    r02804e1 rdf0bbe1  
    7575                return ret;
    7676        }
    77 //      device->driver_data = ohci;
    78         hc_register_hub(&ohci->hc, ohci->rh_fun);
     77        device->driver_data = ohci;
    7978
    8079        usb_log_info("Controlling new OHCI device `%s'.\n", device->name);
     
    9493{
    9594        usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
     95        sleep(5);
    9696        return ddf_driver_main(&ohci_driver);
    9797}
  • uspace/drv/ohci/ohci.c

    r02804e1 rdf0bbe1  
    5454{
    5555        assert(dev);
    56         assert(dev->driver_data);
    5756        hc_t *hc = &((ohci_t*)dev->driver_data)->hc;
    5857        uint16_t status = IPC_GET_ARG1(*call);
     
    153152        usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n",
    154153            (void *) mem_reg_base, mem_reg_size, irq);
     154
     155        ret = pci_disable_legacy(device);
     156        CHECK_RET_DEST_FUN_RETURN(ret,
     157            "Failed(%d) to disable legacy USB: %s.\n", ret, str_error(ret));
    155158
    156159        bool interrupts = false;
     
    213216            "Failed(%d) to create root hub function.\n", ret);
    214217
     218        hc_register_hub(&instance->hc, instance->rh_fun);
    215219
    216220        instance->rh_fun->ops = &rh_ops;
    217221        instance->rh_fun->driver_data = NULL;
    218        
    219         device->driver_data = instance;
    220 
    221         hc_start_hw(&instance->hc);
     222        ret = ddf_fun_bind(instance->rh_fun);
     223        CHECK_RET_FINI_RETURN(ret,
     224            "Failed(%d) to register OHCI root hub.\n", ret);
     225
    222226        return EOK;
    223227#undef CHECK_RET_FINI_RETURN
  • uspace/drv/ohci/pci.c

    r02804e1 rdf0bbe1  
    136136        return enabled ? EOK : EIO;
    137137}
     138/*----------------------------------------------------------------------------*/
     139/** Implements BIOS handoff routine as decribed in OHCI spec
     140 *
     141 * @param[in] device Device asking for interrupts
     142 * @return Error code.
     143 */
     144int pci_disable_legacy(ddf_dev_t *device)
     145{
     146        /* TODO: implement */
     147        return EOK;
     148}
     149/*----------------------------------------------------------------------------*/
    138150/**
    139151 * @}
Note: See TracChangeset for help on using the changeset viewer.