From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: "Alvin Šipraga" <alvin@pqrs.dk>, "Kalle Valo" <kvalo@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Rob Herring" <robh+dt@kernel.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Arend van Spriel" <aspriel@gmail.com>,
"Franky Lin" <franky.lin@broadcom.com>,
"Hante Meuleman" <hante.meuleman@broadcom.com>,
"van Spriel" <arend@broadcom.com>
Cc: "Alvin Šipraga" <alsi@bang-olufsen.dk>,
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" <kernel@pengutronix.de>
Subject: Re: [PATCH 2/2] wifi: brcmfmac: support brcm,ccode-map-trivial DT property
Date: Thu, 14 Jul 2022 17:22:11 +0200 [thread overview]
Message-ID: <efa997a0-f1a1-c09f-801c-80617e2f51dc@pengutronix.de> (raw)
In-Reply-To: <20220711123005.3055300-3-alvin@pqrs.dk>
On 11.07.22 14:30, Alvin Šipraga wrote:
> From: Alvin Šipraga <alsi@bang-olufsen.dk>
>
> 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 <alsi@bang-olufsen.dk>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
> 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 |
prev parent reply other threads:[~2022-07-14 15:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-11 12:30 [PATCH 0/2] wifi: brcmfmac: add DT property for trivial ccode mapping Alvin Šipraga
2022-07-11 12:30 ` [PATCH 1/2] dt-bindings: bcm4329-fmac: add optional brcm,ccode-map-trivial Alvin Šipraga
2022-07-14 15:21 ` Ahmad Fatoum
2022-07-18 18:43 ` Rob Herring
2022-07-28 9:58 ` Kalle Valo
2022-07-11 12:30 ` [PATCH 2/2] wifi: brcmfmac: support brcm,ccode-map-trivial DT property Alvin Šipraga
2022-07-14 15:22 ` Ahmad Fatoum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=efa997a0-f1a1-c09f-801c-80617e2f51dc@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=SHA-cyfmac-dev-list@infineon.com \
--cc=alsi@bang-olufsen.dk \
--cc=alvin@pqrs.dk \
--cc=arend@broadcom.com \
--cc=aspriel@gmail.com \
--cc=brcm80211-dev-list.pdl@broadcom.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=franky.lin@broadcom.com \
--cc=hante.meuleman@broadcom.com \
--cc=kernel@pengutronix.de \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).