wlan-ap-Telecominfraproject/feeds/ipq807x/mac80211/patches/143-ath11k-add-caldb-addr-to-hw-params.patch
John Crispin 3affbc1cad QualComm/AX: add Hawkeye and Cypress support
This series is based on
* 2020-07-10 ipq6018-ilq-11-0_qca_oem-034672b0676c37b1f4519e5720e18e95fe6236ef

Add support for
* qsdk kernel/v4.4
* qsdk ethernet subsystem
* v5.7 ath11k backport + QualComm staging patches (wlan_ap_1.0)
* ath11k-firmware
* hostapd/iw/...

Feature support
* full boot, system detection
* sysupgrade to nand
* HE support via latest hostapd
* driver support for usb, crypto, hwmon, cpufreq, ...

Missing
* NSS/HW flow offloading - FW blob is not redistributable

Using the qsdk v4.4 is an intermediate solution while the vanilla is being
tested. Vanilla kernel is almost on feature par. Work has already started
to upstream the ethernet and switch drivers. Once complete the target will
be fully upstream.

Signed-off-by: John Crispin <john@phrozen.org>
2020-07-23 18:54:03 +02:00

171 lines
5.4 KiB
Diff

--- a/drivers/net/wireless/ath/ath11k/ahb.c
+++ b/drivers/net/wireless/ath/ath11k/ahb.c
@@ -632,13 +632,20 @@ void ath11k_ahb_power_down(struct ath11k
int ath11k_ahb_fwreset_from_cold_boot(struct ath11k_base *ab)
{
+ int timeout;
+
if (enable_cold_boot_cal == 0 || ab->qmi.cal_done)
return 0;
ath11k_dbg(ab, ATH11K_DBG_AHB, "wait for cold boot done\n");
- while (ab->qmi.cal_done == 0)
- msleep(ATH11K_FW_READY_DELAY);
+ timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, (ab->qmi.cal_done == 1),
+ ATH11K_COLD_BOOT_FW_RESET_DELAY);
+ if (timeout <= 0) {
+ ath11k_warn(ab, "Coldboot Calibration timed out\n");
+ return -ETIMEDOUT;
+ }
+
/* reset the firmware */
ath11k_ahb_power_down(ab);
ath11k_ahb_power_up(ab);
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -38,6 +38,7 @@ static const struct ath11k_hw_params ath
.spectral_fft_sz = 2,
.max_radios = 3,
.bdf_addr = 0x4B0C0000,
+ .caldb_addr = 0x4BA00000,
.hw_ops = &qca8074_ops,
},
{
@@ -51,6 +52,7 @@ static const struct ath11k_hw_params ath
.spectral_fft_sz = 4,
.max_radios = 2,
.bdf_addr = 0x4ABC0000,
+ .caldb_addr = 0x4B500000,
.hw_ops = &qca6018_ops,
},
};
@@ -950,6 +952,7 @@ struct ath11k_base *ath11k_core_alloc(st
INIT_LIST_HEAD(&ab->peers);
init_waitqueue_head(&ab->peer_mapping_wq);
init_waitqueue_head(&ab->wmi_ab.tx_credits_wq);
+ init_waitqueue_head(&ab->qmi.cold_boot_waitq);
INIT_WORK(&ab->restart_work, ath11k_core_restart);
timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
ab->dev = dev;
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -119,6 +119,7 @@ enum ath11k_firmware_mode {
ATH11K_FIRMWARE_MODE_COLD_BOOT = 7,
};
+extern bool enable_cold_boot_cal;
#define ATH11K_IRQ_NUM_MAX 52
#define ATH11K_EXT_IRQ_GRP_NUM_MAX 11
#define ATH11K_EXT_IRQ_NUM_MAX 16
--- a/drivers/net/wireless/ath/ath11k/hw.h
+++ b/drivers/net/wireless/ath/ath11k/hw.h
@@ -113,6 +113,7 @@ struct ath11k_hw_params {
u16 dev_id;
u8 max_radios;
u32 bdf_addr;
+ u32 caldb_addr;
struct {
const char *dir;
size_t board_size;
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -10,8 +10,8 @@
#include <linux/firmware.h>
/* set the default max assoc sta to max supported by driver */
-unsigned int enable_cold_boot_cal = 1;
-module_param(enable_cold_boot_cal, uint, 0644);
+bool enable_cold_boot_cal = 1;
+module_param(enable_cold_boot_cal, bool, 0644);
MODULE_PARM_DESC(enable_cold_boot_cal, "cold boot calibration enable:1 disable:0");
unsigned int enable_qdss_trace = 1;
@@ -2021,7 +2021,6 @@ out:
static int ath11k_qmi_alloc_target_mem_chunk(struct ath11k_base *ab)
{
int i, idx;
- u32 caldb_location[2] = {0, 0};
for (i = 0, idx = 0; i < ab->qmi.mem_seg_count; i++) {
switch (ab->qmi.target_mem[i].type) {
@@ -2038,15 +2037,9 @@ static int ath11k_qmi_alloc_target_mem_c
return -EINVAL;
}
- if (of_property_read_u32_array(ab->dev->of_node, "qcom,caldb-addr",
- &caldb_location[0],
- ARRAY_SIZE(caldb_location))) {
- ath11k_warn(ab, "qmi no bdf_addr in device_tree\n");
- }
-
if (enable_cold_boot_cal) {
- ab->qmi.target_mem[idx].paddr = caldb_location[ab->qmi.target_mem_mode];
- ab->qmi.target_mem[idx].vaddr = caldb_location[ab->qmi.target_mem_mode];
+ ab->qmi.target_mem[idx].paddr = ab->hw_params.caldb_addr;
+ ab->qmi.target_mem[idx].vaddr = ab->hw_params.caldb_addr;
} else {
ab->qmi.target_mem[idx].paddr = 0;
ab->qmi.target_mem[idx].vaddr = 0;
@@ -2505,7 +2498,7 @@ int ath11k_qmi_firmware_start(struct ath
int ath11k_qmi_process_coldboot_calibration(struct ath11k_base *ab)
{
int ret;
- int coldboot_wait_limit = 0;
+ int timeout;
ret = ath11k_qmi_wlanfw_mode_send(ab, ATH11K_FIRMWARE_MODE_COLD_BOOT);
if (ret < 0) {
@@ -2514,14 +2507,12 @@ int ath11k_qmi_process_coldboot_calibrat
}
ath11k_info(ab, "Coldboot calibration wait started\n");
- while (ab->qmi.cal_done == 0) {
- if (++coldboot_wait_limit >= ATH11K_COLD_BOOT_MAX_WAIT_LIMIT) {
- ath11k_warn(ab, "Coldboot Calibration timeout %d secs",
- coldboot_wait_limit / 10);
- return -EINVAL;
- }
- mdelay(ATH11K_FW_READY_DELAY);
- }
+ timeout = wait_event_timeout(ab->qmi.cold_boot_waitq, (ab->qmi.cal_done == 1),
+ ATH11K_COLD_BOOT_FW_RESET_DELAY);
+ if (timeout <= 0) {
+ ath11k_warn(ab, "Coldboot Calibration timed out\n");
+ return -ETIMEDOUT;
+ }
ath11k_info(ab, "Coldboot calibration wait ended\n");
@@ -2673,6 +2664,7 @@ static void ath11k_qmi_msg_cold_boot_cal
struct ath11k_base *ab = qmi->ab;
ab->qmi.cal_done = 1;
+ wake_up(&ab->qmi.cold_boot_waitq);
ath11k_dbg(ab, ATH11K_DBG_QMI, "qmi cold boot calibration done\n");
}
--- a/drivers/net/wireless/ath/ath11k/qmi.h
+++ b/drivers/net/wireless/ath/ath11k/qmi.h
@@ -38,10 +38,7 @@
#define ATH11K_FIRMWARE_MODE_OFF 4
#define ATH11K_QMI_TARGET_MEM_MODE_DEFAULT 0
-#define ATH11K_FW_READY_DELAY 100 /* 100 msec */
-#define ATH11K_COLD_BOOT_MAX_WAIT_LIMIT 400
-
-extern unsigned int enable_cold_boot_cal;
+#define ATH11K_COLD_BOOT_FW_RESET_DELAY (40 * HZ)
struct ath11k_base;
@@ -122,6 +119,7 @@ struct ath11k_qmi {
u32 target_mem_mode;
u8 cal_done;
struct target_info target;
+ wait_queue_head_t cold_boot_waitq;
};
#define QMI_WLANFW_QDSS_TRACE_CONFIG_DOWNLOAD_REQ_MSG_V01_MAX_LEN 6167