From patchwork Wed Jun 24 09:39:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shayne Chen X-Patchwork-Id: 11622741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3907260D for ; Wed, 24 Jun 2020 09:40:24 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 11D81206C3 for ; Wed, 24 Jun 2020 09:40:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LQ5QwRuc"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="mle+wtZx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 11D81206C3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mediatek.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=JYBhC64yNodRHCsMQ2MA9TxT8D0OpI0pB+CdCV2q0/U=; b=LQ5QwRucC9J2JjhhjEFiwYzhCb KrSnlEbxfjQr9UbjFSlXfizdpPi+REOAUR8fCSSV0cuZ/SyzL3X1HbhPd+4aVjqqeG4u5z0qcYa/y 16yaWLlnqM89jw6FkFzOBHEzioSKxfEeNrdItbMI4fCtyBmlzfpJNibHQyvE8bjFs1uSNQqJzDY0X LzlFEl1C7ks8kUFsWilxgY4X/Ad7m26bwM3WDhBFAh6gFwU6ca5X1p3IpeDWHMAj6JAHneV/hnQ/B qPWDiWjnYPjh1mv9H4KFkSB2+EDpOoSFav/cZyvGuJFqhFhczxITEg9p2cBlOSXfiqn5e58Cp7VuV 7he3LbIA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo1tE-0001kF-0D; Wed, 24 Jun 2020 09:40:20 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo1tB-0001hN-ON for linux-mediatek@lists.infradead.org; Wed, 24 Jun 2020 09:40:18 +0000 X-UUID: f07a824c7a2f422bbaa00b0af8c3d06b-20200624 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=7PK14oqTmOFJOT/MNKY1j9wxaPQDa9X5TZTJttjSw70=; b=mle+wtZxiJfh0Onj8zPGNPIevxbP/tIPcTpFzgY0eaqPnubUFCAX5mGZ0XsxmrlntQwVEm4NsIB6/QkxzcTh+xv/L+xSz6zY0MT1K2WTT2AaJmmKBHlrz3JxykoOB9CX3+GZXQBrMtQ5LjNLRw4u0QpKWAEIcMSgQ6/yFJ67Hgw=; X-UUID: f07a824c7a2f422bbaa00b0af8c3d06b-20200624 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLS) with ESMTP id 1403934533; Wed, 24 Jun 2020 01:40:06 -0800 Received: from MTKMBS02N2.mediatek.inc (172.21.101.101) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 02:40:07 -0700 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs02n2.mediatek.inc (172.21.101.101) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 24 Jun 2020 17:40:03 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 24 Jun 2020 17:40:03 +0800 From: Shayne Chen To: Felix Fietkau Subject: [PATCH] mt76: mt7615: register ext_phy if DBDC is detected Date: Wed, 24 Jun 2020 17:39:37 +0800 Message-ID: <20200624093937.26741-1-shayne.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-TM-SNTS-SMTP: B75E107CDB5820FA4F527F0EDDC99885F69BA3767655EBCCEA2B8DAFEB7A1CC92000:8 X-MTK: N X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.0 MIME_BASE64_TEXT RAW: Message text disguised using base64 encoding -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryder Lee , Evelyn Tsai , linux-wireless , linux-mediatek , Lorenzo Bianconi , Shayne Chen Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org MT_EE_WIFI_CONF field can be used to detect if the chipset is MT7615D. Thus, add support to automatically register ext_phy if DBDC is detected. Signed-off-by: Shayne Chen --- drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7615/init.c | 2 +- drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c index 22e4eab..4e07c7e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/eeprom.c @@ -125,6 +125,9 @@ mt7615_eeprom_parse_hw_band_cap(struct mt7615_dev *dev) case MT_EE_2GHZ: dev->mt76.cap.has_2ghz = true; break; + case MT_EE_DBDC: + dev->mt76.phy2 = &dev->mphy; + /* fall through */ default: dev->mt76.cap.has_2ghz = true; dev->mt76.cap.has_5ghz = true; diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c index 3921e7e..c075006 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c @@ -384,7 +384,7 @@ int mt7615_register_ext_phy(struct mt7615_dev *dev) if (test_bit(MT76_STATE_RUNNING, &dev->mphy.state)) return -EINVAL; - if (phy) + if (phy && phy != &dev->phy) return 0; mt7615_cap_dbdc_enable(dev); diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c index 69cba86..ec94944 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci_init.c @@ -25,6 +25,9 @@ static void mt7615_init_work(struct work_struct *work) mt7615_phy_init(dev); mt7615_mcu_del_wtbl_all(dev); mt7615_check_offload_capability(dev); + + if (dev->mt76.phy2) + mt7615_register_ext_phy(dev); } static int mt7615_init_hardware(struct mt7615_dev *dev)