Commit Graph

160 Commits

Author SHA1 Message Date
Yeshwanth Sriram Guntuka
8ddd31db96 qcacmn: Invoke hal_reg_write_need_delay before the register write
hal_reg_write_need_delay is invoked immediately after
q_elem->valid check. The first two instructions in
hal_reg_write_need_delay could be in the CPU instruction
pipeline which could result in possible loading and
dereferencing of NULL srng from an invalid q_elem.

Fix is to invoke hal_reg_write_need_delay just before
hal_process_reg_write_q_elem and also add NULL checks
to avoid the srng NULL pointer dereference.

Change-Id: I2de50b1e78782e3c91a9cb4477f28d91f9c29439
CRs-Fixed: 2973257
2021-06-24 22:25:27 -07:00
Rakesh Pillai
1104d6d5a7 qcacmn: Delay 50us when update same shadow reg
Add 50us delay if srng's shadow reg write again within 5us.

Change-Id: I8d48496814e063ebd441db3520e3a5406c5db13e
CRs-Fixed: 2965371
2021-06-24 22:25:21 -07:00
Basamma Yakkanahalli
00bcc8cbd3 qcacmn: Initial changes for ipq9574 target compilation
Added device ID and target type checks for ipq9574 traget
compilation.

Change-Id: Ie337d1256f828987ed469a609c8fb74de2180dca
2021-06-18 11:07:50 -07:00
nobelj
8a11583471 qcacmn: Add field to return Lmac ring start ID
Return LMAC start id also as part of hal_get_meminfo API.
This field is added to hal_mem_info struct.

Change-Id: I013d357cf4337702c06a91ed15e8337469865270
2021-06-10 06:16:57 -07:00
nobelj
25acb759bf qcacmn: Fixes to enable LI & BE in a build
Changes to build Lithium and Beryllium together.
This is needed for WIN

Change-Id: I74c86803ea99fb17d1f73e8b9c4e7cf59751a707
2021-06-07 01:51:15 -07:00
Rakesh Pillai
b2548a90cd qcacmn: HAL srng API changes for beryllium
Add HAL srng API changes for WCN7850

Change-Id: I4b78dbe6a88b24c9ef7662c2091123fa7f86ba18
CRs-Fixed: 2891049
2021-06-05 15:10:50 -07:00
Mohit Khanna
4e6a7cf1bf qcacmn: Use function to attach HAL TX/RX ops
Assign th HAL TX/RX ops in a function instead of assining a structure
directly. This can be later extended to have default ops for a family of
chips and then override that with chip specific ops.

This also helps the case where a new hal_soc->ops needs to be added.
The new 'op' will need to be added to only a default ops initializer
(with assumption that it applies to all chips).

Change-Id: Iefa23d14110fa5252444fad89737a3b2b2fbab6f
CRs-Fixed: 2891049
2021-06-05 15:10:50 -07:00
Karthik Kantamneni
bd49a69019 qcacmn: Introduce intermediate EP voting access state
Introduce intermediate EP voting state during this transition state
access the votes only if direct writes are not possible.

Change-Id: Ib4522aef2209b4797100ca84e4e230a00e14b654
CRs-Fixed: 2954903
2021-05-28 18:30:53 -07:00
Karthik Kantamneni
ad0f442d8f qcacmn: Add delayed reg write support based on EP power state
Even though HP/TP updates are posted writes at CPU level, they
are getting blocked until soc comes out retention which is hogging
CPU.

To avoid this if EP is in low power state update HP/TP writes from
delayed work context. In delayed work vote for EP awake wait till it
comes out low power state and then proceed to HP/TP update.

Change-Id: I61d5795f58f25f850b5a9ad4d30e3181dba23713
CRs-Fixed: 2913495
2021-05-11 08:03:35 -07:00
Karthik Kantamneni
1807be0f1e qcacmn: Add CE delayed reg update support for QCA6750
Add support to update CE srngs HP/TP in delayed manner
for QCA6750 target. This avoids busy wait in register update.

