18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
48c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
58c2ecf20Sopenharmony_ci * for more details.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 1994 by Waldorf Electronics
88c2ecf20Sopenharmony_ci * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
98c2ecf20Sopenharmony_ci * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
108c2ecf20Sopenharmony_ci * Copyright (C) 2007  Maciej W. Rozycki
118c2ecf20Sopenharmony_ci * Copyright (C) 2020 Loongson Technology Co., Ltd.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci#ifndef _ASM_DELAY_H
148c2ecf20Sopenharmony_ci#define _ASM_DELAY_H
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include <linux/param.h>
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciextern void __delay(unsigned long cycles);
198c2ecf20Sopenharmony_ciextern void __ndelay(unsigned long ns);
208c2ecf20Sopenharmony_ciextern void __udelay(unsigned long us);
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#define ndelay(ns) __ndelay(ns)
238c2ecf20Sopenharmony_ci#define udelay(us) __udelay(us)
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/* make sure "usecs *= ..." in udelay do not overflow. */
268c2ecf20Sopenharmony_ci#if HZ >= 1000
278c2ecf20Sopenharmony_ci#define MAX_UDELAY_MS	1
288c2ecf20Sopenharmony_ci#elif HZ <= 200
298c2ecf20Sopenharmony_ci#define MAX_UDELAY_MS	5
308c2ecf20Sopenharmony_ci#else
318c2ecf20Sopenharmony_ci#define MAX_UDELAY_MS	(1000 / HZ)
328c2ecf20Sopenharmony_ci#endif
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif /* _ASM_DELAY_H */
35