diff options
Diffstat (limited to 'hw/omap1.c')
-rw-r--r-- | hw/omap1.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -1983,6 +1983,8 @@ struct omap_uart_s { SerialState *serial; /* TODO */ struct omap_target_agent_s *ta; target_phys_addr_t base; + omap_clk fclk; + qemu_irq irq; uint8_t eblr; uint8_t syscontrol; @@ -2007,6 +2009,9 @@ struct omap_uart_s *omap_uart_init(target_phys_addr_t base, struct omap_uart_s *s = (struct omap_uart_s *) qemu_mallocz(sizeof(struct omap_uart_s)); + s->base = base; + s->fclk = fclk; + s->irq = irq; s->serial = serial_mm_init(base, 2, irq, omap_clk_getrate(fclk)/16, chr ?: qemu_chr_open("null"), 1); @@ -2108,13 +2113,20 @@ struct omap_uart_s *omap2_uart_init(struct omap_target_agent_s *ta, omap_uart_writefn, s); s->ta = ta; - s->base = base; cpu_register_physical_memory(s->base + 0x20, 0x100, iomemtype); return s; } +void omap_uart_attach(struct omap_uart_s *s, CharDriverState *chr) +{ + /* TODO: Should reuse or destroy current s->serial */ + s->serial = serial_mm_init(s->base, 2, s->irq, + omap_clk_getrate(s->fclk) / 16, + chr ?: qemu_chr_open("null"), 1); +} + /* MPU Clock/Reset/Power Mode Control */ static uint32_t omap_clkm_read(void *opaque, target_phys_addr_t addr) { |