From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BF01DC77B7F for ; Sun, 14 May 2023 16:34:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sP1s3TyTNR2xaheXB5ulgxT8TwPE9wVNHMHH4x9e/js=; b=os5IAtcowl+x1/G24/kS/5pdIg 8eWAyNw6QXcvQZtk+rQMlfScrN60j0kjDJIq+xUvxj9VJXe79eqxFWBT3NMZzR6I9O4FiTJRfMNz7 0QSau0y2q1Fa4nqenkjoYiX8zAG3jf5SPXU9rhQgrk58w+1Pgw7p5GKxtGOvjLD4Es3Ke+z50IdhN oYLolcvWGfQIdvn22kh1lqMuBQEPIA7seWzO4syTiP9NUKfB3ZKULi2rektDZkDTrnTAfXzW+cnK5 FTQCqNGSYXvuzNZ3fqcoOc7iWndNdYkyfDsuwiQYw0ck3hMXcgXXBLHspje2H6kojjrqx8wpZvJpX MYg2kdoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pyEg7-00HWjU-0W; Sun, 14 May 2023 16:34:35 +0000 Received: from pidgin.makrotopia.org ([185.142.180.65]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pyEg1-00HWhy-0F; Sun, 14 May 2023 16:34:33 +0000 Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1pyEfh-00070J-22; Sun, 14 May 2023 16:34:09 +0000 Date: Sun, 14 May 2023 18:32:15 +0200 From: Daniel Golle To: Simon Horman Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Felix Fietkau , Lorenzo Bianconi , Ryder Lee , Shayne Chen , Sean Wang , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Alexander Couzens , Sujuan Chen , Bo Jiao , Nicolas Cavallari , Howard Hsu , MeiChia Chiu , Peter Chiu , Johannes Berg , Wang Yufen , Lorenz Brun Subject: Re: [PATCH] wifi: mt76: mt7915: add support for MT7981 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230514_093429_134939_B7E7A865 X-CRM114-Status: GOOD ( 23.06 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org Hi Simon, thank you for reviewing! On Sun, May 14, 2023 at 04:53:43PM +0200, Simon Horman wrote: > On Sat, May 13, 2023 at 03:35:51PM +0200, Daniel Golle wrote: > > From: Alexander Couzens > > > > Add support for the MediaTek MT7981 SoC which is similar to the MT7986 > > but with a newer IP cores and only 2x ARM Cortex-A53 instead of 4x. > > Unlike MT7986 the MT7981 can only connect a single wireless frontend, > > usually MT7976 is used for DBDC. > > > > Signed-off-by: Alexander Couzens > > Signed-off-by: Daniel Golle > > ... > > > @@ -489,7 +516,10 @@ static int mt7986_wmac_adie_patch_7976(struct mt7915_dev *dev, u8 adie) > > rg_xo_01 = 0x1d59080f; > > rg_xo_03 = 0x34c00fe0; > > } else { > > - rg_xo_01 = 0x1959f80f; > > + if (is_mt7981(&dev->mt76)) > > + rg_xo_01 = 0x1959c80f; > > + else if (is_mt7986(&dev->mt76)) > > + rg_xo_01 = 0x1959f80f; > > Hi Daniel, > > rg_xo_01 will be used uninitialised below if we get here > and neither of the conditions above are true. > > Can this occur? No, it cannot occur. Either of is_mt7981() or is_mt7986() will return true, as the driver is bound via one of the two compatibles 'mediatek,mt7986-wmac' or newly added 'mediatek,mt7981-wmac'. Based on that the match_data is either 0x7986 or 0x7981, which is then used as chip_id, which is used by the is_mt7981() and is_mt7986() functions. > > > rg_xo_03 = 0x34d00fe0; > > } > > > > ... >