mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 09/11] i.MX clocksource: Use readl/writel instead of pointer deref
Date: Thu, 24 Jun 2010 11:39:14 +0200	[thread overview]
Message-ID: <1277372356-32370-10-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1277372356-32370-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/clocksource.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c
index 4b400a0..a166038 100644
--- a/arch/arm/mach-imx/clocksource.c
+++ b/arch/arm/mach-imx/clocksource.c
@@ -35,12 +35,14 @@
 #include <notifier.h>
 #include <mach/imx-regs.h>
 #include <mach/clock.h>
+#include <asm/io.h>
 
 #define GPT(x) __REG(IMX_TIM1_BASE + (x))
+#define timer_base (IMX_TIM1_BASE)
 
 uint64_t imx_clocksource_read(void)
 {
-	return GPT(GPT_TCN);
+	return readl(timer_base + GPT_TCN);
 }
 
 static struct clocksource cs = {
@@ -62,8 +64,10 @@ static struct notifier_block imx_clock_notifier = {
 static int clocksource_init (void)
 {
 	int i;
+	uint32_t val;
+
 	/* setup GP Timer 1 */
-	GPT(GPT_TCTL) = TCTL_SWR;
+	writel(TCTL_SWR, timer_base + GPT_TCTL);
 
 #ifdef CONFIG_ARCH_IMX21
 	PCCR1 |= PCCR1_GPT1_EN;
@@ -74,12 +78,12 @@ static int clocksource_init (void)
 #endif
 
 	for (i = 0; i < 100; i++)
-		GPT(GPT_TCTL) = 0; /* We have no udelay by now */
+		writel(0, timer_base + GPT_TCTL); /* We have no udelay by now */
 
-	GPT(GPT_TPRER) = 0;
-	GPT(GPT_TCTL) |= TCTL_FRR | (1<<TCTL_CLKSOURCE); /* Freerun Mode, PERCLK1 input */
-	GPT(GPT_TCTL) &= ~TCTL_TEN;
-	GPT(GPT_TCTL) |= TCTL_TEN; /* Enable timer */
+	writel(0, timer_base + GPT_TPRER);
+	val = readl(timer_base + GPT_TCTL);
+	val |= TCTL_FRR | (1 << TCTL_CLKSOURCE) | TCTL_TEN; /* Freerun Mode, PERCLK1 input */
+	writel(val, timer_base + GPT_TCTL);
 
 	cs.mult = clocksource_hz2mult(imx_get_gptclk(), cs.shift);
 
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2010-06-24  9:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-24  9:39 assorted patches Sascha Hauer
2010-06-24  9:39 ` [PATCH 01/11] i.MX27: merge iomux pim definitions from kernel Sascha Hauer
2010-06-24  9:39 ` [PATCH 02/11] imxfb: Add board specific hook to enable display Sascha Hauer
2010-06-24  9:39 ` [PATCH 03/11] imxfb: do not enable framebuffer on startup Sascha Hauer
2010-06-24  9:39 ` [PATCH 04/11] memcpy cmd: Do not expect to read/write the whole chunk at once Sascha Hauer
2010-06-25  7:17   ` Peter Korsgaard
2010-06-28  8:37     ` Sascha Hauer
2010-06-24  9:39 ` [PATCH 05/11] armlinux: reorder tag setup Sascha Hauer
2010-06-24  9:39 ` [PATCH 06/11] remove eco920 board support Sascha Hauer
2010-06-24  9:39 ` [PATCH 07/11] usbnet: remove unused dev member in struct usbnet Sascha Hauer
2010-06-24  9:39 ` [PATCH 08/11] i.MX serial: Use readl/writel instead of pointer deref Sascha Hauer
2010-06-24  9:39 ` Sascha Hauer [this message]
2010-06-24  9:39 ` [PATCH 10/11] i.MX27: Add some missing device base addresses Sascha Hauer
2010-06-24  9:39 ` [PATCH 11/11] fb: add a usage counter to prevent double enable/disable Sascha Hauer
2010-06-24 15:05 ` assorted patches Eric Bénard

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=1277372356-32370-10-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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