Skip to content

Commit

Permalink
cnss: using bmi target info from wlan to determine firmware files
Browse files Browse the repository at this point in the history
Currently we are reading ROME revision id from pci config space and
deciding firmware files based on that. This is not portable across
different buses. Instead, we need to use the revision id read by qcacld
WLAN driver(BMI) to decide firmware files for ROME. This change amends
cnss_get_fw_files API to receive target info and return firmware file
names based on that.

CRs-Fixed: 669587
Change-Id: Ic6ea327737a4ab428020f0ee5414a144a45f21ba
Signed-off-by: Mohit Khanna <mkhannaqca@codeaurora.org>
Signed-off-by: Sunghun Ra <nsh1189@gmail.com>
  • Loading branch information
Mohit Khanna authored and javilonas committed May 14, 2015
1 parent ca13770 commit 3ccf91f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
46 changes: 46 additions & 0 deletions drivers/net/wireless/cnss/cnss.c
Expand Up @@ -56,6 +56,22 @@
#define QCA6174_FW_1_3 (0x13)
#define QCA6174_FW_2_0 (0x20)
#define QCA6174_FW_3_0 (0x30)
#define AR6320_REV1_VERSION 0x5000000
#define AR6320_REV1_1_VERSION 0x5000001
#define AR6320_REV1_3_VERSION 0x5000003
#define AR6320_REV2_1_VERSION 0x5010000
#define AR6320_REV3_VERSION 0x5020000
static struct cnss_fw_files FW_FILES_QCA6174_FW_1_1 = {
"qwlan11.bin", "bdwlan11.bin", "otp11.bin", "utf11.bin", "utfbd11.bin"};
static struct cnss_fw_files FW_FILES_QCA6174_FW_2_0 = {
"qwlan20.bin", "bdwlan20.bin", "otp20.bin", "utf20.bin", "utfbd20.bin"};
static struct cnss_fw_files FW_FILES_QCA6174_FW_1_3 = {
"qwlan13.bin", "bdwlan13.bin", "otp13.bin", "utf13.bin", "utfbd13.bin"};
static struct cnss_fw_files FW_FILES_QCA6174_FW_3_0 = {
"qwlan30.bin", "bdwlan30.bin", "otp30.bin", "utf30.bin", "utfbd30.bin"};
static struct cnss_fw_files FW_FILES_DEFAULT = {
"qwlan.bin", "bdwlan.bin", "otp.bin", "utf.bin", "utfbd.bin"};


#define WLAN_VREG_NAME "vdd-wlan"
#define WLAN_SWREG_NAME "wlan-soc-swreg"
Expand Down Expand Up @@ -534,6 +550,36 @@ int cnss_get_fw_files(struct cnss_fw_files *pfw_files)
}
EXPORT_SYMBOL(cnss_get_fw_files);

int cnss_get_fw_files_for_target(struct cnss_fw_files *pfw_files,
u32 target_type, u32 target_version)
{
if (!pfw_files)
return -ENODEV;

switch (target_version) {
case AR6320_REV1_VERSION:
case AR6320_REV1_1_VERSION:
memcpy(pfw_files, &FW_FILES_QCA6174_FW_1_1, sizeof(*pfw_files));
break;
case AR6320_REV1_3_VERSION:
memcpy(pfw_files, &FW_FILES_QCA6174_FW_1_3, sizeof(*pfw_files));
break;
case AR6320_REV2_1_VERSION:
memcpy(pfw_files, &FW_FILES_QCA6174_FW_2_0, sizeof(*pfw_files));
break;
case AR6320_REV3_VERSION:
memcpy(pfw_files, &FW_FILES_QCA6174_FW_3_0, sizeof(*pfw_files));
break;
default:
memcpy(pfw_files, &FW_FILES_DEFAULT, sizeof(*pfw_files));
pr_err("%s version mismatch 0x%X 0x%X",
__func__, target_type, target_version);
break;
}
return 0;
}
EXPORT_SYMBOL(cnss_get_fw_files_for_target);

#ifdef CONFIG_CNSS_SECURE_FW
static void cnss_wlan_fw_mem_alloc(struct pci_dev *pdev)
{
Expand Down
2 changes: 2 additions & 0 deletions include/net/cnss.h
Expand Up @@ -86,6 +86,8 @@ extern int cnss_pcie_shadow_control(struct pci_dev *dev, bool enable);
extern int cnss_wlan_register_driver(struct cnss_wlan_driver *driver);
extern void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver);
extern int cnss_get_fw_files(struct cnss_fw_files *pfw_files);
extern int cnss_get_fw_files_for_target(struct cnss_fw_files *pfw_files,
u32 target_type, u32 target_version);
extern void cnss_flush_work(void *work);
extern void cnss_flush_delayed_work(void *dwork);
extern void cnss_get_monotonic_boottime(struct timespec *ts);
Expand Down

0 comments on commit 3ccf91f

Please sign in to comment.