Commit Graph

157 次程式碼提交

作者 SHA1 備註 提交日期
Naman Padhiar
35fdadc9a2 cnss2: Avoid shadow register dump in RDDM mode
Before CNSS2 triggers RDDM mode in device it collects shadow
register dump in a global variable. Now when device moves to
RDDM, shadow registers will be reset. Reading shadow registers
in RDDM mode will override previously read correct values with
reset values. To avoid it, do not dump shadow register in RDDM
mode.

Change-Id: I470208be7e38bc9291932a7acfbaf07d87d46651
2022-11-26 11:53:00 -08:00
Naman Padhiar
69cf56c2cf cnss2: Dump PBL logging registers on RDDM timeout
Dump PBL and SBL logging registers to debug RDDM failure.

Change-Id: I9225e95c529a928e6e6f9e4528dadbe7237440b3
2022-11-26 11:52:59 -08:00
Rajesh Chauhan
8d75ecdd2d cnss2: Setup GPIOs for interrupt wakeup capable
Setup GPIOs for interrupt wakeup capable by calling
msm_gpio_mpm_wake_set() for such GPIOs.

Change-Id: I8a6e35b6e5ab49c569bfcb0a96c5361072cbe458
CRs-Fixed: 3345066
2022-11-23 21:25:51 -08:00
Vijay Raj
722aaf5581 wlan_platform: Add CLD80211_ATTR_IFINDEX to send interface index
Add CLD80211_ATTR_IFINDEX attribute to send interface index
in order to overcome duplicate logs for STA+STA case

Change-Id: Iba2a5d59b2e3a444844510afa2f17140244507d7
CRs-Fixed: 3340768
2022-11-23 13:54:50 -08:00
Rajesh Chauhan
3ea3cda16f cnss2: Add support for additional regulators
Add support for regulators: 1.2V IO, and Antenna sharing
to enable those based on entries in device tree file.

Change-Id: I362f0251ff3923c725f0e2a62922a35149bef3b9
CRs-Fixed: 3338737
2022-11-21 01:12:12 -08:00
Tiger Yu
e6f30383bf cnss2: Do not notify mhi about pcie link down for QCA6174
Do not invoke the mhi_control_error to notify the pcie link down event
for QCA6174 to avoid NULL pointer access.

Change-Id: I2c899ab51117aef2f9474e83217229b211eb4759
CRs-Fixed: 3335555
2022-11-18 06:52:12 -08:00
Naman Padhiar
2fd60f792b cnss2: Add API to get FW supported capabilities
Add and export API to check whether FW capabilities like
DIRECT_LINK, etc are supported by FW or not.
Update WLAN Firmware Service QMI file as per latest IDL file.

Change-Id: Ic33104ec55e18845b8c33ff611d1ecc15ec5cd77
CRs-Fixed: 3335259
2022-11-12 17:29:28 -08:00
Sandeep Singh
414f0dcf64 icnss2: pass fw build id in soc info to wlan host driver
Pass fw build id as part of  soc info to wlan host driver.

Change-Id: I6a8bced678ada0f88e744b5fd3f2ed58fa4173ef
CRs-Fixed: 3324963
2022-11-10 12:56:04 -08:00
Yu Wang
44ad9ad95f cnss_prealloc: Add null pointer check before accessing memory pool
Pointer for memory pool may be null if it fails to
create memory pool in cnss_pool_init().
Add null pointer check before accessing memory pool.

Change-Id: I8ae2b6a5193cffdcba3990b238178a1b93297925
CRs-Fixed: 3332360
2022-11-10 07:26:47 -08:00
Lin Bai
39a9deb49b cnss2: Only send host IOVA range to firmware when SMMU enabled
Only when SMMU S1 enabled, CNSS driver will send IOVA range in
HOST_CAP message, and let firmware to configure ATU.

