On Monday, 13 May 2019 22:58:00 CEST Sam Samy wrote:
>  I installed master branch openwrt onto Asus MAP-AC2200 AP. It has tri
> band. Its based on IPQ4019 DK04 QCA reference platform. 2 radios
> (2Ghz/5Ghz) on AHB bus and one 5GHZ on PCIe bus. Its generally working
> fine except one problem in 5Ghz. On both the 5Ghz radios the RSSI is
> pretty low on any 5Ghz channel I put it in.  In one feet range I see -60dB
> RSSI, where as the stock firmware that came with the AP gives an RSSI
> of -36dB at one foot distance.The downstream transmit rates are MCS8/9
> for most part. The 2Ghz is working fine.

It could be the boarddata which contains more than the targetpower and CTLs 
(and thus not necessarily visible in tpc_stats). As first check, test whether 
your board-2.bin has the md5sum 34c1e73e609a27eb9848fdc89cbc2be7 for 
/lib/firmware/ath10k/QCA4019/hw1.0/board-2.bin. Also check that the correct
BDF (with the variant string is loaded). But this should only affect 
the QCA4019 5GHz PHY because the QCA9886 boarddata is generated here using the 
pre-cal data from art (unsure whether this is valid or not for this board and 
bootup sequence).

You can just check with the ath10k-bdencoder [0] from qca-swiss-army-knife 
whether the board files from board-2.bin are the ones which also your stock 
firmware is loading.

The next big problem are filters in the rx/tx chains [1]. The ieee80211-freq-
limit in the DTS file should assist you and not allow you to chose the wrong 
channel/frequency for a specific PHY. But maybe the author accidentally 
switched the settings in the board and actually wanted the lower 5GHz channels 
on the SoC 5GHz PHY and the the upper 5GHz channels on the PCIe card? This 
would be at least worth a try.

> What is the reg. domains 0x20 and 0x58 value points to?

It is 20 (0x14) and not 0x20. Same for 58 (0x3a)

Btw. the regd numbers from QCA can be checked in regd_common.h [2]. The 
mapping in regDomainPairs is not necessarily correct because someone has to 
take them from the newest proprietary driver and use them to update the ath*k 
stuff.

>   Looks like ./sys/kernel/debug/ieee80211/phy2/ath10k/cal_data is junk
> for both the 5Ghz radios even though the
> pre-cal-pci-0000:01:00.0.bin/pre-cal-ahb-a800000.wifi.bin is correct.

Yes, the implemented method for reading the data is not correct for the
wave 2 cards (and maybe also other). You can try the attached hack. At 
least this worked in 2017 when I've poked around in the stuff with 
Christian Lamparter.

Kind regards,
        Sven

[0] 
https://github.com/qca/qca-swiss-army-knife/blob/master/tools/scripts/ath10k/ath10k-bdencoder
[1] 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=41a86debe3c0a01e075e749d0bb1c6d631e35c32
[2] 
https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/tree/drivers/net/wireless/ath/regd_common.h?id=5fad78689a9229d08ea11af53e48de3c2a845ea3#n29
diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c
index 43e3443..0687a3f 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -509,6 +509,38 @@ static int ath10k_push_board_ext_data(struct ath10k *ar, const void *data,
 	return 0;
 }
 
+static int ath10k_debug_cal_data_fetch(struct ath10k *ar)
+{
+	u32 board_data_size = ar->hw_params.fw.board_size;
+	u32 address;
+	int ret;
+	printk("%s:%u\n", __func__, __LINE__);
+
+	ret = ath10k_bmi_read32(ar, hi_board_data, &address);
+	if (ret) {
+		ath10k_err(ar, "could not read board data addr (%d)\n", ret);
+		goto exit;
+	}
+
+	ret = ath10k_bmi_read_memory(ar, address, ar->debug.cal_data,
+				      min_t(u32, board_data_size,
+					    ar->hw_params.cal_data_len));
+	if (ret) {
+		ath10k_warn(ar, "failed to read calibration data: %d\n", ret);
+		return ret;
+	}
+
+	ret = ath10k_bmi_write32(ar, hi_board_data_initialized, 1);
+	if (ret) {
+		ath10k_err(ar, "could not write board data bit (%d)\n", ret);
+		goto exit;
+	}
+	printk("%s:%u\n", __func__, __LINE__);
+
+exit:
+	return ret;
+}
+
 static int ath10k_download_board_data(struct ath10k *ar, const void *data,
 				      size_t data_len)
 {
@@ -704,7 +736,6 @@ static int ath10k_core_get_board_id_from_otp(struct ath10k *ar)
 
 	return 0;
 }
-
 static int ath10k_download_and_run_otp(struct ath10k *ar)
 {
 	u32 result, address = ar->hw_params.patch_load_addr;
@@ -746,6 +777,8 @@ static int ath10k_download_and_run_otp(struct ath10k *ar)
 		return ret;
 	}
 
+	ath10k_debug_cal_data_fetch(ar);
+
 	ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result);
 
 	if (!(skip_otp || test_bit(ATH10K_FW_FEATURE_IGNORE_OTP_RESULT,
diff --git a/drivers/net/wireless/ath/ath10k/debug.c b/drivers/net/wireless/ath/ath10k/debug.c
index fa72ef5..451bd59 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -1437,47 +1437,12 @@ static const struct file_operations fops_fw_dbglog = {
 	.llseek = default_llseek,
 };
 
-static int ath10k_debug_cal_data_fetch(struct ath10k *ar)
-{
-	u32 hi_addr;
-	__le32 addr;
-	int ret;
-
-	lockdep_assert_held(&ar->conf_mutex);
-
-	if (WARN_ON(ar->hw_params.cal_data_len > ATH10K_DEBUG_CAL_DATA_LEN))
-		return -EINVAL;
-
-	hi_addr = host_interest_item_address(HI_ITEM(hi_board_data));
-
-	ret = ath10k_hif_diag_read(ar, hi_addr, &addr, sizeof(addr));
-	if (ret) {
-		ath10k_warn(ar, "failed to read hi_board_data address: %d\n",
-			    ret);
-		return ret;
-	}
-
-	ret = ath10k_hif_diag_read(ar, le32_to_cpu(addr), ar->debug.cal_data,
-				   ar->hw_params.cal_data_len);
-	if (ret) {
-		ath10k_warn(ar, "failed to read calibration data: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
-}
-
 static int ath10k_debug_cal_data_open(struct inode *inode, struct file *file)
 {
 	struct ath10k *ar = inode->i_private;
 
 	mutex_lock(&ar->conf_mutex);
 
-	if (ar->state == ATH10K_STATE_ON ||
-	    ar->state == ATH10K_STATE_UTF) {
-		ath10k_debug_cal_data_fetch(ar);
-	}
-
 	file->private_data = ar;
 	mutex_unlock(&ar->conf_mutex);
 
@@ -1910,8 +1875,6 @@ void ath10k_debug_stop(struct ath10k *ar)
 {
 	lockdep_assert_held(&ar->conf_mutex);
 
-	ath10k_debug_cal_data_fetch(ar);
-
 	/* Must not use _sync to avoid deadlock, we do that in
 	 * ath10k_debug_destroy(). The check for htt_stats_mask is to avoid
 	 * warning from del_timer(). */
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1223,10 +1223,13 @@ static int ath10k_core_fetch_board_data_
 
 	/* attempt to find boardname in the IE list */
 	ret = ath10k_core_search_bd(ar, boardname, data, len);
+	printk("Trying boardname %s: %d\n", boardname, ret);
 
 	/* if we didn't find it and have a fallback name, try that */
-	if (ret == -ENOENT && fallback_boardname)
+	if (ret == -ENOENT && fallback_boardname) {
 		ret = ath10k_core_search_bd(ar, fallback_boardname, data, len);
+		printk("Falling back to boardname %s: %d\n", fallback_boardname, ret);
+	}
 
 	if (ret == -ENOENT) {
 		ath10k_err(ar,

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to