All of lore.kernel.org
 help / color / mirror / Atom feed
From: <yhchuang@realtek.com>
To: <kvalo@codeaurora.org>
Cc: <linux-wireless@vger.kernel.org>, <sgruszka@redhat.com>,
	<briannorris@chromium.org>
Subject: [PATCH v2 2/5] rtw88: check efuse for BT FT S1
Date: Thu, 25 Jul 2019 10:53:28 +0800	[thread overview]
Message-ID: <1564023211-3138-3-git-send-email-yhchuang@realtek.com> (raw)
In-Reply-To: <1564023211-3138-1-git-send-email-yhchuang@realtek.com>

From: Yan-Hsuan Chuang <yhchuang@realtek.com>

Some modules might not have full programed efuse.
Driver should check the BT FT S1 type to know that
if BT has been programed. If BT is not programed,
throw a warning to notify that this module is not
capable of working with WiFi + BT concurrently.

Signed-off-by: Yan-Hsuan Chuang <yhchuang@realtek.com>
---
v1 -> v2
    no change

 drivers/net/wireless/realtek/rtw88/efuse.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/efuse.c b/drivers/net/wireless/realtek/rtw88/efuse.c
index 66e56f3..82aa26a 100644
--- a/drivers/net/wireless/realtek/rtw88/efuse.c
+++ b/drivers/net/wireless/realtek/rtw88/efuse.c
@@ -8,6 +8,11 @@
 #include "debug.h"
 
 #define RTW_EFUSE_BANK_WIFI		0x0
+#define RTW_EFUSE_BANK_BT		0x1
+
+#define EFUSE_BT_S1_ADDR		0x4a
+#define EFUSE_BT_S1_TYPE1		0xff
+#define EFUSE_BT_S1_TYPE2		0x00
 
 static void switch_efuse_bank(struct rtw_dev *rtwdev, u8 efuse_bank)
 {
@@ -89,6 +94,7 @@ static int rtw_dump_physical_efuse_map(struct rtw_dev *rtwdev, u8 *map)
 	u32 efuse_ctl;
 	u32 addr;
 	u32 cnt;
+	u8 ft_ver;
 
 	switch_efuse_bank(rtwdev, RTW_EFUSE_BANK_WIFI);
 
@@ -113,6 +119,24 @@ static int rtw_dump_physical_efuse_map(struct rtw_dev *rtwdev, u8 *map)
 		*(map + addr) = (u8)(efuse_ctl & BIT_MASK_EF_DATA);
 	}
 
+	/* verify BT FT S1 efuse type */
+	switch_efuse_bank(rtwdev, RTW_EFUSE_BANK_BT);
+
+	efuse_ctl = rtw_read32(rtwdev, REG_EFUSE_CTRL);
+	efuse_ctl &= ~(BIT_MASK_EF_DATA | BITS_EF_ADDR);
+	efuse_ctl |= (EFUSE_BT_S1_ADDR & BIT_MASK_EF_ADDR) << BIT_SHIFT_EF_ADDR;
+	rtw_write32(rtwdev, REG_EFUSE_CTRL, efuse_ctl & (~BIT_EF_FLAG));
+
+	if (!check_hw_ready(rtwdev, REG_EFUSE_CTRL, BIT_EF_FLAG, 0x1)) {
+		rtw_err(rtwdev, "failed to read BT efuse\n");
+		return -EBUSY;
+	}
+
+	efuse_ctl = rtw_read32(rtwdev, REG_EFUSE_CTRL);
+	ft_ver = (u8)(efuse_ctl & BIT_MASK_EF_DATA);
+	if (ft_ver == EFUSE_BT_S1_TYPE1 || ft_ver == EFUSE_BT_S1_TYPE2)
+		rtw_warn(rtwdev, "BT S1 not calibrated, not recommended to verify BT for this module\n");
+
 	return 0;
 }
 
-- 
2.7.4


  parent reply	other threads:[~2019-07-25  2:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-25  2:53 [PATCH v2 0/5] rtw88: add support for BT co-existence mechanism yhchuang
2019-07-25  2:53 ` [PATCH v2 1/5] rtw88: switch specified efuse bank yhchuang
2019-07-25  2:53 ` yhchuang [this message]
2019-07-25  2:53 ` [PATCH v2 3/5] rtw88: allow c2h operation in irq context yhchuang
2019-07-25  2:53 ` [PATCH v2 4/5] rtw88: enclose c2h cmd handle with mutex yhchuang
2019-07-25  2:53 ` [PATCH v2 5/5] rtw88: add BT co-existence support yhchuang
2019-07-29  8:12   ` Stanislaw Gruszka
2019-07-30  3:13     ` Tony Chuang
2019-07-30  6:34       ` Stanislaw Gruszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1564023211-3138-3-git-send-email-yhchuang@realtek.com \
    --to=yhchuang@realtek.com \
    --cc=briannorris@chromium.org \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=sgruszka@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.