hw/char/xilinx_uartlite: Open-code xilinx_uartlite_create()
Open-code the single use of xilinx_uartlite_create(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20230220115114.25237-6-philmd@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
3440a4a93a
commit
dc1daf392c
@ -100,8 +100,11 @@ petalogix_s3adsp1800_init(MachineState *machine)
|
|||||||
irq[i] = qdev_get_gpio_in(dev, i);
|
irq[i] = qdev_get_gpio_in(dev, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
xilinx_uartlite_create(UARTLITE_BASEADDR, irq[UARTLITE_IRQ],
|
dev = qdev_new(TYPE_XILINX_UARTLITE);
|
||||||
serial_hd(0));
|
qdev_prop_set_chr(dev, "chardev", serial_hd(0));
|
||||||
|
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
|
||||||
|
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, UARTLITE_BASEADDR);
|
||||||
|
sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, irq[UARTLITE_IRQ]);
|
||||||
|
|
||||||
/* 2 timers at irq 2 @ 62 Mhz. */
|
/* 2 timers at irq 2 @ 62 Mhz. */
|
||||||
dev = qdev_new("xlnx.xps-timer");
|
dev = qdev_new("xlnx.xps-timer");
|
||||||
|
@ -15,29 +15,9 @@
|
|||||||
#ifndef XILINX_UARTLITE_H
|
#ifndef XILINX_UARTLITE_H
|
||||||
#define XILINX_UARTLITE_H
|
#define XILINX_UARTLITE_H
|
||||||
|
|
||||||
#include "hw/qdev-properties.h"
|
|
||||||
#include "hw/sysbus.h"
|
|
||||||
#include "qapi/error.h"
|
|
||||||
#include "qom/object.h"
|
#include "qom/object.h"
|
||||||
|
|
||||||
#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
|
#define TYPE_XILINX_UARTLITE "xlnx.xps-uartlite"
|
||||||
OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
|
OBJECT_DECLARE_SIMPLE_TYPE(XilinxUARTLite, XILINX_UARTLITE)
|
||||||
|
|
||||||
static inline DeviceState *xilinx_uartlite_create(hwaddr addr,
|
|
||||||
qemu_irq irq,
|
|
||||||
Chardev *chr)
|
|
||||||
{
|
|
||||||
DeviceState *dev;
|
|
||||||
SysBusDevice *s;
|
|
||||||
|
|
||||||
dev = qdev_new(TYPE_XILINX_UARTLITE);
|
|
||||||
s = SYS_BUS_DEVICE(dev);
|
|
||||||
qdev_prop_set_chr(dev, "chardev", chr);
|
|
||||||
sysbus_realize_and_unref(s, &error_fatal);
|
|
||||||
sysbus_mmio_map(s, 0, addr);
|
|
||||||
sysbus_connect_irq(s, 0, irq);
|
|
||||||
|
|
||||||
return dev;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user