Commit Graph

64 Commits

Author SHA1 Message Date
Nijun Gong
d173765b26 cnss2: treat no wlan regulator as no error
If device tree doesn't configure any regulators for
device, means this device doesn't need extra regulator.
This case shall not be treated as an error.

Return a positive value for this case to allow caller to
make proper choice.

Change-Id: I7ead81b3915d16f966f94c9d916e0d67bc04fda0
CRs-Fixed: 3355141
2023-01-05 13:22:01 +08:00
Nijun Gong
1f53dc0696 cnss2: make sure wlan_en is low when power up
Some auto HW can't guarantee wlan_en low state when powerup.
Add a macro to enable initializing wlan_en state.

Change-Id: I6755bcd49c78f7bb9931f80cb385e62177ebe603
CRs-Fixed: 3355148
2022-12-26 17:47:35 +08:00
Geetha Jaya Sri Bandla
7e956ba94e cnss2: Add support for qca6174
Added below mentioned changes to support qca6174 in cnss2 driver.
1.    While resuming pci link, restore the pci config space before
     enabling pci device.
2.    Add 10ms delay between wlan_en become active and pcie reset
     de-assert.
3.    For wlan chipsets which don't support cold boot calibration,
     schedule Wlan driver load in cnss_cold_boot_cal_start_hdlr.

Change-Id: I28435896314783353db5dd830051df9467be6585
CRs-Fixed: 3359223
2022-12-26 17:39:43 +08:00
chunquan
a7f6cb0389 cnss2: Free m3 blob memory once driver probed
Free m3 blob memory after driver probed.

Change-Id: I10803eae60f2308b3a024877cdb7c446f3d33802
CRs-Fixed: 3321438
2022-12-01 14:07:57 +08:00
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
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
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
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
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
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
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
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
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
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
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
Nirav Shah
20cf29c42e cnss2: Add sysfs support for configuring timer sync interval
It can be used to tune the host and fw time synchronization interval
for better accuracy.

Change-Id: I0a3d8895520cec526341f278c91f153dd0bd1966
CRs-Fixed: 3257702
2022-07-29 10:44:44 +05:30
Wade Song
f0ec361d6a cnss2: Add support for conditional powering off
It is observed during some stress tests under very bad thermal
conditions that wlan re-probe can fail after cnss2 probes the
device for the 1st time and then powers it off.

When this happens, the SW_CTRL signal doesn't go high after
cnss2 toggles WLAN_EN.

To avoid such issue, add support for conditional device power
off so power supply will be retained for certain chipsets after
cnss2 probes it for the 1st time.

Change-Id: I81d508f2a69fcbc6f8761988981ec432af059fac
CRs-Fixed: 3241179
2022-07-18 16:36:35 -07:00
Sandeep Singh
1e6a925b34 cnss2: Add base changes for pci hang data support on HMT
Add base changes for pci hang data support for HMT.

Change-Id: I0e1dde6649b36ffdca5a6a75f2198f4fde50d211
CRs-Fixed: 3111908
2022-07-12 21:55:24 -07:00
Sandeep Singh
1e6b77b03b cnss2: Add code to fallback to non-contiguous FW mem allocation
Add code to fallback to non-contiguous FW mem allocation on
failure to allocate contiguous memory.

Change-Id: Idbc7ff7f9ea4d2157e3b549dde8ee090a0f0b412
CRs-Fixed: 3072737
2022-07-13 10:18:20 +05:30
Sandeep Singh
6b4390361d cnss2: Add code to optimize prints
Add code to optimize prints.

Change-Id: I21c070b4c136eeb5ef3ea2cc18e0fc415fd2297b
CRs-Fixed: 3161488
2022-07-06 12:29:56 +05:30
Alan Chen
79dd3075ca cnss2: Add support for WLAN MANGO PCI device
Add PCI device ID config and code updates to handle MANGO WLAN device.

CRs-fixed: 3210010
Change-Id: I48fffdb8c7ecf5343908d823facf7a2fad2f2dea
2022-06-30 17:51:42 -07:00
Kai Liu
07e71590f2 cnss2: Dump qdss registers only when etr dump enabled
Skip dumping qdss registers if etr dump is not enabled, or
will hit NOC error since these qdss registers are not powered on.
Move dump process after device enter into RDDM mode, or registers
might be invalid.

Change-Id: Ib5e5a8d8beb2e1f76266ce0f25d4abe6e73e7506
CRs-fixed: 3226702
2022-06-28 12:14:21 -07:00
Mohit Khanna
2c3d91eed9 cnss2: Dynamically use shadow regs for time_sync
For kiwi target the current code is using shadow_reg indexes 0,1. Change
the logic to use next two shadow registers of what is used by the host.

Change-Id: Ice95be0f2106078b8f799ca1182d1d8702b564c6
CRs-Fixed: 3218660
2022-06-24 16:11:19 -07:00
Manikandan Mohan
ad4399e37a cnss2: Add support secured wlan HW disable mode
WLAN HW can be securely disabled. Add support in platform driver to
handle WLAN cold boot initialization sequence changes if HW is disabled
at boot and WLAN resume sequence after WLAN HW is enabled.

Change-Id: If5036560820c54653801298ceebe4f50b7532f3f
CRs-fixed: 3211229
2022-06-16 16:23:19 -07:00
Manikandan Mohan
99b7b2d663 cnss2: Remove MHI satellite config for QCA6490 and KIWI_V1
MHI Satellite configuration is not supported for QCA6490 and KIWI_V1.
Hence remove these configuration from MHI controller for these wlan
devices.

Change-Id: I781af04da1a0a69e1997d5b53704b5e341e17a53
CRs-fixed: 3202317
2022-06-09 10:48:48 -07:00
Lin Bai
418727f314 cnss2: Print the bandwidth level voted
Print the bandwidth level voted.

Change-Id: Icb747e622931456a0ad79047865f0d97b5c2b7dd
2022-06-06 15:42:19 +08:00
Kai Liu
add05df61f cnss2: loads different fw binary per running mode
Kiwi-v2 supports separates image for MM and FTM mode,
platform driver will load difffernt binary according to the mode
indicated by wlan driver.
If seprate binary is not there, fall back to default binary.

Change-Id: I848309440fdffd6517463e18190c03c1b7ed9269
2022-05-31 21:54:57 +08:00
Naman Padhiar
126f48b0f4 cnss2: Allow wlan host driver loading if cnss2 node is present
This change allows wlan host driver loading only if cnss2
node is present in dtsi. On spf, qca6490 wlan driver loading
is getting retried 100 times even if cnss2 node is not present
which is causing andoid bootup delay. This change will return
ENODEV error on wlan driver loading if cnss2 node is not present
instead of EAGAIN which was getting returned earlier.

Change-Id: Ic8568147257642a84983a0d6e738e4bf0ee917b5
CRs-Fixed: 3201930
2022-05-26 16:18:52 -07:00
Mohammed Siddiq
334ef0ec36 cnss2: Add code to dump SRAM on MHI power on failure for QCA6490
Add code to dump SRAM on MHI power-on failure. To avoid CPU hog
relinquish CPU after dumping 256Kb chunks.

Change-Id: I2c9c64424c8ae4612e67b78fcabc1f872fefea81
2022-05-17 10:43:17 -07:00
Mohammed Siddiq
4ba2be4db0 cnss2: change log_level to avoid flooding of Dmesg
Due to SPF, multiple drivers are supported and are loaded
run time. It is expected for one driver to fail to load,
however the failing driver should not flood the dmesg.
So add code to change log level of debug message in
cnss_wlan_register_driver api to avoid flooding of
kernel logs when ipci driver is loaded.

Change-Id: I281ff2424daf2e8d85502cb9b11a392e049cd45d
2022-05-16 22:11:18 -07:00
Mohammed Siddiq
29e96e5173 cnss2: Add code to separate MSM PCIe APIs to pci_qcom.c file
Add code to move the platform related apis mainly defined under
CONFIG_ARCH_QCOM and CONFIG_PCI_MSM flags to separate file,
named pci_qcom.c. This change facilitates easy code upgrade for
customer.

Change-Id: Ic81e633829ccfdeb3fc3f123013708e6d712c5c2
2022-05-16 08:26:27 -07:00
Mohammed Siddiq
04bdb792b7 cnss2: Add code to address boot timer debug corner case
To handle corner case where mhi power on success and the boot
debug timer handler execution(i.e dumping register) runs parellel.
Even-though the timer is deleted as soon as mhi is powered on,
as this handler is still running it is armed again. Use the
del_timer_sync api which makes sure the timer is not queued and
the handler is not running upon its exit.

Change-Id: Ie428f3e8af8870018dfed99a5472afca14116bb3
2022-05-12 14:19:00 +05:30
Mohammed Siddiq
8ebc3d7e4f cnss2: Log SW_CTRL GPIO value if PCIe link training fails
Add change to print SW_CTRL GPIO value when PCIe link training
fails during power on.

Change-Id: I77bd2db80dad4c56647f52d67acfab0fe7efb7a7
2022-05-09 20:27:55 -07:00
Mohammed Siddiq
83cc8e3076 cnss2: Add code to enable hang data for kiwi
Add code to enable hang data for kiwi.

Change-Id: Idef5d036c0add2f20bd452eb4f91be81dcc90e5e
2022-05-09 17:49:09 -07:00
Mohammed Siddiq
42f4e0431a cnss2: Get hang event params over target cap qmi response
Add change to get hang event params over target cap response.
With this change hard-coding of hang data address and offset
is removed if valid hang data params are received over QMI.

Change-Id: Ife163cf66d5880cd9a658a841e5d4a73816fd982
2022-05-09 17:47:54 -07:00
Manikandan Mohan
51894fbfb9 cnss2: Add code to notify mhi about link down
Add code to notify mhi about link down.In scenario of link down
recovery failure with SSR enabled, cnss-daemon posts a QMI req
during subsystem shutdown execution, the mhi layer tries to access
doorbell register to process the qmi msg but it leads to NOC error
as pci link is down. So added code to notify mhi about link down
to avoid NOC error.

Change-Id: I3ccc2cbda37e271f14f3821bb055db3107dac228
2022-04-21 13:19:12 -07:00
Manikandan Mohan
e8d76601a7 cnss2: Fix PBL / SBL logs collection for KIWI device
Fix PBL / SBL logs collection for KIWI device.

Change-Id: I271f1dc605f49db60339f1d7470bdd6c60770eb2
2022-04-18 11:32:29 -07:00
Manikandan Mohan
11e6daf9bf cnss2: Refactor calibration timeout handling
WLAN driver register requires calibration to complete if enabled.
Calibration timeout can happen due to FW or file system mount delay.

Update driver to assert only for calibration timeout due to FW.

In some cases file system mount may take longer if file system repair
is attempted. Thus update cnss platform driver to wait for this
operation to complete and only log the time elapsed.

Change-Id: Iacd4d4565fb05ae1557c94c574c0153b5995b226
2022-04-04 13:51:28 -07:00
Manikandan Mohan
abe9d5bfb6 cnss2: Add sysfs entry for charger mode
WLAN is not needed in charger mode. Thus add a sysfs entry to notify
charger mode to cnss platform driver to ignore wlan initialization
request.

Change-Id: I4719b16e7fa6914c253018284b5a5d80acf14bbb
2022-04-04 13:49:57 -07:00