Change-Id: Id825a6fdf709187765ff823cb3015db21a024af3
CRs-Fixed: 2894094
2021-03-18 03:38:36 -07:00
Aditya Kodukula
7679b0651a qcacmn: Add params to the wlan_minidump_remove function
For the minidump feature, the wlan_minidump_remove function
definition is modified. So, update the function parameters
accordingly at all instances of the wlan_minidump_remove function.

Change-Id: I5a346f6cdf423ece02fb08d68e4422251af54876
CRs-Fixed: 2860435
2021-03-09 21:07:01 -08:00
Nisha Menon
8d4b739df0 qcacmn: Enable device force wake recipe in driver
Enable force wake recipe feature DEVICE_FORCE_WAKE_ENABLE
and disable the generic shadow register write feature
GENERIC_SHADOW_REGISTER_ACCESS_ENABLE.
Force wake recipe will be used to write to the REO remap
control registers by waking up the UMAC instead of using
shadow register writes.
Assert soc wake reg and poll on the scratch reg to check
if UMAC is awake.
Enable HIF_REG_WINDOW_SUPPORT to enable windowed reg
read/write in HIF layer.

Change-Id: Ib696e27e19a07c0084c097b95b7780b56e643c8b
CRs-Fixed: 2850590
2021-02-24 19:35:13 -08:00
Vevek Venkatesan
38af510319 qcacmn: add dedicated workqueue for Tx ring delayed reg write
Add delayed SRNG register writes support for Tx Ring, also add
dedicated workqueue to do the delayed Tx SRNG register writes.

Change-Id: I8dd157d341f3035e988804eab50d1ca681ab789b
CRs-Fixed: 2868989
2021-02-12 14:40:11 -08:00
Pavankumar Nandeshwar
d6c9f3ad8a qcacmn: change qcn9100 to qcn6122 in data path
Change the name of target type qcn9100
to qcn6122 in data path.

Change-Id: Ia1463ca276b7c107ca4c1ebce4ffc8b517134a5e
CRs-Fixed: 2849577
2021-01-18 21:45:30 -08:00
Yeshwanth Sriram Guntuka
871c29e8f2 qcacmn: Set IPA WBM2SW ring HP to DDR addr on disable pipes
WLAN HW can still access the IPA tx doorbell address post
disable pipes if there are any pending tx completions which
could result in a NOC error.

Fix is to reset the WBM2SW ring HP addr to shadow addr in
DDR before pipes are disabled.

Change-Id: I52900eb34530388487923a887354ef8839d8c728
CRs-Fixed: 2846421
2021-01-06 13:52:45 -08:00
Mohit Khanna
a939d20dbf qcacmn: Move delayed-reg-work active_work_cnt decrement
Currently, we decrement active_work_cnt in a while loop in delayed
register worker and later on make a "allow_l1" call to enable L1ss.
The bus suspend routine depends on the value of active_work_cnt to
determine if any register writes are pending. In case there are, bus
suspend is rejected.
As a result its possible that when bus suspend happens, the
delayed worker while processing the last remaining enqueued
write,  makes the active_work_cnt to 0. This will allow the bus suspend
routine to continue to disable the bus, even before the
delayed-reg-worker has called allow_l1 and run to completion. This may
lead to a NOC error while calling "allow_l1" API from
delayed-reg-worker.

Hence, move the decrement of active_work_cnt to the very end in
hal_reg_write_work function.

Change-Id: Iec602f97c953df1c6a018310fd02ab458547ce3a
CRs-fixed: 2813733
2020-11-14 20:04:04 -08:00
Wu Gao
32cab9b00c qcacmn: Fix compilation issue on arch32 by gcc 9.3
This change fixed compilation error about implicit-fallthrough and
pointer to in cast.

Change-Id: Iea2c25d97d8a039ed0f8083078427a8f8de70cd1
CRs-Fixed: 2814658
2020-11-11 10:23:54 -08:00
Mohit Khanna
98181d9ccc qcacmn: Flush reg write work before bus suspend
Delayed register write work needs to be flushed before bus suspend to
make sure there are on pending writes after driver's bus suspend routine
exits. In case delayed work context is not able to finish before the bus
(PCI) is suspended (DRV), it may lead to a NOC error.

