Patchwork [RFC,V1,04/14] xilinx_uartlite: Added fdt gen. platform support

login
register
mail settings
Submitter Peter A. G. Crosthwaite
Date Aug. 25, 2011, 6:41 a.m.
Message ID <1314254480-22438-5-git-send-email-peter.crosthwaite@petalogix.com>
Download mbox | patch
Permalink /patch/111469/
State New
Headers show

Comments

Peter A. G. Crosthwaite - Aug. 25, 2011, 6:41 a.m.
Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
---
 hw/xilinx_uartlite.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/xilinx_uartlite.c b/hw/xilinx_uartlite.c
index 467a26c..dc2debd 100644
--- a/hw/xilinx_uartlite.c
+++ b/hw/xilinx_uartlite.c
@@ -218,3 +218,27 @@  static void xilinx_uart_register(void)
 }
 
 device_init(xilinx_uart_register)
+
+#ifdef CONFIG_FDT
+
+#include "fdt_generic_util.h"
+
+static int xilinx_uartlite_fdt_init(char *node_path, FDTMachineInfo *fdti,
+    void *unused)
+{
+    target_phys_addr_t base;
+    qemu_irq irqline;
+    char irq_info[1024];
+
+    base = qemu_devtree_getprop(fdti->fdt, NULL, node_path, "reg", 0, 0);
+    irqline = fdt_get_irq_info(fdti, node_path, 0, NULL, irq_info);
+    printf("FDT: UARTLITE: baseaddr: 0x" TARGET_FMT_plx ", irq: %s\n", base,
+        irq_info);
+    sysbus_create_simple("xilinx,uartlite", base, irqline);
+    return 0;
+}
+
+fdt_register_compatibility(xilinx_uartlite_fdt_init,
+    "xlnx,xps-uartlite-1.00.a");
+
+#endif /* CONFIG_FDT */