Skip to content

Commit

Permalink
char: xilinx_uartlite: Don't reset from init
Browse files Browse the repository at this point in the history
This refresh of the device state is intended to be a reset side
effect. Move it to a proper reset handler rather than do it at
init time.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
  • Loading branch information
pete128 authored and edgarigl committed Jun 8, 2014
1 parent e8198f6 commit 95faaa7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hw/char/xilinx_uartlite.c
Expand Up @@ -87,6 +87,11 @@ static void uart_update_status(XilinxUARTLite *s)
s->regs[R_STATUS] = r;
}

static void xilinx_uartlite_reset(DeviceState *dev)
{
uart_update_status(XILINX_UARTLITE(dev));
}

static uint64_t
uart_read(void *opaque, hwaddr addr, unsigned int size)
{
Expand Down Expand Up @@ -202,7 +207,6 @@ static int xilinx_uartlite_init(SysBusDevice *dev)

sysbus_init_irq(dev, &s->irq);

uart_update_status(s);
memory_region_init_io(&s->mmio, OBJECT(s), &uart_ops, s,
"xlnx.xps-uartlite", R_MAX * 4);
sysbus_init_mmio(dev, &s->mmio);
Expand All @@ -216,8 +220,10 @@ static int xilinx_uartlite_init(SysBusDevice *dev)
static void xilinx_uartlite_class_init(ObjectClass *klass, void *data)
{
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
DeviceClass *dc = DEVICE_CLASS(klass);

sdc->init = xilinx_uartlite_init;
dc->reset = xilinx_uartlite_reset;
}

static const TypeInfo xilinx_uartlite_info = {
Expand Down

0 comments on commit 95faaa7

Please sign in to comment.