xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Chen Baozi <baozich@gmail.com>
To: Ian Campbell <Ian.Campbell@citrix.com>,
	Julien Grall <julien.grall@linaro.org>
Cc: Chen Baozi <baozich@gmail.com>,
	Xen Developer List <xen-devel@lists.xen.org>
Subject: [PATCH v8 5/6] xen/arm: Add support for device tree specified arch_timer clock frequency.
Date: Tue, 13 Aug 2013 19:14:25 +0800	[thread overview]
Message-ID: <1376392466-26685-6-git-send-email-baozich@gmail.com> (raw)
In-Reply-To: <1376392466-26685-1-git-send-email-baozich@gmail.com>

Signed-off-by: Chen Baozi <baozich@gmail.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
 xen/arch/arm/time.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index b5864ef..9c176cd 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -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);
-- 
1.8.1.4

  parent reply	other threads:[~2013-08-13 11:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13 11:14 [PATCH v8 8/5] Add UART support and arch timer initialization for OMAP5 Chen Baozi
2013-08-13 11:14 ` [PATCH v8 1/6] xen: rename ns16550-uart.h to 8250-uart.h and fix some typos Chen Baozi
2013-08-13 11:14 ` [PATCH v8 2/6] xen/arm: add 8250 compatible UART support for early_printk Chen Baozi
2013-08-22 10:14   ` Ian Campbell
2013-08-13 11:14 ` [PATCH v8 3/6] xen: Introduce a helper to read a u32 property in device tree Chen Baozi
2013-08-13 11:14 ` [PATCH v8 4/6] xen/arm: Add the new OMAP UART driver Chen Baozi
2013-08-22 10:20   ` Ian Campbell
2013-08-22 13:21     ` Julien Grall
2013-08-22 14:03       ` Ian Campbell
2013-08-23  0:05     ` Chen Baozi
2013-08-13 11:14 ` Chen Baozi [this message]
2013-08-13 11:14 ` [PATCH v8 6/6] xen/arm: Platform recognition and initialize arch_timer for the OMAP5 Chen Baozi
2013-08-22 12:52 ` [PATCH v8 8/5] Add UART support and arch timer initialization for OMAP5 Ian Campbell
2013-08-22 23:58   ` Chen Baozi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1376392466-26685-6-git-send-email-baozich@gmail.com \
    --to=baozich@gmail.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=julien.grall@linaro.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).