Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp975210rwl; Fri, 31 Mar 2023 05:14:23 -0700 (PDT) X-Google-Smtp-Source: AKy350ZaHJ7FEuP6Lx5jhMh9f4fqG8r3RLKY6LT/3zpoae32PUcqzNC4Mw7linsSIeNOeTDCZBtr X-Received: by 2002:a17:907:c304:b0:931:b34:4172 with SMTP id tl4-20020a170907c30400b009310b344172mr29643120ejc.3.1680264863423; Fri, 31 Mar 2023 05:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680264863; cv=none; d=google.com; s=arc-20160816; b=UznI2islwk3ZIHs3U0MiOAxkR9VHUtwVhf0lxCc0gyOVdEspMzkIbf0z58VsVL4iZG p6EqN3OcIxkpyUuUKm0tVqJeFUNNurzdcXioLuqGkgHYI7PfpTKoc9wzYY8kzidL2lLI PqX7DLnrMSsY14LUM2FbKHPnDm0F8xQUvee5u7N+xAYknACMF/YBMKp7HU5BwW5VzDi4 kNPS+ZN0ARXyqxVXC2thvH1JpEFhrx2bSBcWVAYlz2+Gkq1PYfr4O6bz23HmMnbvPA7X llzKXLxbwVwHFcP9aaALA0Vu0z7Apx0L2IWQRUP36mz0QXOiBzVHZKUFzUzouwSO61E7 tbiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=2znLcO1X8mEDuZjoxtuSQpYOoPrhB0Qf78EcadU8BbI=; b=zCEwWJJ9JVIfpCE67FCn9xGoHHTeb/N+m4SvOuOYWOaS08aCZNdn7uAhqFkZjsoQxB 9sZ2Zew6mq4+Aty642DJ49uyiQ8A4yKaIxW1Xwxdrpu2tOtD//jA5O5NtrpFm4db1980 wLuqRFvrVutYc7xkCnU9BJyfNCaXAaC+EnO8R9kSvrxRd+liCl8Vsc8BEbbbc3mVvvHS I4P04OoT3ExMUmUOF+DU14FFCRe2cMA4oBvxDTMdgu3mZUKjvCKVLbiDlD51IBe1vrF7 GB5ukQAk/Lj/cbdbuq7J06oYQ1XQWS8udMPPkatTUZ9s7D3EhXjknJQbhhQEJ8ujAg2d gdmg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z4-20020a170906074400b008d999c3bfeesi1853356ejb.256.2023.03.31.05.14.08; Fri, 31 Mar 2023 05:14:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232071AbjCaMLR (ORCPT + 58 others); Fri, 31 Mar 2023 08:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232035AbjCaMLO (ORCPT ); Fri, 31 Mar 2023 08:11:14 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B84C31C1F4 for ; Fri, 31 Mar 2023 05:11:12 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1piDaw-0007FD-1x; Fri, 31 Mar 2023 14:11:02 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1piDas-007zAG-B0; Fri, 31 Mar 2023 14:10:58 +0200 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1piDar-001AJP-IP; Fri, 31 Mar 2023 14:10:57 +0200 From: Sascha Hauer To: linux-wireless Cc: Hans Ulli Kroll , Larry Finger , Pkshih , Tim K , "Alex G ." , Nick Morrow , Viktor Petrenko , Andreas Henriksson , ValdikSS , kernel@pengutronix.de, stable@vger.kernel.org, Sascha Hauer Subject: [PATCH 2/2] wifi: rtw88: rtw8821c: Fix rfe_option field width Date: Fri, 31 Mar 2023 14:10:54 +0200 Message-Id: <20230331121054.112758-3-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230331121054.112758-1-s.hauer@pengutronix.de> References: <20230331121054.112758-1-s.hauer@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On my RTW8821CU chipset rfe_option reads as 0x22. Looking at the downstream driver suggests that the field width of rfe_option is 5 bit, so rfe_option should be masked with 0x1f. Without this the rfe_option comparisons with 2 further down the driver evaluate as false when they should really evaluate as true. The effect is that 2G channels do not work. rfe_option is also used as an array index into rtw8821c_rfe_defs[]. rtw8821c_rfe_defs[34] (0x22) was added as part of adding USB support, likely because rfe_option reads as 0x22. As this now becomes 0x2, rtw8821c_rfe_defs[34] is no longer used and can be removed. Signed-off-by: Sascha Hauer --- drivers/net/wireless/realtek/rtw88/rtw8821c.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/realtek/rtw88/rtw8821c.c b/drivers/net/wireless/realtek/rtw88/rtw8821c.c index 17f800f6efbd0..67efa58dd78ee 100644 --- a/drivers/net/wireless/realtek/rtw88/rtw8821c.c +++ b/drivers/net/wireless/realtek/rtw88/rtw8821c.c @@ -47,7 +47,7 @@ static int rtw8821c_read_efuse(struct rtw_dev *rtwdev, u8 *log_map) map = (struct rtw8821c_efuse *)log_map; - efuse->rfe_option = map->rfe_option; + efuse->rfe_option = map->rfe_option & 0x1f; efuse->rf_board_option = map->rf_board_option; efuse->crystal_cap = map->xtal_k; efuse->pa_type_2g = map->pa_type; @@ -1537,7 +1537,6 @@ static const struct rtw_rfe_def rtw8821c_rfe_defs[] = { [2] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2), [4] = RTW_DEF_RFE_EXT(8821c, 0, 0, 2), [6] = RTW_DEF_RFE(8821c, 0, 0), - [34] = RTW_DEF_RFE(8821c, 0, 0), }; static struct rtw_hw_reg rtw8821c_dig[] = { -- 2.39.2