Linux kernel from version 3.4 requires CM_REFCNT register for sched timer
for Integrator/CP board (integrator_defconfig).

See
http://infocenter.arm.com/help/topic/com.arm.doc.dui0138e/ch04s06s11.html

Signed-off-by: Jan Petrous <jan.petr...@tieto.com>
---
 hw/arm/integratorcp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index c44b2a4..f419764 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -83,8 +83,11 @@ static uint64_t integratorcm_read(void *opaque, hwaddr
offset,
     case 9: /* CM_INIT */
         return s->cm_init;
     case 10: /* CM_REFCT */
-        /* ??? High frequency timer.  */
-        hw_error("integratorcm_read: CM_REFCT");
+       /* This register, CM_REFCNT, provides a 32-bit count value.
+ * The count increments at the fixed reference clock frequency of 24MHz
+ * and can be used as a real-time counter.
+ */
+       return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24, 1000);
     case 12: /* CM_FLAGS */
         return s->cm_flags;
     case 14: /* CM_NVFLAGS */
-- 
1.7.11.3
From a4f7f6220df71a7c7540a6722cc5f96c7d061e28 Mon Sep 17 00:00:00 2001
From: Jan Petrous <jan.petr...@tieto.com>
Date: Tue, 5 Nov 2013 12:13:57 +0100
Subject: [PATCH] integrator/cp: add support for REFCNT register

Linux kernel from version 3.4 requires CM_REFCNT register for sched timer
for Integrator/CP board (integrator_defconfig).

See http://infocenter.arm.com/help/topic/com.arm.doc.dui0138e/ch04s06s11.html

Signed-off-by: Jan Petrous <jan.petr...@tieto.com>
---
 hw/arm/integratorcp.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
index c44b2a4..f419764 100644
--- a/hw/arm/integratorcp.c
+++ b/hw/arm/integratorcp.c
@@ -83,8 +83,11 @@ static uint64_t integratorcm_read(void *opaque, hwaddr offset,
     case 9: /* CM_INIT */
         return s->cm_init;
     case 10: /* CM_REFCT */
-        /* ??? High frequency timer.  */
-        hw_error("integratorcm_read: CM_REFCT");
+       /* This register, CM_REFCNT, provides a 32-bit count value.
+	* The count increments at the fixed reference clock frequency of 24MHz
+	* and can be used as a real-time counter.
+	*/
+       return muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 24, 1000);
     case 12: /* CM_FLAGS */
         return s->cm_flags;
     case 14: /* CM_NVFLAGS */
-- 
1.7.11.3

Reply via email to