Changes in / [df0bbe1:02804e1] in mainline
- Location:
- uspace
- Files:
-
- 2 added
- 3 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hc.c
rdf0bbe1 r02804e1 49 49 static int interrupt_emulator(hc_t *instance); 50 50 static void hc_gain_control(hc_t *instance); 51 static void hc_init_hw(hc_t *instance);52 51 static int hc_init_transfer_lists(hc_t *instance); 53 52 static int hc_init_memory(hc_t *instance); … … 92 91 usb_log_error("Failed add root hub match-id.\n"); 93 92 } 93 ret = ddf_fun_bind(hub_fun); 94 94 return ret; 95 95 } … … 111 111 ret, str_error(ret)); 112 112 113 list_initialize(&instance->pending_batches); 113 114 usb_device_keeper_init(&instance->manager); 114 115 ret = usb_endpoint_manager_init(&instance->ep_manager, … … 117 118 str_error(ret)); 118 119 119 hc_gain_control(instance);120 120 ret = hc_init_memory(instance); 121 121 CHECK_RET_RETURN(ret, "Failed to create OHCI memory structures: %s.\n", 122 122 str_error(ret)); 123 hc_init_hw(instance); 123 #undef CHECK_RET_RETURN 124 125 126 // hc_init_hw(instance); 127 hc_gain_control(instance); 124 128 fibril_mutex_initialize(&instance->guard); 125 129 … … 132 136 } 133 137 134 list_initialize(&instance->pending_batches);135 #undef CHECK_RET_RETURN136 138 return EOK; 137 139 } … … 287 289 { 288 290 assert(instance); 289 usb_log_debug("OHCI interrupt: %x.\n", status);291 usb_log_debug("OHCI(%p) interrupt: %x.\n", instance, status); 290 292 if ((status & ~I_SF) == 0) /* ignore sof status */ 291 293 return; … … 339 341 (uint32_t*)((char*)instance->registers + 0x100); 340 342 usb_log_debug("OHCI legacy register %p: %x.\n", 341 ohci_emulation_reg, *ohci_emulation_reg); 342 *ohci_emulation_reg &= ~0x1; 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); 343 348 344 349 /* Interrupt routing enabled => smm driver is active */ … … 350 355 } 351 356 usb_log_info("SMM driver: Ownership taken.\n"); 357 instance->registers->control &= (C_HCFS_RESET << C_HCFS_SHIFT); 358 async_usleep(50000); 352 359 return; 353 360 } … … 375 382 } 376 383 /*----------------------------------------------------------------------------*/ 377 void hc_ init_hw(hc_t *instance)384 void hc_start_hw(hc_t *instance) 378 385 { 379 386 /* OHCI guide page 42 */ … … 474 481 { 475 482 assert(instance); 483 484 bzero(&instance->rh, sizeof(instance->rh)); 476 485 /* Init queues */ 477 486 hc_init_transfer_lists(instance); -
uspace/drv/ohci/hc.h
rdf0bbe1 r02804e1 80 80 uintptr_t regs, size_t reg_size, bool interrupts); 81 81 82 void hc_start_hw(hc_t *instance); 83 82 84 /** Safely dispose host controller internal structures 83 85 * -
uspace/drv/ohci/main.c
rdf0bbe1 r02804e1 75 75 return ret; 76 76 } 77 device->driver_data = ohci; 77 // device->driver_data = ohci; 78 hc_register_hub(&ohci->hc, ohci->rh_fun); 78 79 79 80 usb_log_info("Controlling new OHCI device `%s'.\n", device->name); … … 93 94 { 94 95 usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME); 95 sleep(5);96 96 return ddf_driver_main(&ohci_driver); 97 97 } -
uspace/drv/ohci/ohci.c
rdf0bbe1 r02804e1 54 54 { 55 55 assert(dev); 56 assert(dev->driver_data); 56 57 hc_t *hc = &((ohci_t*)dev->driver_data)->hc; 57 58 uint16_t status = IPC_GET_ARG1(*call); … … 152 153 usb_log_debug("Memory mapped regs at %p (size %zu), IRQ %d.\n", 153 154 (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));158 155 159 156 bool interrupts = false; … … 216 213 "Failed(%d) to create root hub function.\n", ret); 217 214 218 hc_register_hub(&instance->hc, instance->rh_fun);219 215 220 216 instance->rh_fun->ops = &rh_ops; 221 217 instance->rh_fun->driver_data = NULL; 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 218 219 device->driver_data = instance; 220 221 hc_start_hw(&instance->hc); 226 222 return EOK; 227 223 #undef CHECK_RET_FINI_RETURN -
uspace/drv/ohci/pci.c
rdf0bbe1 r02804e1 136 136 return enabled ? EOK : EIO; 137 137 } 138 /*----------------------------------------------------------------------------*/139 /** Implements BIOS handoff routine as decribed in OHCI spec140 *141 * @param[in] device Device asking for interrupts142 * @return Error code.143 */144 int pci_disable_legacy(ddf_dev_t *device)145 {146 /* TODO: implement */147 return EOK;148 }149 /*----------------------------------------------------------------------------*/150 138 /** 151 139 * @}
Note:
See TracChangeset
for help on using the changeset viewer.