Skip to content

Commit 818270d

Browse files
author
Rob Herring
committed
ARM: versatile: use OF init for sp804 timer
Enable DT based init for the sp804 timers on versatile DT platform. Signed-off-by: Rob Herring <rob.herring@calxeda.com>
1 parent cc8e9ad commit 818270d

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

arch/arm/boot/dts/versatile-ab.dts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,18 @@
121121
interrupts = <0>;
122122
};
123123

124+
timer@101e2000 {
125+
compatible = "arm,sp804", "arm,primecell";
126+
reg = <0x101e2000 0x1000>;
127+
interrupts = <4>;
128+
};
129+
130+
timer@101e3000 {
131+
compatible = "arm,sp804", "arm,primecell";
132+
reg = <0x101e3000 0x1000>;
133+
interrupts = <5>;
134+
};
135+
124136
gpio0: gpio@101e4000 {
125137
compatible = "arm,pl061", "arm,primecell";
126138
reg = <0x101e4000 0x1000>;

arch/arm/mach-versatile/core.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -749,12 +749,25 @@ void versatile_restart(char mode, const char *cmd)
749749
/* Early initializations */
750750
void __init versatile_init_early(void)
751751
{
752+
u32 val;
752753
void __iomem *sys = __io_address(VERSATILE_SYS_BASE);
753754

754755
osc4_clk.vcoreg = sys + VERSATILE_SYS_OSCCLCD_OFFSET;
755756
clkdev_add_table(lookups, ARRAY_SIZE(lookups));
756757

757758
versatile_sched_clock_init(sys + VERSATILE_SYS_24MHz_OFFSET, 24000000);
759+
760+
/*
761+
* set clock frequency:
762+
* VERSATILE_REFCLK is 32KHz
763+
* VERSATILE_TIMCLK is 1MHz
764+
*/
765+
val = readl(__io_address(VERSATILE_SCTL_BASE));
766+
writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) |
767+
(VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
768+
(VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) |
769+
(VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val,
770+
__io_address(VERSATILE_SCTL_BASE));
758771
}
759772

760773
void __init versatile_init(void)
@@ -785,19 +798,6 @@ void __init versatile_init(void)
785798
*/
786799
void __init versatile_timer_init(void)
787800
{
788-
u32 val;
789-
790-
/*
791-
* set clock frequency:
792-
* VERSATILE_REFCLK is 32KHz
793-
* VERSATILE_TIMCLK is 1MHz
794-
*/
795-
val = readl(__io_address(VERSATILE_SCTL_BASE));
796-
writel((VERSATILE_TIMCLK << VERSATILE_TIMER1_EnSel) |
797-
(VERSATILE_TIMCLK << VERSATILE_TIMER2_EnSel) |
798-
(VERSATILE_TIMCLK << VERSATILE_TIMER3_EnSel) |
799-
(VERSATILE_TIMCLK << VERSATILE_TIMER4_EnSel) | val,
800-
__io_address(VERSATILE_SCTL_BASE));
801801

802802
/*
803803
* Initialise to a known state (all timers off)

arch/arm/mach-versatile/versatile_dt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ DT_MACHINE_START(VERSATILE_PB, "ARM-Versatile (Device Tree Support)")
4545
.map_io = versatile_map_io,
4646
.init_early = versatile_init_early,
4747
.init_irq = versatile_init_irq,
48-
.init_time = versatile_timer_init,
4948
.init_machine = versatile_dt_init,
5049
.dt_compat = versatile_dt_match,
5150
.restart = versatile_restart,

0 commit comments

Comments
 (0)