1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2020 Synopsys, Inc. (www.synopsys.com) 4 * 5 * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com> 6 */ 7 #ifndef __ASM_ARC_DSP_IMPL_H 8 #define __ASM_ARC_DSP_IMPL_H 9 10 #define DSP_CTRL_DISABLED_ALL 0 11 12 #ifdef __ASSEMBLY__ 13 14 /* clobbers r5 register */ 15 .macro DSP_EARLY_INIT 16 lr r5, [ARC_AUX_DSP_BUILD] 17 bmsk r5, r5, 7 18 breq r5, 0, 1f 19 mov r5, DSP_CTRL_DISABLED_ALL 20 sr r5, [ARC_AUX_DSP_CTRL] 21 1: 22 .endm 23 24 /* clobbers r10, r11 registers pair */ 25 .macro DSP_SAVE_REGFILE_IRQ 26 #if defined(CONFIG_ARC_DSP_KERNEL) 27 /* 28 * Drop any changes to DSP_CTRL made by userspace so userspace won't be 29 * able to break kernel - reset it to DSP_CTRL_DISABLED_ALL value 30 */ 31 mov r10, DSP_CTRL_DISABLED_ALL 32 sr r10, [ARC_AUX_DSP_CTRL] 33 #endif /* ARC_DSP_KERNEL */ 34 .endm 35 36 #else /* __ASEMBLY__ */ 37 38 #include <asm/asserts.h> 39 40 static inline bool dsp_exist(void) 41 { 42 struct bcr_generic bcr; 43 44 READ_BCR(ARC_AUX_DSP_BUILD, bcr); 45 return !!bcr.ver; 46 } 47 48 static inline void dsp_config_check(void) 49 { 50 CHK_OPT_STRICT(CONFIG_ARC_DSP_HANDLED, dsp_exist()); 51 } 52 53 #endif /* __ASEMBLY__ */ 54 #endif /* __ASM_ARC_DSP_IMPL_H */ 55