1 /*
2  * Copyright (c) 2015-2018 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  * DOC: hif_io32_snoc.h
22  *
23  * snoc specific implementations and configurations
24  */
25 
26 #ifndef __HIF_IO32_SNOC_H__
27 #define __HIF_IO32_SNOC_H__
28 
29 #include "hif.h"
30 #include "regtable.h"
31 #include "ce_reg.h"
32 #include "qdf_atomic.h"
33 #include "hif_main.h"
34 #include "hif_debug.h"
35 
ce_enable_irq_in_individual_register(struct hif_softc * scn,int ce_id)36 static inline void ce_enable_irq_in_individual_register(struct hif_softc *scn,
37 		int ce_id)
38 {
39 	uint32_t offset;
40 
41 	offset = HOST_IE_ADDRESS + CE_BASE_ADDRESS(ce_id);
42 	if (!TARGET_REGISTER_ACCESS_ALLOWED(scn)) {
43 		hif_err_rl("Target access is not allowed");
44 		return;
45 	}
46 	hif_write32_mb(scn, scn->mem + offset, 1);
47 }
48 
ce_disable_irq_in_individual_register(struct hif_softc * scn,int ce_id)49 static inline void ce_disable_irq_in_individual_register(struct hif_softc *scn,
50 		int ce_id)
51 {
52 	uint32_t offset;
53 
54 	offset = HOST_IE_ADDRESS + CE_BASE_ADDRESS(ce_id);
55 	if (!TARGET_REGISTER_ACCESS_ALLOWED(scn)) {
56 		hif_err_rl("Target access is not allowed");
57 		return;
58 	}
59 	hif_write32_mb(scn, scn->mem + offset, 0);
60 
61 	if (!TARGET_REGISTER_ACCESS_ALLOWED(scn)) {
62 		hif_err_rl("Target access is not allowed");
63 		return;
64 	}
65 	hif_read32_mb(scn, scn->mem + offset);
66 }
67 #endif
68