Commit 521fc37b authored by Maharaja Kennadyrajan's avatar Maharaja Kennadyrajan Committed by Kalle Valo

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: default avatarMaharaja Kennadyrajan <mkenna@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1587649759-14381-1-git-send-email-mkenna@codeaurora.org
parent 657680cc
...@@ -419,7 +419,7 @@ struct ce_pipe_config { ...@@ -419,7 +419,7 @@ struct ce_pipe_config {
#define PIPEDIR_INOUT 3 /* bidirectional */ #define PIPEDIR_INOUT 3 /* bidirectional */
/* Establish a mapping between a service/direction and a pipe. */ /* Establish a mapping between a service/direction and a pipe. */
struct service_to_pipe { struct ce_service_to_pipe {
__le32 service_id; __le32 service_id;
__le32 pipedir; __le32 pipedir;
__le32 pipenum; __le32 pipenum;
......
...@@ -116,7 +116,7 @@ static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state); ...@@ -116,7 +116,7 @@ static void ath10k_pci_htt_rx_cb(struct ath10k_ce_pipe *ce_state);
static void ath10k_pci_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state); static void ath10k_pci_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state);
static void ath10k_pci_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state); static void ath10k_pci_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state);
static struct ce_attr host_ce_config_wlan[] = { static const struct ce_attr pci_host_ce_config_wlan[] = {
/* CE0: host->target HTC control and raw streams */ /* CE0: host->target HTC control and raw streams */
{ {
.flags = CE_ATTR_FLAGS, .flags = CE_ATTR_FLAGS,
...@@ -222,7 +222,7 @@ static struct ce_attr host_ce_config_wlan[] = { ...@@ -222,7 +222,7 @@ static struct ce_attr host_ce_config_wlan[] = {
}; };
/* Target firmware's Copy Engine configuration. */ /* Target firmware's Copy Engine configuration. */
static struct ce_pipe_config target_ce_config_wlan[] = { static const struct ce_pipe_config pci_target_ce_config_wlan[] = {
/* CE0: host->target HTC control and raw streams */ /* CE0: host->target HTC control and raw streams */
{ {
.pipenum = __cpu_to_le32(0), .pipenum = __cpu_to_le32(0),
...@@ -335,7 +335,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = { ...@@ -335,7 +335,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = {
* This table is derived from the CE_PCI TABLE, above. * This table is derived from the CE_PCI TABLE, above.
* It is passed to the Target at startup for use by firmware. * It is passed to the Target at startup for use by firmware.
*/ */
static struct service_to_pipe target_service_to_ce_map_wlan[] = { static const struct ce_service_to_pipe pci_target_service_to_ce_map_wlan[] = {
{ {
__cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO), __cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO),
__cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ __cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */
...@@ -1787,6 +1787,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar) ...@@ -1787,6 +1787,8 @@ static void ath10k_pci_fw_crashed_dump(struct ath10k *ar)
void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
int force) int force)
{ {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
ath10k_dbg(ar, ATH10K_DBG_PCI, "pci hif send complete check\n"); ath10k_dbg(ar, ATH10K_DBG_PCI, "pci hif send complete check\n");
if (!force) { if (!force) {
...@@ -1804,7 +1806,7 @@ void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, ...@@ -1804,7 +1806,7 @@ void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
* If at least 50% of the total resources are still available, * If at least 50% of the total resources are still available,
* don't bother checking again yet. * don't bother checking again yet.
*/ */
if (resources > (host_ce_config_wlan[pipe].src_nentries >> 1)) if (resources > (ar_pci->attr[pipe].src_nentries >> 1))
return; return;
} }
ath10k_ce_per_engine_service(ar, pipe); ath10k_ce_per_engine_service(ar, pipe);
...@@ -1820,14 +1822,15 @@ static void ath10k_pci_rx_retry_sync(struct ath10k *ar) ...@@ -1820,14 +1822,15 @@ static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
int ath10k_pci_hif_map_service_to_pipe(struct ath10k *ar, u16 service_id, int ath10k_pci_hif_map_service_to_pipe(struct ath10k *ar, u16 service_id,
u8 *ul_pipe, u8 *dl_pipe) u8 *ul_pipe, u8 *dl_pipe)
{ {
const struct service_to_pipe *entry; struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
const struct ce_service_to_pipe *entry;
bool ul_set = false, dl_set = false; bool ul_set = false, dl_set = false;
int i; int i;
ath10k_dbg(ar, ATH10K_DBG_PCI, "pci hif map service\n"); ath10k_dbg(ar, ATH10K_DBG_PCI, "pci hif map service\n");
for (i = 0; i < ARRAY_SIZE(target_service_to_ce_map_wlan); i++) { for (i = 0; i < ARRAY_SIZE(pci_target_service_to_ce_map_wlan); i++) {
entry = &target_service_to_ce_map_wlan[i]; entry = &ar_pci->serv_to_pipe[i];
if (__le32_to_cpu(entry->service_id) != service_id) if (__le32_to_cpu(entry->service_id) != service_id)
continue; continue;
...@@ -2316,6 +2319,7 @@ static int ath10k_bus_get_num_banks(struct ath10k *ar) ...@@ -2316,6 +2319,7 @@ static int ath10k_bus_get_num_banks(struct ath10k *ar)
int ath10k_pci_init_config(struct ath10k *ar) int ath10k_pci_init_config(struct ath10k *ar)
{ {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
u32 interconnect_targ_addr; u32 interconnect_targ_addr;
u32 pcie_state_targ_addr = 0; u32 pcie_state_targ_addr = 0;
u32 pipe_cfg_targ_addr = 0; u32 pipe_cfg_targ_addr = 0;
...@@ -2361,7 +2365,7 @@ int ath10k_pci_init_config(struct ath10k *ar) ...@@ -2361,7 +2365,7 @@ int ath10k_pci_init_config(struct ath10k *ar)
} }
ret = ath10k_pci_diag_write_mem(ar, pipe_cfg_targ_addr, ret = ath10k_pci_diag_write_mem(ar, pipe_cfg_targ_addr,
target_ce_config_wlan, ar_pci->pipe_config,
sizeof(struct ce_pipe_config) * sizeof(struct ce_pipe_config) *
NUM_TARGET_CE_CONFIG_WLAN); NUM_TARGET_CE_CONFIG_WLAN);
...@@ -2386,8 +2390,8 @@ int ath10k_pci_init_config(struct ath10k *ar) ...@@ -2386,8 +2390,8 @@ int ath10k_pci_init_config(struct ath10k *ar)
} }
ret = ath10k_pci_diag_write_mem(ar, svc_to_pipe_map, ret = ath10k_pci_diag_write_mem(ar, svc_to_pipe_map,
target_service_to_ce_map_wlan, ar_pci->serv_to_pipe,
sizeof(target_service_to_ce_map_wlan)); sizeof(pci_target_service_to_ce_map_wlan));
if (ret != 0) { if (ret != 0) {
ath10k_err(ar, "Failed to write svc/pipe map: %d\n", ret); ath10k_err(ar, "Failed to write svc/pipe map: %d\n", ret);
return ret; return ret;
...@@ -2459,23 +2463,24 @@ static void ath10k_pci_override_ce_config(struct ath10k *ar) ...@@ -2459,23 +2463,24 @@ static void ath10k_pci_override_ce_config(struct ath10k *ar)
{ {
struct ce_attr *attr; struct ce_attr *attr;
struct ce_pipe_config *config; struct ce_pipe_config *config;
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
/* For QCA6174 we're overriding the Copy Engine 5 configuration, /* For QCA6174 we're overriding the Copy Engine 5 configuration,
* since it is currently used for other feature. * since it is currently used for other feature.
*/ */
/* Override Host's Copy Engine 5 configuration */ /* Override Host's Copy Engine 5 configuration */
attr = &host_ce_config_wlan[5]; attr = &ar_pci->attr[5];
attr->src_sz_max = 0; attr->src_sz_max = 0;
attr->dest_nentries = 0; attr->dest_nentries = 0;
/* Override Target firmware's Copy Engine configuration */ /* Override Target firmware's Copy Engine configuration */
config = &target_ce_config_wlan[5]; config = &ar_pci->pipe_config[5];
config->pipedir = __cpu_to_le32(PIPEDIR_OUT); config->pipedir = __cpu_to_le32(PIPEDIR_OUT);
config->nbytes_max = __cpu_to_le32(2048); config->nbytes_max = __cpu_to_le32(2048);
/* Map from service/endpoint to Copy Engine */ /* Map from service/endpoint to Copy Engine */
target_service_to_ce_map_wlan[15].pipenum = __cpu_to_le32(1); ar_pci->serv_to_pipe[15].pipenum = __cpu_to_le32(1);
} }
int ath10k_pci_alloc_pipes(struct ath10k *ar) int ath10k_pci_alloc_pipes(struct ath10k *ar)
...@@ -2491,7 +2496,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar) ...@@ -2491,7 +2496,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar)
pipe->pipe_num = i; pipe->pipe_num = i;
pipe->hif_ce_state = ar; pipe->hif_ce_state = ar;
ret = ath10k_ce_alloc_pipe(ar, i, &host_ce_config_wlan[i]); ret = ath10k_ce_alloc_pipe(ar, i, &ar_pci->attr[i]);
if (ret) { if (ret) {
ath10k_err(ar, "failed to allocate copy engine pipe %d: %d\n", ath10k_err(ar, "failed to allocate copy engine pipe %d: %d\n",
i, ret); i, ret);
...@@ -2504,7 +2509,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar) ...@@ -2504,7 +2509,7 @@ int ath10k_pci_alloc_pipes(struct ath10k *ar)
continue; continue;
} }
pipe->buf_sz = (size_t)(host_ce_config_wlan[i].src_sz_max); pipe->buf_sz = (size_t)(ar_pci->attr[i].src_sz_max);
} }
return 0; return 0;
...@@ -2520,10 +2525,11 @@ void ath10k_pci_free_pipes(struct ath10k *ar) ...@@ -2520,10 +2525,11 @@ void ath10k_pci_free_pipes(struct ath10k *ar)
int ath10k_pci_init_pipes(struct ath10k *ar) int ath10k_pci_init_pipes(struct ath10k *ar)
{ {
struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
int i, ret; int i, ret;
for (i = 0; i < CE_COUNT; i++) { for (i = 0; i < CE_COUNT; i++) {
ret = ath10k_ce_init_pipe(ar, i, &host_ce_config_wlan[i]); ret = ath10k_ce_init_pipe(ar, i, &ar_pci->attr[i]);
if (ret) { if (ret) {
ath10k_err(ar, "failed to initialize copy engine pipe %d: %d\n", ath10k_err(ar, "failed to initialize copy engine pipe %d: %d\n",
i, ret); i, ret);
...@@ -3595,6 +3601,30 @@ static int ath10k_pci_probe(struct pci_dev *pdev, ...@@ -3595,6 +3601,30 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0); timer_setup(&ar_pci->ps_timer, ath10k_pci_ps_timer, 0);
ar_pci->attr = kmemdup(pci_host_ce_config_wlan,
sizeof(pci_host_ce_config_wlan),
GFP_KERNEL);
if (!ar_pci->attr) {
ret = -ENOMEM;
goto err_free;
}
ar_pci->pipe_config = kmemdup(pci_target_ce_config_wlan,
sizeof(pci_target_ce_config_wlan),
GFP_KERNEL);
if (!ar_pci->pipe_config) {
ret = -ENOMEM;
goto err_free;
}
ar_pci->serv_to_pipe = kmemdup(pci_target_service_to_ce_map_wlan,
sizeof(pci_target_service_to_ce_map_wlan),
GFP_KERNEL);
if (!ar_pci->serv_to_pipe) {
ret = -ENOMEM;
goto err_free;
}
ret = ath10k_pci_setup_resource(ar); ret = ath10k_pci_setup_resource(ar);
if (ret) { if (ret) {
ath10k_err(ar, "failed to setup resource: %d\n", ret); ath10k_err(ar, "failed to setup resource: %d\n", ret);
...@@ -3690,6 +3720,11 @@ static int ath10k_pci_probe(struct pci_dev *pdev, ...@@ -3690,6 +3720,11 @@ static int ath10k_pci_probe(struct pci_dev *pdev,
err_core_destroy: err_core_destroy:
ath10k_core_destroy(ar); ath10k_core_destroy(ar);
err_free:
kfree(ar_pci->attr);
kfree(ar_pci->pipe_config);
kfree(ar_pci->serv_to_pipe);
return ret; return ret;
} }
...@@ -3715,6 +3750,9 @@ static void ath10k_pci_remove(struct pci_dev *pdev) ...@@ -3715,6 +3750,9 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
ath10k_pci_sleep_sync(ar); ath10k_pci_sleep_sync(ar);
ath10k_pci_release(ar); ath10k_pci_release(ar);
ath10k_core_destroy(ar); ath10k_core_destroy(ar);
kfree(ar_pci->attr);
kfree(ar_pci->pipe_config);
kfree(ar_pci->serv_to_pipe);
} }
MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table); MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table);
......
...@@ -183,6 +183,10 @@ struct ath10k_pci { ...@@ -183,6 +183,10 @@ struct ath10k_pci {
* this struct. * this struct.
*/ */
struct ath10k_ahb ahb[0]; struct ath10k_ahb ahb[0];
struct ce_attr *attr;
struct ce_pipe_config *pipe_config;
struct ce_service_to_pipe *serv_to_pipe;
}; };
static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar) static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar)
......
...@@ -356,7 +356,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = { ...@@ -356,7 +356,7 @@ static struct ce_pipe_config target_ce_config_wlan[] = {
}, },
}; };
static struct service_to_pipe target_service_to_ce_map_wlan[] = { static struct ce_service_to_pipe target_service_to_ce_map_wlan[] = {
{ {
__cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO), __cpu_to_le32(ATH10K_HTC_SVC_ID_WMI_DATA_VO),
__cpu_to_le32(PIPEDIR_OUT), /* out = UL = host -> target */ __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, ...@@ -769,7 +769,7 @@ static int ath10k_snoc_hif_map_service_to_pipe(struct ath10k *ar,
u16 service_id, u16 service_id,
u8 *ul_pipe, u8 *dl_pipe) u8 *ul_pipe, u8 *dl_pipe)
{ {
const struct service_to_pipe *entry; const struct ce_service_to_pipe *entry;
bool ul_set = false, dl_set = false; bool ul_set = false, dl_set = false;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment