From: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>
The patch adds proper handling and registration
for serial devices instantiated via FDT.
The devices with 'chardev' properties are
connected to serial backends, if corresponding dts
property serial id number is set.
Signed-off-by: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>
---
hw/core/fdt_generic_util.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/core/fdt_generic_util.c b/hw/core/fdt_generic_util.c
index f3a47cbafe..c92b5c287b 100644
--- a/hw/core/fdt_generic_util.c
+++ b/hw/core/fdt_generic_util.c
@@ -37,6 +37,7 @@
#include "system/system.h"
#include "system/reset.h"
#include "qemu/cutils.h"
+#include "chardev/char.h"
#include "qemu/log.h"
#include "qemu/config-file.h"
#include "hw/core/boards.h"
@@ -721,6 +722,13 @@ static void fdt_init_qdev_properties(char *node_path, FDTMachineInfo *fdti,
continue;
}
+ /* Special case for chardevs. */
+ if (!strcmp(propname, "chardev") && !strcmp(p->type, "str")) {
+ qdev_prop_set_chr(DEVICE(dev), "chardev",
+ serial_hd(get_int_be(value, len)));
+ continue;
+ }
+
fdt_init_qdev_scalar_prop(dev, p, fdti, node_path,
propname, value, len);
}
--
2.43.0