Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1683848ybl; Thu, 19 Dec 2019 00:59:16 -0800 (PST) X-Google-Smtp-Source: APXvYqzmxdR+mKJzZt3TLxFzDLtwxNS6ZroiLWmJvV1k9z3n9NkjlmA9dBmX6yq3m8bnKnQ4+fqY X-Received: by 2002:a9d:ed5:: with SMTP id 79mr7796140otj.72.1576745951600; Thu, 19 Dec 2019 00:59:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576745948; cv=none; d=google.com; s=arc-20160816; b=sSZIMFjd2od0sKIUQlJ7bFmQ0xDqrIx2ZLymmlCqEBHjMPGHvDVx9Am9r/eSA2nCch j/1XW9d8KI8ycAQI7eU65jeeiFSj7boSre08+Ns4MUV+6EL3kJOcOAhlVsxT4Hkshy5L d+StYM6+1sUN071Vpp8TUxgNeGvW+pH0mg236Yo45foxqqv/IOsQwzGZESmVtVDlLODx 27wLxvkzXkr0Abd8/zSTojP6IE2ibXmC/0qdVfvhXf4AQTeFIs+LepzhKnpgUfNBrnxo gma8oxy637GzJ+2/GiOUmgLG6kRA8L9FC1iM7on/jqkpi/UWgbiGyCJ+F16ckM3GtFOT G8vA== 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=KVylXNqZ+nBw73iDiS0FpaOMgGORbo0ZJ1hCUpaIvaw=; b=Q3fOeRpitqqmtmKhFCTvLwGNRrVrxXdvt7ZgchwRDLNi+g2FMMlc+jMHDkpolesbbT OOTAUJ410XVKkr1DBq17262XCwHJDaShySJeI11MmW4/bfGUo2F9c5P+BukrWVzZ/+PT nXg2Ca5BlkYTesxZ0/WlkP0VBmNSv/bQYmBg6yJFhh5R5eVAd7gzVLhqyzK7vHLu/Dg2 v/mM1FLe/XIpgvZh9Ll3am6rEK/YuLD7d3gjmZLz3Yx67G6XwjmA8HprND3T+ofuqaWP BOLP6ARTFP9VoPXEnzNJ9LeQ/aPanCyKNRnnGp4UrNvE/9+zpNnX76SEOu/PuDKUgXI2 qpIg== 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 a64si2780273oii.266.2019.12.19.00.58.45; Thu, 19 Dec 2019 00:59:08 -0800 (PST) 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 S1726694AbfLSI6l (ORCPT + 99 others); Thu, 19 Dec 2019 03:58:41 -0500 Received: from rtits2.realtek.com ([211.75.126.72]:59559 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbfLSI6l (ORCPT ); Thu, 19 Dec 2019 03:58:41 -0500 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.62 with qID xBJ8wX9p024868, 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 xBJ8wX9p024868 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 19 Dec 2019 16:58:33 +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.468.0; Thu, 19 Dec 2019 16:58:33 +0800 From: To: CC: , , Subject: [PATCH v4 3/7] rtw88: add interface config for 8822c Date: Thu, 19 Dec 2019 16:58:12 +0800 Message-ID: <20191219085816.20709-4-yhchuang@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191219085816.20709-1-yhchuang@realtek.com> References: <20191219085816.20709-1-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 devices need to configure interface/HCI related reigsters in power on flow. Add interface_cfg for HCI for the settings. The driver only supports RTL8822BE/RTL8822CE now, and since RTL8822BE does not need to configure PCIE, the configuration is only added for RTL8822CE. Without it, some of the RTL8822CE device can crash and disconnected to host in suspend/wowlan mode. Signed-off-by: Tzu-En Huang Signed-off-by: Yan-Hsuan Chuang --- v3 * new patch v3 -> v4 * no change drivers/net/wireless/realtek/rtw88/hci.h | 6 ++++++ drivers/net/wireless/realtek/rtw88/mac.c | 2 ++ drivers/net/wireless/realtek/rtw88/pci.c | 17 +++++++++++++++++ drivers/net/wireless/realtek/rtw88/reg.h | 2 ++ 4 files changed, 27 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/hci.h b/drivers/net/wireless/realtek/rtw88/hci.h index 3d91aea942c3..85a81a578fd5 100644 --- a/drivers/net/wireless/realtek/rtw88/hci.h +++ b/drivers/net/wireless/realtek/rtw88/hci.h @@ -15,6 +15,7 @@ struct rtw_hci_ops { void (*stop)(struct rtw_dev *rtwdev); void (*deep_ps)(struct rtw_dev *rtwdev, bool enter); void (*link_ps)(struct rtw_dev *rtwdev, bool enter); + void (*interface_cfg)(struct rtw_dev *rtwdev); int (*write_data_rsvd_page)(struct rtw_dev *rtwdev, u8 *buf, u32 size); int (*write_data_h2c)(struct rtw_dev *rtwdev, u8 *buf, u32 size); @@ -59,6 +60,11 @@ static inline void rtw_hci_link_ps(struct rtw_dev *rtwdev, bool enter) rtwdev->hci.ops->link_ps(rtwdev, enter); } +static inline void rtw_hci_interface_cfg(struct rtw_dev *rtwdev) +{ + rtwdev->hci.ops->interface_cfg(rtwdev); +} + static inline int rtw_hci_write_data_rsvd_page(struct rtw_dev *rtwdev, u8 *buf, u32 size) { diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c index 507970387b2a..03a82de053ea 100644 --- a/drivers/net/wireless/realtek/rtw88/mac.c +++ b/drivers/net/wireless/realtek/rtw88/mac.c @@ -1034,5 +1034,7 @@ int rtw_mac_init(struct rtw_dev *rtwdev) if (ret) return ret; + rtw_hci_interface_cfg(rtwdev); + return 0; } diff --git a/drivers/net/wireless/realtek/rtw88/pci.c b/drivers/net/wireless/realtek/rtw88/pci.c index c394df494c95..a60d9b107006 100644 --- a/drivers/net/wireless/realtek/rtw88/pci.c +++ b/drivers/net/wireless/realtek/rtw88/pci.c @@ -6,6 +6,7 @@ #include #include "main.h" #include "pci.h" +#include "reg.h" #include "tx.h" #include "rx.h" #include "fw.h" @@ -1224,6 +1225,21 @@ static void rtw_pci_link_cfg(struct rtw_dev *rtwdev) rtwpci->link_ctrl = link_ctrl; } +static void rtw_pci_interface_cfg(struct rtw_dev *rtwdev) +{ + struct rtw_chip_info *chip = rtwdev->chip; + + switch (chip->id) { + case RTW_CHIP_TYPE_8822C: + if (rtwdev->hal.cut_version >= RTW_CHIP_VER_CUT_D) + rtw_write32_mask(rtwdev, REG_HCI_MIX_CFG, + BIT_PCIE_EMAC_PDN_AUX_TO_FAST_CLK, 1); + break; + default: + break; + } +} + static void rtw_pci_phy_cfg(struct rtw_dev *rtwdev) { struct rtw_chip_info *chip = rtwdev->chip; @@ -1332,6 +1348,7 @@ static struct rtw_hci_ops rtw_pci_ops = { .stop = rtw_pci_stop, .deep_ps = rtw_pci_deep_ps, .link_ps = rtw_pci_link_ps, + .interface_cfg = rtw_pci_interface_cfg, .read8 = rtw_pci_read8, .read16 = rtw_pci_read16, diff --git a/drivers/net/wireless/realtek/rtw88/reg.h b/drivers/net/wireless/realtek/rtw88/reg.h index 7e817bc997eb..cd6b14c379ba 100644 --- a/drivers/net/wireless/realtek/rtw88/reg.h +++ b/drivers/net/wireless/realtek/rtw88/reg.h @@ -194,6 +194,8 @@ #define REG_H2C_INFO 0x0254 #define REG_INT_MIG 0x0304 +#define REG_HCI_MIX_CFG 0x03FC +#define BIT_PCIE_EMAC_PDN_AUX_TO_FAST_CLK BIT(26) #define REG_FWHW_TXQ_CTRL 0x0420 #define BIT_EN_BCNQ_DL BIT(22) -- 2.17.1