diff options
Diffstat (limited to 'drivers/clocksource/timer-atmel-tcb.c')
-rw-r--r-- | drivers/clocksource/timer-atmel-tcb.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/clocksource/timer-atmel-tcb.c b/drivers/clocksource/timer-atmel-tcb.c index 6ed31f9def7e..7427b07495a8 100644 --- a/drivers/clocksource/timer-atmel-tcb.c +++ b/drivers/clocksource/timer-atmel-tcb.c | |||
@@ -6,6 +6,7 @@ | |||
6 | #include <linux/irq.h> | 6 | #include <linux/irq.h> |
7 | 7 | ||
8 | #include <linux/clk.h> | 8 | #include <linux/clk.h> |
9 | #include <linux/delay.h> | ||
9 | #include <linux/err.h> | 10 | #include <linux/err.h> |
10 | #include <linux/ioport.h> | 11 | #include <linux/ioport.h> |
11 | #include <linux/io.h> | 12 | #include <linux/io.h> |
@@ -125,6 +126,18 @@ static u64 notrace tc_sched_clock_read32(void) | |||
125 | return tc_get_cycles32(&clksrc); | 126 | return tc_get_cycles32(&clksrc); |
126 | } | 127 | } |
127 | 128 | ||
129 | static struct delay_timer tc_delay_timer; | ||
130 | |||
131 | static unsigned long tc_delay_timer_read(void) | ||
132 | { | ||
133 | return tc_get_cycles(&clksrc); | ||
134 | } | ||
135 | |||
136 | static unsigned long notrace tc_delay_timer_read32(void) | ||
137 | { | ||
138 | return tc_get_cycles32(&clksrc); | ||
139 | } | ||
140 | |||
128 | #ifdef CONFIG_GENERIC_CLOCKEVENTS | 141 | #ifdef CONFIG_GENERIC_CLOCKEVENTS |
129 | 142 | ||
130 | struct tc_clkevt_device { | 143 | struct tc_clkevt_device { |
@@ -432,6 +445,7 @@ static int __init tcb_clksrc_init(struct device_node *node) | |||
432 | /* setup ony channel 0 */ | 445 | /* setup ony channel 0 */ |
433 | tcb_setup_single_chan(&tc, best_divisor_idx); | 446 | tcb_setup_single_chan(&tc, best_divisor_idx); |
434 | tc_sched_clock = tc_sched_clock_read32; | 447 | tc_sched_clock = tc_sched_clock_read32; |
448 | tc_delay_timer.read_current_timer = tc_delay_timer_read32; | ||
435 | } else { | 449 | } else { |
436 | /* we have three clocks no matter what the | 450 | /* we have three clocks no matter what the |
437 | * underlying platform supports. | 451 | * underlying platform supports. |
@@ -444,6 +458,7 @@ static int __init tcb_clksrc_init(struct device_node *node) | |||
444 | /* setup both channel 0 & 1 */ | 458 | /* setup both channel 0 & 1 */ |
445 | tcb_setup_dual_chan(&tc, best_divisor_idx); | 459 | tcb_setup_dual_chan(&tc, best_divisor_idx); |
446 | tc_sched_clock = tc_sched_clock_read; | 460 | tc_sched_clock = tc_sched_clock_read; |
461 | tc_delay_timer.read_current_timer = tc_delay_timer_read; | ||
447 | } | 462 | } |
448 | 463 | ||
449 | /* and away we go! */ | 464 | /* and away we go! */ |
@@ -458,6 +473,9 @@ static int __init tcb_clksrc_init(struct device_node *node) | |||
458 | 473 | ||
459 | sched_clock_register(tc_sched_clock, 32, divided_rate); | 474 | sched_clock_register(tc_sched_clock, 32, divided_rate); |
460 | 475 | ||
476 | tc_delay_timer.freq = divided_rate; | ||
477 | register_current_timer_delay(&tc_delay_timer); | ||
478 | |||
461 | return 0; | 479 | return 0; |
462 | 480 | ||
463 | err_unregister_clksrc: | 481 | err_unregister_clksrc: |