Skip to content

Commit

Permalink
Inventra MUSB-HDRC host-mode USB.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4232 c046a42c-6fe2-441c-8c8c-71466251a162
  • Loading branch information
balrog committed Apr 22, 2008
1 parent a050e24 commit 942ac05
Show file tree
Hide file tree
Showing 6 changed files with 2,280 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.target
Expand Up @@ -612,7 +612,7 @@ OBJS+= spitz.o ide.o serial.o nand.o ecc.o
OBJS+= omap1.o omap_lcdc.o omap_dma.o omap_clk.o omap_mmc.o omap_i2c.o
OBJS+= omap2.o omap_dss.o
OBJS+= palm.o tsc210x.o
OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o
OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
OBJS+= mst_fpga.o mainstone.o
CPPFLAGS += -DHAS_AUDIO
endif
Expand Down
7 changes: 7 additions & 0 deletions hw/devices.h
Expand Up @@ -52,4 +52,11 @@ void *tahvo_init(qemu_irq irq, int betty);

void retu_key_event(void *retu, int state);

/* tusb6010.c */
struct tusb_s;
struct tusb_s *tusb6010_init(qemu_irq intr);
int tusb6010_sync_io(struct tusb_s *s);
int tusb6010_async_io(struct tusb_s *s);
void tusb6010_power(struct tusb_s *s, int on);

#endif
26 changes: 26 additions & 0 deletions hw/nseries.c
Expand Up @@ -42,6 +42,7 @@ struct n800_s {

int keymap[0x80];

struct tusb_s *usb;
void *retu;
void *tahvo;
};
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 */

Expand Down

0 comments on commit 942ac05

Please sign in to comment.