summaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/csrc-sb1250.c
diff options
context:
space:
mode:
authorDeng-Cheng Zhu <dengcheng.zhu@imgtec.com>2015-03-07 19:30:32 +0100
committerRalf Baechle <ralf@linux-mips.org>2015-04-01 17:21:33 +0200
commit02710fc8512f77597e9fa68d2d00000107b84242 (patch)
treede75053ec069b819eff76c0fc489bff36ef4d835 /arch/mips/kernel/csrc-sb1250.c
parentMIPS: jz4740: Implement read_sched_clock (diff)
downloadlinux-02710fc8512f77597e9fa68d2d00000107b84242.tar.xz
linux-02710fc8512f77597e9fa68d2d00000107b84242.zip
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: Deng-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: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/csrc-sb1250.c')
-rw-r--r--arch/mips/kernel/csrc-sb1250.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/mips/kernel/csrc-sb1250.c b/arch/mips/kernel/csrc-sb1250.c
index 6ecb77d82063..662ae7cc5d6b 100644
--- a/arch/mips/kernel/csrc-sb1250.c
+++ b/arch/mips/kernel/csrc-sb1250.c
@@ -33,15 +33,22 @@
* The HPT is free running from SB1250_HPT_VALUE down to 0 then starts over
* again.
*/
-static cycle_t sb1250_hpt_read(struct clocksource *cs)
+static inline cycle_t sb1250_hpt_get_cycles(void)
{
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;
}
+static cycle_t sb1250_hpt_read(struct clocksource *cs)
+{
+ return sb1250_hpt_get_cycles();
+}
+
struct clocksource bcm1250_clocksource = {
.name = "bcm1250-counter-3",
.rating = 200,