diff options
author | Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> | 2015-03-07 10:30:26 -0800 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 17:21:27 +0200 |
commit | 27acdea8fefeb6bec6f5af771df233c83aeac683 (patch) | |
tree | b634522fc3f0bd341fd9e0ecd837cab0ae72ca6b /arch | |
parent | 788049e2d523e64fa48a9a4bce99ed93a8dc943a (diff) | |
download | lwn-27acdea8fefeb6bec6f5af771df233c83aeac683.tar.gz lwn-27acdea8fefeb6bec6f5af771df233c83aeac683.zip |
MIPS: csrc-bcm1480: Implement read_sched_clock
Use the ZBbus cycle counter for sched_clock source. This implementation
will give high resolution cputime accounting.
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/9480/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/kernel/csrc-bcm1480.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/mips/kernel/csrc-bcm1480.c b/arch/mips/kernel/csrc-bcm1480.c index 0a20a0f694a5..7f65b53d1b24 100644 --- a/arch/mips/kernel/csrc-bcm1480.c +++ b/arch/mips/kernel/csrc-bcm1480.c @@ -12,6 +12,7 @@ * GNU General Public License for more details. */ #include <linux/clocksource.h> +#include <linux/sched_clock.h> #include <asm/addrspace.h> #include <asm/io.h> @@ -37,6 +38,11 @@ struct clocksource bcm1480_clocksource = { .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; +static u64 notrace sb1480_read_sched_clock(void) +{ + return __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT)); +} + void __init sb1480_clocksource_init(void) { struct clocksource *cs = &bcm1480_clocksource; @@ -46,4 +52,6 @@ void __init sb1480_clocksource_init(void) plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000); clocksource_register_hz(cs, zbbus); + + sched_clock_register(sb1480_read_sched_clock, 64, zbbus); } |