From: Mike Frysinger Date: Wed, 23 Apr 2008 21:07:29 +0000 (+0800) Subject: [Blackfin] arch: actually implement get_cycles function X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=764cb81cdc0620711d2cef5d06e9ef03c9d84184;p=linux-2.6 [Blackfin] arch: actually implement get_cycles function Signed-off-by: Mike Frysinger Signed-off-by: Bryan Wu --- diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c index 3aad6d7107..1ce8cb1e49 100644 --- a/arch/blackfin/kernel/time-ts.c +++ b/arch/blackfin/kernel/time-ts.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -35,9 +36,7 @@ static inline unsigned long long cycles_2_ns(cycle_t cyc) static cycle_t read_cycles(void) { - unsigned long tmp, tmp2; - asm("%0 = cycles; %1 = cycles2;" : "=d"(tmp), "=d"(tmp2)); - return tmp | ((cycle_t)tmp2 << 32); + return get_cycles(); } unsigned long long sched_clock(void) diff --git a/include/asm-blackfin/timex.h b/include/asm-blackfin/timex.h index 828590117f..22b0806161 100644 --- a/include/asm-blackfin/timex.h +++ b/include/asm-blackfin/timex.h @@ -1,18 +1,23 @@ -/* blackfin architecture timex specifications: Lineo Inc. 2001 +/* + * asm-blackfin/timex.h: cpu cycles! * - * Based on: include/asm-m68knommu/timex.h + * Copyright 2004-2008 Analog Devices Inc. + * + * Licensed under the GPL-2 or later. */ -#ifndef _ASMBLACKFIN_TIMEX_H -#define _ASMBLACKFIN_TIMEX_H +#ifndef _ASM_BLACKFIN_TIMEX_H +#define _ASM_BLACKFIN_TIMEX_H #define CLOCK_TICK_RATE 1000000 /* Underlying HZ */ -typedef unsigned long cycles_t; +typedef unsigned long long cycles_t; static inline cycles_t get_cycles(void) { - return 0; + unsigned long tmp, tmp2; + __asm__("%0 = cycles; %1 = cycles2;" : "=d"(tmp), "=d"(tmp2)); + return tmp | ((cycles_t)tmp2 << 32); } #endif