Skip to content

Commit

Permalink
wifi: brcmfmac: of: Fetch Apple properties
Browse files Browse the repository at this point in the history
On Apple ARM64 platforms, firmware selection requires two properties
that come from system firmware: the module-instance (aka "island", a
codename representing a given hardware platform) and the antenna-sku.
We map Apple's module codenames to board_types in the form
"apple,<module-instance>".

The mapped board_type is added to the DTS file in that form, while the
antenna-sku is forwarded by our bootloader from the Apple Device Tree
into the FDT. Grab them from the DT so firmware selection can use
them.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/E1oZDnn-0077aS-NA@rmk-PC.armlinux.org.uk
  • Loading branch information
Hector Martin authored and Kalle Valo committed Sep 19, 2022
1 parent e63efbc commit 7682de8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ struct brcmf_mp_device {
struct brcmfmac_pd_cc *country_codes;
const char *board_type;
unsigned char mac[ETH_ALEN];
const char *antenna_sku;
union {
struct brcmfmac_sdio_pd sdio;
} bus;
Expand Down
12 changes: 11 additions & 1 deletion drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,24 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type,
{
struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
struct device_node *root, *np = dev->of_node;
const char *prop;
int irq;
int err;
u32 irqf;
u32 val;

/* 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))
settings->board_type = prop;

if (!of_property_read_string(np, "apple,antenna-sku", &prop))
settings->antenna_sku = prop;

/* Set board-type to the first string of the machine compatible prop */
root = of_find_node_by_path("/");
if (root) {
if (root && !settings->board_type) {
char *board_type;
const char *tmp;

Expand Down

0 comments on commit 7682de8

Please sign in to comment.