Change-Id: Idd19063da975c0105d91e0e31575d0b0d1edd8e2
CRs-Fixed: 2896035
2022-11-08 22:04:29 -08:00
Will Huang
6dcd57f602 cnss2: Add support for handling AFC memory request from FW
Add APIs for handling AFC memory request from FW:
cnss_send_buffer_to_afcmem() and cnss_reset_afcmem().

cnss_send_buffer_to_afcmem() will be called if receive valid AFC
response data, cnss_reset_afcmem() will be called if receive
invalid AFC response data. After memory copy done, another WMI
command will indicate FW ready to read.

Change-Id: I34b9add3d7721d778e5474d9b11ad64adb4f04f0
CRs-Fixed: 3223607
2022-11-06 19:34:15 -08:00
Lin Bai
bf7a19829c cnss2: Print the bandwidth level voted to IPC log
This refine commit 418727f314 ("cnss2: Print the bandwidth level voted"),
to avoid too many vote log in dmesg during traffic test.

Change-Id: Ia260a84bcdb3e5154376471519340db1b5907ce4
CRs-Fixed: 3273973
2022-11-02 23:34:06 -07:00
Sandeep Singh
04ddb614e4 cnss2: Use ol cpr to update retention voltage of aop regulator
Use ol cpr to update retention voltage of aop regulator
for qca6490 chipsets.

Change-Id: Ic67ca32964bd89fb940be069ec9468d97bbec68d
CRs-Fixed: 3326028
2022-11-01 20:44:08 +05:30
Sandeep Singh
866685439c cnss2: Add RC_EP_ULTRASHORT_CHANNEL in cnss feature list
Add RC_EP_ULTRASHORT_CHANNEL in cnss feature if it
is enabled in dtsi and indicate it to wlan fw.

Change-Id: Ic70c4b1b2dd637f11c2e2b281521f2094a9a2fe9
CRs-Fixed: 3323608
2022-10-29 14:43:29 -07:00
Sandeep Singh
8690fc3697 cnss_utils: Add RC_EP_ULTRASHORT_CHANNEL in cnss feature enum
Add RC_EP_ULTRASHORT_CHANNEL parameter in cnss feature
to indicate wlan fw whether root complex and end point
has ultrashort length or not.

Change-Id: I96ce5eb0954e20f7aed4ecbcecdbcde617988791
CRs-Fixed: 3323600
2022-10-29 14:43:28 -07:00
Naman Padhiar
fb716dd278 cnss2: Unregister host driver during PCI remove
CNSS2 registers as both platform and PCI driver. PCI
device can be removed via sysfs exposed by kernel during
PCI device creation. When PCI device gets removed, CNSS
PCI remove ops gets called. In cnss_pci_remove, unregister
host driver and shutdown WLAN chip to cleanly remove PCI
device.

Change-Id: Ia60e8b69bda2b3bdd5990cb83f47c082d6667283
CRs-Fixed: 3308910
2022-10-28 17:57:29 -07:00
Bing Sun
bb44300a42 cnss2: get msi_data again after request_irq is called
The reservation mode of interrupts in kernel assigns a dummy vector
when the interrupt is allocated and assigns a real vector when the
request_irq is called. The reservation mode helps to ease vector
pressure when devices with a large amount of queues/interrupts
are initialized, but only a minimal subset of those queues/interrupts
is actually used.
So on reservation mode, the msi_data may change after request_irq
is called, so reads msi_data again after mhi request_irq is called,
and then the correct msi_data is programmed into hardware components.
Without this change, spurious interrupt occurs in case of one MSI
vector.

Change-Id: I41070987798835f8fa95304fce3b964bbd77b31d
CRs-Fixed: 3313984
2022-10-25 17:52:49 -07:00
Bing Sun
7418239f92 cnss2: Add force one MSI field for quirk
Add new bit FORCE_ONE_MSI for quirk to force one MSI configure

Change-Id: I5053a0f95619ee75aad8a4c3f413affc0f9af3f5
CRs-Fixed: 3313980
2022-10-25 10:08:13 -07:00
Bing Sun
fe37b559b9 cnss2: Add one MSI vector support
Some platforms can't meet the number of MSI interrupt vectors that
wlan driver requires.
Add one MSI interrupt vector support.
If CONFIG_ONE_MSI_VECTOR is not defined, wlan driver fails to load
if reuired MSI vector allocation fails. It is current behavior.
If CONFIG_ONE_MSI_VECTOR is defined, firstly it will allocate multiple
MSI vectors based on MSI config. If MSI vector allocation fails, it
fallbacks to one MSI vector automatically.

Change-Id: I813f7ddf678ecf405e573f3bc72af3e758d1c96d
CRs-Fixed: 3312670
2022-10-25 10:08:12 -07:00
Alan Chen
e3b36fcd46 cnss_prealloc: Update preallocation pool entries
Update pre allocation pool entries as below:

8kb: 22 -> 16
16kb: 16 -> 16
32kb: 6 -> 22
64kb: 8 -> 38
128kb: 2 -> 10

Change-Id: I2ba69d7332447229f0ad2907dd380f663a8a3fd8
CRs-Fixed: 3306034
2022-10-25 00:22:10 -07:00
Wade Song
99580edb00 cnss2: Remove function cnss_pm_notify
To protect firmware download not be processed when system goes into
suspend, before we add semaphore cnss_pm_sem in cnss driver.
Function cnss_pm_notify, PM_POST_SUSPEND may be got before
PM_SUSPEND_PREPARE. Once it happens, the count of cnss_pm_sem will
be abnormal.

And, ROME firmware download is in qcacld driver. Not in cnss driver.

So, remove function cnss_pm_notify, and the export symbol cnss_lock_pm_sem
and cnss_release_pm_sem. Move the protection to qcacld driver. In qcacld
driver, use wakeup source to protect ROME firmware download.

Change-Id: I7768fdbeb1fa8cd6ef3b260eb0aafb231aeed324
CRs-Fixed: 3294347
2022-10-24 18:57:14 -07:00
Wade Song
6d69e079af cnss2: Fix a typo in a parameter type
There is a typo in the parameter list of function
cnss_aop_set_vreg_param's declaration, and that is causing
a compilation error when CONFIG_MSM_QMP is not defined on
certain platforms.

Fix the compilation error by changing the 3rd parameter's
type from 'cnss_aop_tcs_seq_pram' to 'cnss_aop_tcs_seq_param'.

Change-Id: Iccb832e1d841a82db3df42c93ef8ed8367a93d26
CRs-Fixed: 3314506
2022-10-17 21:23:30 -07:00
Rajesh Chauhan
48cfe543c6 cnss_prealloc: add new functions to store cache at beginning of memory
CNSS prealloc maintains various prealloc pools of 8Kb, 16Kb, 32Kb
and so on, and allocates buffer from the pool for wlan driver. When
wlan driver requests to free the memory buffer then CNSS prealloc
derives slab_cache from virtual memory via page struct to identify
prealloc pool id to put memory buffer back into the pool.

In kernel 5.17, slab_cache is removed from the page struct. Add new
functions to store cache at the beginning of allocated buffer and
when wlan driver requests to free the memory then use that cache to
identify CNSS prealloc pool to put back memory.

Change-Id: I6b3a54d3f502d977c6a61cfa6aeae597df9c8e72
CRs-Fixed: 3309289
2022-10-17 21:23:29 -07:00
Jayachandran Sreekumaran
e079e8958c cnss2: Check calibration support after pci probe
Ensure the completion of pci probe before checking
whether the calibration is supported for the device id or not.

Change-Id: Ifb6b6b15c434c16822bb8a4291403e4a635f985f
CRs-Fixed: 3303831
2022-10-17 11:07:58 -07:00
Sandeep Singh
24816433ba cnss2: Read GCC register only for qca6490
Read GCC spare register after SOC reset for qca6490
device.

