aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211/brcmfmac
diff options
context:
space:
mode:
authorDaniel Kim <dekim@broadcom.com>2014-07-12 02:49:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-07-15 16:00:12 -0400
commitc1b20532ef395f23c2d24bc9c7f772a45e0420c7 (patch)
tree880138c85af5188784f78e8f9e0b31ec0b8f696e /drivers/net/wireless/brcm80211/brcmfmac
parent82d957e09d4f0ff8091ca67e39b51ec6bdc672b1 (diff)
brcmfmac: Make firmware path a module parameter
This patch makes firmware path a module parameter so that firmware and nvram files can be loaded from the specified path. Signed-off-by: Daniel Kim <dekim@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c47
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/firmware.c5
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/firmware.h5
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h4
4 files changed, 41 insertions, 20 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
index c0486329331b..67d91d5cc13d 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/dhd_sdio.c
@@ -666,28 +666,34 @@ static const struct brcmf_firmware_names brcmf_fwname_data[] = {
666 { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) } 666 { BRCM_CC_4354_CHIP_ID, 0xFFFFFFFF, BRCMF_FIRMWARE_NVRAM(BCM4354) }
667}; 667};
668 668
669static const char *brcmf_sdio_get_fwname(struct brcmf_chip *ci, 669static int brcmf_sdio_get_fwnames(struct brcmf_chip *ci,
670 enum brcmf_firmware_type type) 670 struct brcmf_sdio_dev *sdiodev)
671{ 671{
672 int i; 672 int i;
673 673
674 for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) { 674 for (i = 0; i < ARRAY_SIZE(brcmf_fwname_data); i++) {
675 if (brcmf_fwname_data[i].chipid == ci->chip && 675 if (brcmf_fwname_data[i].chipid == ci->chip &&
676 brcmf_fwname_data[i].revmsk & BIT(ci->chiprev)) { 676 brcmf_fwname_data[i].revmsk & BIT(ci->chiprev))
677 switch (type) { 677 break;
678 case BRCMF_FIRMWARE_BIN:
679 return brcmf_fwname_data[i].bin;
680 case BRCMF_FIRMWARE_NVRAM:
681 return brcmf_fwname_data[i].nv;
682 default:
683 brcmf_err("invalid firmware type (%d)\n", type);
684 return NULL;
685 }
686 }
687 } 678 }
688 brcmf_err("Unknown chipid %d [%d]\n", 679
689 ci->chip, ci->chiprev); 680 if (i == ARRAY_SIZE(brcmf_fwname_data)) {
690 return NULL; 681 brcmf_err("Unknown chipid %d [%d]\n", ci->chip, ci->chiprev);
682 return -ENODEV;
683 }
684
685 /* check if firmware path is provided by module parameter */
686 if (brcmf_firmware_path[0] != '\0') {
687 if (brcmf_firmware_path[strlen(brcmf_firmware_path) - 1] != '/')
688 strcat(brcmf_firmware_path, "/");
689
690 strcpy(sdiodev->fw_name, brcmf_firmware_path);
691 strcpy(sdiodev->nvram_name, brcmf_firmware_path);
692 }
693 strcat(sdiodev->fw_name, brcmf_fwname_data[i].bin);
694 strcat(sdiodev->nvram_name, brcmf_fwname_data[i].nv);
695
696 return 0;
691} 697}
692 698
693static void pkt_align(struct sk_buff *p, int len, int align) 699static void pkt_align(struct sk_buff *p, int len, int align)
@@ -4160,11 +4166,12 @@ struct brcmf_sdio *brcmf_sdio_probe(struct brcmf_sdio_dev *sdiodev)
4160 brcmf_sdio_debugfs_create(bus); 4166 brcmf_sdio_debugfs_create(bus);
4161 brcmf_dbg(INFO, "completed!!\n"); 4167 brcmf_dbg(INFO, "completed!!\n");
4162 4168
4169 ret = brcmf_sdio_get_fwnames(bus->ci, sdiodev);
4170 if (ret)
4171 goto fail;
4172
4163 ret = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM, 4173 ret = brcmf_fw_get_firmwares(sdiodev->dev, BRCMF_FW_REQUEST_NVRAM,
4164 brcmf_sdio_get_fwname(bus->ci, 4174 sdiodev->fw_name, sdiodev->nvram_name,
4165 BRCMF_FIRMWARE_BIN),
4166 brcmf_sdio_get_fwname(bus->ci,
4167 BRCMF_FIRMWARE_NVRAM),
4168 brcmf_sdio_firmware_callback); 4175 brcmf_sdio_firmware_callback);
4169 if (ret != 0) { 4176 if (ret != 0) {
4170 brcmf_err("async firmware request failed: %d\n", ret); 4177 brcmf_err("async firmware request failed: %d\n", ret);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
index 7b7d237c1ddb..8ea9f283d2b8 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.c
@@ -18,10 +18,15 @@
18#include <linux/slab.h> 18#include <linux/slab.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/firmware.h> 20#include <linux/firmware.h>
21#include <linux/module.h>
21 22
22#include "dhd_dbg.h" 23#include "dhd_dbg.h"
23#include "firmware.h" 24#include "firmware.h"
24 25
26char brcmf_firmware_path[BRCMF_FW_PATH_LEN];
27module_param_string(firmware_path, brcmf_firmware_path,
28 BRCMF_FW_PATH_LEN, 0440);
29
25enum nvram_parser_state { 30enum nvram_parser_state {
26 IDLE, 31 IDLE,
27 KEY, 32 KEY,
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
index 6431bfd7afff..4d3482356b77 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/firmware.h
@@ -21,6 +21,11 @@
21#define BRCMF_FW_REQ_FLAGS 0x00F0 21#define BRCMF_FW_REQ_FLAGS 0x00F0
22#define BRCMF_FW_REQ_NV_OPTIONAL 0x0010 22#define BRCMF_FW_REQ_NV_OPTIONAL 0x0010
23 23
24#define BRCMF_FW_PATH_LEN 256
25#define BRCMF_FW_NAME_LEN 32
26
27extern char brcmf_firmware_path[];
28
24void brcmf_fw_nvram_free(void *nvram); 29void brcmf_fw_nvram_free(void *nvram);
25/* 30/*
26 * Request firmware(s) asynchronously. When the asynchronous request 31 * Request firmware(s) asynchronously. When the asynchronous request
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
index 3deab7959a0d..6c5e585ccda9 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
+++ b/drivers/net/wireless/brcm80211/brcmfmac/sdio_host.h
@@ -18,6 +18,8 @@
18#define _BRCM_SDH_H_ 18#define _BRCM_SDH_H_
19 19
20#include <linux/skbuff.h> 20#include <linux/skbuff.h>
21#include <linux/firmware.h>
22#include "firmware.h"
21 23
22#define SDIO_FUNC_0 0 24#define SDIO_FUNC_0 0
23#define SDIO_FUNC_1 1 25#define SDIO_FUNC_1 1
@@ -182,6 +184,8 @@ struct brcmf_sdio_dev {
182 uint max_segment_size; 184 uint max_segment_size;
183 uint txglomsz; 185 uint txglomsz;
184 struct sg_table sgtable; 186 struct sg_table sgtable;
187 char fw_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
188 char nvram_name[BRCMF_FW_PATH_LEN + BRCMF_FW_NAME_LEN];
185}; 189};
186 190
187/* sdio core registers */ 191/* sdio core registers */