qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-arm] [PATCH v3 28/30] i.MX: Add code to emulate i.MX LCD block


From: Andrey Smirnov
Subject: [Qemu-arm] [PATCH v3 28/30] i.MX: Add code to emulate i.MX LCD block
Date: Mon, 6 Nov 2017 07:48:11 -0800

Add basic i.MX LCD block emulation code needed to boot Linux guest.

Cc: Peter Maydell <address@hidden>
Cc: Jason Wang <address@hidden>
Cc: Philippe Mathieu-Daudé <address@hidden>
Cc: address@hidden
Cc: address@hidden
Cc: address@hidden
Signed-off-by: Andrey Smirnov <address@hidden>
---
 hw/display/Makefile.objs       |  2 ++
 hw/display/imx_lcdif.c         | 71 ++++++++++++++++++++++++++++++++++++++++++
 include/hw/display/imx_lcdif.h | 16 ++++++++++
 3 files changed, 89 insertions(+)
 create mode 100644 hw/display/imx_lcdif.c
 create mode 100644 include/hw/display/imx_lcdif.h

diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs
index 551c050a6a..a7b34be231 100644
--- a/hw/display/Makefile.objs
+++ b/hw/display/Makefile.objs
@@ -41,3 +41,5 @@ virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS)
 virtio-gpu-3d.o-libs += $(VIRGL_LIBS)
 obj-$(CONFIG_DPCD) += dpcd.o
 obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.o
+
+obj-$(CONFIG_IMX) += imx_lcdif.o
diff --git a/hw/display/imx_lcdif.c b/hw/display/imx_lcdif.c
new file mode 100644
index 0000000000..1d7ad4a77b
--- /dev/null
+++ b/hw/display/imx_lcdif.c
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2017, Impinj, Inc.
+ *
+ * i.MX LCD block emulation code
+ *
+ * Author: Andrey Smirnov <address@hidden>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/display/imx_lcdif.h"
+#include "qemu/log.h"
+
+static uint64_t imx_lcdif_read(void *opaque, hwaddr offset,
+                               unsigned size)
+{
+    return 0;
+}
+
+static void imx_lcdif_write(void *opaque, hwaddr offset,
+                            uint64_t value, unsigned size)
+{
+}
+
+static const struct MemoryRegionOps imx_lcdif_ops = {
+    .read       = imx_lcdif_read,
+    .write      = imx_lcdif_write,
+    .endianness = DEVICE_NATIVE_ENDIAN,
+    .impl = {
+        .min_access_size = 4,
+        .max_access_size = 4,
+        .unaligned       = false,
+    },
+};
+
+static void imx_lcdif_init(Object *obj)
+{
+    SysBusDevice *sd = SYS_BUS_DEVICE(obj);
+    IMXLCDState *s = IMX_LCDIF(obj);
+
+    memory_region_init_io(&s->iomem,
+                          obj,
+                          &imx_lcdif_ops,
+                          s,
+                          TYPE_IMX_LCDIF ".iomem",
+                          0x10000);
+    sysbus_init_mmio(sd, &s->iomem);
+}
+
+static void imx_lcdif_class_init(ObjectClass *klass, void *data)
+{
+    DeviceClass *dc = DEVICE_CLASS(klass);
+
+    dc->desc  = "i.MX LCD Controller";
+}
+
+static const TypeInfo imx_lcdif_info = {
+    .name          = TYPE_IMX_LCDIF,
+    .parent        = TYPE_SYS_BUS_DEVICE,
+    .instance_size = sizeof(IMXLCDState),
+    .instance_init = imx_lcdif_init,
+    .class_init    = imx_lcdif_class_init,
+};
+
+static void imx_lcdif_register_type(void)
+{
+    type_register_static(&imx_lcdif_info);
+}
+type_init(imx_lcdif_register_type)
diff --git a/include/hw/display/imx_lcdif.h b/include/hw/display/imx_lcdif.h
new file mode 100644
index 0000000000..51985d3054
--- /dev/null
+++ b/include/hw/display/imx_lcdif.h
@@ -0,0 +1,16 @@
+#ifndef IMX_LCDIF_H
+#define IMX_LCDIF_H
+
+#include "hw/sysbus.h"
+
+typedef struct IMXLCDState {
+    /*< private >*/
+    SysBusDevice parent_obj;
+
+    MemoryRegion iomem;
+} IMXLCDState;
+
+#define TYPE_IMX_LCDIF "imx:lcdif"
+#define IMX_LCDIF(obj) OBJECT_CHECK(IMXLCDState, (obj), TYPE_IMX_LCDIF)
+
+#endif /* IMX_LCDIF_H */
-- 
2.13.6




reply via email to

[Prev in Thread] Current Thread [Next in Thread]