~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/c6x/kernel/time.c

Version: ~ [ linux-5.19-rc3 ] ~ [ linux-5.18.5 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.48 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.123 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.199 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.248 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.284 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.319 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.302 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  *  Port on Texas Instruments TMS320C6x architecture
  4  *
  5  *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
  6  *  Author: Aurelien Jacquiot (aurelien.jacquiot@jaluna.com)
  7  */
  8 
  9 #include <linux/kernel.h>
 10 #include <linux/clocksource.h>
 11 #include <linux/errno.h>
 12 #include <linux/sched.h>
 13 #include <linux/param.h>
 14 #include <linux/string.h>
 15 #include <linux/mm.h>
 16 #include <linux/interrupt.h>
 17 #include <linux/timex.h>
 18 #include <linux/profile.h>
 19 
 20 #include <asm/special_insns.h>
 21 #include <asm/timer64.h>
 22 
 23 static u32 sched_clock_multiplier;
 24 #define SCHED_CLOCK_SHIFT 16
 25 
 26 static u64 tsc_read(struct clocksource *cs)
 27 {
 28         return get_cycles();
 29 }
 30 
 31 static struct clocksource clocksource_tsc = {
 32         .name           = "timestamp",
 33         .rating         = 300,
 34         .read           = tsc_read,
 35         .mask           = CLOCKSOURCE_MASK(64),
 36         .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
 37 };
 38 
 39 /*
 40  * scheduler clock - returns current time in nanoseconds.
 41  */
 42 u64 sched_clock(void)
 43 {
 44         u64 tsc = get_cycles();
 45 
 46         return (tsc * sched_clock_multiplier) >> SCHED_CLOCK_SHIFT;
 47 }
 48 
 49 void __init time_init(void)
 50 {
 51         u64 tmp = (u64)NSEC_PER_SEC << SCHED_CLOCK_SHIFT;
 52 
 53         do_div(tmp, c6x_core_freq);
 54         sched_clock_multiplier = tmp;
 55 
 56         clocksource_register_hz(&clocksource_tsc, c6x_core_freq);
 57 
 58         /* write anything into TSCL to enable counting */
 59         set_creg(TSCL, 0);
 60 
 61         /* probe for timer64 event timer */
 62         timer64_init();
 63 }
 64 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp