summary refs log tree commit diff stats
path: root/hw/nseries.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/nseries.c')
-rw-r--r--hw/nseries.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/hw/nseries.c b/hw/nseries.c
index 31906c1e82..430b8f872d 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -42,6 +42,7 @@ struct n800_s {
 
     int keymap[0x80];
 
+    struct tusb_s *usb;
     void *retu;
     void *tahvo;
 };
@@ -565,6 +566,29 @@ static void n800_cbus_setup(struct n800_s *s)
     cbus_attach(cbus, s->tahvo = tahvo_init(tahvo_irq, 1));
 }
 
+static void n800_usb_power_cb(void *opaque, int line, int level)
+{
+    struct n800_s *s = opaque;
+
+    tusb6010_power(s->usb, level);
+}
+
+static void n800_usb_setup(struct n800_s *s)
+{
+    qemu_irq tusb_irq = omap2_gpio_in_get(s->cpu->gpif, N8X0_TUSB_INT_GPIO)[0];
+    qemu_irq tusb_pwr = qemu_allocate_irqs(n800_usb_power_cb, s, 1)[0];
+    struct tusb_s *tusb = tusb6010_init(tusb_irq);
+
+    /* Using the NOR interface */
+    omap_gpmc_attach(s->cpu->gpmc, N8X0_USB_ASYNC_CS,
+                    tusb6010_async_io(tusb), 0, 0, tusb);
+    omap_gpmc_attach(s->cpu->gpmc, N8X0_USB_SYNC_CS,
+                    tusb6010_sync_io(tusb), 0, 0, tusb);
+
+    s->usb = tusb;
+    omap2_gpio_out_set(s->cpu->gpif, N800_TUSB_ENABLE_GPIO, tusb_pwr);
+}
+
 /* This task is normally performed by the bootloader.  If we're loading
  * a kernel directly, we need to set up GPMC mappings ourselves.  */
 static void n800_gpmc_init(struct n800_s *s)
@@ -891,6 +915,8 @@ static void n800_init(int ram_size, int vga_ram_size,
     n800_spi_setup(s);
     n800_dss_setup(s, ds);
     n800_cbus_setup(s);
+    if (usb_enabled)
+        n800_usb_setup(s);
 
     /* Setup initial (reset) machine state */