Skip to content

Commit 521fc37

Browse files
Maharaja KennadyrajanKalle Valo
Maharaja Kennadyrajan
authored and
Kalle Valo
committed
ath10k: Avoid override CE5 configuration for QCA99X0 chipsets
As the exisiting CE configurations are defined in global, there are the chances of QCA99X0 family chipsets CE configurations are getting changed by the ath10k_pci_override_ce_config() function. The override will be hit and CE5 configurations will be changed, when the user bring up the QCA99X0 chipsets along with QCA6174 or QCA9377 chipset. (Bring up QCA99X0 family chipsets after QCA6174 or QCA9377). Hence, fixing this issue by moving the global CE configuration to radio specific CE configuration. Tested hardware: QCA9888 & QCA6174 Tested firmware: 10.4-3.10-00047 & WLAN.RM.4.4.1.c3-00058 Signed-off-by: Maharaja Kennadyrajan <[email protected]> Signed-off-by: Kalle Valo <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 657680c commit 521fc37

File tree

4 files changed

+61
-19
lines changed

4 files changed

+61
-19
lines changed

drivers/net/wireless/ath/ath10k/ce.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ struct ce_pipe_config {
419419
#define PIPEDIR_INOUT 3 /* bidirectional */
420420

421421
/* Establish a mapping between a service/direction and a pipe. */
422-
struct service_to_pipe {
422+
struct ce_service_to_pipe {
423423
__le32 service_id;
424424
__le32 pipedir;
425425
__le32 pipenum;

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state);
116116
static void ath10k_pci_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state);
117117
static void ath10k_pci_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state);
118118

