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) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (C) 2016-2017 Synopsys, Inc. (www.synopsys.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #ifndef __SOC_ARC_AUX_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #define __SOC_ARC_AUX_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #ifdef CONFIG_ARC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define read_aux_reg(r)		__builtin_arc_lr(r)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /* gcc builtin sr needs reg param to be long immediate */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #define write_aux_reg(r, v)	__builtin_arc_sr((unsigned int)(v), r)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #else	/* !CONFIG_ARC */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static inline int read_aux_reg(u32 r)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * function helps elide unused variable warning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * see: https://lists.infradead.org/pipermail/linux-snps-arc/2016-November/001748.html
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static inline void write_aux_reg(u32 r, u32 v)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define READ_BCR(reg, into)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	unsigned int tmp;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	tmp = read_aux_reg(reg);			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 	if (sizeof(tmp) == sizeof(into)) {		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		into = *((typeof(into) *)&tmp);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	} else {					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		extern void bogus_undefined(void);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 		bogus_undefined();			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	}						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define WRITE_AUX(reg, into)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	unsigned int tmp;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 	if (sizeof(tmp) == sizeof(into)) {		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		tmp = (*(unsigned int *)&(into));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 		write_aux_reg(reg, tmp);		\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	} else  {					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		extern void bogus_undefined(void);	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		bogus_undefined();			\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	}						\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #endif