Loading arch/arm/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -839,6 +839,7 @@ config ARCH_OMAP select ARCH_REQUIRE_GPIOLIB select ARCH_HAS_CPUFREQ select GENERIC_CLOCKEVENTS select HAVE_SCHED_CLOCK select ARCH_HAS_HOLES_MEMORYMODEL help Support for TI's OMAP platform (OMAP1/2/3/4). Loading arch/arm/plat-omap/counter_32k.c +22 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include <linux/io.h> #include <linux/sched.h> #include <asm/sched_clock.h> #include <plat/common.h> #include <plat/board.h> Loading Loading @@ -110,10 +112,25 @@ static struct clocksource clocksource_32k = { * Returns current time from boot in nsecs. It's OK for this to wrap * around for now, as it's just a relative time stamp. */ static DEFINE_CLOCK_DATA(cd); /* * Constants generated by clocks_calc_mult_shift(m, s, 32768, NSEC_PER_SEC, 60). * This gives a resolution of about 30us and a wrap period of about 36hrs. */ #define SC_MULT 4000000000u #define SC_SHIFT 17 unsigned long long notrace sched_clock(void) { return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k), clocksource_32k.mult, clocksource_32k.shift); u32 cyc = clocksource_32k.read(&clocksource_32k); return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT); } static void notrace omap_update_sched_clock(void) { u32 cyc = clocksource_32k.read(&clocksource_32k); update_sched_clock(&cd, cyc, (u32)~0); } /** Loading Loading @@ -171,6 +188,9 @@ static int __init omap_init_clocksource_32k(void) if (clocksource_register_hz(&clocksource_32k, 32768)) printk(err, clocksource_32k.name); init_fixed_sched_clock(&cd, omap_update_sched_clock, 32, 32768, SC_MULT, SC_SHIFT); } return 0; } Loading Loading
arch/arm/Kconfig +1 −0 Original line number Diff line number Diff line Loading @@ -839,6 +839,7 @@ config ARCH_OMAP select ARCH_REQUIRE_GPIOLIB select ARCH_HAS_CPUFREQ select GENERIC_CLOCKEVENTS select HAVE_SCHED_CLOCK select ARCH_HAS_HOLES_MEMORYMODEL help Support for TI's OMAP platform (OMAP1/2/3/4). Loading
arch/arm/plat-omap/counter_32k.c +22 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ #include <linux/io.h> #include <linux/sched.h> #include <asm/sched_clock.h> #include <plat/common.h> #include <plat/board.h> Loading Loading @@ -110,10 +112,25 @@ static struct clocksource clocksource_32k = { * Returns current time from boot in nsecs. It's OK for this to wrap * around for now, as it's just a relative time stamp. */ static DEFINE_CLOCK_DATA(cd); /* * Constants generated by clocks_calc_mult_shift(m, s, 32768, NSEC_PER_SEC, 60). * This gives a resolution of about 30us and a wrap period of about 36hrs. */ #define SC_MULT 4000000000u #define SC_SHIFT 17 unsigned long long notrace sched_clock(void) { return clocksource_cyc2ns(clocksource_32k.read(&clocksource_32k), clocksource_32k.mult, clocksource_32k.shift); u32 cyc = clocksource_32k.read(&clocksource_32k); return cyc_to_fixed_sched_clock(&cd, cyc, (u32)~0, SC_MULT, SC_SHIFT); } static void notrace omap_update_sched_clock(void) { u32 cyc = clocksource_32k.read(&clocksource_32k); update_sched_clock(&cd, cyc, (u32)~0); } /** Loading Loading @@ -171,6 +188,9 @@ static int __init omap_init_clocksource_32k(void) if (clocksource_register_hz(&clocksource_32k, 32768)) printk(err, clocksource_32k.name); init_fixed_sched_clock(&cd, omap_update_sched_clock, 32, 32768, SC_MULT, SC_SHIFT); } return 0; } Loading