arm: Configure reference clock for Versatile Express timers
Subsystems (3)
PATCH 1/1 arm: Configure reference clock for Versatile Express timers
Timers on Versatile Express mainboard are used as system clock/event sources. Driver assumes that they are clocked with 1MHz signal. Old V2M firmware apparently configured it by default, but on newer boards one can observe that "sleep 1" command takes over 30 seconds to finish, as the timers are fed with 32kHz instead...
This patch performs required magic and also removes code clearing timer's control registers, as exactly the same operations are performed by the timer driver few jiffies later.
--- arch/arm/mach-vexpress/v2m.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
arch/arm/mach-vexpress/v2m.c +8 -2
@@ -19,6 +19,7 @@#include <asm/mach/time.h> #include <asm/hardware/arm_timer.h> #include <asm/hardware/timer-sp.h> +#include <asm/hardware/sp810.h> #include <mach/motherboard.h>
@@ -50,10 +51,15 @@ void __init v2m_map_io(struct map_desc *tile, size_t num)static void __init v2m_timer_init (void ) { +u32 scctrl; +versatile_sched_clock_init (MMIO_P2V (V2M_SYS_24MHZ ),24000000 ); -writel (0 ,MMIO_P2V (V2M_TIMER0 ) +TIMER_CTRL ); -writel (0 ,MMIO_P2V (V2M_TIMER1 ) +TIMER_CTRL ); +/* Select 1MHz TIMCLK as the reference clock for SP804 timers */ + scctrl =readl (MMIO_P2V (V2M_SYSCTL +SCCTRL )); + scctrl |= (1 <<15 );/* TIMCLK is used for timer 0 */ + scctrl |= (1 <<17 );/* TIMCLK is used for timer 1 */ +writel (scctrl,MMIO_P2V (V2M_SYSCTL +SCCTRL ));sp804_clocksource_init (MMIO_P2V (V2M_TIMER1 ));sp804_clockevents_init (MMIO_P2V (V2M_TIMER0 ),IRQ_V2M_TIMER0 );
Signature · 1 line
1.6.3.3
PATCH 1/1 arm: Configure reference clock for Versatile Express timers
Quoted 9 lines · Pawel Moll
Timers on Versatile Express mainboard are used as system clock/event sources. Driver assumes that they are clocked with 1MHz signal. Old V2M firmware apparently configured it by default, but on newer boards one can observe that "sleep 1" command takes over 30 seconds to finish, as the timers are fed with 32kHz instead...
This patch performs required magic and also removes code clearing timer's control registers, as exactly the same operations are performed by the timer driver few jiffies later.
It would be nice if these registers were documented...
PATCH 1/1 arm: Configure reference clock for Versatile Express timers
Quoted 4 lines
This patch performs required magic and also removes code clearing
Quoted 2 lines
timer's control registers, as exactly the same operations are performed by the timer driver few jiffies later.
It would be nice if these registers were documented...
The best I can do is to create some more meaningful constants.
V2 to follow...
Pawe?
PATCH 1/1 arm: Configure reference clock for Versatile Express timers
Quoted 6 lines · Pawel Moll
Quoted 4 lines
This patch performs required magic and also removes code clearing
Quoted 2 lines
timer's control registers, as exactly the same operations are performed by the timer driver few jiffies later.
It would be nice if these registers were documented...
The best I can do is to create some more meaningful constants.
I was actually referring to the manuals - last time I looked these register bits are not documented in the user guide for the system. DUI0447A, 4.4.9: "You can, however, use the System Controller to change the timer reference from 32.768kHz to 1MHz."
The only other reference to "System Controller" is at the beginning of the document in the preface: "ARM PrimeCell System Controller (SP810) Technical Reference Manual (ARM DDI 0254)".
Section 4.4.1 refers to the memory map, which tells me that the System Control ARM SP810 is at CS7 + 0x1000.
Section 4.2 is titled "System control registers" but actually describes the "System registers" described in table 4-1. 4.3 describes those system registers. 4.4 describes the other peripherals.
DDI0254 is not published, so there's nothing on the register layout.
PATCH 1/1 arm: Configure reference clock for Versatile Express timers
Quoted 6 lines
The only other reference to "System Controller" is at the beginning of the document in the preface: "ARM PrimeCell System Controller (SP810) Technical Reference Manual (ARM DDI 0254)".
DDI0254 is not published, so there's nothing on the register layout.
It's exactly the DDI0254 that contains the information, but - as you have pointed out - it's marked as obsolete and not available any more. Don't really know the reason...
I spent quite a lot of time investigating the problem and it appears that this cell is of little use these days - the only useful function is the timers reference clock muxer. I didn't even know that there the header file with its register offsets exist at all :-) before Will pointed this out...
So - as I said - the named constants are the best I can do.
Cheers!
Pawe?