linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: R Sricharan <r.sricharan@ti.com>
To: linux-omap@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org, santosh.shilimkar@ti.com,
	tony@atomide.com, b-cousson@ti.com, r.sricharan@ti.com,
	paul@pswan.com
Subject: [PATCH 4/4] ARM: OMAP: counter-32k: Select the CR register offset using the IP scheme.
Date: Thu, 10 May 2012 22:36:55 +0530	[thread overview]
Message-ID: <1336669615-16454-5-git-send-email-r.sricharan@ti.com> (raw)
In-Reply-To: <1336669615-16454-1-git-send-email-r.sricharan@ti.com>

OMAP socs has a legacy and a highlander version of the
32k sync counter IP. The register offsets vary between the
highlander and the legacy scheme. So use the 'SCHEME'
bits(30-31) of the revision register to distinguish between
the two versions and choose the CR register offset accordingly.

Signed-off-by: R Sricharan <r.sricharan@ti.com>
---
 arch/arm/plat-omap/counter_32k.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index b2f634b..cbd939d 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -28,7 +28,10 @@
 #include <plat/clock.h>
 
 /* OMAP2_32KSYNCNT_CR_OFF: offset of 32ksync counter register */
-#define OMAP2_32KSYNCNT_CR_OFF		0x10
+#define OMAP2_32KSYNCNT_REV_OFF		0x0
+#define OMAP2_32KSYNCNT_REV_SCHEME	(0x3 << 30)
+#define OMAP2_32KSYNCNT_CR_OFF_LOW	0x10
+#define OMAP2_32KSYNCNT_CR_OFF_HIGH	0x30
 
 /*
  * 32KHz clocksource ... always available, on pretty most chips except
@@ -83,9 +86,16 @@ int __init omap_init_clocksource_32k(void __iomem *vbase)
 	int ret;
 
 	/*
-	 * 32k sync Counter register offset is at 0x10
+	 * 32k sync Counter IP register offsets vary between the
+	 * highlander version and the legacy ones.
+	 * The 'SCHEME' bits(30-31) of the revision register is used
+	 * to identify the version.
 	 */
-	sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF;
+	if (__raw_readl(vbase + OMAP2_32KSYNCNT_REV_OFF) &
+						OMAP2_32KSYNCNT_REV_SCHEME)
+		sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_HIGH;
+	else
+		sync32k_cnt_reg = vbase + OMAP2_32KSYNCNT_CR_OFF_LOW;
 
 	/*
 	 * 120000 rough estimate from the calculations in
-- 
1.7.1


  parent reply	other threads:[~2012-05-10 17:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-10 17:06 [PATCH 0/4] ARM: OMAP2+: Misc cleanup part2 R Sricharan
2012-05-10 17:06 ` [PATCH 1/4] ARM: OMAP2+: Introduce CONFIG_SOC_HAS_OMAP_DPLL macro R Sricharan
2012-05-10 18:26   ` Hiremath, Vaibhav
2012-05-11  6:16     ` R, Sricharan
2012-05-11  6:22       ` Hiremath, Vaibhav
2012-05-11  6:23         ` R, Sricharan
2012-05-10 17:06 ` [PATCH 2/4] ARM: OMAP2+: Move the stubbed prm and cm functions to prcm.c file and make them __weak R Sricharan
2012-05-10 17:41   ` Paul Walmsley
2012-05-10 17:44     ` Sricharan R
2012-06-14 11:56     ` R, Sricharan
2012-06-28 11:58       ` R, Sricharan
2012-07-04 15:19         ` Paul Walmsley
2012-07-04 15:25           ` R, Sricharan
2012-05-10 17:06 ` [PATCH 3/4] ARM: OMAP2+: Move stubbed secure_sram_reserve function to a common.c and call it __weak R Sricharan
2012-05-10 17:06 ` R Sricharan [this message]
2012-05-10 17:17 ` [PATCH 0/4] ARM: OMAP2+: Misc cleanup part2 Sricharan R

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=1336669615-16454-5-git-send-email-r.sricharan@ti.com \
    --to=r.sricharan@ti.com \
    --cc=b-cousson@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=paul@pswan.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=tony@atomide.com \
    /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).