Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp656613imw; Thu, 14 Jul 2022 08:25:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uT4WKEAOI/VwccsKvmnKjGcdHCn8iTiAS7xQTU0jKnvEq/+ev/1AoPYgCNxh/b0F6ZIQm/ X-Received: by 2002:a17:907:6091:b0:72b:88c5:2a2f with SMTP id ht17-20020a170907609100b0072b88c52a2fmr9172983ejc.715.1657812337170; Thu, 14 Jul 2022 08:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657812337; cv=none; d=google.com; s=arc-20160816; b=EREuA5+Qt2uCGMKk5k8pWFWYyPprJek+gvbEa586MRs/uR0jdJ5wPYMmsHnyFOEjVi nKNQ4wZ2h1zgnoNO8c/oGeS7NpzWcpSaFRsvPlzMonGGTAYtO0yB8GBTuTDgiN/r/GoF 5T2nguJ7T3+02TJVPy8LkFuDJAn3t6o67+y8/bNzpBTB+jdoDW+YsTnZWTMjfwbpuO46 wOFqb5uu5KMV9upvDPjCvYL1K7oVbW6hAKCEAw20vyp3VWi2OgBCbA6zWNi9a4w9sArS mJBR2ofs8vDKD3d7H/tDbGjjYUkKlysH3TOAtTp7kX4mUC8rAy6EHBKdmZzSinZJf2ge zlXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=boXv222cKuUKSyfHWIO+TbaRuhdBCSeAdyqFPT+cvqQ=; b=gWTAlwYnWOEpqVIZ5cDeuTil23Uc70goKL7j3RZc+Pos5sCExUiNf+SHEcgrT+db2a woK7GYsVO7WBi+VtHrOXwdl7WF0kgfKTy2J99y+NTQGy6HZaOX46V3WJfn1gRGX5mpYr iw9Vo+a0gjJ7XuAFrV72SeNCRzhVQVSFkJwrauShvLekolJpshGQj/u0YEhJKBeBP/A2 J74DH7p5Ox+yWh2DUg2YlCgEmZCOKHYr6J+wzGACRMS4IQ0WrvRo7lQ65w1lda9V6UR2 6mNY7G6iHL+yFXfwKCGTrRR1sBlX9jSa0bIzn0lCEFTyclYgDyt4qcuF5zuxsUw8pfWL WUiw== 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 r20-20020a170906a21400b0072b5acf30f9si2281458ejy.157.2022.07.14.08.25.20; Thu, 14 Jul 2022 08:25:37 -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 S239993AbiGNPWd (ORCPT + 65 others); Thu, 14 Jul 2022 11:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238594AbiGNPWd (ORCPT ); Thu, 14 Jul 2022 11:22:33 -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 2F86A62482 for ; Thu, 14 Jul 2022 08:22:32 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oC0fO-0004Zv-2k; Thu, 14 Jul 2022 17:22:14 +0200 Message-ID: Date: Thu, 14 Jul 2022 17:22:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 Subject: Re: [PATCH 2/2] wifi: brcmfmac: support brcm,ccode-map-trivial DT property Content-Language: en-US To: =?UTF-8?Q?Alvin_=c5=a0ipraga?= , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Arend van Spriel , Franky Lin , Hante Meuleman , van Spriel Cc: =?UTF-8?Q?Alvin_=c5=a0ipraga?= , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, Pengutronix Kernel Team References: <20220711123005.3055300-1-alvin@pqrs.dk> <20220711123005.3055300-3-alvin@pqrs.dk> From: Ahmad Fatoum In-Reply-To: <20220711123005.3055300-3-alvin@pqrs.dk> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@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=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 11.07.22 14:30, Alvin Šipraga wrote: > From: Alvin Šipraga > > Commit a21bf90e927f ("brcmfmac: use ISO3166 country code and 0 rev as > fallback on some devices") introduced a fallback mechanism whereby a > trivial mapping from ISO3166 country codes to firmware country code and > revision is used on some devices. This fallback operates on the device > level, so it is enabled only for certain supported chipsets. > > In general though, the firmware country codes are determined by the CLM > blob, which is board-specific and may vary despite the underlying > chipset being the same. > > The aforementioned commit is actually a refinement of a previous commit > that was reverted in commit 151a7c12c4fc ("Revert "brcmfmac: use ISO3166 > country code and 0 rev as fallback"") due to regressions with a BCM4359 > device. The refinement restricted the fallback mechanism to specific > chipsets such as the BCM4345. > > We use a chipset - CYW88359 - that the driver identifies as a BCM4359 > too. But in our case, the CLM blob uses ISO3166 country codes > internally, and all with revision 0. So the trivial mapping is exactly > what is needed in order for the driver to sync the kernel regulatory > domain to the firmware. This is just a matter of how the CLM blob was > prepared by the hardware vendor. The same could hold for other boards > too. > > Although the brcm,ccode-map device tree property is useful for cases > where the mapping is more complex, the trivial case invites a much > simpler specification. This patch adds support for parsing the > brcm,ccode-map-trivial device tree property. Subordinate to the more > specific brcm,ccode-map property, this new proprety simply informs the > driver that the fallback method should be used in every case. > > In the absence of the new property in the device tree, expect no > functional change. > > Signed-off-by: Alvin Šipraga Reviewed-by: Ahmad Fatoum > --- > drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 3 +++ > drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h | 2 ++ > drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 6 ++++++ > 3 files changed, 11 insertions(+) > > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c > index 3ae6779fe153..db45da33adfd 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c > @@ -7481,6 +7481,9 @@ int brcmf_cfg80211_wait_vif_event(struct brcmf_cfg80211_info *cfg, > > static bool brmcf_use_iso3166_ccode_fallback(struct brcmf_pub *drvr) > { > + if (drvr->settings->trivial_ccode_map) > + return true; > + > switch (drvr->bus_if->chip) { > case BRCM_CC_4345_CHIP_ID: > case BRCM_CC_43602_CHIP_ID: > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h > index 15accc88d5c0..fe717cce5d55 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h > @@ -38,6 +38,7 @@ extern struct brcmf_mp_global_t brcmf_mp_global; > * @fcmode: FWS flow control. > * @roamoff: Firmware roaming off? > * @ignore_probe_fail: Ignore probe failure. > + * @trivial_ccode_map: Assume firmware uses ISO3166 country codes with rev 0 > * @country_codes: If available, pointer to struct for translating country codes > * @bus: Bus specific platform data. Only SDIO at the mmoment. > */ > @@ -48,6 +49,7 @@ struct brcmf_mp_device { > bool roamoff; > bool iapp; > bool ignore_probe_fail; > + bool trivial_ccode_map; > struct brcmfmac_pd_cc *country_codes; > const char *board_type; > unsigned char mac[ETH_ALEN]; > diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > index 083ac58f466d..1add942462f8 100644 > --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c > @@ -24,6 +24,12 @@ static int brcmf_of_get_country_codes(struct device *dev, > > count = of_property_count_strings(np, "brcm,ccode-map"); > if (count < 0) { > + /* If no explicit country code map is specified, check whether > + * the trivial map should be used. > + */ > + settings->trivial_ccode_map = > + of_property_read_bool(np, "brcm,ccode-map-trivial"); > + > /* The property is optional, so return success if it doesn't > * exist. Otherwise propagate the error code. > */ -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |