Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp5283001ybh; Wed, 7 Aug 2019 03:42:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqzR19ZG+oH2D57UvNS55aT2qnjIlLbVG3RRLORohNEYzSdWVilq7OK5ggW4cXCHfM3cJTwQ X-Received: by 2002:a63:3281:: with SMTP id y123mr6988656pgy.72.1565174550159; Wed, 07 Aug 2019 03:42:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565174550; cv=none; d=google.com; s=arc-20160816; b=ZInFL64Gkw4LgLAwZyEeSxXsS5wJ2xHBsjqZ4nEFRqx4wAM6j2TJCWLRpcp/Pxt9eL PdPTulwVzWQ3xZVafMlJbG6Em9Wd5EEiFqhcHxg4ZwNkwXnxOdPH9grcmIPBBuSc/rkD jRPo/29JAhUDbj+Efv/zaA+rPqCGovUv8U6eZnFfr0J9nNriKpXeoF+Di5qgGeRnsNxF MbMzFR8a/eEXtmacnwm5Mfa2pZyUC/dqYrIpoX6appjPfxpe6xpAlww/ZGiP28vUr1au TeJzX5+NGwymXs11MUxXl8oyJviJlgh+n5qWULm0nX3CoQQjNBuwgxeC7V59nnM3Xxvf wUMQ== 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=Ua1aupZQ7EdK29y3HWYa5i+KUNgBbNfQO9rvVbAHmlk=; b=n1PIxHTeLKXH4Z/2kOUrnl5bH4XYqz/JXlm6C1Y2UjtZjPyIpaA8840Kuog/yNycmK JMcBHJ7ox891u08pOQJDPdp1Q1M5EAv3dkbYbJBrw3NFo4kHBsi4538xVWwIAWbVdt0o ZWDNiyMYTcjYEdxqXyShUYZT5gcls/7wjLzK1J+CH3Qx86QKj7BmBVcr5wfeqKaMzyi5 h6H/5jQF9kBGpMvmt6/aiQGb1BD5r5M4OvAFvgqvTNcrslS7+FF4Jd0OFNvJCVjsgE/3 cRk7P8YDfiVWuty+ENqTFbA3YPmoZrWIFjvgnQGrnR94UUnQX21nl8gdMf+59K12CXdt t2vQ== 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 24si36430971pfn.144.2019.08.07.03.42.15; Wed, 07 Aug 2019 03:42:30 -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 S1727522AbfHGKkZ (ORCPT + 99 others); Wed, 7 Aug 2019 06:40:25 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:56213 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726893AbfHGKkZ (ORCPT ); Wed, 7 Aug 2019 06:40:25 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID x77AeFI0010049, 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 x77AeFI0010049 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 7 Aug 2019 18:40:15 +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; Wed, 7 Aug 2019 18:40:15 +0800 From: To: CC: , , Subject: [PATCH 4/8] rtw88: 8822c: add FW IQK support Date: Wed, 7 Aug 2019 18:40:01 +0800 Message-ID: <1565174405-2689-5-git-send-email-yhchuang@realtek.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1565174405-2689-1-git-send-email-yhchuang@realtek.com> References: <1565174405-2689-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 Add support for doing IQK in firmware Signed-off-by: Yan-Hsuan Chuang --- drivers/net/wireless/realtek/rtw88/rtw8822c.c | 16 ++++++++++++++++ drivers/net/wireless/realtek/rtw88/rtw8822c.h | 2 ++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c index e11bbc3..176ca5f 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c @@ -1876,6 +1876,22 @@ static void rtw8822c_false_alarm_statistics(struct rtw_dev *rtwdev) static void rtw8822c_do_iqk(struct rtw_dev *rtwdev) { + struct rtw_iqk_para para = {0}; + u8 iqk_chk; + int counter; + + para.clear = 1; + rtw_fw_do_iqk(rtwdev, ¶); + + for (counter = 0; counter < 300; counter++) { + iqk_chk = rtw_read8(rtwdev, REG_RPT_CIP); + if (iqk_chk == 0xaa) + break; + msleep(20); + } + rtw_write8(rtwdev, REG_IQKSTAT, 0x0); + + rtw_dbg(rtwdev, RTW_DBG_RFK, "iqk counter=%d\n", counter); } /* for coex */ diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.h b/drivers/net/wireless/realtek/rtw88/rtw8822c.h index 5ee1de4..14a8894 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8822c.h +++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.h @@ -176,6 +176,7 @@ struct rtw8822c_efuse { #define REG_TXF7 0x1ab0 #define REG_CCK_SOURCE 0x1abc #define BIT_NBI_EN BIT(30) +#define REG_IQKSTAT 0x1b10 #define REG_TXANT 0x1c28 #define REG_ENCCK 0x1c3c #define BIT_CCK_BLK_EN BIT(1) @@ -197,6 +198,7 @@ struct rtw8822c_efuse { #define REG_OFDM_FACNT3 0x2d0c #define REG_OFDM_FACNT4 0x2d10 #define REG_OFDM_FACNT5 0x2d20 +#define REG_RPT_CIP 0x2d9c #define REG_OFDM_TXCNT 0x2de0 #define REG_ORITXCODE2 0x4100 #define REG_3WIRE2 0x410c -- 2.7.4