1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * This file is subject to the terms and conditions of the GNU General Public 4 * License. See the file "COPYING" in the main directory of this archive 5 * for more details. 6 * 7 * Copyright (C) 1994 by Waldorf Electronics 8 * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle 9 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 10 * Copyright (C) 2007 Maciej W. Rozycki 11 * Copyright (C) 2020 Loongson Technology Co., Ltd. 12 */ 13 #ifndef _ASM_DELAY_H 14 #define _ASM_DELAY_H 15 16 #include <linux/param.h> 17 18 extern void __delay(unsigned long cycles); 19 extern void __ndelay(unsigned long ns); 20 extern void __udelay(unsigned long us); 21 22 #define ndelay(ns) __ndelay(ns) 23 #define udelay(us) __udelay(us) 24 25 /* make sure "usecs *= ..." in udelay do not overflow. */ 26 #if HZ >= 1000 27 #define MAX_UDELAY_MS 1 28 #elif HZ <= 200 29 #define MAX_UDELAY_MS 5 30 #else 31 #define MAX_UDELAY_MS (1000 / HZ) 32 #endif 33 34 #endif /* _ASM_DELAY_H */ 35