On Thu, Dec 13, 2012 at 12:25 PM, Gerd Hoffmann <kra...@redhat.com> wrote:
> On 12/13/12 11:38, M P wrote: > > In the i.MX23 emulation, there is a EHCI sysbus device which is supported > > and seems to work well already (using -usbdevice host:...) > > > > However most of the other peripherals (serial, hub, net) fail do to a > > 'speed mismatch' error. I looked into a bit more details, and it seems > the > > EHCI has to be complimented to support lower speed peripherals. > > > > However, none of the attempts I made at 'complimenting' my ehci instance > > with ohci seems to work, and grepping doesn't shows any other device > using > > this. > > > > How is this supposed to work ? > > See docs/ich9-ehci-uhci.cfg how that works in the x86 world. Using ohci > instead of uhci works too. You need a single ohci controller only when > setting the num-ports property to 6. > > Doing the same on sysbus needs some coding work to add masterbus + > firstport properties and to wind up initialization accordingly. > > HTH, > Gerd > I added the properties (see patch lower down) and I Use the following to create a companion ohci, however qemu starts, seems to let me attach lower speed devices, but linux reports: "hub 1-0:1.0: Cannot enable port 1. Maybe the USB cable is bad" I have to say I'm not sure where that comes from -- so I need some sort of kernel support for companion ports perhaps? + DeviceState * d = qdev_create(NULL, "sysbus-ohci"); + qdev_prop_set_string(d, "masterbus", u->bus.qbus.name); + qdev_prop_set_uint32(d, "firstport", 0); + qdev_prop_set_uint32(d, "num-ports", 6); + qdev_init_nofail(d); -- patch bellow to hcd-ohci.c appears straigthforward enough @@ -1849,7 +1849,9 @@ static int usb_ohci_initfn_pci(struct PCIDevice *dev) typedef struct { SysBusDevice busdev; OHCIState ohci; + char *masterbus; uint32_t num_ports; + uint32_t firstport; dma_addr_t dma_offset; } OHCISysBusState; @@ -1858,8 +1860,9 @@ static int ohci_init_pxa(SysBusDevice *dev) OHCISysBusState *s = FROM_SYSBUS(OHCISysBusState, dev); /* Cannot fail as we pass NULL for masterbus */ - usb_ohci_init(&s->ohci, &dev->qdev, s->num_ports, s->dma_offset, NULL, 0, - &dma_context_memory); + usb_ohci_init(&s->ohci, &dev->qdev, s->num_ports, s->dma_offset, + s->masterbus, s->firstport, + &dma_context_memory); sysbus_init_irq(dev, &s->ohci.irq); sysbus_init_mmio(dev, &s->ohci.mem); @@ -1897,6 +1900,8 @@ static TypeInfo ohci_pci_info = { static Property ohci_sysbus_properties[] = { DEFINE_PROP_UINT32("num-ports", OHCISysBusState, num_ports, 3), DEFINE_PROP_DMAADDR("dma-offset", OHCISysBusState, dma_offset, 3), + DEFINE_PROP_STRING("masterbus", OHCISysBusState, masterbus), + DEFINE_PROP_UINT32("firstport", OHCISysBusState, firstport, 0), DEFINE_PROP_END_OF_LIST(), };