Hi Gerd, Liming,

On Tue, Dec 4, 2012 at 6:15 PM, Gerd Hoffmann <kra...@redhat.com> wrote:
>   Hi,
>
>> Gerd,
>>
>> Is there any documentation out there on how to tell QEMU on command
>> line which EHCI you want your usb-storage to attach to?
>
> docs/usb2.txt has some examples, although those are pc-centric where the
> ehci is created on the command line.  The problem with zynx is that both
> ehci controllers get the same (default) name so picking one by name
> doesn't work.
>
> Guess we haver to figure a way to explicitly name those devices (so the
> busses are named too), especially in case a board has two identical
> ones.  Maybe sysbus_create_simple needs an additional argument or a
> sysbus_create_simple_with_id variant.
>

Ive taken a more manual approach and just used the manual
qdev_create() flow first to get up and running:

--- a/hw/xilinx_zynq.c
+++ b/hw/xilinx_zynq.c
@@ -162,12 +162,28 @@ static void zynq_init(QEMUMachineInitArgs *args)
         pic[n] = qdev_get_gpio_in(dev, n);
     }

+    dev = qdev_create(NULL, "xlnx.ps7-usb");
+    dev->id = "zynq-usb-0";
+    qdev_init_nofail(dev);
+    busdev = sysbus_from_qdev(dev);
+    sysbus_mmio_map(busdev, 0, 0xE0002000);
+    sysbus_connect_irq(busdev, 0, pic[53-IRQ_OFFSET]);
+
+    dev = qdev_create(NULL, "xlnx.ps7-usb");
+    dev->id = "zynq-usb-1";
+    busdev = sysbus_from_qdev(dev);
+    qdev_init_nofail(dev);
+    sysbus_mmio_map(busdev, 0, 0xE0003000);
+    sysbus_connect_irq(busdev, 0, pic[76-IRQ_OFFSET]);
+
     zynq_init_spi_flashes(0xE0006000, pic[58-IRQ_OFFSET], false);
     zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false);
     zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true);

+#if 0
     sysbus_create_simple("xlnx,ps7-usb", 0xE0002000, pic[53-IRQ_OFFSET]);
     sysbus_create_simple("xlnx,ps7-usb", 0xE0003000, pic[76-IRQ_OFFSET]);
+#endif

This works and gives the two USBs different names, and I can attach to
each on command lines using bus=zynq-usb-0.0 and bus=zynq-usb-0.1.

We can probably now think about a more palatable way to do this,
perhaps your sysbus_create_simple_id() approach.

Regards,
Peter

> cheers,
>   Gerd
>
>

Reply via email to