net: cnss: snapshot of cnss platform driver
CNSS driver snapshot and associated files from kernel-5.4
commit e67e76d6d1c8 ("cnss: Add cnss_get_restart_level").
Added panic handler notifier.
Change-Id: I884af31f21cef5d96b54ca2551102e74812a0b19
Signed-off-by: Sudha Vankudothu <quic_svankudo@quicinc.com>
Signed-off-by: Ravi Ranjan Kumar <quic_ravirk@quicinc.com>
This commit is contained in:
parent
d2fad072d1
commit
c167ff0031
8 changed files with 2706 additions and 0 deletions
|
|
@ -37,6 +37,7 @@ source "drivers/net/wireless/st/Kconfig"
|
|||
source "drivers/net/wireless/ti/Kconfig"
|
||||
source "drivers/net/wireless/zydas/Kconfig"
|
||||
source "drivers/net/wireless/quantenna/Kconfig"
|
||||
source "drivers/net/wireless/cnss/Kconfig"
|
||||
|
||||
config PCMCIA_RAYCS
|
||||
tristate "Aviator/Raytheon 2.4GHz wireless support"
|
||||
|
|
|
|||
|
|
@ -32,3 +32,4 @@ obj-$(CONFIG_USB_NET_RNDIS_WLAN) += rndis_wlan.o
|
|||
obj-$(CONFIG_MAC80211_HWSIM) += mac80211_hwsim.o
|
||||
|
||||
obj-$(CONFIG_VIRT_WIFI) += virt_wifi.o
|
||||
obj-$(CONFIG_CNSS) += cnss/
|
||||
|
|
|
|||
99
drivers/net/wireless/cnss/Kconfig
Normal file
99
drivers/net/wireless/cnss/Kconfig
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# cnss device configuration
|
||||
#
|
||||
|
||||
config CNSS
|
||||
tristate "CNSS driver for wifi module"
|
||||
select CNSS_UTILS
|
||||
select CRYPTO
|
||||
select CRYPTO_HASH
|
||||
select CRYPTO_BLKCIPHER
|
||||
help
|
||||
This module adds support for the CNSS connectivity subsystem used
|
||||
for wifi devices based on the QCA AR6320 chipset.
|
||||
This driver also adds support to integrate WLAN module to subsystem
|
||||
restart framework.
|
||||
|
||||
config CNSS_SDIO
|
||||
bool "Enable/disable cnss sdio platform driver for wifi module"
|
||||
depends on CNSS
|
||||
depends on MMC
|
||||
help
|
||||
This module adds support for the CNSS wlan module interfaced
|
||||
with SDIO bus.
|
||||
This driver also adds support to integrate WLAN module to subsystem
|
||||
restart framework, power on WLAN chip and registered the WLAN module
|
||||
as a SDIO client device.
|
||||
|
||||
config CNSS_MAC_BUG
|
||||
bool "Enable/disable 0-4K memory initialization for QCA6174"
|
||||
depends on CNSS
|
||||
help
|
||||
If enabled, 0-4K memory is reserved for QCA6174 to address
|
||||
a MAC HW bug. MAC would do an invalid pointer fetch based on
|
||||
the data, that was read from 0 to 4K. So fill it with zero's;
|
||||
to an address for which PCIe root complex would honor the read
|
||||
without any errors.
|
||||
|
||||
config CLD_DEBUG
|
||||
bool "Enable/disable CLD debug features"
|
||||
help
|
||||
WLAN CLD driver uses this config to enable certain debug features.
|
||||
Some of the debug features may affect performance or may compromise
|
||||
on security.
|
||||
|
||||
Say N, if you are building a release kernel for production use.
|
||||
Only say Y, if you are building a kernel with debug support.
|
||||
|
||||
config CLD_USB_CORE
|
||||
tristate "Qualcomm Technologies Inc. Core wlan driver for QCA USB interface"
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
select WEXT_CORE
|
||||
select WEXT_SPY
|
||||
select NL80211_TESTMODE
|
||||
help
|
||||
This section contains the necessary modules needed to enable the
|
||||
core WLAN driver for Qualcomm Technologies Inc USB wlan chipset.
|
||||
Select Y to compile the driver in order to have WLAN functionality
|
||||
support.
|
||||
|
||||
config CLD_HL_SDIO_CORE
|
||||
tristate "Qualcomm Technologies Inc. Core wlan driver for QCA SDIO interface"
|
||||
select WIRELESS_EXT
|
||||
select WEXT_PRIV
|
||||
select WEXT_CORE
|
||||
select WEXT_SPY
|
||||
select NL80211_TESTMODE
|
||||
depends on ARCH_QCOM
|
||||
depends on MMC
|
||||
|
||||
config CLD_LL_CORE
|
||||
tristate "Qualcomm Technologies Inc. Core wlan driver"
|
||||
select NL80211_TESTMODE
|
||||
select WEXT_CORE
|
||||
select WEXT_PRIV
|
||||
select WEXT_SPY
|
||||
select WIRELESS_EXT
|
||||
help
|
||||
This section contains the necessary modules needed to enable the
|
||||
core WLAN driver for Qualcomm Technologies Inc QCA6174 chipset.
|
||||
Select Y to compile the driver in order to have WLAN functionality
|
||||
support.
|
||||
|
||||
config CNSS_SECURE_FW
|
||||
bool "Enable/Disable Memory Allocation for Secure Firmware Feature"
|
||||
depends on CNSS
|
||||
help
|
||||
CLD Driver can use this for holding local copy of firmware
|
||||
binaries which is used for sha crypto computation.
|
||||
The Memory Allocation is done only if this Config Parameter is
|
||||
enabled
|
||||
|
||||
config WLAN_FEATURE_RX_WAKELOCK
|
||||
bool "Enable RX wake lock feature"
|
||||
help
|
||||
Enable WLAN_FEATURE_HOLD_RX_WAKELOCK which is required to take rx
|
||||
wakelock when driver receives packets from fw.
|
||||
|
||||
7
drivers/net/wireless/cnss/Makefile
Normal file
7
drivers/net/wireless/cnss/Makefile
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Makefile for CNSS platform driver
|
||||
#
|
||||
|
||||
obj-$(CONFIG_CNSS_SDIO) += cnss_sdio.o
|
||||
obj-$(CONFIG_CNSS) += cnss_common.o
|
||||
438
drivers/net/wireless/cnss/cnss_common.c
Normal file
438
drivers/net/wireless/cnss/cnss_common.c
Normal file
|
|
@ -0,0 +1,438 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/pm_wakeup.h>
|
||||
#include <linux/sched/debug.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/rwsem.h>
|
||||
#include <net/cnss.h>
|
||||
#include "cnss_common.h"
|
||||
#include <net/cfg80211.h>
|
||||
|
||||
#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
|
||||
#define AR6320_REV3_2_VERSION 0x5030000
|
||||
#define AR900B_DEV_VERSION 0x1000000
|
||||
#define QCA9377_REV1_1_VERSION 0x5020001
|
||||
|
||||
static struct cnss_fw_files FW_FILES_QCA6174_FW_1_1 = {
|
||||
"qwlan11.bin", "bdwlan11.bin", "otp11.bin", "utf11.bin",
|
||||
"utfbd11.bin", "epping11.bin", "evicted11.bin"};
|
||||
static struct cnss_fw_files FW_FILES_QCA6174_FW_2_0 = {
|
||||
"qwlan20.bin", "bdwlan20.bin", "otp20.bin", "utf20.bin",
|
||||
"utfbd20.bin", "epping20.bin", "evicted20.bin"};
|
||||
static struct cnss_fw_files FW_FILES_QCA6174_FW_1_3 = {
|
||||
"qwlan13.bin", "bdwlan13.bin", "otp13.bin", "utf13.bin",
|
||||
"utfbd13.bin", "epping13.bin", "evicted13.bin"};
|
||||
static struct cnss_fw_files FW_FILES_QCA6174_FW_3_0 = {
|
||||
"qwlan30.bin", "bdwlan30.bin", "otp30.bin", "utf30.bin",
|
||||
"utfbd30.bin", "epping30.bin", "evicted30.bin"};
|
||||
static struct cnss_fw_files FW_FILES_DEFAULT = {
|
||||
"qwlan.bin", "bdwlan.bin", "otp.bin", "utf.bin",
|
||||
"utfbd.bin", "epping.bin", "evicted.bin"};
|
||||
|
||||
enum cnss_dev_bus_type {
|
||||
CNSS_BUS_NONE = -1,
|
||||
CNSS_BUS_PCI,
|
||||
CNSS_BUS_SDIO
|
||||
};
|
||||
|
||||
static DEFINE_MUTEX(unsafe_channel_list_lock);
|
||||
static DEFINE_MUTEX(dfs_nol_info_lock);
|
||||
|
||||
static struct cnss_unsafe_channel_list {
|
||||
u16 unsafe_ch_count;
|
||||
u16 unsafe_ch_list[CNSS_MAX_CH_NUM];
|
||||
} unsafe_channel_list;
|
||||
|
||||
static struct cnss_dfs_nol_info {
|
||||
void *dfs_nol_info;
|
||||
u16 dfs_nol_info_len;
|
||||
} dfs_nol_info;
|
||||
|
||||
static enum cnss_cc_src cnss_cc_source = CNSS_SOURCE_CORE;
|
||||
|
||||
int cnss_set_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 ch_count)
|
||||
{
|
||||
mutex_lock(&unsafe_channel_list_lock);
|
||||
if (!unsafe_ch_list || ch_count > CNSS_MAX_CH_NUM) {
|
||||
mutex_unlock(&unsafe_channel_list_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
unsafe_channel_list.unsafe_ch_count = ch_count;
|
||||
|
||||
if (ch_count != 0) {
|
||||
memcpy((char *)unsafe_channel_list.unsafe_ch_list,
|
||||
(char *)unsafe_ch_list, ch_count * sizeof(u16));
|
||||
}
|
||||
mutex_unlock(&unsafe_channel_list_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_set_wlan_unsafe_channel);
|
||||
|
||||
int cnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list,
|
||||
u16 *ch_count, u16 buf_len)
|
||||
{
|
||||
mutex_lock(&unsafe_channel_list_lock);
|
||||
if (!unsafe_ch_list || !ch_count) {
|
||||
mutex_unlock(&unsafe_channel_list_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (buf_len < (unsafe_channel_list.unsafe_ch_count * sizeof(u16))) {
|
||||
mutex_unlock(&unsafe_channel_list_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
*ch_count = unsafe_channel_list.unsafe_ch_count;
|
||||
memcpy((char *)unsafe_ch_list,
|
||||
(char *)unsafe_channel_list.unsafe_ch_list,
|
||||
unsafe_channel_list.unsafe_ch_count * sizeof(u16));
|
||||
mutex_unlock(&unsafe_channel_list_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_get_wlan_unsafe_channel);
|
||||
|
||||
int cnss_wlan_set_dfs_nol(const void *info, u16 info_len)
|
||||
{
|
||||
void *temp;
|
||||
struct cnss_dfs_nol_info *dfs_info;
|
||||
|
||||
mutex_lock(&dfs_nol_info_lock);
|
||||
if (!info || !info_len) {
|
||||
mutex_unlock(&dfs_nol_info_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
temp = kmemdup(info, info_len, GFP_KERNEL);
|
||||
if (!temp) {
|
||||
mutex_unlock(&dfs_nol_info_lock);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dfs_info = &dfs_nol_info;
|
||||
kfree(dfs_info->dfs_nol_info);
|
||||
|
||||
dfs_info->dfs_nol_info = temp;
|
||||
dfs_info->dfs_nol_info_len = info_len;
|
||||
mutex_unlock(&dfs_nol_info_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_wlan_set_dfs_nol);
|
||||
|
||||
int cnss_wlan_get_dfs_nol(void *info, u16 info_len)
|
||||
{
|
||||
int len;
|
||||
struct cnss_dfs_nol_info *dfs_info;
|
||||
|
||||
mutex_lock(&dfs_nol_info_lock);
|
||||
if (!info || !info_len) {
|
||||
mutex_unlock(&dfs_nol_info_lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dfs_info = &dfs_nol_info;
|
||||
|
||||
if (!dfs_info->dfs_nol_info || dfs_info->dfs_nol_info_len == 0) {
|
||||
mutex_unlock(&dfs_nol_info_lock);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
len = min(info_len, dfs_info->dfs_nol_info_len);
|
||||
|
||||
memcpy(info, dfs_info->dfs_nol_info, len);
|
||||
mutex_unlock(&dfs_nol_info_lock);
|
||||
|
||||
return len;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_wlan_get_dfs_nol);
|
||||
|
||||
void cnss_init_work(struct work_struct *work, work_func_t func)
|
||||
{
|
||||
INIT_WORK(work, func);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_init_work);
|
||||
|
||||
void cnss_flush_work(void *work)
|
||||
{
|
||||
struct work_struct *cnss_work = work;
|
||||
|
||||
cancel_work_sync(cnss_work);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_flush_work);
|
||||
|
||||
void cnss_flush_delayed_work(void *dwork)
|
||||
{
|
||||
struct delayed_work *cnss_dwork = dwork;
|
||||
|
||||
cancel_delayed_work_sync(cnss_dwork);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_flush_delayed_work);
|
||||
|
||||
void cnss_pm_wake_lock_init(struct wakeup_source **ws, const char *name)
|
||||
{
|
||||
*ws = wakeup_source_register(NULL, name);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_pm_wake_lock_init);
|
||||
|
||||
void cnss_pm_wake_lock(struct wakeup_source *ws)
|
||||
{
|
||||
__pm_stay_awake(ws);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_pm_wake_lock);
|
||||
|
||||
void cnss_pm_wake_lock_timeout(struct wakeup_source *ws, ulong msec)
|
||||
{
|
||||
__pm_wakeup_event(ws, msec);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_pm_wake_lock_timeout);
|
||||
|
||||
void cnss_pm_wake_lock_release(struct wakeup_source *ws)
|
||||
{
|
||||
__pm_relax(ws);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_pm_wake_lock_release);
|
||||
|
||||
void cnss_pm_wake_lock_destroy(struct wakeup_source *ws)
|
||||
{
|
||||
wakeup_source_unregister(ws);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_pm_wake_lock_destroy);
|
||||
|
||||
void cnss_get_monotonic_boottime(struct timespec64 *ts)
|
||||
{
|
||||
ktime_get_boottime_ts64(ts);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_get_monotonic_boottime);
|
||||
|
||||
void cnss_get_boottime(struct timespec64 *ts)
|
||||
{
|
||||
ktime_get_ts64(ts);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_get_boottime);
|
||||
|
||||
void cnss_init_delayed_work(struct delayed_work *work, work_func_t func)
|
||||
{
|
||||
INIT_DELAYED_WORK(work, func);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_init_delayed_work);
|
||||
|
||||
int cnss_vendor_cmd_reply(struct sk_buff *skb)
|
||||
{
|
||||
return cfg80211_vendor_cmd_reply(skb);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_vendor_cmd_reply);
|
||||
|
||||
int cnss_set_cpus_allowed_ptr(struct task_struct *task, ulong cpu)
|
||||
{
|
||||
return set_cpus_allowed_ptr(task, cpumask_of(cpu));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_set_cpus_allowed_ptr);
|
||||
|
||||
/* wlan prop driver cannot invoke show_stack
|
||||
* function directly, so to invoke this function it
|
||||
* call wcnss_dump_stack function
|
||||
*/
|
||||
void cnss_dump_stack(struct task_struct *task)
|
||||
{
|
||||
show_stack(task, NULL, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_dump_stack);
|
||||
|
||||
struct cnss_dev_platform_ops *cnss_get_platform_ops(struct device *dev)
|
||||
{
|
||||
if (!dev)
|
||||
return NULL;
|
||||
else
|
||||
return dev->platform_data;
|
||||
}
|
||||
|
||||
int cnss_common_request_bus_bandwidth(struct device *dev, int bandwidth)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->request_bus_bandwidth)
|
||||
return pf_ops->request_bus_bandwidth(bandwidth);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_request_bus_bandwidth);
|
||||
|
||||
void *cnss_common_get_virt_ramdump_mem(struct device *dev, unsigned long *size)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->get_virt_ramdump_mem)
|
||||
return pf_ops->get_virt_ramdump_mem(size);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_get_virt_ramdump_mem);
|
||||
|
||||
void cnss_common_device_self_recovery(struct device *dev)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->device_self_recovery)
|
||||
pf_ops->device_self_recovery();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_device_self_recovery);
|
||||
|
||||
void cnss_common_schedule_recovery_work(struct device *dev)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->schedule_recovery_work)
|
||||
pf_ops->schedule_recovery_work();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_schedule_recovery_work);
|
||||
|
||||
void cnss_common_device_crashed(struct device *dev)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->device_crashed)
|
||||
pf_ops->device_crashed();
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_device_crashed);
|
||||
|
||||
u8 *cnss_common_get_wlan_mac_address(struct device *dev, u32 *num)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->get_wlan_mac_address)
|
||||
return pf_ops->get_wlan_mac_address(num);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_get_wlan_mac_address);
|
||||
|
||||
int cnss_common_set_wlan_mac_address(struct device *dev, const u8 *in, u32 len)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->set_wlan_mac_address)
|
||||
return pf_ops->set_wlan_mac_address(in, len);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_set_wlan_mac_address);
|
||||
|
||||
int cnss_power_up(struct device *dev)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->power_up)
|
||||
return pf_ops->power_up(dev);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_power_up);
|
||||
|
||||
int cnss_power_down(struct device *dev)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->power_down)
|
||||
return pf_ops->power_down(dev);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_power_down);
|
||||
|
||||
void cnss_get_qca9377_fw_files(struct cnss_fw_files *pfw_files,
|
||||
u32 size, u32 tufello_dual_fw)
|
||||
{
|
||||
if (tufello_dual_fw)
|
||||
memcpy(pfw_files, &FW_FILES_DEFAULT, sizeof(*pfw_files));
|
||||
else
|
||||
memcpy(pfw_files, &FW_FILES_QCA6174_FW_3_0, sizeof(*pfw_files));
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_get_qca9377_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:
|
||||
case AR6320_REV3_2_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 default version 0x%X 0x%X\n", __func__,
|
||||
target_type, target_version);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_get_fw_files_for_target);
|
||||
|
||||
void cnss_set_cc_source(enum cnss_cc_src cc_source)
|
||||
{
|
||||
cnss_cc_source = cc_source;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_set_cc_source);
|
||||
|
||||
enum cnss_cc_src cnss_get_cc_source(void)
|
||||
{
|
||||
return cnss_cc_source;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_get_cc_source);
|
||||
|
||||
const char *cnss_wlan_get_evicted_data_file(void)
|
||||
{
|
||||
return FW_FILES_QCA6174_FW_3_0.evicted_data;
|
||||
}
|
||||
|
||||
int cnss_common_register_tsf_captured_handler(struct device *dev,
|
||||
irq_handler_t handler, void *ctx)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->register_tsf_captured_handler)
|
||||
return pf_ops->register_tsf_captured_handler(handler, ctx);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_register_tsf_captured_handler);
|
||||
|
||||
int cnss_common_unregister_tsf_captured_handler(struct device *dev,
|
||||
void *ctx)
|
||||
{
|
||||
struct cnss_dev_platform_ops *pf_ops = cnss_get_platform_ops(dev);
|
||||
|
||||
if (pf_ops && pf_ops->unregister_tsf_captured_handler)
|
||||
return pf_ops->unregister_tsf_captured_handler(ctx);
|
||||
else
|
||||
return -EINVAL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cnss_common_unregister_tsf_captured_handler);
|
||||
58
drivers/net/wireless/cnss/cnss_common.h
Normal file
58
drivers/net/wireless/cnss/cnss_common.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _NET_CNSS_COMMON_H_
|
||||
#define _NET_CNSS_COMMON_H_
|
||||
|
||||
/* max 20mhz channel count */
|
||||
#define CNSS_MAX_CH_NUM 45
|
||||
|
||||
struct cnss_cap_tsf_info {
|
||||
int irq_num;
|
||||
void *context;
|
||||
irq_handler_t irq_handler;
|
||||
};
|
||||
|
||||
struct cnss_dev_platform_ops {
|
||||
int (*request_bus_bandwidth)(int bandwidth);
|
||||
void* (*get_virt_ramdump_mem)(unsigned long *size);
|
||||
void (*device_self_recovery)(void);
|
||||
void (*schedule_recovery_work)(void);
|
||||
void (*device_crashed)(void);
|
||||
u8 * (*get_wlan_mac_address)(u32 *num);
|
||||
int (*set_wlan_mac_address)(const u8 *in, u32 len);
|
||||
int (*power_up)(struct device *dev);
|
||||
int (*power_down)(struct device *dev);
|
||||
int (*register_tsf_captured_handler)(irq_handler_t handler,
|
||||
void *adapter);
|
||||
int (*unregister_tsf_captured_handler)(void *adapter);
|
||||
};
|
||||
|
||||
int cnss_pci_request_bus_bandwidth(int bandwidth);
|
||||
int cnss_sdio_request_bus_bandwidth(int bandwidth);
|
||||
|
||||
void cnss_sdio_device_crashed(void);
|
||||
void cnss_pci_device_crashed(void);
|
||||
|
||||
void cnss_pci_device_self_recovery(void);
|
||||
void cnss_sdio_device_self_recovery(void);
|
||||
|
||||
void *cnss_pci_get_virt_ramdump_mem(unsigned long *size);
|
||||
void *cnss_sdio_get_virt_ramdump_mem(unsigned long *size);
|
||||
|
||||
void cnss_sdio_schedule_recovery_work(void);
|
||||
void cnss_pci_schedule_recovery_work(void);
|
||||
|
||||
int cnss_pcie_set_wlan_mac_address(const u8 *in, u32 len);
|
||||
int cnss_sdio_set_wlan_mac_address(const u8 *in, u32 len);
|
||||
|
||||
u8 *cnss_pci_get_wlan_mac_address(u32 *num);
|
||||
u8 *cnss_sdio_get_wlan_mac_address(u32 *num);
|
||||
int cnss_sdio_power_up(struct device *dev);
|
||||
int cnss_sdio_power_down(struct device *dev);
|
||||
int cnss_pcie_power_up(struct device *dev);
|
||||
int cnss_pcie_power_down(struct device *dev);
|
||||
const char *cnss_wlan_get_evicted_data_file(void);
|
||||
#endif /* _NET_CNSS_COMMON_H_ */
|
||||
1847
drivers/net/wireless/cnss/cnss_sdio.c
Normal file
1847
drivers/net/wireless/cnss/cnss_sdio.c
Normal file
File diff suppressed because it is too large
Load diff
255
include/net/cnss.h
Normal file
255
include/net/cnss.h
Normal file
|
|
@ -0,0 +1,255 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef _NET_CNSS_H_
|
||||
#define _NET_CNSS_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
#ifdef CONFIG_CNSS
|
||||
#define MAX_FIRMWARE_SIZE (1 * 1024 * 1024)
|
||||
#define CNSS_MAX_FILE_NAME 20
|
||||
#define PINCTRL_SLEEP 0
|
||||
#define PINCTRL_ACTIVE 1
|
||||
|
||||
enum cnss_bus_width_type {
|
||||
CNSS_BUS_WIDTH_NONE,
|
||||
CNSS_BUS_WIDTH_LOW,
|
||||
CNSS_BUS_WIDTH_MEDIUM,
|
||||
CNSS_BUS_WIDTH_HIGH
|
||||
};
|
||||
|
||||
enum cnss_cc_src {
|
||||
CNSS_SOURCE_CORE,
|
||||
CNSS_SOURCE_11D,
|
||||
CNSS_SOURCE_USER
|
||||
};
|
||||
|
||||
/* FW image files */
|
||||
struct cnss_fw_files {
|
||||
char image_file[CNSS_MAX_FILE_NAME];
|
||||
char board_data[CNSS_MAX_FILE_NAME];
|
||||
char otp_data[CNSS_MAX_FILE_NAME];
|
||||
char utf_file[CNSS_MAX_FILE_NAME];
|
||||
char utf_board_data[CNSS_MAX_FILE_NAME];
|
||||
char epping_file[CNSS_MAX_FILE_NAME];
|
||||
char evicted_data[CNSS_MAX_FILE_NAME];
|
||||
};
|
||||
|
||||
struct cnss_wlan_runtime_ops {
|
||||
int (*runtime_suspend)(struct pci_dev *pdev);
|
||||
int (*runtime_resume)(struct pci_dev *pdev);
|
||||
};
|
||||
|
||||
struct cnss_wlan_driver {
|
||||
char *name;
|
||||
int (*probe)(struct pci_dev *pdev, const struct pci_device_id *id);
|
||||
void (*remove)(struct pci_dev *pdev);
|
||||
int (*reinit)(struct pci_dev *pdev, const struct pci_device_id *id);
|
||||
void (*shutdown)(struct pci_dev *pdev);
|
||||
void (*crash_shutdown)(struct pci_dev *pdev);
|
||||
int (*suspend)(struct pci_dev *pdev, pm_message_t state);
|
||||
int (*resume)(struct pci_dev *pdev);
|
||||
void (*modem_status)(struct pci_dev *pdev, int state);
|
||||
void (*update_status)(struct pci_dev *pdev, uint32_t status);
|
||||
struct cnss_wlan_runtime_ops *runtime_ops;
|
||||
const struct pci_device_id *id_table;
|
||||
};
|
||||
|
||||
/*
|
||||
* codeseg_total_bytes: Total bytes across all the codesegment blocks
|
||||
* num_codesegs: No of Pages used
|
||||
* codeseg_size: Size of each segment. Should be power of 2 and multiple of 4K
|
||||
* codeseg_size_log2: log2(codeseg_size)
|
||||
* codeseg_busaddr: Physical address of the DMAble memory;4K aligned
|
||||
*/
|
||||
|
||||
#define CODESWAP_MAX_CODESEGS 16
|
||||
struct codeswap_codeseg_info {
|
||||
u32 codeseg_total_bytes;
|
||||
u32 num_codesegs;
|
||||
u32 codeseg_size;
|
||||
u32 codeseg_size_log2;
|
||||
void *codeseg_busaddr[CODESWAP_MAX_CODESEGS];
|
||||
};
|
||||
|
||||
struct image_desc_info {
|
||||
dma_addr_t fw_addr;
|
||||
u32 fw_size;
|
||||
dma_addr_t bdata_addr;
|
||||
u32 bdata_size;
|
||||
};
|
||||
|
||||
/* platform capabilities */
|
||||
enum cnss_platform_cap_flag {
|
||||
CNSS_HAS_EXTERNAL_SWREG = 0x01,
|
||||
CNSS_HAS_UART_ACCESS = 0x02,
|
||||
};
|
||||
|
||||
struct cnss_platform_cap {
|
||||
u32 cap_flag;
|
||||
};
|
||||
|
||||
/* WLAN driver status, keep it aligned with cnss2 */
|
||||
enum cnss_driver_status {
|
||||
CNSS_UNINITIALIZED,
|
||||
CNSS_INITIALIZED,
|
||||
CNSS_LOAD_UNLOAD,
|
||||
CNSS_RECOVERY,
|
||||
CNSS_FW_DOWN,
|
||||
CNSS_SSR_FAIL,
|
||||
};
|
||||
|
||||
enum cnss_runtime_request {
|
||||
CNSS_PM_RUNTIME_GET,
|
||||
CNSS_PM_RUNTIME_PUT,
|
||||
CNSS_PM_RUNTIME_MARK_LAST_BUSY,
|
||||
CNSS_PM_RUNTIME_RESUME,
|
||||
CNSS_PM_RUNTIME_PUT_NOIDLE,
|
||||
CNSS_PM_REQUEST_RESUME,
|
||||
CNSS_PM_RUNTIME_PUT_AUTO,
|
||||
CNSS_PM_GET_NORESUME,
|
||||
};
|
||||
|
||||
struct dma_iommu_mapping *cnss_smmu_get_mapping(void);
|
||||
int cnss_smmu_map(phys_addr_t paddr, uint32_t *iova_addr, size_t size);
|
||||
int cnss_get_fw_image(struct image_desc_info *image_desc_info);
|
||||
void cnss_runtime_init(struct device *dev, int auto_delay);
|
||||
void cnss_runtime_exit(struct device *dev);
|
||||
void cnss_wlan_pci_link_down(void);
|
||||
int cnss_pcie_shadow_control(struct pci_dev *dev, bool enable);
|
||||
int cnss_wlan_register_driver(struct cnss_wlan_driver *driver);
|
||||
void cnss_wlan_unregister_driver(struct cnss_wlan_driver *driver);
|
||||
int cnss_get_fw_files(struct cnss_fw_files *pfw_files);
|
||||
int cnss_get_fw_files_for_target(struct cnss_fw_files *pfw_files,
|
||||
u32 target_type, u32 target_version);
|
||||
void cnss_get_qca9377_fw_files(struct cnss_fw_files *pfw_files,
|
||||
u32 size, u32 tufello_dual_fw);
|
||||
|
||||
int cnss_request_bus_bandwidth(int bandwidth);
|
||||
|
||||
#ifdef CONFIG_CNSS_SECURE_FW
|
||||
int cnss_get_sha_hash(const u8 *data, u32 data_len,
|
||||
u8 *hash_idx, u8 *out);
|
||||
void *cnss_get_fw_ptr(void);
|
||||
#endif
|
||||
|
||||
int cnss_get_codeswap_struct(struct codeswap_codeseg_info *swap_seg);
|
||||
int cnss_get_bmi_setup(void);
|
||||
|
||||
#ifdef CONFIG_PCI_MSM
|
||||
int cnss_wlan_pm_control(bool vote);
|
||||
#endif
|
||||
void cnss_lock_pm_sem(void);
|
||||
void cnss_release_pm_sem(void);
|
||||
|
||||
void cnss_request_pm_qos_type(int latency_type, u32 qos_val);
|
||||
void cnss_request_pm_qos(u32 qos_val);
|
||||
void cnss_remove_pm_qos(void);
|
||||
|
||||
void cnss_pci_request_pm_qos_type(int latency_type, u32 qos_val);
|
||||
void cnss_pci_request_pm_qos(u32 qos_val);
|
||||
void cnss_pci_remove_pm_qos(void);
|
||||
|
||||
void cnss_sdio_request_pm_qos_type(int latency_type, u32 qos_val);
|
||||
void cnss_sdio_request_pm_qos(u32 qos_val);
|
||||
void cnss_sdio_remove_pm_qos(void);
|
||||
|
||||
int cnss_get_platform_cap(struct cnss_platform_cap *cap);
|
||||
void cnss_set_driver_status(enum cnss_driver_status driver_status);
|
||||
|
||||
#ifndef CONFIG_WCNSS_MEM_PRE_ALLOC
|
||||
static inline int wcnss_pre_alloc_reset(void) { return 0; }
|
||||
#endif
|
||||
|
||||
int msm_pcie_enumerate(u32 rc_idx);
|
||||
int cnss_auto_suspend(void);
|
||||
int cnss_auto_resume(void);
|
||||
int cnss_prevent_auto_suspend(const char *caller_func);
|
||||
int cnss_allow_auto_suspend(const char *caller_func);
|
||||
int cnss_is_auto_suspend_allowed(const char *caller_func);
|
||||
|
||||
int cnss_pm_runtime_request(struct device *dev, enum
|
||||
cnss_runtime_request request);
|
||||
void cnss_set_cc_source(enum cnss_cc_src cc_source);
|
||||
enum cnss_cc_src cnss_get_cc_source(void);
|
||||
#endif
|
||||
|
||||
void cnss_pm_wake_lock_init(struct wakeup_source **ws, const char *name);
|
||||
void cnss_pm_wake_lock(struct wakeup_source *ws);
|
||||
|
||||
void cnss_device_crashed(void);
|
||||
void cnss_device_self_recovery(void);
|
||||
void *cnss_get_virt_ramdump_mem(unsigned long *size);
|
||||
|
||||
void cnss_schedule_recovery_work(void);
|
||||
int cnss_pcie_set_wlan_mac_address(const u8 *in, uint32_t len);
|
||||
u8 *cnss_get_wlan_mac_address(struct device *dev, uint32_t *num);
|
||||
int cnss_sdio_set_wlan_mac_address(const u8 *in, uint32_t len);
|
||||
|
||||
enum {
|
||||
CNSS_RESET_SOC = 0,
|
||||
CNSS_RESET_SUBSYS_COUPLED,
|
||||
CNSS_RESET_LEVEL_MAX
|
||||
};
|
||||
|
||||
int cnss_get_restart_level(void);
|
||||
|
||||
struct cnss_sdio_wlan_driver {
|
||||
const char *name;
|
||||
const struct sdio_device_id *id_table;
|
||||
int (*probe)(struct sdio_func *func, const struct sdio_device_id *id);
|
||||
void (*remove)(struct sdio_func *func);
|
||||
int (*reinit)(struct sdio_func *func, const struct sdio_device_id *id);
|
||||
void (*shutdown)(struct sdio_func *func);
|
||||
void (*crash_shutdown)(struct sdio_func *func);
|
||||
int (*suspend)(struct device *dev);
|
||||
int (*resume)(struct device *dev);
|
||||
};
|
||||
|
||||
int cnss_sdio_wlan_register_driver(struct cnss_sdio_wlan_driver *driver);
|
||||
void cnss_sdio_wlan_unregister_driver(struct cnss_sdio_wlan_driver *driver);
|
||||
|
||||
typedef void (*oob_irq_handler_t)(void *dev_para);
|
||||
int cnss_wlan_query_oob_status(void);
|
||||
int cnss_wlan_register_oob_irq_handler(oob_irq_handler_t handler, void *pm_oob);
|
||||
int cnss_wlan_unregister_oob_irq_handler(void *pm_oob);
|
||||
|
||||
void cnss_dump_stack(struct task_struct *task);
|
||||
u8 *cnss_common_get_wlan_mac_address(struct device *dev, uint32_t *num);
|
||||
void cnss_init_work(struct work_struct *work, work_func_t func);
|
||||
void cnss_flush_delayed_work(void *dwork);
|
||||
void cnss_flush_work(void *work);
|
||||
void cnss_pm_wake_lock_timeout(struct wakeup_source *ws, ulong msec);
|
||||
void cnss_pm_wake_lock_release(struct wakeup_source *ws);
|
||||
void cnss_pm_wake_lock_destroy(struct wakeup_source *ws);
|
||||
void cnss_get_monotonic_boottime(struct timespec64 *ts);
|
||||
void cnss_get_boottime(struct timespec64 *ts);
|
||||
void cnss_init_delayed_work(struct delayed_work *work, work_func_t func);
|
||||
int cnss_vendor_cmd_reply(struct sk_buff *skb);
|
||||
int cnss_set_cpus_allowed_ptr(struct task_struct *task, ulong cpu);
|
||||
int cnss_set_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 ch_count);
|
||||
int cnss_get_wlan_unsafe_channel(u16 *unsafe_ch_list, u16 *ch_count, u16 buf_len);
|
||||
int cnss_wlan_set_dfs_nol(const void *info, u16 info_len);
|
||||
int cnss_wlan_get_dfs_nol(void *info, u16 info_len);
|
||||
int cnss_common_request_bus_bandwidth(struct device *dev, int bandwidth);
|
||||
void cnss_common_device_crashed(struct device *dev);
|
||||
void cnss_common_device_self_recovery(struct device *dev);
|
||||
void *cnss_common_get_virt_ramdump_mem(struct device *dev, unsigned long *size);
|
||||
void cnss_common_schedule_recovery_work(struct device *dev);
|
||||
int cnss_common_set_wlan_mac_address(struct device *dev, const u8 *in, uint32_t len);
|
||||
u8 *cnss_common_get_wlan_mac_address(struct device *dev, uint32_t *num);
|
||||
int cnss_power_up(struct device *dev);
|
||||
int cnss_power_down(struct device *dev);
|
||||
int cnss_sdio_configure_spdt(bool state);
|
||||
|
||||
int cnss_common_register_tsf_captured_handler(struct device *dev, irq_handler_t handler,
|
||||
void *ctx);
|
||||
int cnss_common_unregister_tsf_captured_handler(struct device *dev, void *ctx);
|
||||
#endif /* _NET_CNSS_H_ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue