Patchwork [RFC,V1,09/14] xilinx_intc: Added fdt generic platform support

login
register
mail settings
Submitter Peter A. G. Crosthwaite
Date Aug. 25, 2011, 6:41 a.m.
Message ID <1314254480-22438-10-git-send-email-peter.crosthwaite@petalogix.com>
Download mbox | patch
Permalink /patch/111477/
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_intc.c |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

Patch

diff --git a/hw/xilinx_intc.c b/hw/xilinx_intc.c
index cb72d5a..aa7783a 100644
--- a/hw/xilinx_intc.c
+++ b/hw/xilinx_intc.c
@@ -158,9 +158,11 @@  static int xilinx_intc_init(SysBusDevice *dev)
     return 0;
 }
 
+#define QDEV_NAME "xilinx,intc"
+
 static SysBusDeviceInfo xilinx_intc_info = {
     .init = xilinx_intc_init,
-    .qdev.name  = "xilinx,intc",
+    .qdev.name  = QDEV_NAME,
     .qdev.size  = sizeof(struct xlx_pic),
     .qdev.props = (Property[]) {
         DEFINE_PROP_UINT32("kind-of-intr", struct xlx_pic, c_kind_of_intr, 0),
@@ -174,3 +176,34 @@  static void xilinx_intc_register(void)
 }
 
 device_init(xilinx_intc_register)
+
+#ifdef CONFIG_FDT
+
+#include "fdt_generic_qdev.h"
+
+static FDTQDevPropMapping *
+xilinx_intc_fdt_qdev_map(char *node_path, FDTMachineInfo *fdti)
+{
+    FDTQDevPropMapping *ret = g_malloc0(sizeof(*ret) * 2);
+    struct FDTQDevPropMapping sprops [] = {
+        {
+            .name = "kind-of-intr",
+            .src.u32 = qemu_devtree_getprop(fdti->fdt, NULL, node_path,
+                "xlnx,kind-of-intr", 0, 0)
+        },{
+           .name = NULL
+        }
+    };
+    return memcpy(ret, sprops, sizeof(*ret) * 2);
+}
+
+FDTQDevOps xilinx_intc_fdt_qdev_ops = {
+    .dev_name = QDEV_NAME,
+    .is_intc = 32,
+    .map = xilinx_intc_fdt_qdev_map,
+};
+
+fdt_qdev_register_compatibility(&xilinx_intc_fdt_qdev_ops,
+    "xlnx,xps-intc-1.00.a");
+
+#endif /* CONFIG_FDT */