Commit 727fae14 authored by Carl Huang's avatar Carl Huang Committed by Kalle Valo

ath11k: enable internal sleep clock

On x86 and other non-qcom platforms, host needs to explicitly tell the firmware
to use the internal sleep clock. Some QCA6390 modules have OTP burnt with
external sleep clock selected, and these modules can't work expectedly unless
firmware selects internal sleep clock.

Add a field to hw_params to support this difference.

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1
Tested-on: IPQ8074 hw2.0 AHB WLAN.HK.2.1.0.1-01238-QCAHKSWPL_SILICONZ-2
Signed-off-by: default avatarCarl Huang <cjhuang@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1597389030-13887-11-git-send-email-kvalo@codeaurora.org
parent 6c809d04
...@@ -31,6 +31,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { ...@@ -31,6 +31,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.bdf_addr = 0x4B0C0000, .bdf_addr = 0x4B0C0000,
.hw_ops = &ipq8074_ops, .hw_ops = &ipq8074_ops,
.ring_mask = &ath11k_hw_ring_mask_ipq8074, .ring_mask = &ath11k_hw_ring_mask_ipq8074,
.internal_sleep_clock = false,
}, },
{ {
.name = "qca6390 hw2.0", .name = "qca6390 hw2.0",
...@@ -44,6 +45,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = { ...@@ -44,6 +45,7 @@ static const struct ath11k_hw_params ath11k_hw_params[] = {
.bdf_addr = 0x4B0C0000, .bdf_addr = 0x4B0C0000,
.hw_ops = &qca6390_ops, .hw_ops = &qca6390_ops,
.ring_mask = &ath11k_hw_ring_mask_ipq8074, .ring_mask = &ath11k_hw_ring_mask_ipq8074,
.internal_sleep_clock = true,
}, },
}; };
......
...@@ -133,6 +133,8 @@ struct ath11k_hw_params { ...@@ -133,6 +133,8 @@ struct ath11k_hw_params {
const struct ath11k_hw_ops *hw_ops; const struct ath11k_hw_ops *hw_ops;
const struct ath11k_hw_ring_mask *ring_mask; const struct ath11k_hw_ring_mask *ring_mask;
bool internal_sleep_clock;
}; };
extern const struct ath11k_hw_ops ipq8074_ops; extern const struct ath11k_hw_ops ipq8074_ops;
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#include <linux/of.h> #include <linux/of.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#define SLEEP_CLOCK_SELECT_INTERNAL_BIT 0x02
#define HOST_CSTATE_BIT 0x04
static struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = { static struct qmi_elem_info qmi_wlanfw_host_cap_req_msg_v01_ei[] = {
{ {
.data_type = QMI_OPT_FLAG, .data_type = QMI_OPT_FLAG,
...@@ -1531,6 +1534,20 @@ static int ath11k_qmi_host_cap_send(struct ath11k_base *ab) ...@@ -1531,6 +1534,20 @@ static int ath11k_qmi_host_cap_send(struct ath11k_base *ab)
req.cal_done_valid = 1; req.cal_done_valid = 1;
req.cal_done = ab->qmi.cal_done; req.cal_done = ab->qmi.cal_done;
if (ab->hw_params.internal_sleep_clock) {
req.nm_modem_valid = 1;
/* Notify firmware that this is non-qualcomm platform. */
req.nm_modem |= HOST_CSTATE_BIT;
/* Notify firmware about the sleep clock selection,
* nm_modem_bit[1] is used for this purpose. Host driver on
* non-qualcomm platforms should select internal sleep
* clock.
*/
req.nm_modem |= SLEEP_CLOCK_SELECT_INTERNAL_BIT;
}
ret = qmi_txn_init(&ab->qmi.handle, &txn, ret = qmi_txn_init(&ab->qmi.handle, &txn,
qmi_wlanfw_host_cap_resp_msg_v01_ei, &resp); qmi_wlanfw_host_cap_resp_msg_v01_ei, &resp);
if (ret < 0) if (ret < 0)
......
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