Inventra MUSB-HDRC host-mode USB.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4232 c046a42c-6fe2-441c-8c8c-71466251a162
diff --git a/hw/nseries.c b/hw/nseries.c
index 31906c1..430b8f8 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -42,6 +42,7 @@
int keymap[0x80];
+ struct tusb_s *usb;
void *retu;
void *tahvo;
};
@@ -565,6 +566,29 @@
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 @@
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 */