xref: /linux/drivers/net/wireless/ath/ath12k/wifi7/mhi.c (revision 505d195b0f96fd613a51b13dde37aa5ad301eb32)
1 // SPDX-License-Identifier: BSD-3-Clause-Clear
2 /*
3  * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
4  * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
5  */
6 
7 #include "../mhi.h"
8 #include "mhi.h"
9 
10 static const struct mhi_channel_config ath12k_wifi7_mhi_channels_qcn9274[] = {
11 	{
12 		.num = 20,
13 		.name = "IPCR",
14 		.num_elements = 32,
15 		.event_ring = 1,
16 		.dir = DMA_TO_DEVICE,
17 		.ee_mask = 0x4,
18 		.pollcfg = 0,
19 		.doorbell = MHI_DB_BRST_DISABLE,
20 		.lpm_notify = false,
21 		.offload_channel = false,
22 		.doorbell_mode_switch = false,
23 	},
24 	{
25 		.num = 21,
26 		.name = "IPCR",
27 		.num_elements = 32,
28 		.event_ring = 1,
29 		.dir = DMA_FROM_DEVICE,
30 		.ee_mask = 0x4,
31 		.pollcfg = 0,
32 		.doorbell = MHI_DB_BRST_DISABLE,
33 		.lpm_notify = false,
34 		.offload_channel = false,
35 		.doorbell_mode_switch = false,
36 	},
37 };
38 
39 static struct mhi_event_config ath12k_wifi7_mhi_events_qcn9274[] = {
40 	{
41 		.num_elements = 32,
42 		.irq_moderation_ms = 0,
43 		.irq = 1,
44 		.data_type = MHI_ER_CTRL,
45 		.mode = MHI_DB_BRST_DISABLE,
46 		.hardware_event = false,
47 		.client_managed = false,
48 		.offload_channel = false,
49 	},
50 	{
51 		.num_elements = 256,
52 		.irq_moderation_ms = 1,
53 		.irq = 2,
54 		.mode = MHI_DB_BRST_DISABLE,
55 		.priority = 1,
56 		.hardware_event = false,
57 		.client_managed = false,
58 		.offload_channel = false,
59 	},
60 };
61 
62 const struct mhi_controller_config ath12k_wifi7_mhi_config_qcn9274 = {
63 	.max_channels = 30,
64 	.timeout_ms = 10000,
65 	.use_bounce_buf = false,
66 	.buf_len = 0,
67 	.num_channels = ARRAY_SIZE(ath12k_wifi7_mhi_channels_qcn9274),
68 	.ch_cfg = ath12k_wifi7_mhi_channels_qcn9274,
69 	.num_events = ARRAY_SIZE(ath12k_wifi7_mhi_events_qcn9274),
70 	.event_cfg = ath12k_wifi7_mhi_events_qcn9274,
71 };
72 
73 static const struct mhi_channel_config ath12k_wifi7_mhi_channels_wcn7850[] = {
74 	{
75 		.num = 20,
76 		.name = "IPCR",
77 		.num_elements = 64,
78 		.event_ring = 1,
79 		.dir = DMA_TO_DEVICE,
80 		.ee_mask = 0x4,
81 		.pollcfg = 0,
82 		.doorbell = MHI_DB_BRST_DISABLE,
83 		.lpm_notify = false,
84 		.offload_channel = false,
85 		.doorbell_mode_switch = false,
86 	},
87 	{
88 		.num = 21,
89 		.name = "IPCR",
90 		.num_elements = 64,
91 		.event_ring = 1,
92 		.dir = DMA_FROM_DEVICE,
93 		.ee_mask = 0x4,
94 		.pollcfg = 0,
95 		.doorbell = MHI_DB_BRST_DISABLE,
96 		.lpm_notify = false,
97 		.offload_channel = false,
98 		.doorbell_mode_switch = false,
99 	},
100 };
101 
102 static struct mhi_event_config ath12k_wifi7_mhi_events_wcn7850[] = {
103 	{
104 		.num_elements = 32,
105 		.irq_moderation_ms = 0,
106 		.irq = 1,
107 		.mode = MHI_DB_BRST_DISABLE,
108 		.data_type = MHI_ER_CTRL,
109 		.hardware_event = false,
110 		.client_managed = false,
111 		.offload_channel = false,
112 	},
113 	{
114 		.num_elements = 256,
115 		.irq_moderation_ms = 1,
116 		.irq = 2,
117 		.mode = MHI_DB_BRST_DISABLE,
118 		.priority = 1,
119 		.hardware_event = false,
120 		.client_managed = false,
121 		.offload_channel = false,
122 	},
123 };
124 
125 const struct mhi_controller_config ath12k_wifi7_mhi_config_wcn7850 = {
126 	.max_channels = 128,
127 	.timeout_ms = 2000,
128 	.use_bounce_buf = false,
129 	.buf_len = 8192,
130 	.num_channels = ARRAY_SIZE(ath12k_wifi7_mhi_channels_wcn7850),
131 	.ch_cfg = ath12k_wifi7_mhi_channels_wcn7850,
132 	.num_events = ARRAY_SIZE(ath12k_wifi7_mhi_events_wcn7850),
133 	.event_cfg = ath12k_wifi7_mhi_events_wcn7850,
134 };
135