Change-Id: I20a110020224116f93225f55ae0124324441031c
CRs-Fixed: 3309323
2022-10-11 13:29:38 +05:30
Naman Padhiar
9eaccc90ab cnss2: Dump PCI scratch registers for MANGO and KIWI
Add support to dump PCIE SOC scratch registers for MANGO
and KIWI device.

Change-Id: I4f7a64c2bf186d19d96500ffedc5e732cc50fc03
CRs-Fixed: 3306157
2022-10-04 21:36:23 +05:30
Rajesh Chauhan
f7e10ed87e cnss2: fix issue in return type of debug functions
Fix issue in return type of following functions:
 - cnss_rddm_trigger_debug()
 - cnss_rddm_trigger_check()

Change-Id: I41eb4637605f9a2189e03e732c688c25b0895a90
CRs-Fixed: 3304957
2022-10-02 14:04:25 -07:00
Naman Padhiar
60f897b63a icnss2: Send WLAN_EN delay during Mode request
Send WLAN_EN delay during Mode On QMI request if temperature is
below threshold at that time.

Change-Id: I910168dafa09c25cc4a263a7756379eb8be46824
2022-10-02 01:17:36 -07:00
Naman Padhiar
2d912a8ca2 cnss2: Add GCC register read for debugging
Read GCC spare register after SOC reset to check device
status.

Change-Id: If25d8e42fcf6921744b1907e1abd4ef16ac95148
CRs-Fixed: 3290178
2022-09-30 17:40:38 -07:00
Yu Wang
1296d41e40 cnss2: Add code to update feature list if WLAN_EN gpio supported
Add code to update feature list with CNSS_WLAN_EN_FEATURE flag
if WLAN_EN gpio is supported, the host indicates to firmware
about the WLAN_EN support via the feature list which is sent as
part of host capability qmi message. This would help firmware
to decouple the PERST in RDDM for MSM targets.

Change-Id: Iec870a0f9528a4ffdb118459ec611b33ff01cf80
CRs-Fixed: 3084551
2022-09-30 09:13:39 -07:00
Wade Song
5b9f2c571a cnss2: add support for multi-exchg wlan devices
Converge dt nodes for wlan chips that share the same PCI slot
into one node.

The items in this node are split into 2 parts: common and chip
specific.

The common part will be parsed during cnss probe, such as basic
power related configuration and bus type, to power on the device
and trigger pci probe;

Chip specific part will be parsed during bus specific probe, this
part includes chip specific power and feature related
configurations.

With this change, cnss2 can support different chips on one pci
slot with the same image.

Change-Id: I08c64b6dc3cc27a479ee6fd07e3c8705cc3ac43d
CRs-Fixed: 2384088
2022-09-28 10:09:35 +08:00
Rajesh Chauhan
ecb1bc2deb cnss2: use dma_set_mask and dma_set_coherent_mask
In kernel 5.18, pci-dma-compat.h is removed and so instead of
calling pci_set_dma_mask and pci_set_consistent_dma_mask, call
dma_set_mask and dma_set_coherent_mask.

Change-Id: I91cbe8700b8f165c1140d015c28b1c34d3ea99bd
CRs-Fixed: 3298228
2022-09-27 04:33:39 -07:00
Rajesh Chauhan
291b1a8d27 cnss2: Protect dependency on sec-module-symvers
Protect dependency on sec-module-symvers under flag
TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE so that platform driver
builds successfully if TARGET_KERNEL_DLKM_SECURE_MSM_OVERRIDE
is set to false.

Change-Id: Ieb53f5a6db7378b2ac77db252343dfedb2b51a8c
CRs-Fixed: 3295225
2022-09-27 04:33:37 -07:00
Naman Padhiar
5d4164a215 cnss2: Check if secure peripheral feature is supported
TZ APIs, to check the secure peripheral state, can return error code
which says feature is not supported. Set a flag if feature not
supported and avoid calling TZ APIs again till next device boot.

