Home Home > GIT Browse > openSUSE-15.1
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Brugger <mbrugger@suse.com>2019-01-10 19:12:26 +0100
committerMatthias Brugger <mbrugger@suse.com>2019-01-11 11:40:41 +0100
commita5e003eb55aede77c06f5a778d154f9cb39442ac (patch)
tree091c708b3a6a0b271eaa574ebf03bd2a5704953e
parentbfb238273d35ff2f2ab82413f99745cdcf589b1c (diff)
brcmfmac: Set board_type from DMI on x86 based machines
-rw-r--r--patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch194
-rw-r--r--series.conf1
2 files changed, 195 insertions, 0 deletions
diff --git a/patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch b/patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch
new file mode 100644
index 0000000000..50e42a9387
--- /dev/null
+++ b/patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch
@@ -0,0 +1,194 @@
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Oct 2018 13:01:02 +0200
+Subject: brcmfmac: Set board_type from DMI on x86 based machines
+Git-commit: bd1e82bb420adf4ad7cd468d8a482cde622dd69d
+Patch-mainline: v5.0-rc1
+References: fate#326215
+
+For x86 based machines, set the board_type used for nvram file selection
+based on the DMI sys-vendor and product-name strings.
+
+Since on some models these strings are too generic, this commit also adds
+a quirk table overriding the strings for models listed in that table.
+
+The board_type setting is used to load the board-specific nvram file with
+a board-specific name so that we can ship files for each supported board
+in linux-firmware.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
+Signed-off-by: Matthias Brugger <mbrugger@suse.com>
+---
+ .../broadcom/brcm80211/brcmfmac/Makefile | 2 +
+ .../broadcom/brcm80211/brcmfmac/common.c | 3 +-
+ .../broadcom/brcm80211/brcmfmac/common.h | 7 ++
+ .../broadcom/brcm80211/brcmfmac/dmi.c | 116 ++++++++++++++++++
+ 4 files changed, 127 insertions(+), 1 deletion(-)
+ create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
+index 1f5a9b948abf..22fd95a736a8 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile
+@@ -54,3 +54,5 @@ brcmfmac-$(CONFIG_BRCM_TRACING) += \
+ tracepoint.o
+ brcmfmac-$(CONFIG_OF) += \
+ of.o
++brcmfmac-$(CONFIG_DMI) += \
++ dmi.o
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+index 94044a7a6021..d52774c6489b 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c
+@@ -448,8 +448,9 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev,
+ }
+ }
+ if (!found) {
+- /* No platform data for this device, try OF (Open Firwmare) */
++ /* No platform data for this device, try OF and DMI data */
+ brcmf_of_probe(dev, bus_type, settings);
++ brcmf_dmi_probe(settings, chip, chiprev);
+ }
+ return settings;
+ }
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+index e63a273642e9..4ce56be90b74 100644
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h
+@@ -75,4 +75,11 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param);
+ /* Sets dongle media info (drv_version, mac address). */
+ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp);
+
++#ifdef CONFIG_DMI
++void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev);
++#else
++static inline void
++brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) {}
++#endif
++
+ #endif /* BRCMFMAC_COMMON_H */
+diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+new file mode 100644
+index 000000000000..51d76ac45075
+--- /dev/null
++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c
+@@ -0,0 +1,116 @@
++/*
++ * Copyright 2018 Hans de Goede <hdegoede@redhat.com>
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
++ * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
++ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
++ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <linux/dmi.h>
++#include <linux/mod_devicetable.h>
++#include "core.h"
++#include "common.h"
++#include "brcm_hw_ids.h"
++
++/* The DMI data never changes so we can use a static buf for this */
++static char dmi_board_type[128];
++
++struct brcmf_dmi_data {
++ u32 chip;
++ u32 chiprev;
++ const char *board_type;
++};
++
++/* NOTE: Please keep all entries sorted alphabetically */
++
++static const struct brcmf_dmi_data gpd_win_pocket_data = {
++ BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket"
++};
++
++static const struct brcmf_dmi_data jumper_ezpad_mini3_data = {
++ BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3"
++};
++
++static const struct brcmf_dmi_data meegopad_t08_data = {
++ BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08"
++};
++
++static const struct dmi_system_id dmi_platform_data[] = {
++ {
++ /* Match for the GPDwin which unfortunately uses somewhat
++ * generic dmi strings, which is why we test for 4 strings.
++ * Comparing against 23 other byt/cht boards, board_vendor
++ * and board_name are unique to the GPDwin, where as only one
++ * other board has the same board_serial and 3 others have
++ * the same default product_name. Also the GPDwin is the
++ * only device to have both board_ and product_name not set.
++ */
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
++ DMI_MATCH(DMI_BOARD_NAME, "Default string"),
++ DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
++ },
++ .driver_data = (void *)&gpd_win_pocket_data,
++ },
++ {
++ /* Jumper EZpad mini3 */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),
++ /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
++ DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
++ },
++ .driver_data = (void *)&jumper_ezpad_mini3_data,
++ },
++ {
++ /* Meegopad T08 */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "Default string"),
++ DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
++ DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
++ DMI_MATCH(DMI_BOARD_VERSION, "V1.1"),
++ },
++ .driver_data = (void *)&meegopad_t08_data,
++ },
++ {}
++};
++
++void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev)
++{
++ const struct dmi_system_id *match;
++ const struct brcmf_dmi_data *data;
++ const char *sys_vendor;
++ const char *product_name;
++
++ /* Some models have DMI strings which are too generic, e.g.
++ * "Default string", we use a quirk table for these.
++ */
++ for (match = dmi_first_match(dmi_platform_data);
++ match;
++ match = dmi_first_match(match + 1)) {
++ data = match->driver_data;
++
++ if (data->chip == chip && data->chiprev == chiprev) {
++ settings->board_type = data->board_type;
++ return;
++ }
++ }
++
++ /* Not found in the quirk-table, use sys_vendor-product_name */
++ sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
++ product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
++ if (sys_vendor && product_name) {
++ snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s",
++ sys_vendor, product_name);
++ settings->board_type = dmi_board_type;
++ }
++}
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index c446d5e286..10d697a120 100644
--- a/series.conf
+++ b/series.conf
@@ -41795,6 +41795,7 @@
patches.drivers/0002-brcmfmac-Remove-recursion-from-firmware-load-error-h.patch
patches.drivers/0003-brcmfmac-Add-support-for-first-trying-to-get-a-board.patch
patches.drivers/0004-brcmfmac-Set-board_type-used-for-nvram-file-selectio.patch
+ patches.drivers/0005-brcmfmac-Set-board_type-from-DMI-on-x86-based-machin.patch
patches.drivers/wlcore-Fix-the-return-value-in-case-of-error-in-wlco.patch
patches.drivers/rtl8xxxu-Fix-missing-break-in-switch.patch
patches.drivers/wireless-airo-potential-buffer-overflow-in-sprintf.patch