diff mbox

[01/12] ARM: Remove LATCH reference for time-acorn.c

Message ID 20110804134437.GB919@plexity.net (mailing list archive)
State New, archived
Headers show

Commit Message

Deepak Saxena Aug. 4, 2011, 1:44 p.m. UTC
As part of work to remove the global CLOCK_TICK_RATE
symbol, this patch defines a sub-arch local value
for use by the time-acorn.c file. This is only used
when mach-rpc is built and the tick rate was taken
from that sub-arch's timex.h header.

Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
---
 arch/arm/common/time-acorn.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

Comments

Russell King - ARM Linux Aug. 5, 2011, 9:21 a.m. UTC | #1
On Thu, Aug 04, 2011 at 06:44:37AM -0700, Deepak Saxena wrote:
> As part of work to remove the global CLOCK_TICK_RATE
> symbol, this patch defines a sub-arch local value
> for use by the time-acorn.c file. This is only used
> when mach-rpc is built and the tick rate was taken
> from that sub-arch's timex.h header.
> 
> Signed-off-by: Deepak Saxena <dsaxena@linaro.org>
> ---
>  arch/arm/common/time-acorn.c |   15 +++++++++------
>  1 files changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/common/time-acorn.c b/arch/arm/common/time-acorn.c
> index deeed56..0cc3a0d 100644
> --- a/arch/arm/common/time-acorn.c
> +++ b/arch/arm/common/time-acorn.c
> @@ -24,6 +24,9 @@
>  
>  #include <asm/mach/time.h>
>  
> +#define ACORN_TICK_RATE         2000000
> +#define ACORN_TIMER_LATCH	((CLOCK_TICK_RATE + HZ/2) / HZ)

Shouldn't this be ACORN_TICK_RATE ?
Russell King - ARM Linux Aug. 5, 2011, 9:23 a.m. UTC | #2
On Thu, Aug 04, 2011 at 06:44:37AM -0700, Deepak Saxena wrote:
> +#define ACORN_TICK_RATE         2000000
> +#define ACORN_TIMER_LATCH	((CLOCK_TICK_RATE + HZ/2) / HZ)

And also these should all be DIV_ROUND_CLOSEST(xxx_TICK_RATE, HZ)
Deepak Saxena Aug. 5, 2011, 2:59 p.m. UTC | #3
On Aug 05 2011, at 10:23, Russell King - ARM Linux was caught saying:
> On Thu, Aug 04, 2011 at 06:44:37AM -0700, Deepak Saxena wrote:
> > +#define ACORN_TICK_RATE         2000000
> > +#define ACORN_TIMER_LATCH	((CLOCK_TICK_RATE + HZ/2) / HZ)
> 
> And also these should all be DIV_ROUND_CLOSEST(xxx_TICK_RATE, HZ)

Ack. Will update all patches and post an updated version with
some other fixes.

~Deepak
diff mbox

Patch

diff --git a/arch/arm/common/time-acorn.c b/arch/arm/common/time-acorn.c
index deeed56..0cc3a0d 100644
--- a/arch/arm/common/time-acorn.c
+++ b/arch/arm/common/time-acorn.c
@@ -24,6 +24,9 @@ 
 
 #include <asm/mach/time.h>
 
+#define ACORN_TICK_RATE         2000000
+#define ACORN_TIMER_LATCH	((CLOCK_TICK_RATE + HZ/2) / HZ)
+
 unsigned long ioc_timer_gettimeoffset(void)
 {
 	unsigned int count1, count2, status;
@@ -46,23 +49,23 @@  unsigned long ioc_timer_gettimeoffset(void)
 		 * and count2.
 		 */
 		if (status & (1 << 5))
-			offset -= LATCH;
+			offset -= ACORN_TIMER_LATCH;
 	} else if (count2 > count1) {
 		/*
 		 * We have just had another interrupt between reading
 		 * count1 and count2.
 		 */
-		offset -= LATCH;
+		offset -= ACORN_TIMER_LATCH;
 	}
 
-	offset = (LATCH - offset) * (tick_nsec / 1000);
-	return (offset + LATCH/2) / LATCH;
+	offset = (ACORN_TIMER_LATCH - offset) * (tick_nsec / 1000);
+	return (offset + ACORN_TIMER_LATCH/2) / ACORN_TIMER_LATCH;
 }
 
 void __init ioctime_init(void)
 {
-	ioc_writeb(LATCH & 255, IOC_T0LTCHL);
-	ioc_writeb(LATCH >> 8, IOC_T0LTCHH);
+	ioc_writeb(ACORN_TIMER_LATCH & 255, IOC_T0LTCHL);
+	ioc_writeb(ACORN_TIMER_LATCH >> 8, IOC_T0LTCHH);
 	ioc_writeb(0, IOC_T0GO);
 }