77#include "core.h"
88#include "debug.h"
99#include "mhi.h"
10+ #include "pci.h"
1011
1112#define MHI_TIMEOUT_DEFAULT_MS 90000
1213
13- static struct mhi_channel_config ath11k_mhi_channels [] = {
14+ static struct mhi_channel_config ath11k_mhi_channels_qca6390 [] = {
1415 {
1516 .num = 0 ,
1617 .name = "LOOPBACK" ,
@@ -69,7 +70,7 @@ static struct mhi_channel_config ath11k_mhi_channels[] = {
6970 },
7071};
7172
72- static struct mhi_event_config ath11k_mhi_events [] = {
73+ static struct mhi_event_config ath11k_mhi_events_qca6390 [] = {
7374 {
7475 .num_elements = 32 ,
7576 .irq_moderation_ms = 0 ,
@@ -92,15 +93,108 @@ static struct mhi_event_config ath11k_mhi_events[] = {
9293 },
9394};
9495
95- static struct mhi_controller_config ath11k_mhi_config = {
96+ static struct mhi_controller_config ath11k_mhi_config_qca6390 = {
9697 .max_channels = 128 ,
9798 .timeout_ms = 2000 ,
9899 .use_bounce_buf = false,
99100 .buf_len = 0 ,
100- .num_channels = ARRAY_SIZE (ath11k_mhi_channels ),
101- .ch_cfg = ath11k_mhi_channels ,
102- .num_events = ARRAY_SIZE (ath11k_mhi_events ),
103- .event_cfg = ath11k_mhi_events ,
101+ .num_channels = ARRAY_SIZE (ath11k_mhi_channels_qca6390 ),
102+ .ch_cfg = ath11k_mhi_channels_qca6390 ,
103+ .num_events = ARRAY_SIZE (ath11k_mhi_events_qca6390 ),
104+ .event_cfg = ath11k_mhi_events_qca6390 ,
105+ };
106+
107+ static struct mhi_channel_config ath11k_mhi_channels_qcn9074 [] = {
108+ {
109+ .num = 0 ,
110+ .name = "LOOPBACK" ,
111+ .num_elements = 32 ,
112+ .event_ring = 1 ,
113+ .dir = DMA_TO_DEVICE ,
114+ .ee_mask = 0x14 ,
115+ .pollcfg = 0 ,
116+ .doorbell = MHI_DB_BRST_DISABLE ,
117+ .lpm_notify = false,
118+ .offload_channel = false,
119+ .doorbell_mode_switch = false,
120+ .auto_queue = false,
121+ },
122+ {
123+ .num = 1 ,
124+ .name = "LOOPBACK" ,
125+ .num_elements = 32 ,
126+ .event_ring = 1 ,
127+ .dir = DMA_FROM_DEVICE ,
128+ .ee_mask = 0x14 ,
129+ .pollcfg = 0 ,
130+ .doorbell = MHI_DB_BRST_DISABLE ,
131+ .lpm_notify = false,
132+ .offload_channel = false,
133+ .doorbell_mode_switch = false,
134+ .auto_queue = false,
135+ },
136+ {
137+ .num = 20 ,
138+ .name = "IPCR" ,
139+ .num_elements = 32 ,
140+ .event_ring = 1 ,
141+ .dir = DMA_TO_DEVICE ,
142+ .ee_mask = 0x14 ,
143+ .pollcfg = 0 ,
144+ .doorbell = MHI_DB_BRST_DISABLE ,
145+ .lpm_notify = false,
146+ .offload_channel = false,
147+ .doorbell_mode_switch = false,
148+ .auto_queue = false,
149+ },
150+ {
151+ .num = 21 ,
152+ .name = "IPCR" ,
153+ .num_elements = 32 ,
154+ .event_ring = 1 ,
155+ .dir = DMA_FROM_DEVICE ,
156+ .ee_mask = 0x14 ,
157+ .pollcfg = 0 ,
158+ .doorbell = MHI_DB_BRST_DISABLE ,
159+ .lpm_notify = false,
160+ .offload_channel = false,
161+ .doorbell_mode_switch = false,
162+ .auto_queue = true,
163+ },
164+ };
165+
166+ static struct mhi_event_config ath11k_mhi_events_qcn9074 [] = {
167+ {
168+ .num_elements = 32 ,
169+ .irq_moderation_ms = 0 ,
170+ .irq = 1 ,
171+ .data_type = MHI_ER_CTRL ,
172+ .mode = MHI_DB_BRST_DISABLE ,
173+ .hardware_event = false,
174+ .client_managed = false,
175+ .offload_channel = false,
176+ },
177+ {
178+ .num_elements = 256 ,
179+ .irq_moderation_ms = 1 ,
180+ .irq = 2 ,
181+ .mode = MHI_DB_BRST_DISABLE ,
182+ .priority = 1 ,
183+ .hardware_event = false,
184+ .client_managed = false,
185+ .offload_channel = false,
186+ },
187+ };
188+
189+ static struct mhi_controller_config ath11k_mhi_config_qcn9074 = {
190+ .max_channels = 30 ,
191+ .timeout_ms = 10000 ,
192+ .use_bounce_buf = false,
193+ .buf_len = 0 ,
194+ .num_channels = ARRAY_SIZE (ath11k_mhi_channels_qcn9074 ),
195+ .ch_cfg = ath11k_mhi_channels_qcn9074 ,
196+ .num_events = ARRAY_SIZE (ath11k_mhi_events_qcn9074 ),
197+ .event_cfg = ath11k_mhi_events_qcn9074 ,
104198};
105199
106200void ath11k_mhi_set_mhictrl_reset (struct ath11k_base * ab )
@@ -221,6 +315,7 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
221315{
222316 struct ath11k_base * ab = ab_pci -> ab ;
223317 struct mhi_controller * mhi_ctrl ;
318+ struct mhi_controller_config * ath11k_mhi_config ;
224319 int ret ;
225320
226321 mhi_ctrl = mhi_alloc_controller ();
@@ -254,7 +349,12 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
254349 mhi_ctrl -> read_reg = ath11k_mhi_op_read_reg ;
255350 mhi_ctrl -> write_reg = ath11k_mhi_op_write_reg ;
256351
257- ret = mhi_register_controller (mhi_ctrl , & ath11k_mhi_config );
352+ if (ab -> hw_rev == ATH11K_HW_QCA6390_HW20 )
353+ ath11k_mhi_config = & ath11k_mhi_config_qca6390 ;
354+ else if (ab -> hw_rev == ATH11K_HW_QCN9074_HW10 )
355+ ath11k_mhi_config = & ath11k_mhi_config_qcn9074 ;
356+
357+ ret = mhi_register_controller (mhi_ctrl , ath11k_mhi_config );
258358 if (ret ) {
259359 ath11k_err (ab , "failed to register to mhi bus, err = %d\n" , ret );
260360 mhi_free_controller (mhi_ctrl );
0 commit comments