diff options
| author | Deng-Cheng Zhu <dengcheng.zhu@imgtec.com> | 2015-03-07 13:30:26 -0500 |
|---|---|---|
| committer | Ralf Baechle <ralf@linux-mips.org> | 2015-04-01 11:21:27 -0400 |
| commit | 27acdea8fefeb6bec6f5af771df233c83aeac683 (patch) | |
| tree | b634522fc3f0bd341fd9e0ecd837cab0ae72ca6b /arch/mips/kernel | |
| parent | 788049e2d523e64fa48a9a4bce99ed93a8dc943a (diff) | |
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/mips/kernel')
| -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 @@ | |||
| 12 | * GNU General Public License for more details. | 12 | * GNU General Public License for more details. |
| 13 | */ | 13 | */ |
| 14 | #include <linux/clocksource.h> | 14 | #include <linux/clocksource.h> |
| 15 | #include <linux/sched_clock.h> | ||
| 15 | 16 | ||
| 16 | #include <asm/addrspace.h> | 17 | #include <asm/addrspace.h> |
| 17 | #include <asm/io.h> | 18 | #include <asm/io.h> |
| @@ -37,6 +38,11 @@ struct clocksource bcm1480_clocksource = { | |||
| 37 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, | 38 | .flags = CLOCK_SOURCE_IS_CONTINUOUS, |
| 38 | }; | 39 | }; |
| 39 | 40 | ||
| 41 | static u64 notrace sb1480_read_sched_clock(void) | ||
| 42 | { | ||
| 43 | return __raw_readq(IOADDR(A_SCD_ZBBUS_CYCLE_COUNT)); | ||
| 44 | } | ||
| 45 | |||
| 40 | void __init sb1480_clocksource_init(void) | 46 | void __init sb1480_clocksource_init(void) |
| 41 | { | 47 | { |
| 42 | struct clocksource *cs = &bcm1480_clocksource; | 48 | struct clocksource *cs = &bcm1480_clocksource; |
| @@ -46,4 +52,6 @@ void __init sb1480_clocksource_init(void) | |||
| 46 | plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); | 52 | plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); |
| 47 | zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000); | 53 | zbbus = ((plldiv >> 1) * 50000000) + ((plldiv & 1) * 25000000); |
| 48 | clocksource_register_hz(cs, zbbus); | 54 | clocksource_register_hz(cs, zbbus); |
| 55 | |||
| 56 | sched_clock_register(sb1480_read_sched_clock, 64, zbbus); | ||
| 49 | } | 57 | } |