Change-Id: I8f83c206b7a876cbaa304b442a9cfe9f6372a04d
CRs-Fixed: 3290183
2022-09-26 23:36:04 -07:00
Rajesh Chauhan
1771314f7e cnss2: Replace fallthrough comment with attribute
Some compilers such as clang requires the attribute instead
of just a fallthrough comment when -Wimplicit-fallthrough
is enabled. So replace fallthrough comment with attribute.

Change-Id: I1935bfb325b550fbc6539c58a99b3696fb6cc753
CRs-Fixed: 3295197
2022-09-26 23:36:01 -07:00
Sandeep Singh
39e099aa46 cnss2: pass fw build id in soc info to wlan host driver
Pass fw build id as part of  soc info to wlan host driver.

Change-Id: If1906abe5efc8f98a1e396e19574c817169a954a
CRs-Fixed: 3298924
2022-09-23 18:14:18 +05:30
Bruce Levy
18d51db05d cnss2: Enable/Disable DLKM
Control DLKM using ENABLE_WLAN_PLATFORM_DLKM.

Change-Id: Id1dc01a87565abc73ab1a84edb61351e29bdc602
CRs-Fixed: 3292543
2022-09-16 00:47:29 -07:00
Sandeep Singh
eeed8341c6 cnss2: move pci/mhi register dump after rddm mode trigger
Move pci/mhi register dump after rddm mode trigger
in case of smmu fault.

Change-Id: I3e2c4c5725f614b7b12e95d3a13ec0250a631608
CRs-Fixed: 3291781
2022-09-15 18:26:56 +05:30
Naman Padhiar
9f778282b9 cnss2: Avoid assert if WLAN HW disabled during power on
In some scenario like ssgtzd get killed, CNE and TZ go out of sync.
Consider a case where TZ notified CNE to enable WLAN HW. Now CNE
will request to CNSS to Enable WLAN HW. At the same time again TZ
notified CNE to Disable WLAN HW but due ssgtzd killed, CNE did not
wait for previous request(sent to CNSS to enable WLAN HW) and immediately
return to TZ. TZ assumes everything is done and change state to secure
mode. Now CNSS act on previous request of enabling WLAN HW but when
when checks the state it get secure mode and fails to enable WLAN
and asserts. Avoid assert in such scenarios.

Change-Id: I85f63258ff55a44cfcc5ebeaa9da9ba19db67780
CRs-Fixed: 3288122
2022-09-13 18:08:10 -07:00
Naman Padhiar
2e0fe8fe22 cnss2: Release DMS QMI handle during dms_del_server
DMS server runs in Modem. When Modem SSR happens dms_del_server
gets called. Even after DMS service disconnected, qmi_txn_wait is
still waiting. Release DMS QMI handle in dms_del_server to cancel
pending transaction.

Change-Id: I06ccfba34269dc51288300aa5fa0326842a09e32
CRs-Fixed: 3288808
2022-09-13 13:47:10 +05:30
Yu Wang
a5a88a8d75 cnss_prealloc: replace in_atomic() with proper API
According to kernel comment for in_atomic(), it's
incorrect to use it outside core kernel code.
To follow this rule, replace
(irqs_disabled() || in_atomic()) with (!preemptible())
when getting GFP flags.

Change-Id: I7cdb28a7f12ffd60216c7bc1921a277de6113cb5
CRs-Fixed: 3273779
2022-08-26 12:28:06 -07:00
Sandeep Singh
865b5ac35b cnss2: Add support for pci reg dump for hang data for kiwi
Add support for pci reg dump for hang data for kiwi.

Change-Id: I0b4372e3cf977a3916487360112dc06355b457d8
CRs-Fixed: 3139461
2022-08-24 18:33:07 -07:00
Naman Padhiar
3adaa3d25d cnss2: Fix dereference of pointer before NULL check
Have NULL check for plat_priv pointer before dereference.

