Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2655483pxa; Mon, 24 Aug 2020 22:31:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAyVibUccDc0ALF/+rq6M6owSBFUlNDcyrgpv9tZakDNmvbTnBTyFaMWj8eCZw2hcz6xKb X-Received: by 2002:a05:6402:486:: with SMTP id k6mr8615266edv.83.1598333462964; Mon, 24 Aug 2020 22:31:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598333462; cv=none; d=google.com; s=arc-20160816; b=iaMM64SHs2f5MxWGlwaLWaI34Qup73D66i5bxJrIk/Tt4AEwfRk7K1avWmpR5k/OMD iBxAB98eK96+lP9WkEqC6vJLACAuBGAkZqcSaFHPLnnbG7hJJHQuEk4QjZIfODG036m3 fGMpEesdwuZEPmrFScPxT3au33AvHE7czSlYsrFSDfGOfS/mNw/prI0Sj2BMR7Rj7z4k trGJhqUd+OPlxLezBoZHi/R83tYthWDYt+D0xDpGfVlf/ONzlScXKNO4LUPYo4ZIIn+d GAtbwedvxo5yESUW87gJWT0jQ0UFZ2RJ8qMdEVOWZK1/aC7KCt+v48mQfjIaj9ShXKxL /EDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=TQUY20uymugMjzesOEr4DiO2q9rqRWCCRtR6t9JNX6c=; b=IhjORJEc+HV3aBlx7PObp0sw1e1Aev0CM7Bt1gBxWACHVNWhMCccS2kOcrkFSQftKz /9g5jVf1tSjsdwqDObKj4lkLNCJZQoIWrmG30mC/dl453FLRLJ3mUSuPt1rfw6Ykn35g oEWfugG1OALkeJCdnd2fMuJ3nPJcbZiiLe60NNoQa1OIjcA+G9/CEWLnczBtG1LubSd+ KXS0En4c05KJDH+W9IXlOVLwb0eSSSYsD1hlTuUmHlewzBb4l/FblNstU0jdDIsyGHtN 9pXy5oT/HAMfEDYsiDEVYSFmLJTHzYBtvBTSF4EPSkfpMvE1lnbe+PzecsVb5SQkCDw+ 5wsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b="KZ/UJhul"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m18si2287892ejx.605.2020.08.24.22.30.39; Mon, 24 Aug 2020 22:31:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@nbd.name header.s=20160729 header.b="KZ/UJhul"; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728670AbgHYF3R (ORCPT + 99 others); Tue, 25 Aug 2020 01:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728333AbgHYF3Q (ORCPT ); Tue, 25 Aug 2020 01:29:16 -0400 Received: from nbd.name (nbd.name [IPv6:2a01:4f8:221:3d45::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9BE4C0613ED for ; Mon, 24 Aug 2020 22:29:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbd.name; s=20160729; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=TQUY20uymugMjzesOEr4DiO2q9rqRWCCRtR6t9JNX6c=; b=KZ/UJhulXhT4ttCslp4l2I8IZA lLV0z/sEPUIvtL8PWLRraZru242rMgkorwujOnym7aFkxmRtTnUQjStnDyv/Z3nNwZYMoj7ZWGrnD 0AOd/N//9i42QbsErV3mrMOcIj/2IiE40rO9OWC/4fBNcSB1fcQeq752Ze2mLT3ieVxw=; Received: from p5b206497.dip0.t-ipconnect.de ([91.32.100.151] helo=localhost.localdomain) by ds12 with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.89) (envelope-from ) id 1kARWC-0006jr-RD for linux-wireless@vger.kernel.org; Tue, 25 Aug 2020 07:29:12 +0200 From: Felix Fietkau To: linux-wireless@vger.kernel.org Subject: [PATCH 9/9] mt76: mt7603: check for single-stream EEPROM configuration Date: Tue, 25 Aug 2020 07:29:09 +0200 Message-Id: <20200825052909.36955-9-nbd@nbd.name> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200825052909.36955-1-nbd@nbd.name> References: <20200825052909.36955-1-nbd@nbd.name> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Some devices using MT7628 or MT7603 have only one antenna chain connected. Detect these using the EEPROM rx/tx path settings Reported-by: Qin Wei Signed-off-by: Felix Fietkau --- drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h | 3 +++ drivers/net/wireless/mediatek/mt76/mt7603/init.c | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h b/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h index b893facfba48..4687d6dc00dc 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h +++ b/drivers/net/wireless/mediatek/mt76/mt7603/eeprom.h @@ -85,4 +85,7 @@ enum mt7603_eeprom_source { MT_EE_SRC_FLASH, }; +#define MT_EE_NIC_CONF_0_RX_PATH GENMASK(3, 0) +#define MT_EE_NIC_CONF_0_TX_PATH GENMASK(7, 4) + #endif diff --git a/drivers/net/wireless/mediatek/mt76/mt7603/init.c b/drivers/net/wireless/mediatek/mt76/mt7603/init.c index 94196599797e..43dbabccc083 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7603/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7603/init.c @@ -510,11 +510,17 @@ mt7603_init_txpower(struct mt7603_dev *dev, } } +static inline bool is_mt7688(struct mt7603_dev *dev) +{ + return mt76_rr(dev, MT_EFUSE_BASE + 0x64) & BIT(4); +} + int mt7603_register_device(struct mt7603_dev *dev) { struct mt76_bus_ops *bus_ops; struct ieee80211_hw *hw = mt76_hw(dev); struct wiphy *wiphy = hw->wiphy; + u8 *eeprom = (u8 *)dev->mt76.eeprom.data; int ret; dev->bus_ops = dev->mt76.bus; @@ -536,9 +542,11 @@ int mt7603_register_device(struct mt7603_dev *dev) tasklet_init(&dev->mt76.pre_tbtt_tasklet, mt7603_pre_tbtt_tasklet, (unsigned long)dev); - /* Check for 7688, which only has 1SS */ + /* Check for 1SS devices */ dev->mphy.antenna_mask = 3; - if (mt76_rr(dev, MT_EFUSE_BASE + 0x64) & BIT(4)) + if (FIELD_GET(MT_EE_NIC_CONF_0_RX_PATH, eeprom[MT_EE_NIC_CONF_0]) == 1 || + FIELD_GET(MT_EE_NIC_CONF_0_TX_PATH, eeprom[MT_EE_NIC_CONF_0]) == 1 || + is_mt7688(dev)) dev->mphy.antenna_mask = 1; dev->slottime = 9; -- 2.28.0