Commit 02710fc8 authored by Deng-Cheng Zhu's avatar Deng-Cheng Zhu Committed by Ralf Baechle

MIPS: csrc-sb1250: Extract hpt cycle acquisition from sb1250_hpt_read

This is to prepare for the upcoming read_sched_clock implementation, which
will also need to get cycles from the high precision timer.
Signed-off-by: default avatarDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>
Cc: linux-mips@linux-mips.org
Cc: macro@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/9486/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 944081ac
...@@ -33,15 +33,22 @@ ...@@ -33,15 +33,22 @@
* The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over * The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
* again. * again.
*/ */
static cycle_t sb1250_hpt_read(struct clocksource *cs) static inline cycle_t sb1250_hpt_get_cycles(void)
{ {
unsigned int count; unsigned int count;
void __iomem *addr;
count = G_SCD_TIMER_CNT(__raw_readq(IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CNT)))); addr = IOADDR(A_SCD_TIMER_REGISTER(SB1250_HPT_NUM, R_SCD_TIMER_CNT));
count = G_SCD_TIMER_CNT(__raw_readq(addr));
return SB1250_HPT_VALUE - count; return SB1250_HPT_VALUE - count;
} }
static cycle_t sb1250_hpt_read(struct clocksource *cs)
{
return sb1250_hpt_get_cycles();
}
struct clocksource bcm1250_clocksource = { struct clocksource bcm1250_clocksource = {
.name = "bcm1250-counter-3", .name = "bcm1250-counter-3",
.rating = 200, .rating = 200,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment