xen/arm: Add support for device tree specified arch_timer clock frequency.
authorChen Baozi <baozich@gmail.com>
Tue, 13 Aug 2013 11:14:25 +0000 (19:14 +0800)
committerIan Campbell <ian.campbell@citrix.com>
Thu, 22 Aug 2013 12:17:41 +0000 (13:17 +0100)
Signed-off-by: Chen Baozi <baozich@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/time.c

index b5864ef6abdc33bc26569d98c8135d3dedfc15bc..9c176cd483916d21e656546416a27f8487ee4f68 100644 (file)
@@ -104,6 +104,7 @@ int __init init_xen_time(void)
     struct dt_device_node *dev;
     int res;
     unsigned int i;
+    u32 rate;
 
     dev = dt_find_compatible_node(NULL, NULL, "arm,armv7-timer");
     if ( !dev )
@@ -134,7 +135,11 @@ int __init init_xen_time(void)
     if ( !cpu_has_gentimer )
         panic("CPU does not support the Generic Timer v1 interface.\n");
 
-    cpu_khz = READ_SYSREG32(CNTFRQ_EL0) / 1000;
+    res = dt_property_read_u32(dev, "clock-frequency", &rate);
+    if ( res )
+        cpu_khz = rate / 1000;
+    else
+        cpu_khz = READ_SYSREG32(CNTFRQ_EL0) / 1000;
 
     boot_count = READ_SYSREG64(CNTPCT_EL0);
     printk("Using generic timer at %lu KHz\n", cpu_khz);