Change-Id: I40cbcec5d23ddd75ec87aed69ac45d95510fa880
CRs-Fixed: 2813733
2020-11-09 22:57:51 -08:00
Nisha Menon
a377301c78 qcacmn: Add support to map generic shadow regs
Add apis to map generic registers to shadow region. Existing
logic includes mapping only srng based regs to the shadow
region.
Add support to map REO control regs and WBM2SW2 rel
ring HP reg address to the shadow region in case the direct
reg writes in IPA enable/disable autonomy fail due to UMAC
block being in a power collapsed state.
Shadow reg mapping for these regs is provided to FW during
init. Add stat shadow_reg_write_fail to track shadow reg
write failure and shadow_reg_write_succ to track successful
shadow writes.

Change-Id: I04790765a3de80047689657e2cad0b73123440b9
CRs-Fixed: 2790321
2020-10-20 15:05:51 -07:00
Jinwei Chen
4fdb9be461 qcacmn: Retry reo_dst_ctrl register writing if fails
If reo_dst_ctrl register writing failed, this is a fatal error for
IPA pipe going to down case as RX frames will still be routed to
IPA rings then hit NOC error. retry register writing to see any
chance to write successfully, if fail always, trigger SSR or panic.

Change-Id: I3c03faa28e6cc93f396944579a360d5405c8138e
CRs-Fixed: 2774789
2020-09-15 04:59:41 -07:00
Srinivas Girigowda
5040a3b6ed qcacmn: hal: Remove redundant __func__ from the logs
The logging macros implicitly takes care of embedding function name
in the log, hence there is no need to include __func__ again.
Getting rid of redundant __func__ reduces driver memory footprint.

Change-Id: I6b5beea990e78486e1e5aab5a8df5fc2f1e5ab51
CRs-Fixed: 2774457
2020-09-15 02:45:57 -07:00
Pavankumar Nandeshwar
6756b1a5aa qcacmn: Data path changes for QCN9100 bringup
Initial changes made for bring up of
QCN9100 in data path and hal

Change-Id: I6cbe90428b552b6ff5733bc0f60bfb9f7933bc9a
2020-09-01 01:49:51 -07:00
Tiger Yu
0f08390fa4 qcacmn: Add memory barrier to avoid inconsistent reg write for valid flag
Add memory barrier to avoid inconsistent reg write for valid flag.

Change-Id: Ieb4ed80872961889f29de083a6b1dcdbe6a303d2
CRs-Fixed: 2699549
2020-06-16 21:44:18 -07:00
Nandha Kishore Easwaran
3e8172d58b qcacmn: Set low threshold for monitor ring
Configure low threshold for monitor ring only when monitor
vap is created. This is needed to avoid spurious low threshold
interrupts on monitor ring since the low threshold condition always
evaluates to true.

Change-Id: I452c0ada84e0a4f18e410c865d8a6a7f50329aef
2020-06-05 00:48:39 -07:00
Basamma Yakkanahalli
c0b1d0ebf0 qcacmn: use distinct I/O remap to access CE register for ipq5018
In ipq5018 CE registers(0x08400000)  kept outside WCSS(0x0C000000) block.
As both regions are more than 60MB apart, not feasible to allocate
single resource which include both.
So, using a separate I/O region to access CE registers.

Change-Id: I67bb6d5ac82a1c0ed1d3e13f7776f9d69ee19956
2020-05-18 22:33:42 -07:00
Jianmin Zhu
6f95b4aadb qcacmn: Force wake PCIe for hsp register write
make sure both PCIe and device are force woken for the register
writes for hsp, or write may fail.
Earlier WAR is not required as we have root caused it.

Change-Id: I350b810a6cef8eec46428e57f5b779f888552c1b
CRs-Fixed: 2677342
2020-05-13 08:37:42 -07:00
Rakesh Pillai
37cc4255e2 qcacmn: Drain group tasklets and reg write work for runtime PM
Currently as part of runtime PM, only the active
tasklets are being drained. For chips eg. QCA6390,
QCA6490 etc, there are grp_tasklets and delayed reg
write work which has to be drained before entering
runtime PM.

Add the logic to drain all the possible tasks
before entering runtime PM.

Change-Id: Ieb486f00fffd7346dcdc1faea6fed5850ef6daf7
CRs-Fixed: 2676000
2020-05-08 20:27:43 -07:00
Vevek Venkatesan
9043089a40 qcacmn: Add prefetch_timer config for CE rings
Add prefetch_timer configuration for CE rings.
Set prefetch_timer=1 configuration for qca6490 destination CEs,
prefetch_timer=0 configuration for other targets CEs.

Basically setting to 1us asking CE hw to update ring tail pointer to
update within 1us. FW side CE SW sets all rings to 1us already.
Idea behind this change  is, we have seen pre-silicon issue where SRC
ring TP read by SW was not seen updated value when prefetch was set
to 8us. Changing prefetch timer value to 1us helps to resolve
pre-silicon issue.
So host side rings need to update the prefetch timer to 1us.

Change-Id: I0830c73517c29cf39e6b2974bf3faa44e5673741
CRs-Fixed: 2669762
2020-04-28 03:59:18 -07:00
Rakesh Pillai
94ff74fcf9 qcacmn: Add memory barrier to avoid inconsistent reg write
The delayed register write enqueue fills a queue element
with the required data which can be dequeued in a workqueue
running on a different CPU. Since these operations are not
lock protected, there can be stale value access when memory
write has not been flushed to the actual address.

Using write memory barrier before setting the valid flag for
a queue element will make sure that the dequeuing worker
thread will always see the updated values if the element valid
flag is set and thereby avoid any race condition.

Change-Id: I81b0735f0fb39599095ad309157020c691e25a0b
CRs-Fixed: 2665576
2020-04-21 18:48:58 -07:00
Rakesh Pillai
eee37dab3f qcacmn: Add dequeue value in delayed register write entry
The delayed register write for srngs will have
the value of the HP/TP at the time of enqueue,
but the final value which is written to the
hp_addr/tp_addr will be determined based on
HP/TP value at the time of dequeue of the
entry for a particular srng.

Hence to know what was the exact value which
was written to the HP/TP address, add one more
element in the delayed register write entry.
This element will contain the value of the
HP/TP which was actually written to the address.

Change-Id: I73e592611fa50b106da1deda06b839cf4fbe2126
CRs-Fixed: 2658331
2020-04-15 12:12:36 -07:00
Rakesh Pillai
99e3c8b80e qcacmn: Confirm HP register init when enabling IPA pipes
As a part of enabling IPA pipes, the WBM2SW2 head
pointer register is written with the number of
buffers which have been allocated initially. This
register write is a critical one and failure in
writing this register can be fatal.

Confirm the written value, when initializing
the HP register for WBM2SW2 (for IPA).

Change-Id: Ib2da3a7aa6096375cf64857721619f47c50658de
CRs-Fixed: 2620750
2020-03-24 14:38:55 -07:00
Basamma Yakkanahalli
9def5df14a qcacmn: device ID and target type checks for ipq5018 target
Initial changes for ipq5018 compilation.
Added device ID and target type checks for ipq5018 traget.

Change-Id: Ib86a371fbe66749fcb6d114e7a4a9931b684e03d
2020-03-20 23:45:43 -07:00
Guisen Yang
b1d228b9aa qcacmn: Change print format for pointer and timer
Build failure happen when use the incorrect print format for
pointer. The timer type should not be used for time difference.
Use %pK for pointer format, and change the variable type to
uint64_t for delta_us.

Change-Id: I7da553ee2a770e4498a23f16d5187dec74357635
CRs-Fixed: 2639868
2020-03-13 23:50:54 -07:00
Mohit Khanna
b4429e8278 qcacmn: Add delayed register write support in HAL
In case the bus is in low power mode, the register writes (followed by a
memory barrier) may take a long time (~4ms). This can cause the caller
to block till the PCIe write is completed. Thus, even though PCI
writes are posted, it can still block the caller.

Hence, in case the bus is in low power mode (not in M0), or not in high
throughput scenarios, queue the register write in a workqueue. The
register write will happen in the delayed work context. In other cases,
i.e ,when the bus is not in low power mode or in high thoughput
scenarios, do the register writes in caller context.

Change-Id: Idf218e4581545bc6ac67b91d0f70d495387ca90e
CRs-Fixed: 2602029
2020-03-09 20:58:23 -07:00
Sumedh Baikady
d188789876 qcacmn: Enhancement in Minidump feature
Handle minidump logging using dynamic
configurablity options. Data structures
to be logged in minidump can be configured
using internal INI file.

Change-Id: I99f12b3f98c4a9c0e15c3e5d611019e6b8d0909a
2020-02-26 08:35:46 -08:00
Rakesh Pillai
8e01014b7d qcacmn: Add history for register write failure
Maintain a history of the register writes which
have failed. The failure of register write is
determined by reading back the register after
writing a value to that register. If the read
value does not match the value which was written
then it is termed as a failed register write.

Change-Id: Ic3423c2cbd74bf498c0d3dd8ee7ce4231054541a
CRs-Fixed: 2624475
2020-02-25 03:01:36 -08:00
Alok Kumar
7271755f47 qcacmn: Add static window support for UMAC and CE access in 6750
Use static window for accessing UMAC and CE register in qca6750. For
UMAC and CE register access, separate static window is mapped. Host
accesses these registers using relative offset to window address.

Change-Id: I7940336579553f05a11f1379f635689d08508c56
CRs-Fixed: 2617684
2020-02-15 17:42:01 -08:00
Rakesh Pillai
984343c2ea qcacmn: HAL layer changes for Moselle
Add the HAL layer APIs for supporting Moselle

CRs-Fixed: 2597328
Change-Id: Idc59af4ee093e702da95aa704fd3abd76ae5834f
2020-01-18 04:45:14 -08:00
Jinwei Chen
a718c757b3 qcacmn: check register writing result for IPA case
When SAP do connection with first Ref-STA or dis-connection with
last Ref_STA, wlan host need to re-configure REO Dst ring control
register. one of the register offset is 0xA38004, host need to write
remap window register (offset 0x310C) with value 0x14 first, but
sometimes this remap window writing not work, so just use the remap
window value 0x3F left by last writing, final Dst register offset will
be 0x1FB8004 which is out of valid range.
  Find that if we read back the remap window after writing is done,
remap window writing failure issue is gone. as a WAR, check register
writing result for this specific register REO_R0_DST_RING_CTRL_IX_0
always before root caused.

Change-Id: I8d385a0f974ff37bdd867d2ec946f2f46f6eff32
CRs-Fixed: 2570728
2019-12-01 13:11:45 -08:00
Nandha Kishore Easwaran
bcf953583a qcacmn: Use multi window write and read for pine
Write into hal register using three floating windows instead of one.
This change is done to avoid frequent window changes for writing into
DP and CE registers. Instead 3 windows are used. One window is statically
mapped to CE block and another window is mapped statically to DP block.
Due to this design there is no need to change the window register to
write into these blocks and write can be done on corresponding window
with single iowrite32. Similar loginc is used for ioread32.

Also modified the hp_addr and tp_addr in initialisation stage so that
hal_write will not have multiple if checks.

Change-Id: Ibb99ec4da7f63323082e46a28afbe90e1f555545
CRs-fixed: 2507441
2019-11-26 02:15:26 -08:00
Venkata Sharath Chandra Manchala
2b0d3f38d5 qcacmn: Support force wake request
1. Add hif_force_wake_request API to wake the
mhi and umac before reading/writing the memory region
greater than BAR+4K.
2. Add hif_force_wake_release API to release the
PCIE_PCIE_LOCAL_REG_PCIE_SOC_WAKE_PCIE_LOCAL_REG so the
umac can power collapse again at a later point of time.
3. Add pci stats to dump the force wake status.

Change-Id: Ic6d5463ea0cdb28d9144be61da55e43033b53298
CRs-Fixed: 2478052
2019-11-26 02:15:13 -08:00
Jinwei Chen
99ae1c1f3d qcacmn: Support register writing result check for IPA case
a. Add new macro HAL_REG_WRITE_CONFIRM to check register writing result,
enable register writing result check when do REO DST ring remap for
IPA.
b. only enable register writing result check when macro
HAL_REGISTER_WRITE_DEBUG is configured.

Change-Id: Ib52e6b0d689ccf714876b3978fa8e356f652d25e
CRs-Fixed: 2557252
2019-11-11 13:41:55 -08:00
Venkata Sharath Chandra Manchala
ea6518b89e qcacmn: Record reo command srng events
Add debugging infrastructure to record every event posted to reo
command ring. The infrastructure maintains the record of the last
64 events posted to the ring.

Change-Id: Id56fc352050eb664a64b0abb767f3b4a6b4c3aa3
CRs-Fixed: 2552822
2019-11-07 19:50:09 -08:00
Venkata Sharath Chandra Manchala
05c1f9c8c3 qcacmn: Remove unneccessary logging
Remove unneccessary logging to avoid
printing on the console.

Change-Id: Icdd5ea5703ab41561af7092def2b3b4352c637f2
CRs-Fixed: 2552006
2019-11-05 22:18:03 -08:00
Venkata Sharath Chandra Manchala
e69c9c2ac0 qcacmn: Add support for QCA6490
Add the following support for QCA6490:
1. Initialize the qca6490_hal_hw_txrx_ops
2. Initialize the hw_srng_table
3. Attach hal_qca6490_attach

Change-Id: Ic53c520ef804eb4fbe1434c704e9040c83011d3d
CRs-Fixed: 2522133
2019-10-17 15:12:14 -07:00
Sravan Kumar Kairam
78b01a1e1b qcacmn: Flush srng tp and hp only for flush event
Currently after runtime resume all SW2TCL data and reo cmd
srng rings hp and tp value are flushed. In case of IPA
offload case SW2TCL3 righ hp value will be updated by IPA
and not by host. In case of runtime pm enable host is
setting the value to zero as part of runtime resume which
results in incorrect hp value of SW2TCL3. As part of this
change set flush event for rings which are accessed by host
during link down state and after runtime resume flush the
rings for which flush event is set.

Change-Id: I5c9afa708277cf3a6e6d5ef99447bc21f88cfdcf
CRs-Fixed: 2514621
2019-10-12 22:16:04 -07:00
Nandha Kishore Easwaran
5d3475b985 qcacmn: Initial changes for pine
Add device ID change and target type checks for pine.
Also remove memory war added for Hk emulation.

Change-Id: Idf531a48a03202d4fb241a92a1d671ee2b94cfbd
CRs-fixed: 2453899
2019-08-11 02:11:41 -07:00
Akshay Kosigi
8eda31cab3 qcacmn: Remove void ptr usage in HAL
Add code to replace usage of void pointers from
HAL layer and instead use appropriate opaque pointers

Change-Id: Id950bd9130a99014305738937aed736cf0144aca
CRs-Fixed: 2487250
2019-07-27 13:43:07 -07:00
Akshay Kosigi
0bca9fb200 qcacmn: Change to remove void pointer usage for HAL SRNG
Add code to remove void pointer usage for hal_srng
and use opaque pointer dp_hal_ring_t instead.

Change-Id: I6907f7376d7fe3c9180b8795bd96f49fead2ec64
CRs-Fixed: 2484404
2019-07-27 13:42:41 -07:00
Akshay Kosigi
6a206753d6 qcacmn: Add code to remove void pointer usage
Add code to remove void pointer usage for hal_soc
and introduce opaque pointer to be used intead of void
from dp layer into hal layer

Change-Id: Ia38571174c6ed79558d0f0c9cd1a0f4afaa66483
CRs-Fixed: 2480857
2019-07-27 13:42:34 -07:00