Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10418071ybi; Wed, 24 Jul 2019 22:52:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZHG0JomBvroohkh4FH5m/BdRdAeDtbkbmmoc/yDYyl2qe5YpbsYvoWP1n7w5bVxUJx5WP X-Received: by 2002:a17:902:b48f:: with SMTP id y15mr90925112plr.268.1564033928918; Wed, 24 Jul 2019 22:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564033928; cv=none; d=google.com; s=arc-20160816; b=bWUZZ86DA/DXXTZEWE2CTeguucpdh+BgkLSWd7N/Yfmpz3XFAUkv+AU2MFNfUgbM8r cP7rKXcg5rt/JAPHVo4+3I91q68MmgCW8oxGLeKBUwL8BgR2dbgc+pkmBvgGjULC1QtQ nb58FEwxC0gWGYXCjDlvCZTToAYOBM4cWAVJn0ZBANqAQh2UP0LU/EH64Uz+I7eYPpDQ 3EW57oxxlowBHvjz52CIUa5OuRYZuiUnBB59xbRIu4JMVsasFYsHNkjBV2Jy3JHMOibr p9CbF06FOoYew0GwEj5Z07v0Tw0Xl2Z4ThQ1YhginQY5Hp8pbSmzdZvMe/H1MwCLO6ac DqJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:authenticated-by; bh=DukJT3bMM52ygIFuwn2Gczk+9xafALuuYDEwiRMFZ90=; b=pGQHI/XRQ+VzwLGfysoJZ439+mgGtahGfWcM8cW53PMxj0bhBL1hVP531cIbM2ICeq 5yWI+0O0mUJFvXald8V/KcUDZyWmiAtR3GDaufMcFmuadzX6qlu2M9Kh55LNkByjpFR4 IqLPhmAkhJdbBBb2+Dn7UV0/AA+sgmOTJ6IC0EukDvpyAssoFfgnVCNvtUNqTQy+6Bdg ugKquGUIoDm7+H0zgqAzqK9KqvZdo4PrNAh9kgl/xBR2m3Jn5ddpHaiX1WaJyqEtQDfU RaFeUA2+fVqW+DWM2XWHM2FOiFezgFXy1qTmesripk/RHpwjHSV+/XZRjcm//BI6V8dT HZPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7si7431632pgs.210.2019.07.24.22.51.54; Wed, 24 Jul 2019 22:52:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-wireless-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389440AbfGYCye (ORCPT + 99 others); Wed, 24 Jul 2019 22:54:34 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:60788 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389431AbfGYCyd (ORCPT ); Wed, 24 Jul 2019 22:54:33 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x6P2sOaU010428, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (RTITCASV01.realtek.com.tw[172.21.6.18]) by rtits2.realtek.com.tw (8.15.2/2.57/5.78) with ESMTPS id x6P2sOaU010428 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 25 Jul 2019 10:54:24 +0800 Received: from localhost.localdomain (172.21.68.126) by RTITCASV01.realtek.com.tw (172.21.6.18) with Microsoft SMTP Server id 14.3.439.0; Thu, 25 Jul 2019 10:54:23 +0800 From: To: CC: , , Subject: [PATCH v2 2/5] rtw88: check efuse for BT FT S1 Date: Thu, 25 Jul 2019 10:53:28 +0800 Message-ID: <1564023211-3138-3-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564023211-3138-1-git-send-email-yhchuang@realtek.com> References: <1564023211-3138-1-git-send-email-yhchuang@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.68.126] Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Yan-Hsuan Chuang 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 --- 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