119-
static struct ce_attr host_ce_config_wlan[] = {
119+
static const struct ce_attr pci_host_ce_config_wlan[] = {
120120
/* CE0: host->target HTC control and raw streams */
121121
{
122122
.flags = CE_ATTR_FLAGS,
@@ -222,7 +222,7 @@ static struct ce_attr host_ce_config_wlan[] = {
222222
};
223223

224224
/* Target firmware's Copy Engine configuration. */
225-
static struct ce_pipe_config target_ce_config_wlan[] = {
225+
static const struct ce_pipe_config pci_target_ce_config_wlan[] = {
226226
/* CE0: host->target HTC control and raw streams */
227227
{
228228
.pipenum = __cpu_to_le32(0),
@@ -335,7 +335,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = {
335335
* This table is derived from the CE_PCI TABLE, above.
336336
* It is passed to the Target at startup for use by firmware.
337337
*/
338-
static struct service_to_pipe target_service_to_ce_map_wlan[] = {
338+
static const struct ce_service_to_pipe pci_target_service_to_ce_map_wlan[] = {
339339
{
340340
__cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO),
341341
__cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
@@ -1787,6 +1787,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
17871787
void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
17881788
int force)
17891789
{
1790+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1791+
17901792
ath10k_dbg(ar, ATH10K_DBG_PCI, "pci hif send complete check\n");
17911793

17921794
if (!force) {
@@ -1804,7 +1806,7 @@ void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
18041806
* If at least 50% of the total resources are still available,
18051807
* don't bother checking again yet.
18061808
*/
1807-
if (resources > (host_ce_config_wlan[pipe].src_nentries >> 1))
1809+
if (resources > (ar_pci->attr[pipe].src_nentries >> 1))
18081810
return;
18091811
}
18101812
ath10k_ce_per_engine_service(ar, pipe);
@@ -1820,14 +1822,15 @@ static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
18201822
int ath10k_pci_hif_map_service_to_pipe(struct ath10k *ar, u16 service_id,
18211823
u8 *ul_pipe, u8 *dl_pipe)
18221824
{
1823-
const struct service_to_pipe *entry;
1825+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
1826+
const struct ce_service_to_pipe *entry;
18241827
bool ul_set = false, dl_set = false;
18251828
int i;
18261829

18271830
ath10k_dbg(ar, ATH10K_DBG_PCI, "pci hif map service\n");
18281831

1829-
for (i = 0; i < ARRAY_SIZE(target_service_to_ce_map_wlan); i++) {
1830-
entry = &target_service_to_ce_map_wlan[i];
1832+
for (i = 0; i < ARRAY_SIZE(pci_target_service_to_ce_map_wlan); i++) {
1833+
entry = &ar_pci->serv_to_pipe[i];
18311834

18321835
if (__le32_to_cpu(entry->service_id) != service_id)
18331836
continue;
@@ -2316,6 +2319,7 @@ static int ath10k_bus_get_num_banks(struct ath10k *ar)
23162319

23172320
int ath10k_pci_init_config(struct ath10k *ar)
23182321
{
2322+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
23192323
u32 interconnect_targ_addr;
23202324
u32 pcie_state_targ_addr = 0;
23212325
u32 pipe_cfg_targ_addr = 0;
@@ -2361,7 +2365,7 @@ int ath10k_pci_init_config(struct ath10k *ar)
23612365
}
23622366

23632367
ret = ath10k_pci_diag_write_mem(ar, pipe_cfg_targ_addr,
2364-
target_ce_config_wlan,
2368+
ar_pci->pipe_config,
23652369
sizeof(struct ce_pipe_config) *
23662370
NUM_TARGET_CE_CONFIG_WLAN);
23672371

@@ -2386,8 +2390,8 @@ int ath10k_pci_init_config(struct ath10k *ar)
23862390
}
23872391

23882392
ret = ath10k_pci_diag_write_mem(ar, svc_to_pipe_map,
2389-
target_service_to_ce_map_wlan,
2390-
sizeof(target_service_to_ce_map_wlan));
2393+
ar_pci->serv_to_pipe,
2394+
sizeof(pci_target_service_to_ce_map_wlan));
23912395
if (ret != 0) {
23922396
ath10k_err(ar, "Failed to write svc/pipe map: %d\n", ret);
23932397
return ret;
@@ -2459,23 +2463,24 @@ static void ath10k_pci_override_ce_config(struct ath10k *ar)
24592463
{
24602464
struct ce_attr *attr;
24612465
struct ce_pipe_config *config;
2466+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
24622467

24632468
/* For QCA6174 we're overriding the Copy Engine 5 configuration,
24642469
* since it is currently used for other feature.
24652470
*/
24662471

24672472
/* Override Host's Copy Engine 5 configuration */
2468-
attr = &host_ce_config_wlan[5];
2473+
attr = &ar_pci->attr[5];
24692474
attr->src_sz_max = 0;
24702475
attr->dest_nentries = 0;
24712476

24722477
/* Override Target firmware's Copy Engine configuration */
2473-
config = &target_ce_config_wlan[5];
2478+
config = &ar_pci->pipe_config[5];
24742479
config->pipedir = __cpu_to_le32(PIPEDIR_OUT);
24752480
config->nbytes_max = __cpu_to_le32(2048);
24762481

24772482
/* Map from service/endpoint to Copy Engine */
2478-
target_service_to_ce_map_wlan[15].pipenum = __cpu_to_le32(1);
2483+
ar_pci->serv_to_pipe[15].pipenum = __cpu_to_le32(1);
24792484
}
24802485

24812486
int ath10k_pci_alloc_pipes(struct ath10k *ar)
@@ -2491,7 +2496,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar)
24912496
pipe->pipe_num = i;
24922497
pipe->hif_ce_state = ar;
24932498

2494-
ret = ath10k_ce_alloc_pipe(ar, i, &host_ce_config_wlan[i]);
2499+
ret = ath10k_ce_alloc_pipe(ar, i, &ar_pci->attr[i]);
24952500
if (ret) {
24962501
ath10k_err(ar, "failed to allocate copy engine pipe %d: %d\n",
24972502
i, ret);
@@ -2504,7 +2509,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar)
25042509
continue;
25052510
}
25062511

2507-
pipe->buf_sz = (size_t)(host_ce_config_wlan[i].src_sz_max);
2512+
pipe->buf_sz = (size_t)(ar_pci->attr[i].src_sz_max);
25082513
}
25092514

25102515
return 0;
@@ -2520,10 +2525,11 @@ void ath10k_pci_free_pipes(struct ath10k *ar)
25202525

25212526
int ath10k_pci_init_pipes(struct ath10k *ar)
25222527
{
2528+
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
25232529
int i, ret;
25242530

25252531
for (i = 0; i < CE_COUNT; i++) {
2526-
ret = ath10k_ce_init_pipe(ar, i, &host_ce_config_wlan[i]);
2532+
ret = ath10k_ce_init_pipe(ar, i, &ar_pci->attr[i]);
25272533
if (ret) {
25282534
ath10k_err(ar, "failed to initialize copy engine pipe %d: %d\n",
25292535
i, ret);
@@ -3595,6 +3601,30 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
35953601

35963602
timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0);
35973603

3604+
ar_pci->attr = kmemdup(pci_host_ce_config_wlan,
3605+
sizeof(pci_host_ce_config_wlan),
3606+
GFP_KERNEL);
3607+
if (!ar_pci->attr) {
3608+
ret = -ENOMEM;
3609+
goto err_free;
3610+
}
3611+
3612+
ar_pci->pipe_config = kmemdup(pci_target_ce_config_wlan,
3613+
sizeof(pci_target_ce_config_wlan),
3614+
GFP_KERNEL);
3615+
if (!ar_pci->pipe_config) {
3616+
ret = -ENOMEM;
3617+
goto err_free;
3618+
}
3619+
3620+
ar_pci->serv_to_pipe = kmemdup(pci_target_service_to_ce_map_wlan,
3621+
sizeof(pci_target_service_to_ce_map_wlan),
3622+
GFP_KERNEL);
3623+
if (!ar_pci->serv_to_pipe) {
3624+
ret = -ENOMEM;
3625+
goto err_free;
3626+
}
3627+
35983628
ret = ath10k_pci_setup_resource(ar);
35993629
if (ret) {
36003630
ath10k_err(ar, "failed to setup resource: %d\n", ret);
@@ -3690,6 +3720,11 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
36903720
err_core_destroy:
36913721
ath10k_core_destroy(ar);
36923722

3723+
err_free:
3724+
kfree(ar_pci->attr);
3725+
kfree(ar_pci->pipe_config);
3726+
kfree(ar_pci->serv_to_pipe);
3727+
36933728
return ret;
36943729
}
36953730

@@ -3715,6 +3750,9 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
37153750
ath10k_pci_sleep_sync(ar);
37163751
ath10k_pci_release(ar);
37173752
ath10k_core_destroy(ar);
3753+
kfree(ar_pci->attr);
3754+
kfree(ar_pci->pipe_config);
3755+
kfree(ar_pci->serv_to_pipe);
37183756
}
37193757

37203758
MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table);

drivers/net/wireless/ath/ath10k/pci.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ struct ath10k_pci {
183183
* this struct.
184184
*/
185185
struct ath10k_ahb ahb[0];
186+
187+
struct ce_attr *attr;
188+
struct ce_pipe_config *pipe_config;
189+
struct ce_service_to_pipe *serv_to_pipe;
186190
};
187191

188192
static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)

drivers/net/wireless/ath/ath10k/snoc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = {
356356
},
357357
};
358358

359-
static struct service_to_pipe target_service_to_ce_map_wlan[] = {
359+
static struct ce_service_to_pipe target_service_to_ce_map_wlan[] = {
360360
{
361361
__cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO),
362362
__cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
@@ -769,7 +769,7 @@ static int ath10k_snoc_hif_map_service_to_pipe(struct ath10k *ar,
769769
u16 service_id,
770770
u8 *ul_pipe, u8 *dl_pipe)
771771
{
772-
const struct service_to_pipe *entry;
772+
const struct ce_service_to_pipe *entry;
773773
bool ul_set = false, dl_set = false;
774774
int i;
775775

0 commit comments

Comments
 (0)