hc
2024-02-19 1c055e55a242a33e574e48be530e06770a210dcd
kernel/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c
....@@ -1,17 +1,6 @@
1
+// SPDX-License-Identifier: ISC
12 /*
23 * Copyright (c) 2014 Broadcom Corporation
3
- *
4
- * Permission to use, copy, modify, and/or distribute this software for any
5
- * purpose with or without fee is hereby granted, provided that the above
6
- * copyright notice and this permission notice appear in all copies.
7
- *
8
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
154 */
165 #include <linux/init.h>
176 #include <linux/of.h>
....@@ -27,11 +16,33 @@
2716 struct brcmf_mp_device *settings)
2817 {
2918 struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio;
30
- struct device_node *np = dev->of_node;
19
+ struct device_node *root, *np = dev->of_node;
3120 int irq;
3221 u32 irqf;
3322 u32 val;
3423
24
+ /* Set board-type to the first string of the machine compatible prop */
25
+ root = of_find_node_by_path("/");
26
+ if (root) {
27
+ int i, len;
28
+ char *board_type;
29
+ const char *tmp;
30
+
31
+ of_property_read_string_index(root, "compatible", 0, &tmp);
32
+
33
+ /* get rid of '/' in the compatible string to be able to find the FW */
34
+ len = strlen(tmp) + 1;
35
+ board_type = devm_kzalloc(dev, len, GFP_KERNEL);
36
+ strscpy(board_type, tmp, len);
37
+ for (i = 0; i < board_type[i]; i++) {
38
+ if (board_type[i] == '/')
39
+ board_type[i] = '-';
40
+ }
41
+ settings->board_type = board_type;
42
+
43
+ of_node_put(root);
44
+ }
45
+
3546 if (!np || bus_type != BRCMF_BUSTYPE_SDIO ||
3647 !of_device_is_compatible(np, "brcm,bcm4329-fmac"))
3748 return;