public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: dsaxena@linaro•org (Deepak Saxena)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 02/12] ARM: at91: Remove LATCH and CLOCK_TICK_RATE dependency
Date: Thu, 4 Aug 2011 06:46:16 -0700	[thread overview]
Message-ID: <20110804134616.GC919@plexity.net> (raw)
In-Reply-To: <cover.1312455035.git.dsaxena@linaro.org>

As part of work to remove the global CLOCK_TICK_RATE symbol,
this patch defines a sub-arch local value for use by the
at91 code.  Once all LATCH and CLOCK_TICK_RATE references
are removed, we will remove all the definitions across
sub-arches.

Signed-off-by: Deepak Saxena <dsaxena@linaro•org>
---
 arch/arm/mach-at91/at91rm9200_time.c      |    6 +-
 arch/arm/mach-at91/include/mach/at91_st.h |   63 +++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-at91/at91rm9200_time.c b/arch/arm/mach-at91/at91rm9200_time.c
index 1dd69c8..61a6d0c 100644
--- a/arch/arm/mach-at91/at91rm9200_time.c
+++ b/arch/arm/mach-at91/at91rm9200_time.c
@@ -74,8 +74,8 @@ static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id)
 	if (sr & AT91_ST_PITS) {
 		u32	crtr = read_CRTR();
 
-		while (((crtr - last_crtr) & AT91_ST_CRTV) >= LATCH) {
-			last_crtr += LATCH;
+		while (((crtr - last_crtr) & AT91_ST_CRTV) >= AT91_TIMER_LATCH) {
+			last_crtr += AT91_TIMER_LATCH;
 			clkevt.event_handler(&clkevt);
 		}
 		return IRQ_HANDLED;
@@ -116,7 +116,7 @@ clkevt32k_mode(enum clock_event_mode mode, struct clock_event_device *dev)
 	case CLOCK_EVT_MODE_PERIODIC:
 		/* PIT for periodic irqs; fixed rate of 1/HZ */
 		irqmask = AT91_ST_PITS;
-		at91_sys_write(AT91_ST_PIMR, LATCH);
+		at91_sys_write(AT91_ST_PIMR, AT91_TIMER_LATCH);
 		break;
 	case CLOCK_EVT_MODE_ONESHOT:
 		/* ALM for oneshot irqs, set by next_event()
diff --git a/arch/arm/mach-at91/include/mach/at91_st.h b/arch/arm/mach-at91/include/mach/at91_st.h
index 8847173..7d55a49 100644
--- a/arch/arm/mach-at91/include/mach/at91_st.h
+++ b/arch/arm/mach-at91/include/mach/at91_st.h
@@ -46,4 +46,67 @@
 #define	AT91_ST_CRTR		(AT91_ST + 0x24)	/* Current Real-time Register */
 #define		AT91_ST_CRTV		(0xfffff << 0)		/* Current Real-Time Value */
 
+#if defined(CONFIG_ARCH_AT91RM9200)
+
+#define AT91_TICK_RATE		(AT91_SLOW_CLOCK)
+
+#elif defined(CONFIG_ARCH_AT91SAM9260)
+
+#if defined(CONFIG_MACH_USB_A9260) || defined(CONFIG_MACH_QIL_A9260)
+#define AT91SAM9_MASTER_CLOCK	90000000
+#else
+#define AT91SAM9_MASTER_CLOCK	99300000
+#endif
+
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91SAM9261)
+
+#define AT91SAM9_MASTER_CLOCK	99300000
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91SAM9G10)
+
+#define AT91SAM9_MASTER_CLOCK	133000000
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91SAM9263)
+
+#if defined(CONFIG_MACH_USB_A9263)
+#define AT91SAM9_MASTER_CLOCK	90000000
+#else
+#define AT91SAM9_MASTER_CLOCK	99959500
+#endif
+
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91SAM9RL)
+
+#define AT91SAM9_MASTER_CLOCK	100000000
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91SAM9G20)
+
+#define AT91SAM9_MASTER_CLOCK	132096000
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91SAM9G45)
+
+#define AT91SAM9_MASTER_CLOCK	133333333
+#define AT91_TICK_RATE		(AT91SAM9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91CAP9)
+
+#define AT91CAP9_MASTER_CLOCK	100000000
+#define AT91_TICK_RATE		(AT91CAP9_MASTER_CLOCK/16)
+
+#elif defined(CONFIG_ARCH_AT91X40)
+
+#define AT91X40_MASTER_CLOCK	40000000
+#define AT91_TICK_RATE		(AT91X40_MASTER_CLOCK)
+
+#endif
+
+#define AT91_TIMER_LATCH  	((AT91_TICK_RATE + HZ/2) / HZ)
+
 #endif
-- 
1.7.4.1

  parent reply	other threads:[~2011-08-04 13:46 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1312455035.git.dsaxena@linaro.org>
2011-08-04 13:44 ` [PATCH 01/12] ARM: Remove LATCH reference for time-acorn.c Deepak Saxena
2011-08-05  9:21   ` Russell King - ARM Linux
2011-08-05  9:23   ` Russell King - ARM Linux
2011-08-05 14:59     ` Deepak Saxena
2011-08-04 13:46 ` Deepak Saxena [this message]
2011-08-04 13:47 ` [PATCH 03/12] ARM: unicore32: Remove depency on LATCH Deepak Saxena
2011-08-04 13:56   ` Deepak Saxena
2011-08-04 13:49 ` [PATCH 04/12] ARM: clps711x: Remove LATCH and CLOCK_TICK_RATE dependency Deepak Saxena
2011-08-04 13:49 ` [PATCH 05/12] ARM: h720x: " Deepak Saxena
2011-08-04 13:50 ` [PATCH 06/12] ARM: IXP23xx: " Deepak Saxena
2011-08-04 14:03   ` Lennert Buytenhek
2011-08-04 13:50 ` [PATCH 07/12] ARM: IXP4x: " Deepak Saxena
2011-08-04 13:52 ` [PATCH 08/12] ARM: ks8695: " Deepak Saxena
2011-08-04 13:53 ` [PATCH 09/12] ARM: netx: " Deepak Saxena
2011-08-04 13:53 ` [PATCH 10/12] ARM: pnx4000: " Deepak Saxena
2011-08-04 13:53 ` [PATCH 11/12] ARM: sa1100: " Deepak Saxena
2011-08-04 13:54 ` [PATCH 12/12] ARM: Remove mach-*/include/mach/timex.h Deepak Saxena
2011-08-04 15:57   ` Linus Walleij
2011-08-04 17:52   ` H Hartley Sweeten
2011-08-04 18:14     ` H Hartley Sweeten

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=20110804134616.GC919@plexity.net \
    --to=dsaxena@linaro$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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