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