Patchwork [2/2] usb: windup ich9_ehci_with_companion_init via -usb2 switch.

login
register
mail settings
Submitter Gerd Hoffmann
Date July 1, 2011, 11:27 a.m.
Message ID <1309519646-3206-3-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/102900/
State New
Headers show

Comments

Gerd Hoffmann - July 1, 2011, 11:27 a.m.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/pc_piix.c    |   14 ++++++++++----
 qemu-options.hx |   13 +++++++++++--
 vl.c            |    3 +++
 3 files changed, 24 insertions(+), 6 deletions(-)

Patch

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index c5c16b4..c9aed67 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -39,6 +39,7 @@ 
 #include "blockdev.h"
 #include "smbus.h"
 #include "xen.h"
+#include "usb.h"
 #ifdef CONFIG_XEN
 #  include <xen/hvm/hvm_info_table.h>
 #endif
@@ -134,6 +135,15 @@  static void pc_init1(ram_addr_t ram_size,
 
     pc_register_ferr_irq(isa_get_irq(13));
 
+    if (pci_enabled && usb_enabled) {
+        if (usb_enabled == 2) {
+            int slot = PCI_SLOT(piix3_devfn) + 1;
+            ich9_ehci_with_companion_init(pci_bus, PCI_DEVFN(slot, 0), "ehci");
+        } else {
+            usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
+        }
+    }
+
     pc_vga_init(pci_enabled? pci_bus: NULL);
 
     if (xen_enabled()) {
@@ -172,10 +182,6 @@  static void pc_init1(ram_addr_t ram_size,
     pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
                  idebus[0], idebus[1], rtc_state);
 
-    if (pci_enabled && usb_enabled) {
-        usb_uhci_piix3_init(pci_bus, piix3_devfn + 2);
-    }
-
     if (pci_enabled && acpi_enabled) {
         i2c_bus *smbus;
 
diff --git a/qemu-options.hx b/qemu-options.hx
index 37e54ee..c59b532 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -411,7 +411,7 @@  STEXI
 ETEXI
 
 DEF("usb", 0, QEMU_OPTION_usb,
-    "-usb            enable the USB driver (will be the default soon)\n",
+    "-usb            enable the USB 1.1 driver (will be the default soon)\n",
     QEMU_ARCH_ALL)
 STEXI
 USB options:
@@ -419,7 +419,16 @@  USB options:
 
 @item -usb
 @findex -usb
-Enable the USB driver (will be the default soon)
+Enable the USB 1.1 driver (will be the default soon)
+ETEXI
+
+DEF("usb2", 0, QEMU_OPTION_usb2,
+    "-usb2           enable the USB 2.0 driver\n",
+    QEMU_ARCH_ALL)
+STEXI
+@item -usb2
+@findex -usb2
+Enable the USB 2.0 driver
 ETEXI
 
 DEF("usbdevice", HAS_ARG, QEMU_OPTION_usbdevice,
diff --git a/vl.c b/vl.c
index 52402a2..f4f23ce 100644
--- a/vl.c
+++ b/vl.c
@@ -2698,6 +2698,9 @@  int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_usb:
                 usb_enabled = 1;
                 break;
+            case QEMU_OPTION_usb2:
+                usb_enabled = 2;
+                break;
             case QEMU_OPTION_usbdevice:
                 usb_enabled = 1;
                 add_device_config(DEV_USB, optarg);