Skip to contentSkip to conversation

brcmfmac: Prefer DT board type over DMI board type

PATCH Applied Ivan T. Ivanov 6 participants 6 messages Jan 6, 2023 – Jan 16, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 brcmfmac: Prefer DT board type over DMI board type

The introduction of support for Apple board types inadvertently changed the precedence order, causing hybrid SMBIOS+DT platforms to look up the firmware using the DMI information instead of the device tree compatible to generate the board type. Revert back to the old behavior, as affected platforms use firmwares named after the DT compatible.

Fixes 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1206697#c13

---
Changes since v1
Rewrite commit message according feedback.
https://lore.kernel.org/all/[email protected]/

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +3 -2
index a83699de01ec..fdd0c9abc1a1 100644
@@ -79,7 +79,8 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 	/* Apple ARM64 platforms have their own idea of board type, passed in
 	 * via the device tree. They also have an antenna SKU parameter
 	 */
-	if (!of_property_read_string(np, "brcm,board-type", &prop))
+	err = of_property_read_string(np, "brcm,board-type", &prop);
+	if (!err)
 		settings->board_type = prop;
 
 	if (!of_property_read_string(np, "apple,antenna-sku", &prop))
@@ -87,7 +88,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 
 	/* Set board-type to the first string of the machine compatible prop */
 	root = of_find_node_by_path("/");
-	if (root && !settings->board_type) {
+	if (root && err) {
 		char *board_type;
 		const char *tmp;
 
Signature · 1 line
2.35.3
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Ivan T. Ivanov

The introduction of support for Apple board types inadvertently changed the precedence order, causing hybrid SMBIOS+DT platforms to look up the firmware using the DMI information instead of the device tree compatible to generate the board type. Revert back to the old behavior, as affected platforms use firmwares named after the DT compatible.

Quoted 6 lines
Fixes 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1206697#c13

Looks good to me. I do have a question about the devicetree node for brcmfmac. The driver does a compatible check against "brcm,bcm4329-fmac". I actually expect all devicetree specifications to use this. That said I noticed the check for it in brcmf_of_probe() should be moved so it is the first check done.

Quoted 32 lines

---
Changes since v1
Rewrite commit message according feedback.
https://lore.kernel.org/all/[email protected]/

  drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +3 -2
index a83699de01ec..fdd0c9abc1a1 100644
@@ -79,7 +79,8 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
  	/* Apple ARM64 platforms have their own idea of board type, passed in
  	 * via the device tree. They also have an antenna SKU parameter
  	 */
-	if (!of_property_read_string(np, "brcm,board-type", &prop))
+	err = of_property_read_string(np, "brcm,board-type", &prop);
+	if (!err)
  		settings->board_type = prop;
 
  	if (!of_property_read_string(np, "apple,antenna-sku", &prop))
@@ -87,7 +88,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 
  	/* Set board-type to the first string of the machine compatible prop */
  	root = of_find_node_by_path("/");
-	if (root && !settings->board_type) {
+	if (root && err) {
  		char *board_type;
  		const char *tmp;
 
#2 lore raw
Quoted 11 lines · Arend Van Spriel
Quoted 10 lines · Ivan T. Ivanov

The introduction of support for Apple board types inadvertently changed the precedence order, causing hybrid SMBIOS+DT platforms to look up the firmware using the DMI information instead of the device tree compatible to generate the board type. Revert back to the old behavior, as affected platforms use firmwares named after the DT compatible.

Fixes 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1206697#c13

Quoted 8 lines
Quoted 2 lines

Looks good to me. I do have a question about the devicetree node for brcmfmac. The driver does a compatible check against "brcm,bcm4329-fmac". I actually expect all devicetree specifications to use this. That said I noticed the check for it in brcmf_of_probe() should be moved so it is the first check done.

We're talking about the machine compatible in the root OF node, not the compatible for the device itself. That's how firmware selection for non-Apple platforms works (and has worked since before the Apple stuff got introduced): first try the machine type which is either derived from DMI info or the root compatible, and fall back to generic firmware.

The device compatible is indeed always brcm,bcm4329-fmac.

- Hector

Tested-by on v2 1/1
#3 lore raw
In reply to Ivan T. Ivanov
Quoted 7 lines · Ivan T. Ivanov

The introduction of support for Apple board types inadvertently changed the precedence order, causing hybrid SMBIOS+DT platforms to look up the firmware using the DMI information instead of the device tree compatible to generate the board type. Revert back to the old behavior, as affected platforms use firmwares named after the DT compatible.

Quoted 7 lines
Fixes 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1206697#c13

Tested on a RPi3B+, a RPi4B and a Rockchips device with 6.2rc2 and it fixed the issue I had seen on Fedora.

Thanks

Quoted 34 lines

---
Changes since v1
Rewrite commit message according feedback.
https://lore.kernel.org/all/[email protected]/

 drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +3 -3
index a83699de01ec..fdd0c9abc1a1 100644
@@ -79,7 +79,8 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
        /* Apple ARM64 platforms have their own idea of board type, passed in
         * via the device tree. They also have an antenna SKU parameter
         */
-       if (!of_property_read_string(np, "brcm,board-type", &prop))
+       err = of_property_read_string(np, "brcm,board-type", &prop);
+       if (!err)
                settings->board_type = prop;
 
        if (!of_property_read_string(np, "apple,antenna-sku", &prop))
@@ -87,7 +88,7 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
 
        /* Set board-type to the first string of the machine compatible prop */
        root = of_find_node_by_path("/");
-       if (root && !settings->board_type) {
+       if (root && err) {
                char *board_type;
                const char *tmp;
 
--

2.35.3

#4 lore raw
In reply to Ivan T. Ivanov
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:

Quoted 9 lines · On Fri, 6 Jan 2023 15:19:05 +0200 you wrote:

The introduction of support for Apple board types inadvertently changed the precedence order, causing hybrid SMBIOS+DT platforms to look up the firmware using the DMI information instead of the device tree compatible to generate the board type. Revert back to the old behavior, as affected platforms use firmwares named after the DT compatible.

Fixes 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")

[...]

Here is the summary with links:
- [v2] brcmfmac: Prefer DT board type over DMI board type

    https://git.kernel.org/netdev/net/c/a5a36720c3f6

You are awesome, thank you!

Signature · 9 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#5 lore raw
In reply to Ivan T. Ivanov
Quoted 8 lines · Ivan T. Ivanov

The introduction of support for Apple board types inadvertently changed the precedence order, causing hybrid SMBIOS+DT platforms to look up the firmware using the DMI information instead of the device tree compatible to generate the board type. Revert back to the old behavior, as affected platforms use firmwares named after the DT compatible.

Fixes 7682de8b3351 ("wifi: brcmfmac: of: Fetch Apple properties")
Quoted 7 lines

[1] https://bugzilla.opensuse.org/show_bug.cgi?id=1206697#c13

Dave applied this directly to net tree:

https://git.kernel.org/linus/a5a36720c3f6

Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel