Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * License.  See the file "COPYING" in the main directory of this archive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 1994 by Waldorf Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Copyright (C) 1995 - 2000, 01, 03 by Ralf Baechle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  * Copyright (C) 2007, 2014 Maciej W. Rozycki
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/stringify.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <asm/asm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #include <asm/compiler.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/war.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #ifndef CONFIG_CPU_DADDI_WORKAROUNDS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define GCC_DADDI_IMM_ASM() "I"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define GCC_DADDI_IMM_ASM() "r"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #ifndef CONFIG_HAVE_PLAT_DELAY
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) void __delay(unsigned long loops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	__asm__ __volatile__ (
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	"	.set	noreorder				\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	"	.align	3					\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	"1:	bnez	%0, 1b					\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	"	 " __stringify(LONG_SUBU) "	%0, %1		\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	"	.set	reorder					\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	: "=r" (loops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	: GCC_DADDI_IMM_ASM() (1), "0" (loops));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) EXPORT_SYMBOL(__delay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)  * Division by multiplication: you don't have to worry about
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)  * loss of precision.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)  * Use only for very small delays ( < 1 msec).	Should probably use a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)  * lookup table, really, as the multiplications take much too long with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  * short delays.  This is a "reasonable" implementation, though (and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)  * first constant multiplications gets optimized away if the delay is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)  * a constant)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) void __udelay(unsigned long us)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	unsigned int lpj = raw_current_cpu_data.udelay_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	__delay((us * 0x000010c7ull * HZ * lpj) >> 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) EXPORT_SYMBOL(__udelay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) void __ndelay(unsigned long ns)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	unsigned int lpj = raw_current_cpu_data.udelay_val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	__delay((ns * 0x00000005ull * HZ * lpj) >> 32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) EXPORT_SYMBOL(__ndelay);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) #endif