From 26a4b43f26703f45e2e9b4c8ae0bfab90825faf2 Mon Sep 17 00:00:00 2001 From: Andrew Victor Date: Mon, 19 Jun 2006 15:26:50 +0100 Subject: [PATCH] --- yaml --- r: 28087 b: refs/heads/master c: 2a6f9902c6a799a9c0218b37e39b75690c3b9a70 h: refs/heads/master i: 28085: 422049ae94c3076af4a3ecb10b74c52693ef0d00 28083: 5997ca310ac286ade6a7d614f0ddb04ce1100a49 28079: 533f65b0ef29cffc4ed14ecaed381f475efbca9c v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-at91rm9200/time.c | 44 ++++++++++++++++++--------- 2 files changed, 31 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 815a526840e0..ab1fc10a57f7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 963151f2471d0e6475d8b2d3a005417aec1766f7 +refs/heads/master: 2a6f9902c6a799a9c0218b37e39b75690c3b9a70 diff --git a/trunk/arch/arm/mach-at91rm9200/time.c b/trunk/arch/arm/mach-at91rm9200/time.c index 36798a8d532a..fc2d7d5e4637 100644 --- a/trunk/arch/arm/mach-at91rm9200/time.c +++ b/trunk/arch/arm/mach-at91rm9200/time.c @@ -90,6 +90,20 @@ static struct irqaction at91rm9200_timer_irq = { .handler = at91rm9200_timer_interrupt }; +void at91rm9200_timer_reset(void) +{ + last_crtr = 0; + + /* Real time counter incremented every 30.51758 microseconds */ + at91_sys_write(AT91_ST_RTMR, 1); + + /* Set Period Interval timer */ + at91_sys_write(AT91_ST_PIMR, LATCH); + + /* Enable Period Interval Timer interrupt */ + at91_sys_write(AT91_ST_IER, AT91_ST_PITS); +} + /* * Set up timer interrupt. */ @@ -99,28 +113,30 @@ void __init at91rm9200_timer_init(void) at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS); (void) at91_sys_read(AT91_ST_SR); /* Clear any pending interrupts */ - /* - * Make IRQs happen for the system timer. - */ + /* Make IRQs happen for the system timer */ setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq); - /* Set initial alarm to 0 */ - at91_sys_write(AT91_ST_RTAR, 0); - - /* Real time counter incremented every 30.51758 microseconds */ - at91_sys_write(AT91_ST_RTMR, 1); - - /* Set Period Interval timer */ - at91_sys_write(AT91_ST_PIMR, LATCH); - /* Change the kernel's 'tick' value to 10009 usec. (the default is 10000) */ tick_usec = (LATCH * 1000000) / CLOCK_TICK_RATE; - /* Enable Period Interval Timer interrupt */ - at91_sys_write(AT91_ST_IER, AT91_ST_PITS); + /* Initialize and enable the timer interrupt */ + at91rm9200_timer_reset(); +} + +#ifdef CONFIG_PM +static void at91rm9200_timer_suspend(void) +{ + /* disable Period Interval Timer interrupt */ + at91_sys_write(AT91_ST_IDR, AT91_ST_PITS); } +#else +#define at91rm9200_timer_suspend NULL +#endif struct sys_timer at91rm9200_timer = { .init = at91rm9200_timer_init, .offset = at91rm9200_gettimeoffset, + .suspend = at91rm9200_timer_suspend, + .resume = at91rm9200_timer_reset, }; +