Commit a491e203 authored by Mao Minkai's avatar Mao Minkai Committed by guzitao
Browse files

sw64: add timer support

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8Y8CY



--------------------------------

Add timer for basic SW64 support.

Signed-off-by: default avatarMao Minkai <maominkai@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent 4549f1fd
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_SW64_TC_H
#define _ASM_SW64_TC_H

static inline unsigned long rdtc(void)
{
	unsigned long ret;

	__asm__ __volatile__ ("rtc %0" : "=r"(ret));
	return ret;
}

extern void tc_sync_clear(void);
extern void tc_sync_ready(void *ignored);
extern void tc_sync_set(void);
#endif /* _ASM_SW64_TC_H */
+11 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_SW64_TIMER_H
#define _ASM_SW64_TIMER_H

extern void sw64_setup_clocksource(void);

extern void sw64_setup_timer(void);

extern void __init setup_sched_clock(void);

#endif /* _ASM_SW64_TIMER_H */
+23 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_SW64_TIMEX_H
#define _ASM_SW64_TIMEX_H

#include <asm/tc.h>

/* With only one or two oddballs, we use the RTC as the ticker, selecting
 * the 32.768kHz reference clock, which nicely divides down to our HZ.
 */
#define CLOCK_TICK_RATE	32768

/*
 * Standard way to access the cycle counter.
 */

typedef unsigned long cycles_t;

static inline cycles_t get_cycles(void)
{
	return rdtc();
}

#endif /* _ASM_SW64_TIMEX_H */