Change-Id: I1a67f5cb237c7a6d2f960c0afa5146c5ed90d44f
CRs-Fixed: 3273468
2022-08-24 01:32:18 -07:00
Yu Wang
728b08d683 cnss_prealloc: fix GFP flag for mempool_alloc
As per implementation of might_sleep(), rcu_read_lock()
nesting depth should be take into consideration too to
figure out whether sleeping is allowable or not.
To make align with it, allocate memory with GFP_ATOMIC
if rcu_read_lock() nesting depth is not zero.

Change-Id: Ib225a33b1a3f37b919e41daf064ce2de44428973
CRs-Fixed: 3271651
2022-08-22 04:51:13 -07:00
Sandeep Singh
99c1335031 cnss2: Allocate sram dump memory for qca6490 debug build only
Sram dumps are getting dumped only for qca6490 debug build, so
allocate sram dump memory for qca6490 debug build only.

Change-Id: If714b49720c1445ebfc0d4645dde592145b734a8
CRs-Fixed: 3256709
2022-08-19 03:15:10 -07:00
Sandeep Singh
db6c6ce1d2 cnss2: Return kobject to wlan host driver
Return kobject to wlan host driver. Host driver
asks platform driver for wifi kobject. If wifi kobject
provided by platform driver is NULL, it creates wifi
kobject itself.

Change-Id: I7f44350a84ad054c674442ae0c0272885dc95d38
CRs-Fixed: 3262907
2022-08-09 01:27:16 -07:00
Alan Chen
a2e700310b cnss2: Enable PCIe gen switch
PCIe gen switch via debugfs is allowed only for QCA6490. Remove check
on QCA6490 and instead allow PCIe gen switch based on firmware
capability exchange.

Change-Id: Ib17c54a6c17a2b87d01a877b057495debec704f6
CRs-Fixed: 3260767
2022-08-05 18:08:23 -07:00
Alan Chen
787df21a61 cnss2: Disable MHI satellite if DRV is disabled
When DRV is disabled during use, MHI satellite is still enabled and
is causing timeout when suspend occurs again. Hence, set base to 0
for MHI satellite when DRV is disabled in order to disable it.

Change-Id: I68315cc102884a33b2ba92753f21af2e59b6b466
CRs-Fixed: 3256095
2022-08-03 11:19:05 -07:00
Naman Padhiar
a9d924743a cnss2: Fix boot time secure peripheral mode issues
If Device boots up in secure mode, CNSS defers PCI enumeration,
calibration and host driver registration. When secure mode exits
host driver gets notified from CTRL_PARAM and calls PLD API to
perform previously deferred operations and enable WLAN HW. This
can take some seconds and by the time again Secure mode can enter,
disable WLAN and access controlled by TZ.
Now Calibration completes and CNSS receives CAL_DONE indication.
As part of CAL_DONE when CNSS try to power off WLAN access WLAN_EN
it results in NOC error.

One more scenario, where CNSS can access WLAN_EN when WLAN HW
is disabled by TZ, could be when QMI message times out. Consider
secure mode is entering as part of CNSS will to IDLE shutdown.
During IDLE shutdown while sending MODE_OFF QMI message to FW
it might wait for 10 seconds if FW does not respond. But TZ has
timeout of 5 sec if framework does not respond in 5 Sec TZ will
disable WLAN_EN and access control it. Now when after QMI timedout
when try to access WLAN_EN it results in NOC error.

Check secure peripheral state before updating WLAN_EN and maintain
correct driver state in such scenario.

Change-Id: I4a0892f02edb42496b9633d2d33ded26cbc08707
CRs-Fixed: 3247847
2022-08-02 12:23:25 -07:00
Yu Wang
54e992906b cnss2: skip operations when it's under reboot
Skip FW ready event handling and driver probe
when it's under reboot.

Change-Id: I59418faea0d36e77d4da001110cf65756a842d8d
CRs-Fixed: 3256553
2022-08-02 11:54:36 -07:00