return 0;
}
-int
-ohci_init(struct usb_s *cntl)
+void
+ohci_init(void *data)
{
if (! CONFIG_USB_OHCI)
- return 0;
+ return;
+ struct usb_s *cntl = data;
+ // XXX - don't call pci_config_XXX from a thread
cntl->type = USB_TYPE_OHCI;
u32 baseaddr = pci_config_readl(cntl->bdf, PCI_BASE_ADDRESS_0);
cntl->ohci.regs = (void*)(baseaddr & PCI_BASE_ADDRESS_MEM_MASK);
struct ohci_ed *control_ed = malloc_high(sizeof(*control_ed));
if (!hcca || !control_ed) {
dprintf(1, "No ram for ohci init\n");
- return 0;
+ return;
}
memset(hcca, 0, sizeof(*hcca));
memset(control_ed, 0, sizeof(*control_ed));
int count = check_ohci_ports(cntl);
if (! count)
goto err;
- return count;
+ return;
err:
stop_ohci(cntl);
free(hcca);
free(control_ed);
- return 0;
}
static int
dprintf(1, "Timeout on wait_ed %p\n", ed);
return -1;
}
- cpu_relax();
+ yield();
}
}
int ret = wait_ed(ed);
ed->hwINFO = ED_SKIP;
- usleep(1); // XXX - in case controller still accessing tds
+ if (ret)
+ usleep(1); // XXX - in case controller still accessing tds
free(tds);
return ret;
}