[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC PATCH V1 08/14] xilinx_timer: Added fdt_generic platfo
From: |
Peter A. G. Crosthwaite |
Subject: |
[Qemu-devel] [RFC PATCH V1 08/14] xilinx_timer: Added fdt_generic platform support |
Date: |
Thu, 25 Aug 2011 16:41:14 +1000 |
Signed-off-by: Peter A. G. Crosthwaite <address@hidden>
---
hw/xilinx_timer.c | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/hw/xilinx_timer.c b/hw/xilinx_timer.c
index f1c7abc..8fe32f6 100644
--- a/hw/xilinx_timer.c
+++ b/hw/xilinx_timer.c
@@ -215,9 +215,11 @@ static int xilinx_timer_init(SysBusDevice *dev)
return 0;
}
+#define QDEV_NAME "xilinx,timer"
+
static SysBusDeviceInfo xilinx_timer_info = {
.init = xilinx_timer_init,
- .qdev.name = "xilinx,timer",
+ .qdev.name = QDEV_NAME,
.qdev.size = sizeof(struct timerblock),
.qdev.props = (Property[]) {
DEFINE_PROP_UINT32("frequency", struct timerblock, freq_hz, 0),
@@ -232,3 +234,38 @@ static void xilinx_timer_register(void)
}
device_init(xilinx_timer_register)
+
+#ifdef CONFIG_FDT
+
+#include "fdt_generic_qdev.h"
+
+#define FREQ_HZ (62 * 1000000)
+
+static FDTQDevPropMapping *
+xilinx_timer_fdt_qdev_map(char *node_path, FDTMachineInfo *fdti)
+{
+ FDTQDevPropMapping *ret = g_malloc0(sizeof(*ret) * 3);
+ struct FDTQDevPropMapping sprops [] = {
+ {
+ .name = "frequency",
+ .src.u32 = FREQ_HZ
+ },{
+ .name = "nr-timers",
+ .src.u32 = 2 - qemu_devtree_getprop(fdti->fdt, NULL, node_path,
+ "xlnx,one-timer-only", 0, 0)
+ },{
+ .name = NULL
+ }
+ };
+ return memcpy(ret, sprops, sizeof(*ret) * 3);
+}
+
+FDTQDevOps xilinx_timer_fdt_qdev_ops = {
+ .dev_name = QDEV_NAME,
+ .map = xilinx_timer_fdt_qdev_map,
+};
+
+fdt_qdev_register_compatibility(&xilinx_timer_fdt_qdev_ops,
+ "xlnx,xps-timer-1.00.a");
+
+#endif /* CONFIG_FDT */
--
1.7.3.2
- [Qemu-devel] [RFC PATCH V1 07/14] fdt_generic_qdev: first revision, (continued)
- [Qemu-devel] [RFC PATCH V1 09/14] xilinx_intc: Added fdt generic platform support, Peter A. G. Crosthwaite, 2011/08/25
- [Qemu-devel] [RFC PATCH V1 10/14] xilinx_ethlite: Added fdt generic platform support, Peter A. G. Crosthwaite, 2011/08/25
- [Qemu-devel] [RFC PATCH V1 08/14] xilinx_timer: Added fdt_generic platform support,
Peter A. G. Crosthwaite <=
- [Qemu-devel] [RFC PATCH V1 11/14] vl.c: Added hw_dtb/kern_dtb command line opts, Peter A. G. Crosthwaite, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Anthony Liguori, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Peter Crosthwaite, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Paolo Bonzini, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Anthony Liguori, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Edgar E. Iglesias, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Anthony Liguori, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Edgar E. Iglesias, 2011/08/25
- Re: [Qemu-devel] [RFC PATCH V1 00/14] Dynamic machine model creation from device trees, Anthony Liguori, 2011/08/25