Re: Qualcomm Atheros Ath10k and Ath11k CE Buffer DMA alignment issues on Raspberry PI CM4 - Aarch64 architecture

2021-10-01 Thread Govind Singh


On 01-10-2021 12:08, Kalle Valo wrote:

Maurice Smulders  writes:


I am trying to use the QCA6174A and the QCA6390 on a custom board using a PCIe 
switch - but that doesn't matter - It still fails w/o the switch:

lspci
00:00.0 PCI bridge: Broadcom Inc. and subsidiaries BCM2711 PCIe Bridge (rev 20)
01:00.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane 
Packet Switch
02:01.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane 
Packet Switch
02:02.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane 
Packet Switch
02:03.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane 
Packet Switch
02:04.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane 
Packet Switch
02:05.0 PCI bridge: Pericom Semiconductor PI7C9X2G608GP PCIe2 6-Port/8-Lane 
Packet Switch
05:00.0 Unassigned class [ff00]: Qualcomm QCA6390 Wireless Network Adapter 
[AX500-DBS (2x2)]
06:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network 
Adapter (rev 32)

Both device drivers do not work. I changed the CE code to use the GFP_DMA32 
flag as an attempt to allocate the memory correctly, but DMESG shows

[pi@node6745 ~]$ dmesg | grep ath
[5.801896] ath10k_pci :06:00.0: ath10k_ce_alloc_src_ring: Not unaligned 
<--- User message exit from this function
[5.804284] ath10k_pci :06:00.0: failed to alloc CE src ring 0: -12
[5.813138] ath10k_pci :06:00.0: failed to allocate copy engine pipe 0: 
-12
[5.815414] ath10k_pci :06:00.0: failed to allocate copy engine pipes: 
-12
[5.818002] ath10k_pci :06:00.0: failed to setup resource: -12
[5.826953] ath10k_pci: probe of :06:00.0 failed with error -12
[5.855993] ath11k_pci :05:00.0: WARNING: ath11k PCI support is 
experimental!
[5.896148] ath11k_pci :05:00.0: BAR 0: assigned [mem 
0x6-0x600ff 64bit]
[5.900236] ath11k_pci :05:00.0: enabling device ( -> 0002)
[5.914050] ath11k_pci: probe of :05:00.0 failed with error -12

Error -12 (ENOMEM) gets returned and the driver doesn't work...

05:00.0 Unassigned class [ff00]: Qualcomm QCA6390 Wireless Network Adapter 
[AX500-DBS (2x2)]
Subsystem: Qualcomm Device 0108
Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- 
SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 
Kernel modules: ath11k_pci

06:00.0 Network controller: Qualcomm Atheros QCA6174 802.11ac Wireless Network 
Adapter (rev 32)
Subsystem: ASUSTeK Computer Inc. Device 86e0
Control: I/O- Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- 
SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR- 
Kernel modules: ath10k_pci

I am at a loss what to do here. The ath11k driver has the SINGLE MSI fix built 
in.

Any ideas' what I can try to fix this problem on the raspberry Pi CM4?

Sorry, no ideas. But adding ath10k and ath11k lists, maybe people there
can propose something.
In RPI CM4 board, pcie-32bit-dma configuration is required for 
QCA6174/QCA9880 module, which can be enabled using dt overlay. Also, you 
will have to enable legacy PCI IRQ mode(using modparam@ath10k_pci 
irq_mode=1) as MSI does not work.


DT overlay change:
56b8b2c96118293ad6dec20203dada8116f7c664:overlays: Add pcie-32bit-dma 
overlay



BR,

Govind



___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


ath10k:IBSS-RSN not working with QCA6174.

2021-08-02 Thread Govind Singh
Hi,

IBSS-RSN not working with QCA6174(ath10k <--> ath10k).
Test Env: openwrt/ubuntu
FW: WLAN.RM.4.4.1.c3

Is there any specific OLD FW version that works with IBSS-RSN or any
WAR available?

Observation:

WPA Supplicant:
AUTH: 04:f0:21:48:bb:bb - sending 1/4 msg of 4-Way Handshake
AUTH: 04:f0:21:48:bb:bb - sending 1/4 msg of 4-Way Handshake
AUTH: 04:f0:21:48:bb:bb - sending 1/4 msg of 4-Way Handshake
AUTH: 04:f0:21:48:bb:bb - sending 1/4 msg of 4-Way Handshake
WPA: Use EAPOL-Key timeout of 1000 ms (retry counter 4)
AUTH: 04:f0:21:48:bb:bb - EAPOL-Key timeout

ath10k driver:
>From the driver side WIPHY_FLAG_IBSS_RSN is set but EAPOL is getting
dropped by FW.
As per tx completion its DISCARD status from FW and FW is dropping EAPOL frame.

[ 9353.374056] ath10k_pci :01:00.0: htt tx completion msdu_id 0 status 3
[ 9353.374062] ath10k_pci :01:00.0: htt tx free msdu_id 0
[ 9353.374112] ath10k_pci :01:00.0: htt tx completion msdu_id 1 status 3
[ 9353.374118] ath10k_pci :01:00.0: htt tx free msdu_id 1
[ 9353.374133] ath10k_pci :01:00.0: htt tx completion msdu_id 2 status 3
[ 9353.374138] ath10k_pci :01:00.0: htt tx free msdu_id 2
[ 9353.374152] ath10k_pci :01:00.0: htt tx completion msdu_id 3 status 3

BR,
Govind Singh

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] wireless: ath10k: Return early in ath10k_qmi_event_server_exit() to avoid hard crash on reboot

2020-08-28 Thread Govind Singh

Hi Kalle,

On 2020-08-28 18:22, Kalle Valo wrote:

Amit Pundir  writes:


On Mon, 8 Jun 2020 at 17:07, Kalle Valo  wrote:

> I don't agree with this. If you read through the replies to the bug report,
> it is clear that NS migration uncovered a corner case or even a bug. So we
> should try to fix that indeed.

I'm with Mani, we should try to fix ath10k instead. Hopefully we can
find a fix soon.


Hi Team,

Any updates on this? I can reproduce this hard crash on v5.9-rc1 as 
well.


It is not a blocker for us because we switched to a userspace
workaround, where we do not wait for modem to shutdown gracefully and
SIGKILL it instead, during the shutdown/reboot process. But I'm happy
to take a swing at any intermediate/in-progress solution available.


Govind submitted this patch and later he asked to drop it, but I think
it would be a good idea to test it anyway:

ath10k: Move msa region map/unmap to init/deinit path

https://lkml.kernel.org/r/1591191231-31917-1-git-send-email-govi...@codeaurora.org

(patchwork is down so I cannot give a patchwork link)


This patchwork is not fixing the issue and changing MSA mapping sequence 
is major design change.
This issue is only seen with DB845 which uses SCM call, newer targets 
QCS404/SC7180/SM8150 will not have this issue as MSA mapping is 
hard-coded in TZ.
Probably changes in qmi layer to give different indication for this 
scenario and changes in FW is required to mitigate this issue 
gracefully.


BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH] ath10k: Move msa region map/unmap to init/deinit path

2020-06-06 Thread Govind Singh

Pls ignore this WAR as it does not fix all cases.

On 2020-06-03 19:03, Govind Singh wrote:

With kernel qrtr switch from user space qrtr, fw crash is seen
during reboot. During reboot modem rproc shutdown causes wlan qmi
service exit and msa region gets unmapped. Since pdev is not suspended
hw still accessing the msa region and this results in  fw crash as
msa region is unmapped.

Decouple msa mapping from wlan qmi server arrive/exit to init/deinit
path.

Testing is pending with "0c2204a4ad71 net: qrtr: Migrate nameservice
to kernel from userspace", only regression sanity performed with user 
space

qrtr on QCS404/SC7180.

Fixes: 0c2204a4ad71 net: qrtr: Migrate nameservice to kernel from 
userspace

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c
b/drivers/net/wireless/ath/ath10k/qmi.c
index 5ae829b46c3d..8b1291e28ba2 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -796,22 +796,16 @@ static void
ath10k_qmi_event_server_arrive(struct ath10k_qmi *qmi)
 */
msleep(20);

-   ret = ath10k_qmi_setup_msa_permissions(qmi);
-   if (ret)
-   return;
-
ret = ath10k_qmi_msa_ready_send_sync_msg(qmi);




if (ret)
-   goto err_setup_msa;
+   return;

ret = ath10k_qmi_cap_send_sync_msg(qmi);
if (ret)
-   goto err_setup_msa;
+   return;

return;

-err_setup_msa:
-   ath10k_qmi_remove_msa_permission(qmi);
 }

 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi)
@@ -854,7 +848,6 @@ static void ath10k_qmi_event_server_exit(struct
ath10k_qmi *qmi)
struct ath10k *ar = qmi->ar;
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);

-   ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags))
ath10k_snoc_fw_crashed_dump(ar);
@@ -1046,6 +1039,10 @@ int ath10k_qmi_init(struct ath10k *ar, u32 
msa_size)

if (ret)
goto err_qmi_lookup;

+   ret = ath10k_qmi_setup_msa_permissions(qmi);
+   if (ret)
+   goto err_qmi_lookup;
+
return 0;

 err_qmi_lookup:
@@ -1064,6 +1061,7 @@ int ath10k_qmi_deinit(struct ath10k *ar)
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct ath10k_qmi *qmi = ar_snoc->qmi;

+   ath10k_qmi_remove_msa_permission(qmi);
qmi_handle_release(>qmi_hdl);
cancel_work_sync(>event_work);
destroy_workqueue(qmi->event_wq);


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: Move msa region map/unmap to init/deinit path

2020-06-03 Thread Govind Singh
With kernel qrtr switch from user space qrtr, fw crash is seen
during reboot. During reboot modem rproc shutdown causes wlan qmi
service exit and msa region gets unmapped. Since pdev is not suspended
hw still accessing the msa region and this results in  fw crash as
msa region is unmapped.

Decouple msa mapping from wlan qmi server arrive/exit to init/deinit
path.

Testing is pending with "0c2204a4ad71 net: qrtr: Migrate nameservice
to kernel from userspace", only regression sanity performed with user space
qrtr on QCS404/SC7180.

Fixes: 0c2204a4ad71 net: qrtr: Migrate nameservice to kernel from userspace
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 5ae829b46c3d..8b1291e28ba2 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -796,22 +796,16 @@ static void ath10k_qmi_event_server_arrive(struct 
ath10k_qmi *qmi)
 */
msleep(20);
 
-   ret = ath10k_qmi_setup_msa_permissions(qmi);
-   if (ret)
-   return;
-
ret = ath10k_qmi_msa_ready_send_sync_msg(qmi);
if (ret)
-   goto err_setup_msa;
+   return;
 
ret = ath10k_qmi_cap_send_sync_msg(qmi);
if (ret)
-   goto err_setup_msa;
+   return;
 
return;
 
-err_setup_msa:
-   ath10k_qmi_remove_msa_permission(qmi);
 }
 
 static int ath10k_qmi_fetch_board_file(struct ath10k_qmi *qmi)
@@ -854,7 +848,6 @@ static void ath10k_qmi_event_server_exit(struct ath10k_qmi 
*qmi)
struct ath10k *ar = qmi->ar;
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
 
-   ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags))
ath10k_snoc_fw_crashed_dump(ar);
@@ -1046,6 +1039,10 @@ int ath10k_qmi_init(struct ath10k *ar, u32 msa_size)
if (ret)
goto err_qmi_lookup;
 
+   ret = ath10k_qmi_setup_msa_permissions(qmi);
+   if (ret)
+   goto err_qmi_lookup;
+
return 0;
 
 err_qmi_lookup:
@@ -1064,6 +1061,7 @@ int ath10k_qmi_deinit(struct ath10k *ar)
struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct ath10k_qmi *qmi = ar_snoc->qmi;
 
+   ath10k_qmi_remove_msa_permission(qmi);
qmi_handle_release(>qmi_hdl);
cancel_work_sync(>event_work);
destroy_workqueue(qmi->event_wq);
-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: Remove experimental tag from ath10k Kconfig

2020-05-06 Thread Govind Singh
ath10k(sdio/snoc) is no longer experimental.
Remove experimental tag for SDIO/SNOC from ath10k Kconfig.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/Kconfig | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index 6b3ff02a373d..b99fd0eff994 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -28,11 +28,10 @@ config ATH10K_AHB
  This module adds support for AHB bus
 
 config ATH10K_SDIO
-   tristate "Atheros ath10k SDIO support (EXPERIMENTAL)"
+   tristate "Atheros ath10k SDIO support"
depends on ATH10K && MMC
---help---
- This module adds experimental support for SDIO/MMC bus. Currently
- work in progress and will not fully work.
+ This module adds support for SDIO/MMC bus.
 
 config ATH10K_USB
tristate "Atheros ath10k USB support (EXPERIMENTAL)"
@@ -42,7 +41,7 @@ config ATH10K_USB
  work in progress and will not fully work.
 
 config ATH10K_SNOC
-   tristate "Qualcomm ath10k SNOC support (EXPERIMENTAL)"
+   tristate "Qualcomm ath10k SNOC support"
depends on ATH10K
depends on ARCH_QCOM || COMPILE_TEST
select QCOM_QMI_HELPERS
-- 
2.22.0

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


RE: Ath10k reboot regression with v5.7-rc1 on dragonboard 845c

2020-04-29 Thread Govind Singh
Hi Amit,
Seems del_server is being notified early due to qrtr-ns migration from 
userspace to kernel prior remote(modem + wifi) actually went down.
As per of del_server we are removing the MSA permission via SCM call, but 
remote(wifi user pd in modem Q6) is still accessing the region.

BR,
Govind

-Original Message-
From: ath10k  On Behalf Of Amit Pundir
Sent: Wednesday, April 29, 2020 9:51 PM
To: ath10k@lists.infradead.org
Cc: bjorn.anders...@linaro.org; John Stultz ; 
manivannan.sadhasi...@linaro.org
Subject: [EXT] Ath10k reboot regression with v5.7-rc1 on dragonboard 845c

Hi,

I see a reboot regression with v5.7-rc1 on Dragonboard 845c
(wcn3990/ath10k_snoc) running AOSP. "reboot" or "reboot bootloader"
commands do not work as expected when the board is connected to WiFi AP. I see 
"ath10k_snoc 1880.wifi: firmware crashed"... dump in dmesg and board 
reboots into usb debug/crash mode. I do not see this reboot regression when the 
board is not connected to WiFi.

It started with qrtr-ns migration from userspace to kernel which landed in 
v5.7-rc1. I didn't run into this reboot issue when I was running qrtr-ns 
userspace tool. According to Mani, in-kernel qrtr-ns just live long enough to 
catch modem shutdown requests and advertise it to the modem, unlike the 
userspace tool. Which seem to be the case here. I further narrowed it down to 
ath10k_qmi_remove_msa_permission()
call in ath10k shutdown path. If I comment out that function call then the 
reboot command works as expected.

Any thoughts as to what might be going wrong? I do not understand 
qrtr/ath10k/qmi to see how msa permissions are getting mapped-unmapped here. 
I'd be happy to help debug things.

Regards,
Amit Pundir

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 0/2] Don't call SCM interface for statically mapped msa region

2020-01-03 Thread Govind Singh
For some targets ex: SC7180/QCS404, SCM permissions for MSA region is
statically configured in TrustZone fw. Add SCM call disable option
for such targets to avoid duplicate permissions.

Change since v2:
   rename flag to "qcom,msa-fixed-perm".

Change since v1:
Added devicetree list for review.

Govind Singh (2):
  dt: bindings: add dt entry flag to skip SCM call for msa region
  ath10k: Don't call SCM interface for statically mapped msa region

 .../devicetree/bindings/net/wireless/qcom,ath10k.txt | 4 
 drivers/net/wireless/ath/ath10k/qmi.c| 9 +
 drivers/net/wireless/ath/ath10k/qmi.h| 1 +
 3 files changed, 14 insertions(+)

-- 
2.22.0

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 1/2] dt: bindings: add dt entry flag to skip SCM call for msa region

2020-01-03 Thread Govind Singh
Add boolean context flag to disable SCM call for statically
mapped msa region.

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt  | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 017128394a3e..633366dc33da 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -88,6 +88,9 @@ Optional properties:
of the host capability QMI request
 - qcom,xo-cal-data: xo cal offset to be configured in xo trim register.
 
+- qcom,msa-fixed-perm: Boolean context flag to disable SCM call for statically
+  mapped msa region.
+
 Example (to supply PCI based wifi block details):
 
 In this example, the node is defined as child node of the PCI controller.
@@ -185,4 +188,5 @@ wifi@1800 {
vdd-3.3-ch0-supply = <_l25a_3p3>;
memory-region = <_msa_mem>;
iommus = <_smmu 0x0040 0x1>;
+   qcom,msa-fixed-perm;
 };
-- 
2.22.0

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 2/2] ath10k: Don't call SCM interface for statically mapped msa region

2020-01-03 Thread Govind Singh
For some targets ex: QCS404, SCM permissions for MSA region is
statically configured in TrustZone fw. Add SCM call disable option
for such targets to avoid duplicate permissions.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 9 +
 drivers/net/wireless/ath/ath10k/qmi.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 637f83ef65f8..1b91de70c8d6 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -84,6 +84,9 @@ static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi 
*qmi)
int ret;
int i;
 
+   if (qmi->msa_fixed_perm)
+   return 0;
+
for (i = 0; i < qmi->nr_mem_region; i++) {
ret = ath10k_qmi_map_msa_permission(qmi, >mem_region[i]);
if (ret)
@@ -102,6 +105,9 @@ static void ath10k_qmi_remove_msa_permission(struct 
ath10k_qmi *qmi)
 {
int i;
 
+   if (qmi->msa_fixed_perm)
+   return;
+
for (i = 0; i < qmi->nr_mem_region; i++)
ath10k_qmi_unmap_msa_permission(qmi, >mem_region[i]);
 }
@@ -1018,6 +1024,9 @@ static int ath10k_qmi_setup_msa_resources(struct 
ath10k_qmi *qmi, u32 msa_size)
qmi->msa_mem_size = msa_size;
}
 
+   if (of_property_read_bool(dev->of_node, "qcom,msa-fixed-perm"))
+   qmi->msa_fixed_perm = true;
+
ath10k_dbg(ar, ATH10K_DBG_QMI, "msa pa: %pad , msa va: 0x%p\n",
   >msa_pa,
   qmi->msa_va);
diff --git a/drivers/net/wireless/ath/ath10k/qmi.h 
b/drivers/net/wireless/ath/ath10k/qmi.h
index 40aafb875ed0..dc257375f161 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.h
+++ b/drivers/net/wireless/ath/ath10k/qmi.h
@@ -104,6 +104,7 @@ struct ath10k_qmi {
bool fw_ready;
char fw_build_timestamp[MAX_TIMESTAMP_LEN + 1];
struct ath10k_qmi_cal_data cal_data[MAX_NUM_CAL_V01];
+   bool msa_fixed_perm;
 };
 
 int ath10k_qmi_wlan_enable(struct ath10k *ar,
-- 
2.22.0

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: move non-fatal warn logs to dbg level

2019-11-25 Thread Govind Singh
During driver load below warn logs are printed in the console if
firmware doesn't support some optional HTC services, ex:pktlog.
It is likely some older fw version may not support PKTLOG HTC
service as legacy fw uses HTC DATA service  for pktlog.
Move this log to debug level to remove un-necessary warn message
on console.

htc.c:803:  ath10k_warn(ar, "unsupported HTC service id: %d\n",
htc.c:881:  ath10k_warn(ar, "unsupported HTC service id: %d\n",

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/htc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 28daed5981a1..367b762632d1 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -809,8 +809,8 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
>ul_pipe_id,
>dl_pipe_id);
if (status) {
-   ath10k_warn(ar, "unsupported HTC service id: %d\n",
-   ep->service_id);
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "unsupported HTC service id: 
%d\n",
+  ep->service_id);
return status;
}
 
@@ -887,8 +887,8 @@ static bool ath10k_htc_pktlog_svc_supported(struct ath10k 
*ar)
_pipe_id,
_pipe_id);
if (status) {
-   ath10k_warn(ar, "unsupported HTC service id: %d\n",
-   ATH10K_HTC_SVC_ID_HTT_LOG_MSG);
+   ath10k_dbg(ar, ATH10K_DBG_BOOT, "unsupported HTC pktlog service 
id: %d\n",
+  ATH10K_HTC_SVC_ID_HTT_LOG_MSG);
 
return false;
}
-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 0/2] Don't call SCM interface for statically mapped msa region

2019-11-10 Thread Govind Singh
For some targets ex: SC7180/QCS404, SCM permissions for MSA region is
statically configured in TrustZone fw. Add SCM call disable option
for such targets to avoid duplicate permissions.

Change since v1:
Added devicetree list for review.

Govind Singh (2):
  dt: bindings: add dt entry flag to skip SCM call for msa region
  ath10k: Don't call SCM interface for statically mapped msa region

 .../devicetree/bindings/net/wireless/qcom,ath10k.txt | 4 
 drivers/net/wireless/ath/ath10k/qmi.c| 9 +
 drivers/net/wireless/ath/ath10k/qmi.h| 1 +
 3 files changed, 14 insertions(+)

-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 1/2] dt: bindings: add dt entry flag to skip SCM call for msa region

2019-11-10 Thread Govind Singh
Add boolean context flag to disable SCM call for statically
mapped msa region.

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt  | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 017128394a3e..7ba22918bab7 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -88,6 +88,9 @@ Optional properties:
of the host capability QMI request
 - qcom,xo-cal-data: xo cal offset to be configured in xo trim register.
 
+- qcom,msa_fixed_perm: Boolean context flag to disable SCM call for statically
+  mapped msa region.
+
 Example (to supply PCI based wifi block details):
 
 In this example, the node is defined as child node of the PCI controller.
@@ -185,4 +188,5 @@ wifi@1800 {
vdd-3.3-ch0-supply = <_l25a_3p3>;
memory-region = <_msa_mem>;
iommus = <_smmu 0x0040 0x1>;
+   qcom,msa_fixed_perm;
 };
-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 2/2] ath10k: Don't call SCM interface for statically mapped msa region

2019-11-10 Thread Govind Singh
For some targets ex: QCS404, SCM permissions for MSA region is
statically configured in TrustZone fw. Add SCM call disable option
for such targets to avoid duplicate permissions.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 9 +
 drivers/net/wireless/ath/ath10k/qmi.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 637f83ef65f8..40ffc444ab7b 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -84,6 +84,9 @@ static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi 
*qmi)
int ret;
int i;
 
+   if (qmi->msa_fixed_perm)
+   return 0;
+
for (i = 0; i < qmi->nr_mem_region; i++) {
ret = ath10k_qmi_map_msa_permission(qmi, >mem_region[i]);
if (ret)
@@ -102,6 +105,9 @@ static void ath10k_qmi_remove_msa_permission(struct 
ath10k_qmi *qmi)
 {
int i;
 
+   if (qmi->msa_fixed_perm)
+   return;
+
for (i = 0; i < qmi->nr_mem_region; i++)
ath10k_qmi_unmap_msa_permission(qmi, >mem_region[i]);
 }
@@ -1018,6 +1024,9 @@ static int ath10k_qmi_setup_msa_resources(struct 
ath10k_qmi *qmi, u32 msa_size)
qmi->msa_mem_size = msa_size;
}
 
+   if (of_property_read_bool(dev->of_node, "qcom,msa_fixed_perm"))
+   qmi->msa_fixed_perm = true;
+
ath10k_dbg(ar, ATH10K_DBG_QMI, "msa pa: %pad , msa va: 0x%p\n",
   >msa_pa,
   qmi->msa_va);
diff --git a/drivers/net/wireless/ath/ath10k/qmi.h 
b/drivers/net/wireless/ath/ath10k/qmi.h
index 40aafb875ed0..dc257375f161 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.h
+++ b/drivers/net/wireless/ath/ath10k/qmi.h
@@ -104,6 +104,7 @@ struct ath10k_qmi {
bool fw_ready;
char fw_build_timestamp[MAX_TIMESTAMP_LEN + 1];
struct ath10k_qmi_cal_data cal_data[MAX_NUM_CAL_V01];
+   bool msa_fixed_perm;
 };
 
 int ath10k_qmi_wlan_enable(struct ath10k *ar,
-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 1/2] dt: bindings: add dt entry flag to skip SCM call for msa region

2019-10-24 Thread Govind Singh

Hi Kalle,

On 2019-10-24 12:44, Kalle Valo wrote:

Govind Singh  writes:


Add boolean context flag to disable SCM call for statically
mapped msa region.

Signed-off-by: Govind Singh 


Oddly this didn't apply, but 3-way merge did work. Please double check
the result in the pending branch:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=master-pending=6f308524cf602ed9a0dbb0b0b50ba625b9091879


Change looks good to me.


BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/2] ath10k: Don't call SCM interface for statically mapped msa region

2019-10-23 Thread Govind Singh
For some targets ex: QCS404, SCM permissions for MSA region is
statically configured in TrustZone fw. Add SCM call disable option
for such targets to avoid duplicate permissions.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 9 +
 drivers/net/wireless/ath/ath10k/qmi.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index da16874012c5..d43ec0183287 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -95,6 +95,9 @@ static int ath10k_qmi_setup_msa_permissions(struct ath10k_qmi 
*qmi)
int ret;
int i;
 
+   if (qmi->msa_fixed_perm)
+   return 0;
+
for (i = 0; i < qmi->nr_mem_region; i++) {
ret = ath10k_qmi_map_msa_permission(qmi, >mem_region[i]);
if (ret)
@@ -113,6 +116,9 @@ static void ath10k_qmi_remove_msa_permission(struct 
ath10k_qmi *qmi)
 {
int i;
 
+   if (qmi->msa_fixed_perm)
+   return;
+
for (i = 0; i < qmi->nr_mem_region; i++)
ath10k_qmi_unmap_msa_permission(qmi, >mem_region[i]);
 }
@@ -1021,6 +1027,9 @@ static int ath10k_qmi_setup_msa_resources(struct 
ath10k_qmi *qmi, u32 msa_size)
qmi->msa_mem_size = msa_size;
}
 
+   if (of_property_read_bool(dev->of_node, "qcom,msa_fixed_perm"))
+   qmi->msa_fixed_perm = true;
+
ath10k_dbg(ar, ATH10K_DBG_QMI, "msa pa: %pad , msa va: 0x%p\n",
   >msa_pa,
   qmi->msa_va);
diff --git a/drivers/net/wireless/ath/ath10k/qmi.h 
b/drivers/net/wireless/ath/ath10k/qmi.h
index 4ab21b223aaf..3a039e6e29df 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.h
+++ b/drivers/net/wireless/ath/ath10k/qmi.h
@@ -115,6 +115,7 @@ struct ath10k_qmi {
bool fw_ready;
char fw_build_timestamp[MAX_TIMESTAMP_LEN + 1];
struct ath10k_qmi_cal_data cal_data[MAX_NUM_CAL_V01];
+   bool msa_fixed_perm;
 };
 
 int ath10k_qmi_wlan_enable(struct ath10k *ar,
-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 0/2] Don't call SCM interface for statically mapped msa region

2019-10-23 Thread Govind Singh
For some targets ex: SC7180/QCS404, SCM permissions for MSA region is
statically configured in TrustZone fw. Add SCM call disable option
for such targets to avoid duplicate permissions.

Govind Singh (2):
  dt: bindings: add dt entry flag to skip SCM call for msa region
  ath10k: Don't call SCM interface for statically mapped msa region

 .../devicetree/bindings/net/wireless/qcom,ath10k.txt | 4 
 drivers/net/wireless/ath/ath10k/qmi.c| 9 +
 drivers/net/wireless/ath/ath10k/qmi.h| 1 +
 3 files changed, 14 insertions(+)

-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/2] dt: bindings: add dt entry flag to skip SCM call for msa region

2019-10-23 Thread Govind Singh
Add boolean context flag to disable SCM call for statically
mapped msa region.

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt  | 4 
 1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 81859507db67..0d868443375d 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -83,6 +83,9 @@ Optional properties:
and "sky85803" etc.
 - qcom,xo-cal-data: xo cal offset to be configured in xo trim register.
 
+- qcom,msa_fixed_perm: Boolean context flag to disable SCM call for statically
+  mapped msa region.
+
 Example (to supply PCI based wifi block details):
 
 In this example, the node is defined as child node of the PCI controller.
@@ -180,4 +183,5 @@ wifi@1800 {
vdd-3.3-ch0-supply = <_l25a_3p3>;
memory-region = <_msa_mem>;
iommus = <_smmu 0x0040 0x1>;
+   qcom,msa_fixed_perm;
 };
-- 
2.22.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2] arm64: dts: qcom: qcs404: Add wifi rails in QCS404 dt node for proxy votes

2019-07-31 Thread Govind Singh
Add wifi regulators in qcs404 dt node for proxy vote. Proxy votes are
required for handling driver recovery scenarios to prevent
un-clocked register access during driver recovery.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/qcs404-evb.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi 
b/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
index 11c0a7137823..2289b01ee9f0 100644
--- a/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
@@ -270,6 +270,9 @@
 
  {
status = "okay";
+   vdd-0.8-cx-mx-supply = <_l2_1p275>;
+   vdd-1.8-xo-supply = <_l5_1p8>;
+   vdd-1.3-rfa-supply = <_l1_1p3>;
 };
 
 /* PINCTRL - additions to nodes defined in qcs404.dtsi */
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: revalidate the msa region coming from firmware

2019-07-31 Thread Govind Singh
driver sends QMI_WLFW_MSA_INFO_REQ_V01 QMI request to firmware
and in response expects range of addresses and size to be mapped.
Add condition to check whether addresses in response falls
under valid range otherwise return failure.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 2e678780df5d..3457509a003f 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -111,6 +111,7 @@ static int ath10k_qmi_msa_mem_info_send_sync_msg(struct 
ath10k_qmi *qmi)
struct wlfw_msa_info_resp_msg_v01 resp = {};
struct wlfw_msa_info_req_msg_v01 req = {};
struct ath10k *ar = qmi->ar;
+   phys_addr_t max_mapped_addr;
struct qmi_txn txn;
int ret;
int i;
@@ -150,8 +151,20 @@ static int ath10k_qmi_msa_mem_info_send_sync_msg(struct 
ath10k_qmi *qmi)
goto out;
}
 
+   max_mapped_addr = qmi->msa_pa + qmi->msa_mem_size;
qmi->nr_mem_region = resp.mem_region_info_len;
for (i = 0; i < resp.mem_region_info_len; i++) {
+   if (resp.mem_region_info[i].size > qmi->msa_mem_size ||
+   resp.mem_region_info[i].region_addr > max_mapped_addr ||
+   resp.mem_region_info[i].region_addr < qmi->msa_pa ||
+   resp.mem_region_info[i].size +
+   resp.mem_region_info[i].region_addr > max_mapped_addr) {
+   ath10k_err(ar, "received out of range memory region 
address 0x%llx with size 0x%x, aborting\n",
+  resp.mem_region_info[i].region_addr,
+  resp.mem_region_info[i].size);
+   ret = -EINVAL;
+   goto fail_unwind;
+   }
qmi->mem_region[i].addr = resp.mem_region_info[i].region_addr;
qmi->mem_region[i].size = resp.mem_region_info[i].size;
qmi->mem_region[i].secure = resp.mem_region_info[i].secure_flag;
@@ -165,6 +178,8 @@ static int ath10k_qmi_msa_mem_info_send_sync_msg(struct 
ath10k_qmi *qmi)
ath10k_dbg(ar, ATH10K_DBG_QMI, "qmi msa mem info request completed\n");
return 0;
 
+fail_unwind:
+   memset(>mem_region[0], 0, sizeof(qmi->mem_region[0]) * i);
 out:
return ret;
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



Re: [PATCH 0/3] ath10k: Clean up regulator and clock handling

2019-07-26 Thread Govind Singh

On 2019-07-25 23:17, Bjorn Andersson wrote:
The first patch in this series removes the regulator_set_voltage() of a 
fixed
voltate, as fixed regulator constraints should be specified on a board 
level
and on certain boards - such as the Lenovo Yoga C630 - the voltage 
specified

for the 3.3V regulator is outside the given range.

The following two patches cleans up regulator and clock usage by using 
the bulk

API provided by the two frameworks.

Bjorn Andersson (3):
  ath10k: snoc: skip regulator operations
  ath10k: Use standard regulator bulk API in snoc
  ath10k: Use standard bulk clock API in snoc

 drivers/net/wireless/ath/ath10k/snoc.c | 324 -
 drivers/net/wireless/ath/ath10k/snoc.h |  26 +-
 2 files changed, 48 insertions(+), 302 deletions(-)


Tested on 845 MTP and QCS404 platform with normal sanity and driver 
recover cases for proxy votes.


Tested-by: Govind Singh 
Reviewed-by: Govind Singh 

BR,
Govind


Re: [PATCH 2/3] ath10k: Move regulator config to driver private data

2019-07-23 Thread Govind Singh

On 2019-07-23 05:27, Bjorn Andersson wrote:

On Tue 02 Jul 20:57 PDT 2019, Govind Singh wrote:


WCN3990 Regulator config is varying b/w different MSM platforms.
In order to have scalable config, move regulator config to driver
private data.



Regulators supplying clients with fixed voltage requirements should be
specified in the board devicetree with these required voltage values,
rather than in the driver.  So the appropriate solution is not to add
and adjust these values but rather to drop this code from the driver.

I was about to send a patch that does this, because I have an SDM845
device where the voltage constraints specified on board level does not
meet the ranges specified here in the driver.


Thanks Bjorn for the feedback.
I will resend the qcs404 specific changes(dt) on top of your changes 
once available.



Regards,
Bjorn


Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 38 
+-

 drivers/net/wireless/ath/ath10k/snoc.h | 23 +---
 2 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c

index ca1186ec4129..bd7d97924fe0 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -36,13 +36,20 @@ static char *const ce_name[] = {
"WLAN_CE_11",
 };

-static struct ath10k_vreg_info vreg_cfg[] = {
+static struct ath10k_vreg_info sdm845_reg_cfg[] = {
{NULL, "vdd-0.8-cx-mx", 80, 85, 0, 0, false},
{NULL, "vdd-1.8-xo", 180, 185, 0, 0, false},
{NULL, "vdd-1.3-rfa", 130, 135, 0, 0, false},
{NULL, "vdd-3.3-ch0", 330, 335, 0, 0, false},
 };

+static struct ath10k_vreg_info qcs40x_reg_cfg[] = {
+   {NULL, "vdd-0.8-cx-mx", 1224000, 1224000, 0, 0, false},
+   {NULL, "vdd-1.8-xo", 180, 185, 0, 0, false},
+   {NULL, "vdd-1.3-rfa", 130, 135, 0, 0, false},
+   {NULL, "vdd-3.3-ch0", 330, 335, 0, 0, false},
+};
+
 static struct ath10k_clk_info clk_cfg[] = {
{NULL, "cxo_ref_clk_pin", 0, false},
 };
@@ -54,10 +61,20 @@ static void ath10k_snoc_htt_rx_cb(struct 
ath10k_ce_pipe *ce_state);
 static void ath10k_snoc_htt_htc_rx_cb(struct ath10k_ce_pipe 
*ce_state);
 static void ath10k_snoc_pktlog_rx_cb(struct ath10k_ce_pipe 
*ce_state);


-static const struct ath10k_snoc_drv_priv drv_priv = {
+static const struct ath10k_snoc_drv_priv sdm845_wcn39xx_drv_priv = {
+   .hw_rev = ATH10K_HW_WCN3990,
+   .dma_mask = DMA_BIT_MASK(35),
+   .msa_size = 0x10,
+   .vreg_cfg = sdm845_reg_cfg,
+   .vreg_count = ARRAY_SIZE(sdm845_reg_cfg),
+};
+
+static const struct ath10k_snoc_drv_priv qcs40x_wcn39xx_drv_priv = {
.hw_rev = ATH10K_HW_WCN3990,
.dma_mask = DMA_BIT_MASK(35),
.msa_size = 0x10,
+   .vreg_cfg = qcs40x_reg_cfg,
+   .vreg_count =  ARRAY_SIZE(qcs40x_reg_cfg),
 };

 #define WCN3990_SRC_WR_IDX_OFFSET 0x3C
@@ -1465,7 +1482,7 @@ static int ath10k_snoc_vreg_on(struct ath10k 
*ar)

int ret = 0;
int i;

-   for (i = 0; i < ARRAY_SIZE(vreg_cfg); i++) {
+   for (i = 0; i < ar_snoc->vreg_count; i++) {
vreg_info = _snoc->vreg[i];

if (!vreg_info->reg)
@@ -1498,7 +1515,7 @@ static int ath10k_snoc_vreg_off(struct ath10k 
*ar)

int ret = 0;
int i;

-   for (i = ARRAY_SIZE(vreg_cfg) - 1; i >= 0; i--) {
+   for (i = ar_snoc->vreg_count - 1; i >= 0; i--) {
vreg_info = _snoc->vreg[i];

if (!vreg_info->reg)
@@ -1616,7 +1633,13 @@ static int ath10k_hw_power_off(struct ath10k 
*ar)


 static const struct of_device_id ath10k_snoc_dt_match[] = {
{ .compatible = "qcom,wcn3990-wifi",
-.data = _priv,
+.data = _wcn39xx_drv_priv,
+   },
+   { .compatible = "qcom,sdm845-wcn39xx-wifi",
+.data = _wcn39xx_drv_priv,
+   },
+   { .compatible = "qcom,qcs40x-wcn39xx-wifi",
+.data = _wcn39xx_drv_priv,
},
{ }
 };
@@ -1680,8 +1703,9 @@ static int ath10k_snoc_probe(struct 
platform_device *pdev)

goto err_release_resource;
}

-   ar_snoc->vreg = vreg_cfg;
-   for (i = 0; i < ARRAY_SIZE(vreg_cfg); i++) {
+   ar_snoc->vreg = drv_data->vreg_cfg;
+   ar_snoc->vreg_count = drv_data->vreg_count;
+   for (i = 0; i < ar_snoc->vreg_count; i++) {
ret = ath10k_get_vreg_info(ar, dev, _snoc->vreg[i]);
if (ret)
goto err_free_irq;
diff --git a/drivers/net/wireless/ath/ath10k/snoc.h 
b/drivers/net/wireless/ath/ath10k/snoc.h

index d62f53501fbb..0bdada11985c 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.h
+++ b/drivers/net/wireless/ath/ath10k/snoc.h
@@

[PATCH v4] ath10k: Enable MSA region dump support for WCN3990

2019-07-08 Thread Govind Singh
MSA memory region caries the hw descriptors information.
Dump MSA region in core dump as this is very helpful in debugging
hw issues.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 

---
Changes from v3:
- Fixed error reported in v2.

Changes from v2:
- Rebased on top of 38faed150438 ath10k: perform crash dump collection in 
workqueue.
- Removed redundant msa permission call.
---
 drivers/net/wireless/ath/ath10k/coredump.c | 21 +++
 drivers/net/wireless/ath/ath10k/coredump.h |  1 +
 drivers/net/wireless/ath/ath10k/qmi.c  |  4 ++
 drivers/net/wireless/ath/ath10k/snoc.c | 66 ++
 drivers/net/wireless/ath/ath10k/snoc.h |  1 +
 5 files changed, 93 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/coredump.c 
b/drivers/net/wireless/ath/ath10k/coredump.c
index aa04fbf146e0..0ec690b49fb1 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.c
+++ b/drivers/net/wireless/ath/ath10k/coredump.c
@@ -962,6 +962,19 @@ static const struct ath10k_mem_region 
qca4019_hw10_mem_regions[] = {
},
 };
 
+static const struct ath10k_mem_region wcn399x_hw10_mem_regions[] = {
+   {
+   /* MSA region start is not fixed, hence it is assigned at 
runtime */
+   .type = ATH10K_MEM_REGION_TYPE_MSA,
+   .len = 0x10,
+   .name = "DRAM",
+   .section_table = {
+   .sections = NULL,
+   .size = 0,
+   },
+   },
+};
+
 static const struct ath10k_hw_mem_layout hw_mem_layouts[] = {
{
.hw_id = QCA6174_HW_1_0_VERSION,
@@ -1059,6 +1072,14 @@ static const struct ath10k_hw_mem_layout 
hw_mem_layouts[] = {
.size = ARRAY_SIZE(qca4019_hw10_mem_regions),
},
},
+   {
+   .hw_id = WCN3990_HW_1_0_DEV_VERSION,
+   .hw_rev = ATH10K_HW_WCN3990,
+   .region_table = {
+   .regions = wcn399x_hw10_mem_regions,
+   .size = ARRAY_SIZE(wcn399x_hw10_mem_regions),
+   },
+   },
 };
 
 static u32 ath10k_coredump_get_ramdump_size(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/coredump.h 
b/drivers/net/wireless/ath/ath10k/coredump.h
index 5dac653e1649..9802e90483f4 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.h
+++ b/drivers/net/wireless/ath/ath10k/coredump.h
@@ -126,6 +126,7 @@ enum ath10k_mem_region_type {
ATH10K_MEM_REGION_TYPE_IRAM2= 5,
ATH10K_MEM_REGION_TYPE_IOSRAM   = 6,
ATH10K_MEM_REGION_TYPE_IOREG= 7,
+   ATH10K_MEM_REGION_TYPE_MSA  = 8,
 };
 
 /* Define a section of the region which should be copied. As not all parts
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index ba8f5a8f83d1..8eb0f0f0d3a7 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -817,9 +817,13 @@ ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi,
 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)
 {
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
 
ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
+   if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags))
+   ath10k_snoc_fw_crashed_dump(ar);
+
ath10k_snoc_fw_indication(ar, ATH10K_QMI_EVENT_FW_DOWN_IND);
ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service disconnected\n");
 }
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 0be12996beba..6c362c928e4e 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -24,6 +24,7 @@
 #include 
 
 #include "ce.h"
+#include "coredump.h"
 #include "debug.h"
 #include "hif.h"
 #include "htc.h"
@@ -1586,6 +1587,71 @@ static int ath10k_hw_power_off(struct ath10k *ar)
return ret;
 }
 
+static void ath10k_msa_dump_memory(struct ath10k *ar,
+  struct ath10k_fw_crash_data *crash_data)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   const struct ath10k_hw_mem_layout *mem_layout;
+   const struct ath10k_mem_region *current_region;
+   struct ath10k_dump_ram_data_hdr *hdr;
+   size_t buf_len;
+   u8 *buf;
+
+   if (!crash_data && !crash_data->ramdump_buf)
+   return;
+
+   mem_layout = ath10k_coredump_get_mem_layout(ar);
+   if (!mem_layout)
+   return;
+
+   current_region = _layout->region_table.regions[0];
+
+   buf = crash_data->ramdump_buf;
+   buf_len = crash_data->ramdump_buf_len;
+   memset(buf, 0, buf_len);
+
+   /* Reserve space for the header. */
+   hdr = (void *)buf;
+   buf += sizeof(*hdr)

[PATCH 2/3] ath10k: Move regulator config to driver private data

2019-07-02 Thread Govind Singh
WCN3990 Regulator config is varying b/w different MSM platforms.
In order to have scalable config, move regulator config to driver
private data.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 38 +-
 drivers/net/wireless/ath/ath10k/snoc.h | 23 +---
 2 files changed, 44 insertions(+), 17 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index ca1186ec4129..bd7d97924fe0 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -36,13 +36,20 @@ static char *const ce_name[] = {
"WLAN_CE_11",
 };
 
-static struct ath10k_vreg_info vreg_cfg[] = {
+static struct ath10k_vreg_info sdm845_reg_cfg[] = {
{NULL, "vdd-0.8-cx-mx", 80, 85, 0, 0, false},
{NULL, "vdd-1.8-xo", 180, 185, 0, 0, false},
{NULL, "vdd-1.3-rfa", 130, 135, 0, 0, false},
{NULL, "vdd-3.3-ch0", 330, 335, 0, 0, false},
 };
 
+static struct ath10k_vreg_info qcs40x_reg_cfg[] = {
+   {NULL, "vdd-0.8-cx-mx", 1224000, 1224000, 0, 0, false},
+   {NULL, "vdd-1.8-xo", 180, 185, 0, 0, false},
+   {NULL, "vdd-1.3-rfa", 130, 135, 0, 0, false},
+   {NULL, "vdd-3.3-ch0", 330, 335, 0, 0, false},
+};
+
 static struct ath10k_clk_info clk_cfg[] = {
{NULL, "cxo_ref_clk_pin", 0, false},
 };
@@ -54,10 +61,20 @@ static void ath10k_snoc_htt_rx_cb(struct ath10k_ce_pipe 
*ce_state);
 static void ath10k_snoc_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state);
 static void ath10k_snoc_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state);
 
-static const struct ath10k_snoc_drv_priv drv_priv = {
+static const struct ath10k_snoc_drv_priv sdm845_wcn39xx_drv_priv = {
+   .hw_rev = ATH10K_HW_WCN3990,
+   .dma_mask = DMA_BIT_MASK(35),
+   .msa_size = 0x10,
+   .vreg_cfg = sdm845_reg_cfg,
+   .vreg_count = ARRAY_SIZE(sdm845_reg_cfg),
+};
+
+static const struct ath10k_snoc_drv_priv qcs40x_wcn39xx_drv_priv = {
.hw_rev = ATH10K_HW_WCN3990,
.dma_mask = DMA_BIT_MASK(35),
.msa_size = 0x10,
+   .vreg_cfg = qcs40x_reg_cfg,
+   .vreg_count =  ARRAY_SIZE(qcs40x_reg_cfg),
 };
 
 #define WCN3990_SRC_WR_IDX_OFFSET 0x3C
@@ -1465,7 +1482,7 @@ static int ath10k_snoc_vreg_on(struct ath10k *ar)
int ret = 0;
int i;
 
-   for (i = 0; i < ARRAY_SIZE(vreg_cfg); i++) {
+   for (i = 0; i < ar_snoc->vreg_count; i++) {
vreg_info = _snoc->vreg[i];
 
if (!vreg_info->reg)
@@ -1498,7 +1515,7 @@ static int ath10k_snoc_vreg_off(struct ath10k *ar)
int ret = 0;
int i;
 
-   for (i = ARRAY_SIZE(vreg_cfg) - 1; i >= 0; i--) {
+   for (i = ar_snoc->vreg_count - 1; i >= 0; i--) {
vreg_info = _snoc->vreg[i];
 
if (!vreg_info->reg)
@@ -1616,7 +1633,13 @@ static int ath10k_hw_power_off(struct ath10k *ar)
 
 static const struct of_device_id ath10k_snoc_dt_match[] = {
{ .compatible = "qcom,wcn3990-wifi",
-.data = _priv,
+.data = _wcn39xx_drv_priv,
+   },
+   { .compatible = "qcom,sdm845-wcn39xx-wifi",
+.data = _wcn39xx_drv_priv,
+   },
+   { .compatible = "qcom,qcs40x-wcn39xx-wifi",
+.data = _wcn39xx_drv_priv,
},
{ }
 };
@@ -1680,8 +1703,9 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
goto err_release_resource;
}
 
-   ar_snoc->vreg = vreg_cfg;
-   for (i = 0; i < ARRAY_SIZE(vreg_cfg); i++) {
+   ar_snoc->vreg = drv_data->vreg_cfg;
+   ar_snoc->vreg_count = drv_data->vreg_count;
+   for (i = 0; i < ar_snoc->vreg_count; i++) {
ret = ath10k_get_vreg_info(ar, dev, _snoc->vreg[i]);
if (ret)
goto err_free_irq;
diff --git a/drivers/net/wireless/ath/ath10k/snoc.h 
b/drivers/net/wireless/ath/ath10k/snoc.h
index d62f53501fbb..0bdada11985c 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.h
+++ b/drivers/net/wireless/ath/ath10k/snoc.h
@@ -10,10 +10,22 @@
 #include "ce.h"
 #include "qmi.h"
 
+struct ath10k_vreg_info {
+   struct regulator *reg;
+   const char *name;
+   u32 min_v;
+   u32 max_v;
+   u32 load_ua;
+   unsigned long settle_delay;
+   bool required;
+};
+
 struct ath10k_snoc_drv_priv {
enum ath10k_hw_rev hw_rev;
u64 dma_mask;
u32 msa_size;
+   struct ath10k_vreg_info *vreg_cfg;
+   u8 vreg_count;
 };
 
 struct snoc_state {
@@ -42,16 +54,6 @@ struct ath10k_snoc_ce_irq {
u32 irq_line;
 };
 
-struct ath10k_vreg_info {
-   struct regulator *reg;
-   const char *name;
-   u32 min_v;
-   u32 max_v;
-   u32 load_ua;
-   

[PATCH 1/3] dt: bindings: update compatible dt properties for WCN3990 wifi node

2019-07-02 Thread Govind Singh
update compatible dt properties for WCN3990 wifi node to be
compatible across different MSM platforms.

Signed-off-by: Govind Singh 
---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index ae661e65354e..baaa3f32ae44 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -5,6 +5,8 @@ Required properties:
* "qcom,ath10k"
* "qcom,ipq4019-wifi"
* "qcom,wcn3990-wifi"
+   * "qcom,sdm845-wcn39xx-wifi"
+   * "qcom,qcs40x-wcn39xx-wifi"
 
 PCI based devices uses compatible string "qcom,ath10k" and takes calibration
 data along with board specific data via "qcom,ath10k-calibration-data".
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH 0/3] Move voltage regulator config to driver private data

2019-07-02 Thread Govind Singh
WCN3990 voltage regulator config is varying b/w different MSM platforms ex: 
SDM845/
QCS404. In order to have scalable config, move regulator config to driver
private data.

Tested HW: WCN3990(SDM845/QCS404)
Tested FW: WLAN.HL.3.1-01040-QCAHLSWMTPLZ-1

Govind Singh (3):
  dt: bindings: update compatible dt properties for WCN3990 wifi node
  ath10k: Move regulator config to driver private data
  arm64: dts: qcom: qcs404: Modify wifi dt node for SDM845/QCS404
devices

 .../bindings/net/wireless/qcom,ath10k.txt |  2 +
 arch/arm64/boot/dts/qcom/qcs404-evb.dtsi  |  3 ++
 arch/arm64/boot/dts/qcom/qcs404.dtsi  |  2 +-
 arch/arm64/boot/dts/qcom/sdm845.dtsi  |  2 +-
 drivers/net/wireless/ath/ath10k/snoc.c| 38 +++
 drivers/net/wireless/ath/ath10k/snoc.h| 23 ++-
 6 files changed, 51 insertions(+), 19 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH 3/3] arm64: dts: qcom: qcs404: Modify wifi dt node for SDM845/QCS404 devices

2019-07-02 Thread Govind Singh
Modify the compatible string of wifi node for SDM845/QCS404 devices.
Add wifi regulators in qcs404 dt node for proxy vote. Proxy votes are
required for handling driver recovery scenarios to prevent
un-clocked register access during driver recovery.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/qcs404-evb.dtsi | 3 +++
 arch/arm64/boot/dts/qcom/qcs404.dtsi | 2 +-
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi 
b/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
index 50b3589c7f15..ff81b9c5b057 100644
--- a/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404-evb.dtsi
@@ -190,6 +190,9 @@
 
  {
status = "okay";
+   vdd-0.8-cx-mx-supply = <_l2_1p275>;
+   vdd-1.8-xo-supply = <_l5_1p8>;
+   vdd-1.3-rfa-supply = <_l1_1p3>;
 };
 
 /* PINCTRL - additions to nodes defined in qcs404.dtsi */
diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi 
b/arch/arm64/boot/dts/qcom/qcs404.dtsi
index e8fd26633d57..d9e2173cd3e9 100644
--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi
+++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi
@@ -480,7 +480,7 @@
};
 
wifi: wifi@a00 {
-   compatible = "qcom,wcn3990-wifi";
+   compatible = "qcom,qcs40x-wcn39xx-wifi";
reg = <0xa00 0x80>;
reg-names = "membase";
memory-region = <_msa_mem>;
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 5308f1671824..fdb5fcd814f4 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -2235,7 +2235,7 @@
};
 
wifi: wifi@1880 {
-   compatible = "qcom,wcn3990-wifi";
+   compatible = "qcom,sdm845-wcn39xx-wifi";
status = "disabled";
reg = <0 0x1880 0 0x80>;
reg-names = "membase";
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project



[PATCH v3] ath10k: Enable MSA region dump support for WCN3990

2019-06-10 Thread Govind Singh
MSA memory region caries the hw descriptors information.
Dump MSA region in core dump as this is very helpful in debugging
hw issues.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 

---
Changes from v2:
- Rebased on top of 38faed150438 ath10k: perform crash dump collection in 
workqueue.
- Removed redundant msa permission call.
---
 drivers/net/wireless/ath/ath10k/coredump.c | 21 +++
 drivers/net/wireless/ath/ath10k/coredump.h |  1 +
 drivers/net/wireless/ath/ath10k/qmi.c  |  4 ++
 drivers/net/wireless/ath/ath10k/snoc.c | 66 ++
 drivers/net/wireless/ath/ath10k/snoc.h |  1 +
 5 files changed, 93 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/coredump.c 
b/drivers/net/wireless/ath/ath10k/coredump.c
index aa04fbf146e0..0ec690b49fb1 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.c
+++ b/drivers/net/wireless/ath/ath10k/coredump.c
@@ -962,6 +962,19 @@ static const struct ath10k_mem_region 
qca4019_hw10_mem_regions[] = {
},
 };
 
+static const struct ath10k_mem_region wcn399x_hw10_mem_regions[] = {
+   {
+   /* MSA region start is not fixed, hence it is assigned at 
runtime */
+   .type = ATH10K_MEM_REGION_TYPE_MSA,
+   .len = 0x10,
+   .name = "DRAM",
+   .section_table = {
+   .sections = NULL,
+   .size = 0,
+   },
+   },
+};
+
 static const struct ath10k_hw_mem_layout hw_mem_layouts[] = {
{
.hw_id = QCA6174_HW_1_0_VERSION,
@@ -1059,6 +1072,14 @@ static const struct ath10k_hw_mem_layout 
hw_mem_layouts[] = {
.size = ARRAY_SIZE(qca4019_hw10_mem_regions),
},
},
+   {
+   .hw_id = WCN3990_HW_1_0_DEV_VERSION,
+   .hw_rev = ATH10K_HW_WCN3990,
+   .region_table = {
+   .regions = wcn399x_hw10_mem_regions,
+   .size = ARRAY_SIZE(wcn399x_hw10_mem_regions),
+   },
+   },
 };
 
 static u32 ath10k_coredump_get_ramdump_size(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/coredump.h 
b/drivers/net/wireless/ath/ath10k/coredump.h
index 5dac653e1649..9802e90483f4 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.h
+++ b/drivers/net/wireless/ath/ath10k/coredump.h
@@ -126,6 +126,7 @@ enum ath10k_mem_region_type {
ATH10K_MEM_REGION_TYPE_IRAM2= 5,
ATH10K_MEM_REGION_TYPE_IOSRAM   = 6,
ATH10K_MEM_REGION_TYPE_IOREG= 7,
+   ATH10K_MEM_REGION_TYPE_MSA  = 8,
 };
 
 /* Define a section of the region which should be copied. As not all parts
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index ba8f5a8f83d1..8eb0f0f0d3a7 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -817,9 +817,13 @@ ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi,
 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)
 {
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
 
ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
+   if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags))
+   ath10k_snoc_fw_crashed_dump(ar);
+
ath10k_snoc_fw_indication(ar, ATH10K_QMI_EVENT_FW_DOWN_IND);
ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service disconnected\n");
 }
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 0be12996beba..ecc0f884b123 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -24,6 +24,7 @@
 #include 
 
 #include "ce.h"
+#include "coredump.h"
 #include "debug.h"
 #include "hif.h"
 #include "htc.h"
@@ -1586,6 +1587,71 @@ static int ath10k_hw_power_off(struct ath10k *ar)
return ret;
 }
 
+static void ath10k_msa_dump_memory(struct ath10k *ar,
+  struct ath10k_fw_crash_data *crash_data)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   const struct ath10k_hw_mem_layout *mem_layout;
+   const struct ath10k_mem_region *current_region;
+   struct ath10k_dump_ram_data_hdr *hdr;
+   size_t buf_len;
+   u8 *buf;
+
+   if (!crash_data && !crash_data->ramdump_buf)
+   return;
+
+   mem_layout = ath10k_coredump_get_mem_layout(ar);
+   if (!mem_layout)
+   return;
+
+   current_region = _layout->region_table.regions[0];
+
+   buf = crash_data->ramdump_buf;
+   buf_len = crash_data->ramdump_buf_len;
+   memset(buf, 0, buf_len);
+
+   /* Reserve space for the header. */
+   hdr = (void *)buf;
+   buf += sizeof(*hdr);
+   buf_len -= sizeof(*hdr);
+
+   hdr

[PATCH v2 1/1] ath10k: Enable MSA region dump support for WCN3990

2019-05-06 Thread Govind Singh
MSA memory region caries the hw descriptors information.
Dump MSA region in core dump as this is very helpful in debugging
hw issues.

Testing: Tested on WCN3990 HW
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/coredump.c | 21 +++
 drivers/net/wireless/ath/ath10k/coredump.h |  1 +
 drivers/net/wireless/ath/ath10k/qmi.c  |  6 ++
 drivers/net/wireless/ath/ath10k/snoc.c | 67 ++
 drivers/net/wireless/ath/ath10k/snoc.h |  1 +
 5 files changed, 96 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/coredump.c 
b/drivers/net/wireless/ath/ath10k/coredump.c
index eadae2f9206b..56d62035c988 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.c
+++ b/drivers/net/wireless/ath/ath10k/coredump.c
@@ -962,6 +962,19 @@ static const struct ath10k_mem_region 
qca4019_hw10_mem_regions[] = {
},
 };
 
+static const struct ath10k_mem_region wcn399x_hw10_mem_regions[] = {
+   {
+   /* MSA region start is not fixed, hence it is assigned at 
runtime */
+   .type = ATH10K_MEM_REGION_TYPE_MSA,
+   .len = 0x10,
+   .name = "DRAM",
+   .section_table = {
+   .sections = NULL,
+   .size = 0,
+   },
+   },
+};
+
 static const struct ath10k_hw_mem_layout hw_mem_layouts[] = {
{
.hw_id = QCA6174_HW_1_0_VERSION,
@@ -1059,6 +1072,14 @@ static const struct ath10k_hw_mem_layout 
hw_mem_layouts[] = {
.size = ARRAY_SIZE(qca4019_hw10_mem_regions),
},
},
+   {
+   .hw_id = WCN3990_HW_1_0_DEV_VERSION,
+   .hw_rev = ATH10K_HW_WCN3990,
+   .region_table = {
+   .regions = wcn399x_hw10_mem_regions,
+   .size = ARRAY_SIZE(wcn399x_hw10_mem_regions),
+   },
+   },
 };
 
 static u32 ath10k_coredump_get_ramdump_size(struct ath10k *ar)
diff --git a/drivers/net/wireless/ath/ath10k/coredump.h 
b/drivers/net/wireless/ath/ath10k/coredump.h
index 5dac653e1649..9802e90483f4 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.h
+++ b/drivers/net/wireless/ath/ath10k/coredump.h
@@ -126,6 +126,7 @@ enum ath10k_mem_region_type {
ATH10K_MEM_REGION_TYPE_IRAM2= 5,
ATH10K_MEM_REGION_TYPE_IOSRAM   = 6,
ATH10K_MEM_REGION_TYPE_IOREG= 7,
+   ATH10K_MEM_REGION_TYPE_MSA  = 8,
 };
 
 /* Define a section of the region which should be copied. As not all parts
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index ba8f5a8f83d1..47da492a326b 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -817,9 +817,15 @@ ath10k_qmi_driver_event_post(struct ath10k_qmi *qmi,
 static void ath10k_qmi_event_server_exit(struct ath10k_qmi *qmi)
 {
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
 
ath10k_qmi_remove_msa_permission(qmi);
ath10k_core_free_board_files(ar);
+   if (!test_bit(ATH10K_SNOC_FLAG_UNREGISTERING, _snoc->flags)) {
+   ath10k_qmi_remove_msa_permission(qmi);
+   ath10k_snoc_fw_crashed_dump(ar);
+   ath10k_qmi_setup_msa_permissions(qmi);
+   }
ath10k_snoc_fw_indication(ar, ATH10K_QMI_EVENT_FW_DOWN_IND);
ath10k_dbg(ar, ATH10K_DBG_QMI, "wifi fw qmi service disconnected\n");
 }
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 0be12996beba..252dd4ee782d 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -24,6 +24,7 @@
 #include 
 
 #include "ce.h"
+#include "coredump.h"
 #include "debug.h"
 #include "hif.h"
 #include "htc.h"
@@ -1586,6 +1587,72 @@ static int ath10k_hw_power_off(struct ath10k *ar)
return ret;
 }
 
+static void ath10k_msa_dump_memory(struct ath10k *ar,
+  struct ath10k_fw_crash_data *crash_data)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   const struct ath10k_hw_mem_layout *mem_layout;
+   const struct ath10k_mem_region *current_region;
+   struct ath10k_dump_ram_data_hdr *hdr;
+   size_t buf_len;
+   u8 *buf;
+
+   lockdep_assert_held(>data_lock);
+
+   if (!crash_data && !crash_data->ramdump_buf)
+   return;
+
+   mem_layout = ath10k_coredump_get_mem_layout(ar);
+   if (!mem_layout)
+   return;
+
+   current_region = _layout->region_table.regions[0];
+
+   buf = crash_data->ramdump_buf;
+   buf_len = crash_data->ramdump_buf_len;
+   memset(buf, 0, buf_len);
+
+   /* Reserve space for the header. */
+   hdr = (void *)buf;
+   buf += sizeof(*hdr);
+   buf_len 

[PATCH] ath10k: Add WMI diag fw logging support for WCN3990

2019-04-01 Thread Govind Singh
Integrated WiFi chipset ex:WCN399x supports fw logging
using WMI copy engine and shared mem DIAG based fw logging.
By default shared mem DIAG based fw logging is enabled.
To support WMI copy engine based fw logging add QMI
control message to enable WMI copy engine based fw logging.

Enable WMI based fw logging using fw_diag_log module parameter.

insmod ath10k_core.ko fw_diag_log=1

DIAG utility(https://github.com/andersson/diag) implements extraction
of diagnostics related messages between application processor and
various subsystems while shared mem DIAG based fw logging is enabled.

Testing: Tested on WCN3990/QCA6174 HW
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c |  9 ++
 drivers/net/wireless/ath/ath10k/core.h |  1 +
 drivers/net/wireless/ath/ath10k/hif.h  | 15 +
 drivers/net/wireless/ath/ath10k/qmi.c  | 45 ++
 drivers/net/wireless/ath/ath10k/qmi.h  |  1 +
 drivers/net/wireless/ath/ath10k/snoc.c | 14 
 6 files changed, 85 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 399b501f3c3c..ebf6071bfe15 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -41,6 +41,7 @@ static unsigned int ath10k_cryptmode_param;
 static bool uart_print;
 static bool skip_otp;
 static bool rawmode;
+static bool fw_diag_log;
 
 unsigned long ath10k_coredump_mask = BIT(ATH10K_FW_CRASH_DUMP_REGISTERS) |
 BIT(ATH10K_FW_CRASH_DUMP_CE_DATA);
@@ -51,6 +52,7 @@ module_param_named(cryptmode, ath10k_cryptmode_param, uint, 
0644);
 module_param(uart_print, bool, 0644);
 module_param(skip_otp, bool, 0644);
 module_param(rawmode, bool, 0644);
+module_param(fw_diag_log, bool, 0644);
 module_param_named(coredump_mask, ath10k_coredump_mask, ulong, 0444);
 
 MODULE_PARM_DESC(debug_mask, "Debugging mask");
@@ -59,6 +61,7 @@ MODULE_PARM_DESC(skip_otp, "Skip otp failure for calibration 
in testmode");
 MODULE_PARM_DESC(cryptmode, "Crypto mode: 0-hardware, 1-software");
 MODULE_PARM_DESC(rawmode, "Use raw 802.11 frame datapath");
 MODULE_PARM_DESC(coredump_mask, "Bitfield of what to include in firmware crash 
file");
+MODULE_PARM_DESC(fw_diag_log, "Diag based fw log debugging");
 
 static const struct ath10k_hw_params ath10k_hw_params_list[] = {
{
@@ -2698,6 +2701,12 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
if (status)
goto err_hif_stop;
 
+   status = ath10k_hif_set_target_log_mode(ar, fw_diag_log);
+   if (status && status != -EOPNOTSUPP) {
+   ath10k_warn(ar, "set traget log mode faileds: %d\n", status);
+   goto err_hif_stop;
+   }
+
return 0;
 
 err_hif_stop:
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 46e9c8c97a4d..bfd2b3e23f54 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -635,6 +635,7 @@ struct ath10k_debug {
u32 nf_cal_period;
void *cal_data;
u32 enable_extd_tx_stats;
+   u8 fw_dbglog_mode;
 };
 
 enum ath10k_state {
diff --git a/drivers/net/wireless/ath/ath10k/hif.h 
b/drivers/net/wireless/ath/ath10k/hif.h
index 1a59ea0068c2..ee825a78480d 100644
--- a/drivers/net/wireless/ath/ath10k/hif.h
+++ b/drivers/net/wireless/ath/ath10k/hif.h
@@ -23,6 +23,12 @@
 #include "bmi.h"
 #include "debug.h"
 
+/* Types of fw logging mode */
+enum ath_dbg_mode {
+   ATH10K_ENABLE_FW_LOG_DIAG,
+   ATH10K_ENABLE_FW_LOG_CE,
+};
+
 struct ath10k_hif_sg_item {
u16 transfer_id;
void *transfer_context; /* NULL = tx completion callback not called */
@@ -97,6 +103,7 @@ struct ath10k_hif_ops {
 
int (*get_target_info)(struct ath10k *ar,
   struct bmi_target_info *target_info);
+   int (*set_target_log_mode)(struct ath10k *ar, u8 fw_log_mode);
 };
 
 static inline int ath10k_hif_tx_sg(struct ath10k *ar, u8 pipe_id,
@@ -231,4 +238,12 @@ static inline int ath10k_hif_get_target_info(struct ath10k 
*ar,
return ar->hif.ops->get_target_info(ar, tgt_info);
 }
 
+static inline int ath10k_hif_set_target_log_mode(struct ath10k *ar,
+u8 fw_log_mode)
+{
+   if (!ar->hif.ops->set_target_log_mode)
+   return -EOPNOTSUPP;
+
+   return ar->hif.ops->set_target_log_mode(ar, fw_log_mode);
+}
 #endif /* _HIF_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 99c140a6628d..ba8f5a8f83d1 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -636,6 +636,51 @@ static int ath10k_qmi_host_cap_send_sync(struct ath10k_qmi 
*qmi)
return

[PATCH v3 1/2] dt: bindings: add dt entry for XO calibration support

2019-04-01 Thread Govind Singh
Add dt binding to get xo calibration data support for wifi rf clock.

Signed-off-by: Govind Singh 
---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index ae661e65354e..81859507db67 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -81,6 +81,7 @@ Optional properties:
Definition: Name of external front end module used. Some valid FEM names
for example: "microsemi-lx5586", "sky85703-11"
and "sky85803" etc.
+- qcom,xo-cal-data: xo cal offset to be configured in xo trim register.
 
 Example (to supply PCI based wifi block details):
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 2/2] ath10k: Add xo calibration support for wifi rf clock

2019-04-01 Thread Govind Singh
PMIC XO is the clock source for wifi rf clock in integrated wifi
chipset ex: WCN3990. Due to board layout errors XO frequency drifts
can cause wifi rf clock inaccuracy.
XO calibration test tree in Factory Test Mode is used to find the
best frequency offset(for example +/-2KHz )by programming XO trim
register. This ensure system clock stays within required 20 ppm
WLAN rf clock.

Retrieve the xo trim offset via system firmware (e.g., device tree),
especially in the case where the device doesn't have a useful EEPROM
on which to store the calibrated XO offset (e.g., for integrated Wifi).
Calibrated XO offset is sent to fw, which compensate the clock drift
by programing the XO trim register.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c  | 12 
 drivers/net/wireless/ath/ath10k/snoc.c | 11 +++
 drivers/net/wireless/ath/ath10k/snoc.h |  2 ++
 3 files changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 37b3bd629f48..99c140a6628d 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -302,10 +302,16 @@ static int ath10k_qmi_send_cal_report_req(struct 
ath10k_qmi *qmi)
struct wlfw_cal_report_resp_msg_v01 resp = {};
struct wlfw_cal_report_req_msg_v01 req = {};
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct qmi_txn txn;
int i, j = 0;
int ret;
 
+   if (ar_snoc->xo_cal_supported) {
+   req.xo_cal_data_valid = 1;
+   req.xo_cal_data = ar_snoc->xo_cal_data;
+   }
+
ret = qmi_txn_init(>qmi_hdl, , wlfw_cal_report_resp_msg_v01_ei,
   );
if (ret < 0)
@@ -636,6 +642,7 @@ ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi 
*qmi)
struct wlfw_ind_register_resp_msg_v01 resp = {};
struct wlfw_ind_register_req_msg_v01 req = {};
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct qmi_txn txn;
int ret;
 
@@ -646,6 +653,11 @@ ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi 
*qmi)
req.msa_ready_enable_valid = 1;
req.msa_ready_enable = 1;
 
+   if (ar_snoc->xo_cal_supported) {
+   req.xo_cal_enable_valid = 1;
+   req.xo_cal_enable = 1;
+   }
+
ret = qmi_txn_init(>qmi_hdl, ,
   wlfw_ind_register_resp_msg_v01_ei, );
if (ret < 0)
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 54efe6be8f1d..a7f837f4dc53 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "ce.h"
@@ -1189,6 +1190,16 @@ static int ath10k_snoc_resource_init(struct ath10k *ar)
ar_snoc->ce_irqs[i].irq_line = res->start;
}
 
+   ret = device_property_read_u32(>dev, "qcom,xo-cal-data",
+  _snoc->xo_cal_data);
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc xo-cal-data return %d\n", ret);
+   if (ret == 0) {
+   ar_snoc->xo_cal_supported = true;
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "xo cal data %x\n",
+  ar_snoc->xo_cal_data);
+   }
+   ret = 0;
+
 out:
return ret;
 }
diff --git a/drivers/net/wireless/ath/ath10k/snoc.h 
b/drivers/net/wireless/ath/ath10k/snoc.h
index 2b2f23cf7c5d..25383de8f17d 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.h
+++ b/drivers/net/wireless/ath/ath10k/snoc.h
@@ -91,6 +91,8 @@ struct ath10k_snoc {
struct ath10k_clk_info *clk;
struct ath10k_qmi *qmi;
unsigned long int flags;
+   bool xo_cal_supported;
+   u32 xo_cal_data;
 };
 
 static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 0/2] Add xo calibration support for wifi rf clock

2019-04-01 Thread Govind Singh
PMIC XO is the clock source for wifi rf clock in integrated wifi
chipset ex: WCN3990. Due to board layout errors XO frequency drifts
can cause wifi rf clock inaccuracy.
XO calibration test tree in Factory Test Mode is used to find the
best frequency offset(for example +/-2KHz )by programming XO trim
register. This ensure system clock stays within required 20 ppm
WLAN rf clock.

Retrieve the xo trim offset via system firmware (e.g., device tree),
especially in the case where the device doesn't have a useful EEPROM
on which to store the calibrated XO offset (e.g., for integrated Wifi).
Calibrated XO offset is sent to fw, which compensate the clock drift
by programing the XO trim register.

Testing:
Tested on QCS404 platform(WCN3990 HW)
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

change since v2:
   Added "qcom," prefix in xo cal prop.

change since v1:
Added return check for case where xo cal dt is not populated.


Govind Singh (2):
  dt: bindings: add dt entry for XO calibration support
  ath10k: Add xo calibration support for wifi rf clock

 .../devicetree/bindings/net/wireless/qcom,ath10k.txt |  1 +
 drivers/net/wireless/ath/ath10k/qmi.c| 12 
 drivers/net/wireless/ath/ath10k/snoc.c   | 11 +++
 drivers/net/wireless/ath/ath10k/snoc.h   |  2 ++
 4 files changed, 26 insertions(+)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v2 0/2] Add xo calibration support for wifi rf clock

2019-03-20 Thread Govind Singh

Hi Sven,

On 2019-03-20 14:07, Sven Eckelmann wrote:

On Wednesday, 20 March 2019 05:45:09 CET Govind Singh wrote:

PMIC XO is the clock source for wifi rf clock in integrated wifi
chipset ex: WCN3990. Due to board layout errors XO frequency drifts
can cause wifi rf clock inaccuracy.
XO calibration test tree in Factory Test Mode is used to find the
best frequency offset(for example +/-2KHz )by programming XO trim
register. This ensure system clock stays within required 20 ppm
WLAN rf clock.

Retrieve the xo trim offset via system firmware (e.g., device tree),
especially in the case where the device doesn't have a useful EEPROM
on which to store the calibrated XO offset (e.g., for integrated 
Wifi).

Calibrated XO offset is sent to fw, which compensate the clock drift
by programing the XO trim register.


Who is responsible to fill in this values in the device-tree?


This is populated via boot-loader/system fw(for chrome-OS its coreboot).
Post calibration QDART writes to non-volatile/persist region and
during boot up boot loader fills this value in dt node as there is
no otp region or EPROM available.


On other
products, the correct XTAL capacitor registers values are calibrated on
different devices (in the same product line) separately to ensure that 
each
device has a minimal inaccuracy. During the boot of the device, the two 
u8
taken from params_for_tuning_caps (inside the EEPROM) are just written 
to the
AR_CH0_XTAL register (mapped to the correct the INDAC and OUTDAC 
region).


Your patch here seems to be doing something similar (you may correct me 
if I
misinterpret something) but you are already saying that these devices 
don't
have an EEPROM. This is already quite odd because then we also wouldn't 
have
temperature compensation (also stored in per device EEPROM/precal data 
for

other devices).

So you move it to the device tree. By default, this device tree is most 
likely
a static thing which is shipped with the rest of the firmware. So no 
per
device data is stored in this DTB on the flash. To include device 
specific
information (mac addresses, calibration data, ...), you could also have 
the
bootloader (u-boot for example) change the device tree during the boot 
process

and let it inject the device specific XO trim register data.

How is this planned to work? Is the bootloader expected to modify the 
device
tree during the boot to provide the device specific xo-cal-data. If 
yes, where
is it getting the information from? And is there already support for 
QDART for

it?

Per device data will be stored in NOR flash by QDART and dt entry will 
be populated during boot by bootloader.
Here we are trying to set the xo trim register of PMIC xtal, which is 
the base clk source of wifi rf clk.



If you do this, why aren't you using the data from qcom,ath10k-pre-
calibration-data. At least for other ath10k devices, it includes the
previously mentioned tuning caps. It is the first time I heard about an 
XO
trim register and thus it might be something different than what I 
expect.


No, Integrated chip set ex:WCN3990 does not use 
ath10k-pre-calibration-data.




Last question: why is it an u32 when the message with xo_cal_data can 
only

transport an u8?



Yes, this i will fix in next version.


Kind regards,
Sven


BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 1/2] dt: bindings: add dt entry for XO calibration support

2019-03-19 Thread Govind Singh
Add dt binding to get xo calibration data support for wifi rf clock.

Signed-off-by: Govind Singh 
---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index ae661e65354e..ab8042866e83 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -81,6 +81,7 @@ Optional properties:
Definition: Name of external front end module used. Some valid FEM names
for example: "microsemi-lx5586", "sky85703-11"
and "sky85803" etc.
+- xo-cal-data: xo cal offset to be configured in xo trim register.
 
 Example (to supply PCI based wifi block details):
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 2/2] ath10k: Add xo calibration support for wifi rf clock

2019-03-19 Thread Govind Singh
PMIC XO is the clock source for wifi rf clock in integrated wifi
chipset ex: WCN3990. Due to board layout errors XO frequency drifts
can cause wifi rf clock inaccuracy.
XO calibration test tree in Factory Test Mode is used to find the
best frequency offset(for example +/-2KHz )by programming XO trim
register. This ensure system clock stays within required 20 ppm
WLAN rf clock.

Retrieve the xo trim offset via system firmware (e.g., device tree),
especially in the case where the device doesn't have a useful EEPROM
on which to store the calibrated XO offset (e.g., for integrated Wifi).
Calibrated XO offset is sent to fw, which compensate the clock drift
by programing the XO trim register.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c  | 12 
 drivers/net/wireless/ath/ath10k/snoc.c | 11 +++
 drivers/net/wireless/ath/ath10k/snoc.h |  2 ++
 3 files changed, 25 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 37b3bd629f48..99c140a6628d 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -302,10 +302,16 @@ static int ath10k_qmi_send_cal_report_req(struct 
ath10k_qmi *qmi)
struct wlfw_cal_report_resp_msg_v01 resp = {};
struct wlfw_cal_report_req_msg_v01 req = {};
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct qmi_txn txn;
int i, j = 0;
int ret;
 
+   if (ar_snoc->xo_cal_supported) {
+   req.xo_cal_data_valid = 1;
+   req.xo_cal_data = ar_snoc->xo_cal_data;
+   }
+
ret = qmi_txn_init(>qmi_hdl, , wlfw_cal_report_resp_msg_v01_ei,
   );
if (ret < 0)
@@ -636,6 +642,7 @@ ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi 
*qmi)
struct wlfw_ind_register_resp_msg_v01 resp = {};
struct wlfw_ind_register_req_msg_v01 req = {};
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct qmi_txn txn;
int ret;
 
@@ -646,6 +653,11 @@ ath10k_qmi_ind_register_send_sync_msg(struct ath10k_qmi 
*qmi)
req.msa_ready_enable_valid = 1;
req.msa_ready_enable = 1;
 
+   if (ar_snoc->xo_cal_supported) {
+   req.xo_cal_enable_valid = 1;
+   req.xo_cal_enable = 1;
+   }
+
ret = qmi_txn_init(>qmi_hdl, ,
   wlfw_ind_register_resp_msg_v01_ei, );
if (ret < 0)
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 54efe6be8f1d..7cfd17beb7b0 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -20,6 +20,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include "ce.h"
@@ -1189,6 +1190,16 @@ static int ath10k_snoc_resource_init(struct ath10k *ar)
ar_snoc->ce_irqs[i].irq_line = res->start;
}
 
+   ret = device_property_read_u32(>dev, "xo-cal-data",
+  _snoc->xo_cal_data);
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc xo-cal-data return %d\n", ret);
+   if (ret == 0) {
+   ar_snoc->xo_cal_supported = true;
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "xo cal data %x\n",
+  ar_snoc->xo_cal_data);
+   }
+   ret = 0;
+
 out:
return ret;
 }
diff --git a/drivers/net/wireless/ath/ath10k/snoc.h 
b/drivers/net/wireless/ath/ath10k/snoc.h
index 2b2f23cf7c5d..25383de8f17d 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.h
+++ b/drivers/net/wireless/ath/ath10k/snoc.h
@@ -91,6 +91,8 @@ struct ath10k_snoc {
struct ath10k_clk_info *clk;
struct ath10k_qmi *qmi;
unsigned long int flags;
+   bool xo_cal_supported;
+   u32 xo_cal_data;
 };
 
 static inline struct ath10k_snoc *ath10k_snoc_priv(struct ath10k *ar)
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 0/2] Add xo calibration support for wifi rf clock

2019-03-19 Thread Govind Singh
PMIC XO is the clock source for wifi rf clock in integrated wifi
chipset ex: WCN3990. Due to board layout errors XO frequency drifts
can cause wifi rf clock inaccuracy.
XO calibration test tree in Factory Test Mode is used to find the
best frequency offset(for example +/-2KHz )by programming XO trim
register. This ensure system clock stays within required 20 ppm
WLAN rf clock.

Retrieve the xo trim offset via system firmware (e.g., device tree),
especially in the case where the device doesn't have a useful EEPROM
on which to store the calibrated XO offset (e.g., for integrated Wifi).
Calibrated XO offset is sent to fw, which compensate the clock drift
by programing the XO trim register.

Testing:
Tested on QCS404 platform(WCN3990 HW)
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

change since v1:
Added return check for case where xo cal dt is not populated.

Govind Singh (2):
  dt: bindings: add dt entry for XO calibration support
  ath10k: Add xo calibration support for wifi rf clock

 .../devicetree/bindings/net/wireless/qcom,ath10k.txt |  1 +
 drivers/net/wireless/ath/ath10k/qmi.c| 12 
 drivers/net/wireless/ath/ath10k/snoc.c   | 11 +++
 drivers/net/wireless/ath/ath10k/snoc.h   |  2 ++
 4 files changed, 26 insertions(+)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 0/2] Add xo calibration support for wifi rf clock

2019-03-01 Thread Govind Singh
PMIC XO is the clock source for wifi rf clock in integrated wifi
chipset ex: WCN3990. Due to board layout errors XO frequency drifts
can cause wifi rf clock inaccuracy.
XO calibration test tree in Factory Test Mode is used to find the
best frequency offset(for example +/-2KHz )by programming XO trim
register. This ensure system clock stays within required 20 ppm
WLAN rf clock.

Retrieve the xo trim offset via system firmware (e.g., device tree),
especially in the case where the device doesn't have a useful EEPROM
on which to store the calibrated XO offset (e.g., for integrated Wifi).
Calibrated XO offset is sent to fw, which compensate the clock drift
by programing the XO trim register.

Testing:
Tested on QCS404 platform(WCN3990 HW)
Tested FW: WLAN.HL.3.1-00959-QCAHLSWMTPLZ-1

Govind Singh (2):
  dt: bindings: add dt entry for XO calibration support
  ath10k: Add xo calibration support for wifi rf clock

 .../devicetree/bindings/net/wireless/qcom,ath10k.txt |  1 +
 drivers/net/wireless/ath/ath10k/qmi.c| 12 
 drivers/net/wireless/ath/ath10k/snoc.c   | 10 ++
 drivers/net/wireless/ath/ath10k/snoc.h   |  2 ++
 4 files changed, 25 insertions(+)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/2] dt: bindings: add dt entry for XO calibration support

2019-03-01 Thread Govind Singh
Add dt binding to get xo calibration data support for wifi rf clock.

Signed-off-by: Govind Singh 
---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index ae661e65354e..ab8042866e83 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -81,6 +81,7 @@ Optional properties:
Definition: Name of external front end module used. Some valid FEM names
for example: "microsemi-lx5586", "sky85703-11"
and "sky85803" etc.
+- xo-cal-data: xo cal offset to be configured in xo trim register.
 
 Example (to supply PCI based wifi block details):
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: Modify CE4 src buffer entries to 2048 for WCN3990

2019-03-01 Thread Govind Singh
CE4 is host to target HTT tx pipe, tx completion are not served
on time when CPU is loaded and this cause ce src ring full condition
due to less no of src buffer entries.

To mitigate the issue increase CE4 src buffer entries to 2048.

Testing:
Tested on QCS404 platform(WCN3990 HW)
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 7fa0f5c1d070..f0ea3c494fe6 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -176,7 +176,7 @@ static struct ce_attr host_ce_config_wlan[] = {
/* CE4: host->target HTT */
{
.flags = CE_ATTR_FLAGS | CE_ATTR_DIS_INTR,
-   .src_nentries = 256,
+   .src_nentries = 2048,
.src_sz_max = 256,
.dest_nentries = 0,
.send_cb = ath10k_snoc_htt_tx_cb,
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: Move board id and fw version logging to info level

2019-03-01 Thread Govind Singh
Board id and fw version is not printed by default in qmi
cap response message. Move board id and fw version logging
to info level for default logging.

[   34.005399] ath10k_snoc a00.wifi: qmi chip_id 0x30b chip_family 0x4001 
board_id 0xff soc_id 0x4007
[   34.005432] ath10k_snoc a00.wifi: qmi fw_version 0x3106836b 
fw_build_timestamp 2019-02-13 10:24 fw_build_id 
QC_IMAGE_VERSION_STRING=WLAN.HL.3.1-00875-QCAHLSWMTPL-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/qmi.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
index 54f783ceb147..2b086fa16040 100644
--- a/drivers/net/wireless/ath/ath10k/qmi.c
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -523,6 +523,7 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi 
*qmi)
struct wlfw_cap_resp_msg_v01 *resp;
struct wlfw_cap_req_msg_v01 req = {};
struct ath10k *ar = qmi->ar;
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
struct qmi_txn txn;
int ret;
 
@@ -577,13 +578,13 @@ static int ath10k_qmi_cap_send_sync_msg(struct ath10k_qmi 
*qmi)
strlcpy(qmi->fw_build_id, resp->fw_build_id,
MAX_BUILD_ID_LEN + 1);
 
-   ath10k_dbg(ar, ATH10K_DBG_QMI,
-  "qmi chip_id 0x%x chip_family 0x%x board_id 0x%x soc_id 
0x%x",
-  qmi->chip_info.chip_id, qmi->chip_info.chip_family,
-  qmi->board_info.board_id, qmi->soc_info.soc_id);
-   ath10k_dbg(ar, ATH10K_DBG_QMI,
-  "qmi fw_version 0x%x fw_build_timestamp %s fw_build_id %s",
-  qmi->fw_version, qmi->fw_build_timestamp, qmi->fw_build_id);
+   if (!test_bit(ATH10K_SNOC_FLAG_REGISTERED, _snoc->flags)) {
+   ath10k_info(ar, "qmi chip_id 0x%x chip_family 0x%x board_id 
0x%x soc_id 0x%x",
+   qmi->chip_info.chip_id, qmi->chip_info.chip_family,
+   qmi->board_info.board_id, qmi->soc_info.soc_id);
+   ath10k_info(ar, "qmi fw_version 0x%x fw_build_timestamp %s 
fw_build_id %s",
+   qmi->fw_version, qmi->fw_build_timestamp, 
qmi->fw_build_id);
+   }
 
kfree(resp);
return 0;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 3/3] ath10k: Request credit report if flow control enabled on ep

2019-02-06 Thread Govind Singh
FW credit flow control is enabled for only WMI ctrl
service(CE3) but credit update is requested unconditionally
on all HTC services as part of HTC tx in CE3/CE0/CE4.

This is causing WOW failure as FW is not expecting credit
report request on other end-points(CE0/CE4).

Request credit report only on those endpoints where
credit flow control is enabled.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/htc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 7654a21323ce..5aa57a01c033 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -88,7 +88,8 @@ static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep 
*ep,
hdr->eid = ep->eid;
hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr));
hdr->flags = 0;
-   hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
+   if (ep->tx_credit_flow_enabled)
+   hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
 
spin_lock_bh(>htc->tx_lock);
hdr->seq_no = ep->seq_no++;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 0/3] Add support for suspend/resume and WOW for WCN3990 chipset

2019-02-06 Thread Govind Singh
This series adds support for driver suspend/resume and wake over wlan support
for WCN3990 chipset. CE2 is configured as wakeup source before driver suspend
and FW can wake up application processor on Magic packet/Deauth/AP lost.

Changes since v2:
  * Removed BUS TYPE check and introduced bus param at struct ath10k level
for scalability.

Changes since v1:
  * dropped ath10k: configure the vdev listen interval before wow suspend patch
from the series. This can be send later after refactoring/tuning.
  * updated commit text in ath10k: Disable interface pause wow config for
integrated chipset patch.


Govind Singh (3):
  ath10k: Enable bus layer suspend/resume for WCN3990
  ath10k: Disable interface pause wow config for integrated chipset
  ath10k: Request credit report if flow control enabled on ep

 drivers/net/wireless/ath/ath10k/core.c |  5 ++-
 drivers/net/wireless/ath/ath10k/core.h |  2 +
 drivers/net/wireless/ath/ath10k/coredump.c |  2 +-
 drivers/net/wireless/ath/ath10k/debug.c|  4 +-
 drivers/net/wireless/ath/ath10k/htc.c  |  9 +++--
 drivers/net/wireless/ath/ath10k/htt_rx.c   | 10 ++---
 drivers/net/wireless/ath/ath10k/htt_tx.c   |  6 +--
 drivers/net/wireless/ath/ath10k/pci.c  |  3 +-
 drivers/net/wireless/ath/ath10k/snoc.c | 45 ++
 drivers/net/wireless/ath/ath10k/txrx.c |  2 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c  |  2 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h  |  7 
 12 files changed, 78 insertions(+), 19 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 2/3] ath10k: Disable interface pause wow config for integrated chipset

2019-02-06 Thread Govind Singh
wow pause iface config controls the PCI D0/D3-WOW cases for pcie
bus state. Firmware does not expects WOW_IFACE_PAUSE_ENABLED config
for bus/link that cannot be suspended ex:snoc and does not trigger
common subsystem shutdown.
Disable interface pause wow config for integrated chipset(WCN3990)
for correct WOW configuration in the firmware.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c |  5 +++--
 drivers/net/wireless/ath/ath10k/core.h |  2 ++
 drivers/net/wireless/ath/ath10k/coredump.c |  2 +-
 drivers/net/wireless/ath/ath10k/debug.c|  4 ++--
 drivers/net/wireless/ath/ath10k/htc.c  |  6 +++---
 drivers/net/wireless/ath/ath10k/htt_rx.c   | 10 +-
 drivers/net/wireless/ath/ath10k/htt_tx.c   |  6 +++---
 drivers/net/wireless/ath/ath10k/pci.c  |  3 ++-
 drivers/net/wireless/ath/ath10k/txrx.c |  2 +-
 drivers/net/wireless/ath/ath10k/wmi-tlv.c  |  2 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h  |  7 +++
 11 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 2bdb632b7b1a..01ad53f3c569 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2955,8 +2955,9 @@ static void ath10k_core_register_work(struct work_struct 
*work)
 int ath10k_core_register(struct ath10k *ar,
 const struct ath10k_bus_params *bus_params)
 {
-   ar->chip_id = bus_params->chip_id;
-   ar->dev_type = bus_params->dev_type;
+   ar->bus_param.chip_id = bus_params->chip_id;
+   ar->bus_param.dev_type = bus_params->dev_type;
+   ar->bus_param.link_can_suspend = bus_params->link_can_suspend;
queue_work(ar->workqueue, >register_work);
 
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index d14a4f928218..2f43326decf6 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -921,6 +921,7 @@ enum ath10k_dev_type {
 struct ath10k_bus_params {
u32 chip_id;
enum ath10k_dev_type dev_type;
+   bool link_can_suspend;
 };
 
 struct ath10k {
@@ -1189,6 +1190,7 @@ struct ath10k {
enum ath10k_radar_confirmation_state radar_conf_state;
struct ath10k_radar_found_info last_radar_info;
struct work_struct radar_confirmation_work;
+   struct ath10k_bus_params bus_param;
 
/* must be last */
u8 drv_priv[0] __aligned(sizeof(void *));
diff --git a/drivers/net/wireless/ath/ath10k/coredump.c 
b/drivers/net/wireless/ath/ath10k/coredump.c
index eadae2f9206b..bf84e999466f 100644
--- a/drivers/net/wireless/ath/ath10k/coredump.c
+++ b/drivers/net/wireless/ath/ath10k/coredump.c
@@ -1167,7 +1167,7 @@ static struct ath10k_dump_file_data 
*ath10k_coredump_build(struct ath10k *ar)
dump_data->version = cpu_to_le32(ATH10K_FW_CRASH_DUMP_VERSION);
 
guid_copy(_data->guid, _data->guid);
-   dump_data->chip_id = cpu_to_le32(ar->chip_id);
+   dump_data->chip_id = cpu_to_le32(ar->bus_param.chip_id);
dump_data->bus_type = cpu_to_le32(0);
dump_data->target_version = cpu_to_le32(ar->target_version);
dump_data->fw_version_major = cpu_to_le32(ar->fw_version_major);
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 02988fc378a1..9f2534d6b56f 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -58,7 +58,7 @@ void ath10k_debug_print_hwfw_info(struct ath10k *ar)
ath10k_info(ar, "%s target 0x%08x chip_id 0x%08x sub %04x:%04x",
ar->hw_params.name,
ar->target_version,
-   ar->chip_id,
+   ar->bus_param.chip_id,
ar->id.subsystem_vendor, ar->id.subsystem_device);
 
ath10k_info(ar, "kconfig debug %d debugfs %d tracing %d dfs %d testmode 
%d\n",
@@ -625,7 +625,7 @@ static ssize_t ath10k_read_chip_id(struct file *file, char 
__user *user_buf,
size_t len;
char buf[50];
 
-   len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->chip_id);
+   len = scnprintf(buf, sizeof(buf), "0x%08x\n", ar->bus_param.chip_id);
 
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 28daed5981a1..7654a21323ce 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -53,7 +53,7 @@ static inline void ath10k_htc_restore_tx_skb(struct 
ath10k_htc *htc,
 {
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb);
 
-   if (htc->ar->dev_type != ATH10K

[PATCH v3 1/3] ath10k: Enable bus layer suspend/resume for WCN3990

2019-02-06 Thread Govind Singh
Register snoc bus layer suspend/resume PM ops and configure
the wakeup source(CE2) for the device.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 45 ++
 1 file changed, 45 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index dad7e1ce79c0..60e0f46cfdd9 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -30,6 +30,7 @@
 
 #define ATH10K_SNOC_RX_POST_RETRY_MS 50
 #define CE_POLL_PIPE 4
+#define ATH10K_SNOC_WAKE_IRQ 2
 
 static char *const ce_name[] = {
"WLAN_CE_0",
@@ -1041,6 +1042,46 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar)
return ret;
 }
 
+#ifdef CONFIG_PM
+static int ath10k_snoc_hif_suspend(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   int ret;
+
+   if (!device_may_wakeup(ar->dev))
+   return -EPERM;
+
+   ret = enable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+   if (ret) {
+   ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret);
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n");
+
+   return ret;
+}
+
+static int ath10k_snoc_hif_resume(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   int ret;
+
+   if (!device_may_wakeup(ar->dev))
+   return -EPERM;
+
+   ret = disable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+   if (ret) {
+   ath10k_err(ar, "failed to disable wakeup irq: %d\n", ret);
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n");
+
+   return ret;
+}
+#endif
+
 static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
.read32 = ath10k_snoc_read32,
.write32= ath10k_snoc_write32,
@@ -1054,6 +1095,10 @@ static const struct ath10k_hif_ops ath10k_snoc_hif_ops = 
{
.send_complete_check= ath10k_snoc_hif_send_complete_check,
.get_free_queue_number  = ath10k_snoc_hif_get_free_queue_number,
.get_target_info= ath10k_snoc_hif_get_target_info,
+#ifdef CONFIG_PM
+   .suspend= ath10k_snoc_hif_suspend,
+   .resume = ath10k_snoc_hif_resume,
+#endif
 };
 
 static const struct ath10k_bus_ops ath10k_snoc_bus_ops = {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 1/1] ath10k: update HOST capability qmi message

2019-02-04 Thread Govind Singh
HOST capability interface data structures are updated
in HL3.1 fw version. Update the qmi host capability
members for compatibility across different firmware
versions.
Since this change breaks backward compatibility with
HL2.0 fw, HL2.0 fw upgrade to WLAN.HL.2.0-01617-QCAHLSWMTPLZ-1
or later version is required.

Testing:
Tested on QCS404 platform(WCN3990 HW).
Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1,
   WLAN.HL.2.0-01617-QCAHLSWMTPLZ-1
---
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.c| 229 +-
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.h|  34 ++-
 2 files changed, 257 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c 
b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
index ba79c2e4aed6..4102f7b0b5c3 100644
--- a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
@@ -1763,14 +1763,239 @@ struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[] = {
   daemon_support_valid),
},
{
-   .data_type  = QMI_UNSIGNED_1_BYTE,
+   .data_type  = QMI_UNSIGNED_4_BYTE,
.elem_len   = 1,
-   .elem_size  = sizeof(u8),
+   .elem_size  = sizeof(u32),
.array_type = NO_ARRAY,
.tlv_type   = 0x10,
.offset = offsetof(struct wlfw_host_cap_req_msg_v01,
   daemon_support),
},
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x11,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  wake_msi_valid),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x11,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  wake_msi),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x12,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  gpios_valid),
+   },
+   {
+   .data_type  = QMI_DATA_LEN,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x12,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  gpios_len),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = QMI_WLFW_MAX_NUM_GPIO_V01,
+   .elem_size  = sizeof(u32),
+   .array_type = VAR_LEN_ARRAY,
+   .tlv_type   = 0x12,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  gpios),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x13,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  nm_modem_valid),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_1_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x13,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  nm_modem),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x14,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  bdf_support_valid),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_1_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x14,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  bdf_support),
+   },
+   {
+   .data_type  = 

[PATCH] ath10k: Add support for extended HTT aggr msg support

2019-01-16 Thread Govind Singh
HTT aggr message parameter in HL2.0 fw are different in comparison
to legacy fw version. Fill correct HTT aggr msg parameter for
targets using HL2.0 firmware.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/htt.c|  2 +-
 drivers/net/wireless/ath/ath10k/htt.h| 11 ++
 drivers/net/wireless/ath/ath10k/htt_tx.c | 49 
 3 files changed, 61 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt.c 
b/drivers/net/wireless/ath/ath10k/htt.c
index 21a67f82f037..55c716499830 100644
--- a/drivers/net/wireless/ath/ath10k/htt.c
+++ b/drivers/net/wireless/ath/ath10k/htt.c
@@ -268,7 +268,7 @@ int ath10k_htt_setup(struct ath10k_htt *htt)
return status;
}
 
-   status = ath10k_htt_h2t_aggr_cfg_msg(htt,
+   status = htt->tx_ops->htt_h2t_aggr_cfg_msg(htt,
 htt->max_num_ampdu,
 htt->max_num_amsdu);
if (status) {
diff --git a/drivers/net/wireless/ath/ath10k/htt.h 
b/drivers/net/wireless/ath/ath10k/htt.h
index a76f7c9e2199..f5fa86f6efad 100644
--- a/drivers/net/wireless/ath/ath10k/htt.h
+++ b/drivers/net/wireless/ath/ath10k/htt.h
@@ -357,6 +357,13 @@ struct htt_aggr_conf {
u8 max_num_amsdu_subframes;
 } __packed;
 
+struct htt_aggr_conf_v2 {
+   u8 max_num_ampdu_subframes;
+   /* amsdu_subframes is limited by 0x1F mask */
+   u8 max_num_amsdu_subframes;
+   u8 reserved;
+} __packed;
+
 #define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32
 struct htt_mgmt_tx_desc_qca99x0 {
__le32 rate;
@@ -1650,6 +1657,7 @@ struct htt_cmd {
struct htt_stats_req stats_req;
struct htt_oob_sync_req oob_sync_req;
struct htt_aggr_conf aggr_conf;
+   struct htt_aggr_conf_v2 aggr_conf_v2;
struct htt_frag_desc_bank_cfg32 frag_desc_bank_cfg32;
struct htt_frag_desc_bank_cfg64 frag_desc_bank_cfg64;
struct htt_tx_fetch_resp tx_fetch_resp;
@@ -1890,6 +1898,9 @@ struct ath10k_htt_tx_ops {
  struct sk_buff *msdu);
int (*htt_alloc_txbuff)(struct ath10k_htt *htt);
void (*htt_free_txbuff)(struct ath10k_htt *htt);
+   int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt,
+   u8 max_subfrms_ampdu,
+   u8 max_subfrms_amsdu);
 };
 
 static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c 
b/drivers/net/wireless/ath/ath10k/htt_tx.c
index ad05ab714c9b..336170a4fea6 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1035,6 +1035,53 @@ int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
return 0;
 }
 
+static int ath10k_htt_h2t_aggr_cfg_msg_v2(struct ath10k_htt *htt,
+ u8 max_subfrms_ampdu,
+ u8 max_subfrms_amsdu)
+{
+   struct ath10k *ar = htt->ar;
+   struct htt_aggr_conf_v2 *aggr_conf;
+   struct sk_buff *skb;
+   struct htt_cmd *cmd;
+   int len;
+   int ret;
+
+   /* Firmware defaults are: amsdu = 3 and ampdu = 64 */
+
+   if (max_subfrms_ampdu == 0 || max_subfrms_ampdu > 64)
+   return -EINVAL;
+
+   if (max_subfrms_amsdu == 0 || max_subfrms_amsdu > 31)
+   return -EINVAL;
+
+   len = sizeof(cmd->hdr);
+   len += sizeof(cmd->aggr_conf_v2);
+
+   skb = ath10k_htc_alloc_skb(ar, len);
+   if (!skb)
+   return -ENOMEM;
+
+   skb_put(skb, len);
+   cmd = (struct htt_cmd *)skb->data;
+   cmd->hdr.msg_type = HTT_H2T_MSG_TYPE_AGGR_CFG;
+
+   aggr_conf = >aggr_conf_v2;
+   aggr_conf->max_num_ampdu_subframes = max_subfrms_ampdu;
+   aggr_conf->max_num_amsdu_subframes = max_subfrms_amsdu;
+
+   ath10k_dbg(ar, ATH10K_DBG_HTT, "htt h2t aggr cfg msg amsdu %d ampdu %d",
+  aggr_conf->max_num_amsdu_subframes,
+  aggr_conf->max_num_ampdu_subframes);
+
+   ret = ath10k_htc_send(>ar->htc, htt->eid, skb);
+   if (ret) {
+   dev_kfree_skb_any(skb);
+   return ret;
+   }
+
+   return 0;
+}
+
 int ath10k_htt_tx_fetch_resp(struct ath10k *ar,
 __le32 token,
 __le16 fetch_seq_num,
@@ -1692,6 +1739,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_32 = {
.htt_tx = ath10k_htt_tx_32,
.htt_alloc_txbuff = ath10k_htt_tx_alloc_cont_txbuf_32,
.htt_free_txbuff = ath10k_htt_tx_free_cont_txbuf_32,
+   .htt_h2t_aggr_cfg_msg = ath10k_htt_h2t_aggr_cfg_msg,
 };
 
 static const struct ath10k_htt_tx_ops htt_tx_ops_64 = {
@@ -1702,6 +1750,7 @@ static const struct ath10k_htt_tx_ops htt_tx_ops_64 = {
.htt_tx = ath10k_htt_t

Re: [PATCH v4 0/3] Enable ath10k wcn3990 wifi driver support on sdm845

2018-12-20 Thread Govind Singh

Hi Kalle,

On 2018-12-20 18:48, Kalle Valo wrote:

Kalle Valo  writes:


Govind Singh  writes:


Hi Kalle,

On 2018-11-17 16:39, Kalle Valo wrote:

Govind Singh  writes:


On 2018-11-16 18:59, Kalle Valo wrote:


Via which tree are these patches going? That's not clear for me.


I guess sdm845 dtsi change should be going to
git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git.
I need to send v5 to address one comment from Brian.


Ok, I'll then drop these from my queue.


Can you pls apply below changes to ath10k tree, i will send sdm845
dtsi change as separate patch after rebase.


  dt: bindings: add missing dt properties for WCN3990 wifi node
  dt: bindings: add bindings for wifi iommu node


Ok, these two are back in my queue:

https://patchwork.kernel.org/patch/10668237/

https://patchwork.kernel.org/patch/10668245/

I'll just modify the titles to use ath10k prefix to make it more clear
these are for ath10k:

   dt: bindings: ath10k: .


There were conflicts with this commit:

2b741a8aaa34 dt: bindings: add bindings for msa memory region

I fixed them in the pending branch, please double check carefully:



Changes looks good to me.


https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending=5bb88d4d49783c75ac083e4ea19b7527bc115857

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending=a6d53e207670eacd72a74277658bac1ab346fabd


BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v4 0/3] Enable ath10k wcn3990 wifi driver support on sdm845

2018-12-19 Thread Govind Singh

Hi Kalle,

On 2018-11-17 16:39, Kalle Valo wrote:

Govind Singh  writes:


On 2018-11-16 18:59, Kalle Valo wrote:

Govind Singh  writes:


This series enables ath10k wifi driver support for WCN3990 target
on sdm845 SOC. This series also updates the missing dt binding
documentation
and adds optional iommu property.

Changes since v3:
Moved interrupt/reg/reg-name to required property.
Removed unused clocks.
Corrected interrupt no's.

Changes since v2:
dropped [v2,4/4] dts: arm64/sdm845: Enable iommu for WCN3990
wifi module
device node patch from the series as dependent patch is not yet
merged.
Enabled status flag from sdm845-mtp.dts.

Changes since v1:
Listed no of interrupts/clocks for each set of compatible.
Added missing 'wifi' label to sdm845.dtsi.

Govind Singh (3):
  dt: bindings: add missing dt properties for WCN3990 wifi node
  dts: arm64/sdm845: Add WCN3990 WLAN module device node
  dt: bindings: add bindings for wifi iommu node

 .../bindings/net/wireless/qcom,ath10k.txt  | 62
++
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts|  8 +++
 arch/arm64/boot/dts/qcom/sdm845.dtsi   | 26 +
 3 files changed, 74 insertions(+), 22 deletions(-)


Via which tree are these patches going? That's not clear for me.


I guess sdm845 dtsi change should be going to
git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git.
I need to send v5 to address one comment from Brian.


Ok, I'll then drop these from my queue.


Can you pls apply below changes to ath10k tree, i will send sdm845 dtsi 
change as separate patch after rebase.

  dt: bindings: add missing dt properties for WCN3990 wifi node
  dt: bindings: add bindings for wifi iommu node


BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: Skip sending quiet mode cmd for WCN3990

2018-12-10 Thread Govind Singh
From: Rakesh Pillai 

HL2.0 firmware does not support setting quiet mode.
If the host driver sends the quiet mode setting
command to the HL2.0 firmware, it crashes with the
below signature.

fatal error received: err_qdi.c:456:EX:wlan_process:1:WLAN RT:207a:PC=b001b4f0

The quiet mode command support is exposed by the firmware
via thermal throttle wmi service. Enable ath10k thermal
support if thermal throttle wmi service bit is set.
10X firmware version supports this feature by default, hence
set this service bit by default.

Tested HW: WCN3990
Tested FW: WLAN.HL.2.0-01188-QCAHLSWMTPLZ-1

Co-developed-by: Govind Singh 
Signed-off-by: Rakesh Pillai 
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c| 19 +--
 drivers/net/wireless/ath/ath10k/debug.c   |  5 +++--
 drivers/net/wireless/ath/ath10k/mac.c |  3 ++-
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  3 +++
 drivers/net/wireless/ath/ath10k/wmi.h |  1 +
 5 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 22cbe9a2e646..2bdb632b7b1a 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -2621,6 +2621,10 @@ int ath10k_core_start(struct ath10k *ar, enum 
ath10k_firmware_mode mode,
goto err_hif_stop;
}
 
+   if (test_bit(ATH10K_FW_FEATURE_WMI_10X,
+ar->normal_mode_fw.fw_file.fw_features)) {
+   set_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map);
+   }
/* Some firmware revisions do not properly set up hardware rx filter
 * registers.
 *
@@ -2919,11 +2923,13 @@ static void ath10k_core_register_work(struct 
work_struct *work)
goto err_debug_destroy;
}
 
-   status = ath10k_thermal_register(ar);
-   if (status) {
-   ath10k_err(ar, "could not register thermal device: %d\n",
-  status);
-   goto err_spectral_destroy;
+   if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map)) {
+   status = ath10k_thermal_register(ar);
+   if (status) {
+   ath10k_err(ar, "could not register thermal device: 
%d\n",
+  status);
+   goto err_spectral_destroy;
+   }
}
 
set_bit(ATH10K_FLAG_CORE_REGISTERED, >dev_flags);
@@ -2964,7 +2970,8 @@ void ath10k_core_unregister(struct ath10k *ar)
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, >dev_flags))
return;
 
-   ath10k_thermal_unregister(ar);
+   if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map))
+   ath10k_thermal_unregister(ar);
/* Stop spectral before unregistering from mac80211 to remove the
 * relayfs debugfs file cleanly. Otherwise the parent debugfs tree
 * would be already be free'd recursively, leading to a double free.
diff --git a/drivers/net/wireless/ath/ath10k/debug.c 
b/drivers/net/wireless/ath/ath10k/debug.c
index 15964b374f68..02988fc378a1 100644
--- a/drivers/net/wireless/ath/ath10k/debug.c
+++ b/drivers/net/wireless/ath/ath10k/debug.c
@@ -2578,8 +2578,9 @@ int ath10k_debug_register(struct ath10k *ar)
debugfs_create_file("pktlog_filter", 0644, ar->debug.debugfs_phy, ar,
_pktlog_filter);
 
-   debugfs_create_file("quiet_period", 0644, ar->debug.debugfs_phy, ar,
-   _quiet_period);
+   if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map))
+   debugfs_create_file("quiet_period", 0644, 
ar->debug.debugfs_phy, ar,
+   _quiet_period);
 
debugfs_create_file("tpc_stats", 0400, ar->debug.debugfs_phy, ar,
_tpc_stats);
diff --git a/drivers/net/wireless/ath/ath10k/mac.c 
b/drivers/net/wireless/ath/ath10k/mac.c
index c5130fa264eb..b8a5ec40b949 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -4800,7 +4800,8 @@ static int ath10k_start(struct ieee80211_hw *hw)
ath10k_regd_update(ar);
 
ath10k_spectral_start(ar);
-   ath10k_thermal_set_throttling(ar);
+   if (test_bit(WMI_SERVICE_THERM_THROT, ar->wmi.svc_map))
+   ath10k_thermal_set_throttling(ar);
 
ar->radar_conf_state = ATH10K_RADAR_CONFIRMATION_IDLE;
 
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index bf8a4320c39c..e07e9907e355 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1564,6 +1564,9 @@ wmi_tlv_svc_map_ext(const __le32 *in, unsigned long *out, 
size_t len)
SVCMAP(WMI_TLV_SERVICE_SPOOF_MAC_SUPPORT,
   WMI_SERVICE_SPOOF_MAC_SUPPORT,
   WMI_T

[PATCH] ath10k: Move non-fatal warn logs to dbg level

2018-11-28 Thread Govind Singh
During driver load below warn logs are printed in the console.
Since driver may not implement all wmi events sent by fw and
all of them are non-fatal, move this log to debug level to
remove un-necessary warn message on console.

[  361.887230] ath10k_snoc a00.wifi: Unknown eventid: 16393
[  361.907037] ath10k_snoc a00.wifi: Unknown eventid: 237569

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index ad4114a88170..892bd8c30dd9 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -621,7 +621,7 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct 
sk_buff *skb)
ath10k_wmi_event_mgmt_tx_compl(ar, skb);
break;
default:
-   ath10k_warn(ar, "Unknown eventid: %d\n", id);
+   ath10k_dbg(ar, ATH10K_DBG_WMI, "Unknown eventid: %d\n", id);
break;
}
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH] ath10k: update HOST capability qmi message

2018-11-19 Thread Govind Singh
HOST capability interface data structures are updated
in HL3.1 fw version. Update the qmi host capability
members for compatibility across different firmware
versions.
With this change HL2.0 fw upgrade is required as this
change breaks the backward compatibility with HL2.0 fw.

Testing:
Tested on QCS404 platform(WCN3990 HW).
Tested FW: WLAN.HL.3.1-00338-QCAHLSWMTPL-1.

Signed-off-by: Govind Singh 
---
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.c| 229 +-
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.h|  34 ++-
 2 files changed, 257 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c 
b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
index ba79c2e4aed6..4102f7b0b5c3 100644
--- a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
@@ -1763,14 +1763,239 @@ struct qmi_elem_info wlfw_host_cap_req_msg_v01_ei[] = {
   daemon_support_valid),
},
{
-   .data_type  = QMI_UNSIGNED_1_BYTE,
+   .data_type  = QMI_UNSIGNED_4_BYTE,
.elem_len   = 1,
-   .elem_size  = sizeof(u8),
+   .elem_size  = sizeof(u32),
.array_type = NO_ARRAY,
.tlv_type   = 0x10,
.offset = offsetof(struct wlfw_host_cap_req_msg_v01,
   daemon_support),
},
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x11,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  wake_msi_valid),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x11,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  wake_msi),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x12,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  gpios_valid),
+   },
+   {
+   .data_type  = QMI_DATA_LEN,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x12,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  gpios_len),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = QMI_WLFW_MAX_NUM_GPIO_V01,
+   .elem_size  = sizeof(u32),
+   .array_type = VAR_LEN_ARRAY,
+   .tlv_type   = 0x12,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  gpios),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x13,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  nm_modem_valid),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_1_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x13,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  nm_modem),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x14,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  bdf_support_valid),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_1_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u8),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0x14,
+   .offset = offsetof(struct wlfw_host_cap_req_msg_v01,
+  bdf_support),
+   },
+   {
+   .data_type  = QMI_OPT_FLAG,
+   .elem_len   = 1

[PATCH] ath10k: Remove work in progress logs from snoc driver

2018-11-19 Thread Govind Singh
All the necessary patches to make wifi running (over SNOC)
are merged and tested on SDM845/QCS404 platform with WCN3990
wifi module, hence remove work in progress debug from snoc
driver and Kconfig.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/Kconfig | 3 +--
 drivers/net/wireless/ath/ath10k/snoc.c  | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index e1ad6b9166a6..a7fb5441ced4 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -47,8 +47,7 @@ config ATH10K_SNOC
select QCOM_QMI_HELPERS
---help---
  This module adds support for integrated WCN3990 chip connected
- to system NOC(SNOC). Currently work in progress and will not
- fully work.
+ to system NOC(SNOC).
 
 config ATH10K_DEBUG
bool "Atheros ath10k debugging"
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index 98724d04baef..eda4a6b80e47 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1633,7 +1633,6 @@ static int ath10k_snoc_probe(struct platform_device *pdev)
}
 
ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc probe\n");
-   ath10k_warn(ar, "Warning: SNOC support is still work-in-progress, it 
will not work properly!");
 
return 0;
 
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v4 0/3] Enable ath10k wcn3990 wifi driver support on sdm845

2018-11-16 Thread Govind Singh

On 2018-11-16 18:59, Kalle Valo wrote:

Govind Singh  writes:


This series enables ath10k wifi driver support for WCN3990 target
on sdm845 SOC. This series also updates the missing dt binding 
documentation

and adds optional iommu property.

Changes since v3:
Moved interrupt/reg/reg-name to required property.
Removed unused clocks.
Corrected interrupt no's.

Changes since v2:
dropped [v2,4/4] dts: arm64/sdm845: Enable iommu for WCN3990 wifi 
module
device node patch from the series as dependent patch is not yet 
merged.

Enabled status flag from sdm845-mtp.dts.

Changes since v1:
Listed no of interrupts/clocks for each set of compatible.
Added missing 'wifi' label to sdm845.dtsi.

Govind Singh (3):
  dt: bindings: add missing dt properties for WCN3990 wifi node
  dts: arm64/sdm845: Add WCN3990 WLAN module device node
  dt: bindings: add bindings for wifi iommu node

 .../bindings/net/wireless/qcom,ath10k.txt  | 62 
++

 arch/arm64/boot/dts/qcom/sdm845-mtp.dts|  8 +++
 arch/arm64/boot/dts/qcom/sdm845.dtsi   | 26 +
 3 files changed, 74 insertions(+), 22 deletions(-)


Via which tree are these patches going? That's not clear for me.


I guess sdm845 dtsi change should be going to 
git://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git.

I need to send v5 to address one comment from Brian.

BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH REGRESSION] Revert "ath10k: add quiet mode support for QCA6174/QCA9377"

2018-11-07 Thread Govind Singh

On 2018-11-08 03:00, Rajkumar Manoharan wrote:

On 2018-11-07 10:56, Brian Norris wrote:

This reverts commit cfb353c0dc058bc1619cc226d3cbbda1f360bdd3.

WCN3990 firmware does not yet implement this feature, and so it 
crashes

like this:

  fatal error received: err_qdi.c:456:EX:wlan_process:1:WLAN 
RT:207a:PC=b001b4f0


This feature can be re-implemented with a proper service bitmap or 
other

feature-discovery mechanism in the future. But it should not break
working boards.


Brian,

The change "ath10k: add quiet mode support for QCA6174/QCA9377" was 
merged even

before full WCN3990 device support was added in ath10k. How come it
could be regression
for WCN3990. I know both are sharing same WMI-TLV interface but 
reverting this

will break QCA6174/QCA9377. no?



This regression is found while we switched from 4.18 + WCN3990 
back-ports to 4.19.



I would prefer to handle this within WMI callback or upper layer.



IMO, we should use (WMI_SERVICE_THERMAL_MGMT | WMI_SERVICE_THERM_THROT ) 
service bitmap check and call
ath10k_thermal_set_throttling only if fw supports THERMAL THROTTLE 
feature. But we need to ensure all

available ath10k fw's are reporting this service.


-Rajkumar


BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v4 0/3] Enable ath10k wcn3990 wifi driver support on sdm845

2018-11-05 Thread Govind Singh
This series enables ath10k wifi driver support for WCN3990 target
on sdm845 SOC. This series also updates the missing dt binding documentation
and adds optional iommu property.

Changes since v3:
Moved interrupt/reg/reg-name to required property.
Removed unused clocks.
Corrected interrupt no's.

Changes since v2:
dropped [v2,4/4] dts: arm64/sdm845: Enable iommu for WCN3990 wifi module
device node patch from the series as dependent patch is not yet merged.
Enabled status flag from sdm845-mtp.dts.

Changes since v1:
Listed no of interrupts/clocks for each set of compatible.
Added missing 'wifi' label to sdm845.dtsi.

Govind Singh (3):
  dt: bindings: add missing dt properties for WCN3990 wifi node
  dts: arm64/sdm845: Add WCN3990 WLAN module device node
  dt: bindings: add bindings for wifi iommu node

 .../bindings/net/wireless/qcom,ath10k.txt  | 62 ++
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts|  8 +++
 arch/arm64/boot/dts/qcom/sdm845.dtsi   | 26 +
 3 files changed, 74 insertions(+), 22 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v4 2/3] dts: arm64/sdm845: Add WCN3990 WLAN module device node

2018-11-05 Thread Govind Singh
Add device node for the ath10k SNOC platform driver probe
and add resources required for WCN3990 on SDM845 soc.

Signed-off-by: Govind Singh 
Reviewed-by: Brian Norris 
Tested-by: Brian Norris 
---
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts |  8 
 arch/arm64/boot/dts/qcom/sdm845.dtsi| 26 ++
 2 files changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 
b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
index eedfaf8..c062c5c 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
@@ -440,3 +440,11 @@
bias-pull-up;
};
 };
+
+ {
+   status = "okay";
+   vdd-0.8-cx-mx-supply = <_l5a_0p8>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index b72bdb0..324be5b 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -87,6 +87,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   wlan_msa_mem: memory@9670 {
+   reg = <0 0x9670 0 0x10>;
+   no-map;
+   };
};
 
cpus {
@@ -1403,5 +1408,26 @@
status = "disabled";
};
};
+
+   wifi: wifi@1880 {
+   compatible = "qcom,wcn3990-wifi";
+   status = "disabled";
+   reg = <0x1880 0x80>;
+   reg-names = "membase";
+   memory-region = <_msa_mem>;
+   interrupts =
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ;
+   };
};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v4 1/3] dt: bindings: add missing dt properties for WCN3990 wifi node

2018-11-05 Thread Govind Singh
Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh 
Reviewed-by: Rob Herring 
Reviewed-by: Brian Norris 
Tested-by: Brian Norris 
---
 .../bindings/net/wireless/qcom,ath10k.txt  | 57 +-
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 7fd4e8c..55d255c 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -21,10 +21,22 @@ can be provided per device.
 
 SNOC based devices (i.e. wcn3990) uses compatible string "qcom,wcn3990-wifi".
 
-Optional properties:
 - reg: Address and length of the register set for the device.
 - reg-names: Must include the list of following reg names,
 "membase"
+- interrupts: reference to the list of 17 interrupt numbers for 
"qcom,ipq4019-wifi"
+ compatible target.
+ reference to the list of 12 interrupt numbers for 
"qcom,wcn3990-wifi"
+ compatible target.
+ Must contain interrupt-names property per entry for
+ "qcom,ath10k", "qcom,ipq4019-wifi" compatible targets.
+
+- interrupt-names: Must include the entries for MSI interrupt
+  names ("msi0" to "msi15") and legacy interrupt
+  name ("legacy") for "qcom,ath10k", "qcom,ipq4019-wifi"
+  compatible targets.
+
+Optional properties:
 - resets: Must contain an entry for each entry in reset-names.
   See ../reset/reseti.txt for details.
 - reset-names: Must include the list of following reset names,
@@ -37,12 +49,9 @@ Optional properties:
 - clocks: List of clock specifiers, must contain an entry for each required
   entry in clock-names.
 - clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref",
-   "wifi_wcss_rtc".
-- interrupts: List of interrupt lines. Must contain an entry
- for each entry in the interrupt-names property.
-- interrupt-names: Must include the entries for MSI interrupt
-  names ("msi0" to "msi15") and legacy interrupt
-  name ("legacy"),
+  "wifi_wcss_rtc" for "qcom,ipq4019-wifi" compatible target and
+  "cxo_ref_clk_pin" for "qcom,wcn3990-wifi"
+  compatible target.
 - qcom,msi_addr: MSI interrupt address.
 - qcom,msi_base: Base value to add before writing MSI data into
MSI address register.
@@ -55,7 +64,8 @@ Optional properties:
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
 - -supply: handle to the regulator device tree node
-  optional "supply-name" is "vdd-0.8-cx-mx".
+  optional "supply-name" are "vdd-0.8-cx-mx",
+  "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
 
 Example (to supply the calibration data alone):
 
@@ -133,20 +143,23 @@ wifi@1800 {
compatible = "qcom,wcn3990-wifi";
reg = <0x1880 0x80>;
reg-names = "membase";
-   clocks = <_gcc clk_aggre2_noc_clk>;
-   clock-names = "smmu_aggre2_noc_clk"
+   clocks = <_gcc clk_rf_clk2_pin>;
+   clock-names = "cxo_ref_clk_pin";
interrupts =
-  <0 130 0 /* CE0 */ >,
-  <0 131 0 /* CE1 */ >,
-  <0 132 0 /* CE2 */ >,
-  <0 133 0 /* CE3 */ >,
-  <0 134 0 /* CE4 */ >,
-  <0 135 0 /* CE5 */ >,
-  <0 136 0 /* CE6 */ >,
-  <0 137 0 /* CE7 */ >,
-  <0 138 0 /* CE8 */ >,
-  <0 139 0 /* CE9 */ >,
-  <0 140 0 /* CE10 */ >,
-  <0 141 0 /* CE11 */ >;
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ,
+   ;
vdd-0.8-cx-mx-supply = <_l5>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v4 3/3] dt: bindings: add bindings for wifi iommu node

2018-11-05 Thread Govind Singh
WCN3990 wifi module can optionally make use of the IOMMU.
Add binding documentation for phandle to the IOMMU and
the stream id of wifi iommu block.

Signed-off-by: Govind Singh 
Reviewed-by: Rob Herring 
Reviewed-by: Brian Norris 
Tested-by: Brian Norris 
---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 55d255c..78fb56a 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -66,6 +66,10 @@ Optional properties:
 - -supply: handle to the regulator device tree node
   optional "supply-name" are "vdd-0.8-cx-mx",
   "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
+- iommus:
+   Usage: optional
+   Value type: 
+   Definition: A list of phandle and IOMMU specifier pairs.
 
 Example (to supply the calibration data alone):
 
@@ -162,4 +166,5 @@ wifi@1800 {
vdd-1.8-xo-supply = <_l7a_1p8>;
vdd-1.3-rfa-supply = <_l17a_1p3>;
vdd-3.3-ch0-supply = <_l25a_3p3>;
+   iommus = <_smmu 0x0040 0x1>;
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v3 1/3] dt: bindings: add missing dt properties for WCN3990 wifi node

2018-10-30 Thread Govind Singh

On 2018-10-17 04:23, Doug Anderson wrote:

Hi,

On Wed, Oct 10, 2018 at 4:53 AM Govind Singh  
wrote:


Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh 
---
 .../bindings/net/wireless/qcom,ath10k.txt  | 28 
--

 1 file changed, 21 insertions(+), 7 deletions(-)


Point of order: please CC LKML on _all_ your patches.  Yes, it's a
firehose.  CCing LKML allows your patches to be found on
lore.kernel.org's patchwork and also allows people to find your
patches via <https://lkml.kernel.org/r/MSG_ID> links.


diff --git 
a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

index 7fd4e8c..f831bb1 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -37,12 +37,20 @@ Optional properties:
 - clocks: List of clock specifiers, must contain an entry for each 
required

   entry in clock-names.
 - clock-names: Should contain the clock names "wifi_wcss_cmd", 
"wifi_wcss_ref",

-   "wifi_wcss_rtc".
-- interrupts: List of interrupt lines. Must contain an entry
- for each entry in the interrupt-names property.
+  "wifi_wcss_rtc" for "qcom,ipq4019-wifi" compatible 
target and
+  "cxo_ref_clk_pin", "smmu_aggre2_noc_clk" for 
"qcom,wcn3990-wifi"

+  compatible target.


I always get confused with these big bindings patches that hide
everything under a big "Optional properties" section to avoid
specifying which properties are actually optional and which ones are
required.

After your patch and thinking about "qcom,wcn3990-wifi" in particular,
it's unclear to me which of the following is true (or maybe something
totally different I didn't think of)

A) On wcn3990-wifi these clocks should be a required property but it's
only listed under "Optional" because it's not used for some of the
different WiFi drivers using this same bindings.

These clocks are optional as it is voted by firmware in newer fw 
versions.

During transient state in case of fw crash, fw might remove the vote in
its error/fatal handler. The apps vote helps in avoiding un-clocked 
hw(copy engine)

access in transient state till driver recovers.


B) On wcn3990-wifi these clocks should either both be there or neither.

With the above explanation can you suggest where these controls should 
fall.



C) On wcm3990-wifi you can specify zero, either, or both of these
clocks.  AKA they are independently optional.





It might make sense to reorganize this bindings to make this clearer?
...not just for clock but for interrupts / regulators as well.  Maybe
you need to break this down into sections per class of compatible
string, or add a list per compatible string down below?


can you pls point me to some reference for the change you are expecting.
I will check and rework accordingly.


Also: even stranger is that even though you list two clocks here the
current driver I see in linuxnext only has "cxo_ref_clk_pin".

smmu_aggre2_noc_clk is not applicable to SDM845 and required for other 
msm platforms.
I will remove smmu_aggre2_noc_clk reference and add when this clock is 
available

in upstream for respective target.



+- interrupts: reference to the list of 17 interrupt no's for 
"qcom,ipq4019-wifi"

+ compatible target.
+ reference to the list of 12 interrupt no's for 
"qcom,wcn3990-wifi"

+ compatible target.
+ Must contain interrupt-names property per entry for
+ "qcom,ath10k", "qcom,ipq4019-wifi" compatible targets.


...and just to add some credence to my concerns above, "interrupts"
are currently listed under "Optional" properties but I don't think
that the wcn3990 driver will actually work if you don't specify any of
the interrupts, right?  AKA for wcn3990 they are _not_ optional and
you must have exactly 12 interrupts.


Yes, for other chip-set(QCAxx) also it should not be optional.
I will move interrupt block to Required properties.



One separate issue I have is with your example, which you didn't
change in this patch.  You should fix the example with the same
feedback that I had to your patch ("dts: arm64/sdm845: Add WCN3990
WLAN module device node").



sure , will do in next revision.


-Doug


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 2/3] ath10k: Disable interface pause wow config for integrated chipset

2018-10-12 Thread Govind Singh
wow pause iface config controls the PCI D0/D3-WOW cases for pcie
bus state. Firmware does not expects WOW_IFACE_PAUSE_ENABLED config
for bus/link that cannot be suspended ex:snoc and does not trigger
common subsystem shutdown.
Disable interface pause wow config for integrated chipset(WCN3990)
for correct WOW configuration in the firmware.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 7 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 8c49a26fc571..1e608ef6499c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3185,6 +3185,8 @@ ath10k_wmi_tlv_op_gen_wow_enable(struct ath10k *ar)
cmd = (void *)tlv->value;
 
cmd->enable = __cpu_to_le32(1);
+   if (ar->hif.bus == ATH10K_BUS_SNOC)
+   cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED;
 
ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv wow enable\n");
return skb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 3e1e340cd834..a8bdb5614b9b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1968,8 +1968,15 @@ struct wmi_tlv_set_quiet_cmd {
__le32 enabled;
 } __packed;
 
+enum wmi_tlv_wow_interface_cfg {
+   WOW_IFACE_PAUSE_ENABLED,
+   WOW_IFACE_PAUSE_DISABLED
+};
+
 struct wmi_tlv_wow_enable_cmd {
__le32 enable;
+   __le32 pause_iface_config;
+   __le32 flags;
 } __packed;
 
 struct wmi_tlv_wow_host_wakeup_ind {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 3/3] ath10k: Request credit report if flow control enabled on ep

2018-10-12 Thread Govind Singh
FW credit flow control is enabled for only WMI ctrl
service(CE3) but credit update is requested unconditionally
on all HTC services as part of HTC tx in CE3/CE0/CE4.

This is causing WOW failure as FW is not expecting credit
report request on other end-points(CE0/CE4).

Request credit report only on those endpoints where
credit flow control is enabled.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/htc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 8902720b4e49..31f1a316be7c 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -87,7 +87,8 @@ static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep 
*ep,
hdr->eid = ep->eid;
hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr));
hdr->flags = 0;
-   hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
+   if (ep->tx_credit_flow_enabled)
+   hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
 
spin_lock_bh(>htc->tx_lock);
hdr->seq_no = ep->seq_no++;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 0/3] Add support for suspend/resume and WOW for WCN3990 chipset

2018-10-12 Thread Govind Singh
This series adds support for driver suspend/resume and wake over wlan support
for WCN3990 chipset. CE2 is configured as wakeup source before driver suspend
and FW can wake up application processor on Magic packet/Deauth/AP lost.

change since v1:
  Log enhancement in "ath10k: Enable bus layer suspend/resume for WCN3990" 
patch.

Govind Singh (3):
  ath10k: Enable bus layer suspend/resume for WCN3990
  ath10k: Disable interface pause wow config for integrated chipset
  ath10k: Request credit report if flow control enabled on ep

 drivers/net/wireless/ath/ath10k/htc.c |  3 +-
 drivers/net/wireless/ath/ath10k/snoc.c| 45 +++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c |  2 +
 drivers/net/wireless/ath/ath10k/wmi-tlv.h |  7 
 4 files changed, 56 insertions(+), 1 deletion(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 1/3] ath10k: Enable bus layer suspend/resume for WCN3990

2018-10-12 Thread Govind Singh
Register snoc bus layer suspend/resume PM ops and configure
the wakeup source(CE2) for the device.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 45 ++
 1 file changed, 45 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index bdef3d00f3f4..3f935c5ce8a8 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -30,6 +30,7 @@
 
 #define ATH10K_SNOC_RX_POST_RETRY_MS 50
 #define CE_POLL_PIPE 4
+#define ATH10K_SNOC_WAKE_IRQ 2
 
 static char *const ce_name[] = {
"WLAN_CE_0",
@@ -1025,6 +1026,46 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar)
return ret;
 }
 
+#ifdef CONFIG_PM
+static int ath10k_snoc_hif_suspend(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   int ret;
+
+   if (!device_may_wakeup(ar->dev))
+   return -EPERM;
+
+   ret = enable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+   if (ret) {
+   ath10k_err(ar, "failed to enable wakeup irq :%d\n", ret);
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n");
+
+   return ret;
+}
+
+static int ath10k_snoc_hif_resume(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   int ret;
+
+   if (!device_may_wakeup(ar->dev))
+   return -EPERM;
+
+   ret = disable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+   if (ret) {
+   ath10k_err(ar, "failed to disable wakeup irq: %d\n", ret);
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n");
+
+   return ret;
+}
+#endif
+
 static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
.read32 = ath10k_snoc_read32,
.write32= ath10k_snoc_write32,
@@ -1038,6 +1079,10 @@ static const struct ath10k_hif_ops ath10k_snoc_hif_ops = 
{
.send_complete_check= ath10k_snoc_hif_send_complete_check,
.get_free_queue_number  = ath10k_snoc_hif_get_free_queue_number,
.get_target_info= ath10k_snoc_hif_get_target_info,
+#ifdef CONFIG_PM
+   .suspend= ath10k_snoc_hif_suspend,
+   .resume = ath10k_snoc_hif_resume,
+#endif
 };
 
 static const struct ath10k_bus_ops ath10k_snoc_bus_ops = {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/3] ath10k: Disable interface pause wow config for integrated chipset

2018-10-12 Thread Govind Singh
wow pause iface config controls the PCI D0/D3-WOW cases for pcie
bus state. Firmware does not expects WOW_IFACE_PAUSE_ENABLED config
for bus/link that cannot be suspended ex:snoc and does not trigger
common subsystem shutdown.
Disable interface pause wow config for integrated chipset(WCN3990)
for correct WOW configuration in the firmware.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 2 ++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 7 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 8c49a26fc571..1e608ef6499c 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3185,6 +3185,8 @@ ath10k_wmi_tlv_op_gen_wow_enable(struct ath10k *ar)
cmd = (void *)tlv->value;
 
cmd->enable = __cpu_to_le32(1);
+   if (ar->hif.bus == ATH10K_BUS_SNOC)
+   cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED;
 
ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv wow enable\n");
return skb;
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h 
b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 3e1e340cd834..a8bdb5614b9b 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -1968,8 +1968,15 @@ struct wmi_tlv_set_quiet_cmd {
__le32 enabled;
 } __packed;
 
+enum wmi_tlv_wow_interface_cfg {
+   WOW_IFACE_PAUSE_ENABLED,
+   WOW_IFACE_PAUSE_DISABLED
+};
+
 struct wmi_tlv_wow_enable_cmd {
__le32 enable;
+   __le32 pause_iface_config;
+   __le32 flags;
 } __packed;
 
 struct wmi_tlv_wow_host_wakeup_ind {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/3] ath10k: Enable bus layer suspend/resume for WCN3990

2018-10-12 Thread Govind Singh
Register snoc bus layer suspend/resume PM ops and configure
the wakeup source(CE2) for the device.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 45 ++
 1 file changed, 45 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index bdef3d00f3f4..6da951eea345 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -30,6 +30,7 @@
 
 #define ATH10K_SNOC_RX_POST_RETRY_MS 50
 #define CE_POLL_PIPE 4
+#define ATH10K_SNOC_WAKE_IRQ 2
 
 static char *const ce_name[] = {
"WLAN_CE_0",
@@ -1025,6 +1026,46 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar)
return ret;
 }
 
+#ifdef CONFIG_PM
+static int ath10k_snoc_hif_suspend(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   int ret;
+
+   if (!device_may_wakeup(ar->dev))
+   return -EPERM;
+
+   ret = enable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+   if (ret) {
+   ath10k_err(ar, "failed to enable wakeup irq\n");
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device suspended\n");
+
+   return ret;
+}
+
+static int ath10k_snoc_hif_resume(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   int ret;
+
+   if (!device_may_wakeup(ar->dev))
+   return -EPERM;
+
+   ret = disable_irq_wake(ar_snoc->ce_irqs[ATH10K_SNOC_WAKE_IRQ].irq_line);
+   if (ret) {
+   ath10k_err(ar, "failed to disable wakeup irq\n");
+   return ret;
+   }
+
+   ath10k_dbg(ar, ATH10K_DBG_SNOC, "snoc device resumed\n");
+
+   return ret;
+}
+#endif
+
 static const struct ath10k_hif_ops ath10k_snoc_hif_ops = {
.read32 = ath10k_snoc_read32,
.write32= ath10k_snoc_write32,
@@ -1038,6 +1079,10 @@ static const struct ath10k_hif_ops ath10k_snoc_hif_ops = 
{
.send_complete_check= ath10k_snoc_hif_send_complete_check,
.get_free_queue_number  = ath10k_snoc_hif_get_free_queue_number,
.get_target_info= ath10k_snoc_hif_get_target_info,
+#ifdef CONFIG_PM
+   .suspend= ath10k_snoc_hif_suspend,
+   .resume = ath10k_snoc_hif_resume,
+#endif
 };
 
 static const struct ath10k_bus_ops ath10k_snoc_bus_ops = {
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 3/3] ath10k: Request credit report if flow control enabled on ep

2018-10-12 Thread Govind Singh
FW credit flow control is enabled for only WMI ctrl
service(CE3) but credit update is requested unconditionally
on all HTC services as part of HTC tx in CE3/CE0/CE4.

This is causing WOW failure as FW is not expecting credit
report request on other end-points(CE0/CE4).

Request credit report only on those endpoints where
credit flow control is enabled.

Testing:
Tested on WCN3990 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/htc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 8902720b4e49..31f1a316be7c 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -87,7 +87,8 @@ static void ath10k_htc_prepare_tx_skb(struct ath10k_htc_ep 
*ep,
hdr->eid = ep->eid;
hdr->len = __cpu_to_le16(skb->len - sizeof(*hdr));
hdr->flags = 0;
-   hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
+   if (ep->tx_credit_flow_enabled)
+   hdr->flags |= ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE;
 
spin_lock_bh(>htc->tx_lock);
hdr->seq_no = ep->seq_no++;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 1/3] dt: bindings: add missing dt properties for WCN3990 wifi node

2018-10-10 Thread Govind Singh
Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh 
---
 .../bindings/net/wireless/qcom,ath10k.txt  | 28 --
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 7fd4e8c..f831bb1 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -37,12 +37,20 @@ Optional properties:
 - clocks: List of clock specifiers, must contain an entry for each required
   entry in clock-names.
 - clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref",
-   "wifi_wcss_rtc".
-- interrupts: List of interrupt lines. Must contain an entry
- for each entry in the interrupt-names property.
+  "wifi_wcss_rtc" for "qcom,ipq4019-wifi" compatible target and
+  "cxo_ref_clk_pin", "smmu_aggre2_noc_clk" for "qcom,wcn3990-wifi"
+  compatible target.
+- interrupts: reference to the list of 17 interrupt no's for 
"qcom,ipq4019-wifi"
+ compatible target.
+ reference to the list of 12 interrupt no's for "qcom,wcn3990-wifi"
+ compatible target.
+ Must contain interrupt-names property per entry for
+ "qcom,ath10k", "qcom,ipq4019-wifi" compatible targets.
+
 - interrupt-names: Must include the entries for MSI interrupt
   names ("msi0" to "msi15") and legacy interrupt
-  name ("legacy"),
+  name ("legacy") for "qcom,ath10k", "qcom,ipq4019-wifi"
+  compatible targets.
 - qcom,msi_addr: MSI interrupt address.
 - qcom,msi_base: Base value to add before writing MSI data into
MSI address register.
@@ -55,7 +63,8 @@ Optional properties:
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
 - -supply: handle to the regulator device tree node
-  optional "supply-name" is "vdd-0.8-cx-mx".
+  optional "supply-name" are "vdd-0.8-cx-mx",
+  "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
 
 Example (to supply the calibration data alone):
 
@@ -133,8 +142,10 @@ wifi@1800 {
compatible = "qcom,wcn3990-wifi";
reg = <0x1880 0x80>;
reg-names = "membase";
-   clocks = <_gcc clk_aggre2_noc_clk>;
-   clock-names = "smmu_aggre2_noc_clk"
+   clocks = <_gcc clk_aggre2_noc_clk>,
+<_gcc clk_rf_clk2_pin>;
+   clock-names = "smmu_aggre2_noc_clk",
+ "cxo_ref_clk_pin";
interrupts =
   <0 130 0 /* CE0 */ >,
   <0 131 0 /* CE1 */ >,
@@ -149,4 +160,7 @@ wifi@1800 {
   <0 140 0 /* CE10 */ >,
   <0 141 0 /* CE11 */ >;
vdd-0.8-cx-mx-supply = <_l5>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 2/3] dts: arm64/sdm845: Add WCN3990 WLAN module device node

2018-10-10 Thread Govind Singh
Add device node for the ath10k SNOC platform driver probe
and add resources required for WCN3990 on SDM845 soc.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts |  8 
 arch/arm64/boot/dts/qcom/sdm845.dtsi| 26 ++
 2 files changed, 34 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 
b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
index eedfaf8..b89b8dd 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
@@ -417,6 +417,14 @@
vdda-pll-supply = <_usb2_ss_core>;
 };
 
+ {
+   status = "okay";
+   vdd-0.8-cx-mx-supply = <_l5a_0p8>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
+};
+
 /* PINCTRL - additions to nodes defined in sdm845.dtsi */
 
 _i2c10_default {
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index b72bdb0..a09f7df 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -87,6 +87,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   wlan_msa_mem: reserved-memory@9670 {
+   no-map;
+   reg = <0 0x9670 0 0x10>;
+   };
};
 
cpus {
@@ -1403,5 +1408,26 @@
status = "disabled";
};
};
+
+   wifi: wifi@1880 {
+   compatible = "qcom,wcn3990-wifi";
+   status = "disabled";
+   reg = <0x1880 0x80>;
+   reg-names = "membase";
+   memory-region = <_msa_mem>;
+   interrupts =
+   <0 413 0 /* CE0 */ >,
+   <0 414 0 /* CE1 */ >,
+   <0 415 0 /* CE2 */ >,
+   <0 416 0 /* CE3 */ >,
+   <0 417 0 /* CE4 */ >,
+   <0 418 0 /* CE5 */ >,
+   <0 420 0 /* CE6 */ >,
+   <0 421 0 /* CE7 */ >,
+   <0 422 0 /* CE8 */ >,
+   <0 423 0 /* CE9 */ >,
+   <0 424 0 /* CE10 */ >,
+   <0 425 0 /* CE11 */ >;
+   };
};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 3/3] dt: bindings: add bindings for wifi iommu node

2018-10-10 Thread Govind Singh
WCN3990 wifi module can optionally make use of the IOMMU.
Add binding documentation for phandle to the IOMMU and
the stream id of wifi iommu block.

Signed-off-by: Govind Singh 
---
 Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index f831bb1..3118d99 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -65,6 +65,10 @@ Optional properties:
 - -supply: handle to the regulator device tree node
   optional "supply-name" are "vdd-0.8-cx-mx",
   "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
+- iommus:
+   Usage: optional
+   Value type: 
+   Definition: A list of phandle and IOMMU specifier pairs.
 
 Example (to supply the calibration data alone):
 
@@ -163,4 +167,5 @@ wifi@1800 {
vdd-1.8-xo-supply = <_l7a_1p8>;
vdd-1.3-rfa-supply = <_l17a_1p3>;
vdd-3.3-ch0-supply = <_l25a_3p3>;
+   iommus = <_smmu 0x0040 0x1>;
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v3 0/3] Enable ath10k wcn3990 wifi driver support on sdm845

2018-10-10 Thread Govind Singh
This series enables ath10k wifi driver support for WCN3990 target
on sdm845 SOC. This series also updates the missing dt binding documentation
and adds optional iommu property.

Changes since v2:
dropped [v2,4/4] dts: arm64/sdm845: Enable iommu for WCN3990 wifi module
device node patch from the series as dependent patch is not yet merged.
Enabled status flag from sdm845-mtp.dts.

Changes since v1:
Listed no of interrupts/clocks for each set of compatible.
Added missing 'wifi' label to sdm845.dtsi.

Govind Singh (3):
  dt: bindings: add missing dt properties for WCN3990 wifi node
  dts: arm64/sdm845: Add WCN3990 WLAN module device node
  dt: bindings: add bindings for wifi iommu node

 .../bindings/net/wireless/qcom,ath10k.txt  | 33 +-
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts|  8 ++
 arch/arm64/boot/dts/qcom/sdm845.dtsi   | 26 +
 3 files changed, 60 insertions(+), 7 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 4/4] dts: arm64/sdm845: Enable iommu for WCN3990 wifi module device node

2018-10-01 Thread Govind Singh
WCN3990 wifi module can optionally make use of the IOMMU.
Add phandle to the iommu and stream id of wifi iommu block.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index 36c716cf3a0c..f02da46542cc 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -1225,6 +1225,7 @@
<0 423 0 /* CE9 */ >,
<0 424 0 /* CE10 */ >,
<0 425 0 /* CE11 */ >;
+   iommus = <_smmu 0x0040 0x1>;
};
};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 3/4] dt: bindings: add bindings for wifi iommu node

2018-10-01 Thread Govind Singh
WCN3990 wifi module can optionally make use of the IOMMU.
Add binding documentation for phandle to the IOMMU and
the stream id of wifi iommu block.

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt| 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index f831bb1c5952..2a2f44c461f7 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -65,6 +65,11 @@ Optional properties:
 - -supply: handle to the regulator device tree node
   optional "supply-name" are "vdd-0.8-cx-mx",
   "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
+- iommus:
+   Usage: optional
+   Value type: 
+   Definition: A list of phandle and IOMMU specifier pairs
+   for "qcom,wcn3990-wifi" compatible target.
 
 Example (to supply the calibration data alone):
 
@@ -163,4 +168,5 @@ wifi@1800 {
vdd-1.8-xo-supply = <_l7a_1p8>;
vdd-1.3-rfa-supply = <_l17a_1p3>;
vdd-3.3-ch0-supply = <_l25a_3p3>;
+   iommus = <_smmu 0x0040 0x1>;
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 1/4] dt: bindings: add missing dt properties for WCN3990 wifi node

2018-10-01 Thread Govind Singh
Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh 
---
 .../bindings/net/wireless/qcom,ath10k.txt | 28 ++-
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 7fd4e8ce4149..f831bb1c5952 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -37,12 +37,20 @@ Optional properties:
 - clocks: List of clock specifiers, must contain an entry for each required
   entry in clock-names.
 - clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref",
-   "wifi_wcss_rtc".
-- interrupts: List of interrupt lines. Must contain an entry
- for each entry in the interrupt-names property.
+  "wifi_wcss_rtc" for "qcom,ipq4019-wifi" compatible target and
+  "cxo_ref_clk_pin", "smmu_aggre2_noc_clk" for "qcom,wcn3990-wifi"
+  compatible target.
+- interrupts: reference to the list of 17 interrupt no's for 
"qcom,ipq4019-wifi"
+ compatible target.
+ reference to the list of 12 interrupt no's for "qcom,wcn3990-wifi"
+ compatible target.
+ Must contain interrupt-names property per entry for
+ "qcom,ath10k", "qcom,ipq4019-wifi" compatible targets.
+
 - interrupt-names: Must include the entries for MSI interrupt
   names ("msi0" to "msi15") and legacy interrupt
-  name ("legacy"),
+  name ("legacy") for "qcom,ath10k", "qcom,ipq4019-wifi"
+  compatible targets.
 - qcom,msi_addr: MSI interrupt address.
 - qcom,msi_base: Base value to add before writing MSI data into
MSI address register.
@@ -55,7 +63,8 @@ Optional properties:
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
 - -supply: handle to the regulator device tree node
-  optional "supply-name" is "vdd-0.8-cx-mx".
+  optional "supply-name" are "vdd-0.8-cx-mx",
+  "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
 
 Example (to supply the calibration data alone):
 
@@ -133,8 +142,10 @@ wifi@1800 {
compatible = "qcom,wcn3990-wifi";
reg = <0x1880 0x80>;
reg-names = "membase";
-   clocks = <_gcc clk_aggre2_noc_clk>;
-   clock-names = "smmu_aggre2_noc_clk"
+   clocks = <_gcc clk_aggre2_noc_clk>,
+<_gcc clk_rf_clk2_pin>;
+   clock-names = "smmu_aggre2_noc_clk",
+ "cxo_ref_clk_pin";
interrupts =
   <0 130 0 /* CE0 */ >,
   <0 131 0 /* CE1 */ >,
@@ -149,4 +160,7 @@ wifi@1800 {
   <0 140 0 /* CE10 */ >,
   <0 141 0 /* CE11 */ >;
vdd-0.8-cx-mx-supply = <_l5>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 2/4] dts: arm64/sdm845: Add WCN3990 WLAN module device node

2018-10-01 Thread Govind Singh
Add device node for the ath10k SNOC platform driver probe
and add resources required for WCN3990 on SDM845 soc.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts |  7 +++
 arch/arm64/boot/dts/qcom/sdm845.dtsi| 26 +
 2 files changed, 33 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 
b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
index eedfaf8922e2..4de57f7df93c 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
@@ -440,3 +440,10 @@
bias-pull-up;
};
 };
+
+ {
+   vdd-0.8-cx-mx-supply = <_l5a_0p8>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index e080072cdfdb..36c716cf3a0c 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -86,6 +86,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   wlan_msa_mem: reserved-memory@9670 {
+   no-map;
+   reg = <0 0x9670 0 0x10>;
+   };
};
 
cpus {
@@ -1200,5 +1205,26 @@
status = "disabled";
};
};
+
+   wifi: wifi@1880 {
+   compatible = "qcom,wcn3990-wifi";
+   status = "disabled";
+   reg = <0x1880 0x80>;
+   reg-names = "membase";
+   memory-region = <_msa_mem>;
+   interrupts =
+   <0 413 0 /* CE0 */ >,
+   <0 414 0 /* CE1 */ >,
+   <0 415 0 /* CE2 */ >,
+   <0 416 0 /* CE3 */ >,
+   <0 417 0 /* CE4 */ >,
+   <0 418 0 /* CE5 */ >,
+   <0 420 0 /* CE6 */ >,
+   <0 421 0 /* CE7 */ >,
+   <0 422 0 /* CE8 */ >,
+   <0 423 0 /* CE9 */ >,
+   <0 424 0 /* CE10 */ >,
+   <0 425 0 /* CE11 */ >;
+   };
};
 };
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v2 0/4] Enable ath10k wcn3990 wifi driver support on sdm845

2018-10-01 Thread Govind Singh
This series enables ath10k wifi driver support for WCN3990 target
on sdm845 SOC. This series also updates the missing dt binding documentation
and adds optional iommu property.

sdm845 dtsi changes in this series are based on top of
https://patchwork.kernel.org/cover/10573121/ change.

Changes since v1:
Listed no of interrupts/clocks for each set of compatible.
Added missing 'wifi' label to sdm845.dtsi.

Govind Singh (4):
  dt: bindings: add missing dt properties for WCN3990 wifi node
  dts: arm64/sdm845: Add WCN3990 WLAN module device node
  dt: bindings: add bindings for wifi iommu node
  dts: arm64/sdm845: Enable iommu for WCN3990 wifi module device node

 .../bindings/net/wireless/qcom,ath10k.txt | 34 +++
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts   |  7 
 arch/arm64/boot/dts/qcom/sdm845.dtsi  | 27 +++
 3 files changed, 61 insertions(+), 7 deletions(-)

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 2/4] dts: arm64/sdm845: Add WCN3990 WLAN module device node

2018-09-25 Thread Govind Singh

Hi Brian,

On 2018-09-24 22:41, Brian Norris wrote:

Hi,

On Fri, Sep 21, 2018 at 02:39:05PM +0530, Govind Singh wrote:

Add device node for the ath10k SNOC platform driver probe
and add resources required for WCN3990 on SDM845 soc.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts |  7 +++
 arch/arm64/boot/dts/qcom/sdm845.dtsi| 25 
+

 2 files changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 
b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts

index eedfaf8922e2..4de57f7df93c 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
@@ -440,3 +440,10 @@
bias-pull-up;
};
 };
+
+ {


As the bots have already told you, you missed adding a 'wifi' label to
sdm845.dtsi, so this reference doesn't compile.



Yes, I will correct this in next revision.


+   vdd-0.8-cx-mx-supply = <_l5a_0p8>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi

index e080072cdfdb..b0b107641e74 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -86,6 +86,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   wlan_msa_mem: reserved-memory@9670 {
+   no-map;
+   reg = <0 0x9670 0 0x10>;
+   };
};

cpus {
@@ -1200,5 +1205,25 @@
status = "disabled";
};
};
+
+   qcom,wifi {


That's not a legit node name. Nodes should (a) have a generic name and
(b) include a unit address when the node contains a 'reg' property. [1]

So, how about 'wifi@1880'? (And include the 'wifi:' label, since 
you

want to refer to it in other files.)



I am fine with 'wifi@1880'.


Also, this seems like the kind of device that should remain 'status =
"disabled"' in the top-level DTSI, and be overridden with 'status =
"okay"' in the child DTS.



Sure, i will populate  'status = "disabled"' in next revision, which can 
be enabled from child dtsi

as part of separate change.


Brian

[1] See:
https://elinux.org/Device_Tree_Usage#Node_Names
https://elinux.org/images/c/cf/Power_ePAPR_APPROVED_v1.1.pdf


+   compatible = "qcom,wcn3990-wifi";
+   reg = <0x1880 0x80>;
+   reg-names = "membase";
+   memory-region = <_msa_mem>;
+   interrupts =
+   <0 413 0 /* CE0 */ >,
+   <0 414 0 /* CE1 */ >,
+   <0 415 0 /* CE2 */ >,
+   <0 416 0 /* CE3 */ >,
+   <0 417 0 /* CE4 */ >,
+   <0 418 0 /* CE5 */ >,
+   <0 420 0 /* CE6 */ >,
+   <0 421 0 /* CE7 */ >,
+   <0 422 0 /* CE8 */ >,
+   <0 423 0 /* CE9 */ >,
+   <0 424 0 /* CE10 */ >,
+   <0 425 0 /* CE11 */ >;
+   };
};
 };
--
2.17.0



Thanks,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 3/4] dt: bindings: add bindings for wifi iommu node

2018-09-25 Thread Govind Singh

On 2018-09-25 04:23, Rob Herring wrote:

On Fri, Sep 21, 2018 at 02:39:06PM +0530, Govind Singh wrote:

WCN3990 wifi module can optionally make use of the IOMMU.


Can the other compatibles use IOMMU too?



No, only wcn3990 can optionally use IOMMU.


Add binding documentation for phandle to the IOMMU and
the stream id of wifi iommu block.

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt | 5 
+

 1 file changed, 5 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

index 22dea7d83ee8..07e58008c665 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -59,6 +59,10 @@ Optional properties:
 - -supply: handle to the regulator device tree node
   optional "supply-name" are "vdd-0.8-cx-mx",
   "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
+- iommus:
+   Usage: optional
+   Value type: 
+   Definition: A list of phandle and IOMMU specifier pairs.

 Example (to supply the calibration data alone):

@@ -157,4 +161,5 @@ wifi@1800 {
vdd-1.8-xo-supply = <_l7a_1p8>;
vdd-1.3-rfa-supply = <_l17a_1p3>;
vdd-3.3-ch0-supply = <_l25a_3p3>;
+   iommus = <_smmu 0x0040 0x1>;
 };
--
2.17.0



BR,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH 1/4] dt: bindings: add missing dt properties for WCN3990 wifi node

2018-09-25 Thread Govind Singh

Hi Rob,

On 2018-09-25 04:21, Rob Herring wrote:

On Fri, Sep 21, 2018 at 02:39:04PM +0530, Govind Singh wrote:

Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh 
---
 .../bindings/net/wireless/qcom,ath10k.txt | 22 
+--

 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git 
a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

index 7fd4e8ce4149..22dea7d83ee8 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -37,12 +37,14 @@ Optional properties:
 - clocks: List of clock specifiers, must contain an entry for each 
required

   entry in clock-names.
 - clock-names: Should contain the clock names "wifi_wcss_cmd", 
"wifi_wcss_ref",

-   "wifi_wcss_rtc".
-- interrupts: List of interrupt lines. Must contain an entry
- for each entry in the interrupt-names property.
+   "wifi_wcss_rtc", "cxo_ref_clk_pin", 
"smmu_aggre2_noc_clk".
+- interrupts: List of interrupt lines. Must contain interrupt-names 
property

+ per entry for "qcom,ath10k", "qcom,ipq4019-wifi" compatible
+ targets.


It would be clearer to list how many interrupts for each set of
compatibles.



Sure, I will address this in next revision.


 - interrupt-names: Must include the entries for MSI interrupt
   names ("msi0" to "msi15") and legacy interrupt
-  name ("legacy"),
+  name ("legacy") for "qcom,ath10k", "qcom,ipq4019-wifi"
+  compatible targets.


So no legacy interrupt for wcn3990?



Yes, no legacy interrupt for wcn3990.


 - qcom,msi_addr: MSI interrupt address.
 - qcom,msi_base: Base value to add before writing MSI data into
MSI address register.
@@ -55,7 +57,8 @@ Optional properties:
 - qcom,ath10k-pre-calibration-data : pre calibration data as an 
array,

 the length can vary between hw versions.
 - -supply: handle to the regulator device tree node
-  optional "supply-name" is "vdd-0.8-cx-mx".
+  optional "supply-name" are "vdd-0.8-cx-mx",
+  "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".

 Example (to supply the calibration data alone):

@@ -133,8 +136,10 @@ wifi@1800 {
compatible = "qcom,wcn3990-wifi";
reg = <0x1880 0x80>;
reg-names = "membase";
-   clocks = <_gcc clk_aggre2_noc_clk>;
-   clock-names = "smmu_aggre2_noc_clk"
+   clocks = <_gcc clk_aggre2_noc_clk>,
+<_gcc clk_rf_clk2_pin>;
+   clock-names = "smmu_aggre2_noc_clk",
+ "cxo_ref_clk_pin";


The binding now says there should be 5 clocks...



Only 2 clocks are applicable for wcn3990. I will list no of clocks for 
each set of compatible for more clarity.



interrupts =
   <0 130 0 /* CE0 */ >,
   <0 131 0 /* CE1 */ >,
@@ -149,4 +154,7 @@ wifi@1800 {
   <0 140 0 /* CE10 */ >,
   <0 141 0 /* CE11 */ >;
vdd-0.8-cx-mx-supply = <_l5>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
 };
--
2.17.0



Thanks,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 4/4] dts: arm64/sdm845: Enable iommu for WCN3990 wifi module device node

2018-09-21 Thread Govind Singh
WCN3990 wifi module can optionally make use of the IOMMU.
Add phandle to the iommu and stream id of wifi iommu block.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/sdm845.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index b0b107641e74..5f5848cb1699 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -1224,6 +1224,7 @@
<0 423 0 /* CE9 */ >,
<0 424 0 /* CE10 */ >,
<0 425 0 /* CE11 */ >;
+   iommus = <_smmu 0x0040 0x1>;
};
};
 };
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 3/4] dt: bindings: add bindings for wifi iommu node

2018-09-21 Thread Govind Singh
WCN3990 wifi module can optionally make use of the IOMMU.
Add binding documentation for phandle to the IOMMU and
the stream id of wifi iommu block.

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 22dea7d83ee8..07e58008c665 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -59,6 +59,10 @@ Optional properties:
 - -supply: handle to the regulator device tree node
   optional "supply-name" are "vdd-0.8-cx-mx",
   "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
+- iommus:
+   Usage: optional
+   Value type: 
+   Definition: A list of phandle and IOMMU specifier pairs.
 
 Example (to supply the calibration data alone):
 
@@ -157,4 +161,5 @@ wifi@1800 {
vdd-1.8-xo-supply = <_l7a_1p8>;
vdd-1.3-rfa-supply = <_l17a_1p3>;
vdd-3.3-ch0-supply = <_l25a_3p3>;
+   iommus = <_smmu 0x0040 0x1>;
 };
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/4] dt: bindings: add missing dt properties for WCN3990 wifi node

2018-09-21 Thread Govind Singh
Add missing optional properties in WCN3990 wifi node.

Signed-off-by: Govind Singh 
---
 .../bindings/net/wireless/qcom,ath10k.txt | 22 +--
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 7fd4e8ce4149..22dea7d83ee8 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -37,12 +37,14 @@ Optional properties:
 - clocks: List of clock specifiers, must contain an entry for each required
   entry in clock-names.
 - clock-names: Should contain the clock names "wifi_wcss_cmd", "wifi_wcss_ref",
-   "wifi_wcss_rtc".
-- interrupts: List of interrupt lines. Must contain an entry
- for each entry in the interrupt-names property.
+   "wifi_wcss_rtc", "cxo_ref_clk_pin", "smmu_aggre2_noc_clk".
+- interrupts: List of interrupt lines. Must contain interrupt-names property
+ per entry for "qcom,ath10k", "qcom,ipq4019-wifi" compatible
+ targets.
 - interrupt-names: Must include the entries for MSI interrupt
   names ("msi0" to "msi15") and legacy interrupt
-  name ("legacy"),
+  name ("legacy") for "qcom,ath10k", "qcom,ipq4019-wifi"
+  compatible targets.
 - qcom,msi_addr: MSI interrupt address.
 - qcom,msi_base: Base value to add before writing MSI data into
MSI address register.
@@ -55,7 +57,8 @@ Optional properties:
 - qcom,ath10k-pre-calibration-data : pre calibration data as an array,
 the length can vary between hw versions.
 - -supply: handle to the regulator device tree node
-  optional "supply-name" is "vdd-0.8-cx-mx".
+  optional "supply-name" are "vdd-0.8-cx-mx",
+  "vdd-1.8-xo", "vdd-1.3-rfa" and "vdd-3.3-ch0".
 
 Example (to supply the calibration data alone):
 
@@ -133,8 +136,10 @@ wifi@1800 {
compatible = "qcom,wcn3990-wifi";
reg = <0x1880 0x80>;
reg-names = "membase";
-   clocks = <_gcc clk_aggre2_noc_clk>;
-   clock-names = "smmu_aggre2_noc_clk"
+   clocks = <_gcc clk_aggre2_noc_clk>,
+<_gcc clk_rf_clk2_pin>;
+   clock-names = "smmu_aggre2_noc_clk",
+ "cxo_ref_clk_pin";
interrupts =
   <0 130 0 /* CE0 */ >,
   <0 131 0 /* CE1 */ >,
@@ -149,4 +154,7 @@ wifi@1800 {
   <0 140 0 /* CE10 */ >,
   <0 141 0 /* CE11 */ >;
vdd-0.8-cx-mx-supply = <_l5>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
 };
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 0/4] Enable ath10k wcn3990 wifi driver support on sdm845

2018-09-21 Thread Govind Singh
This series enables ath10k wifi driver support for WCN3990 target
on sdm845 SOC. This series also updates the missing dt binding documentation
and adds optional iommu property.

sdm845 dtsi changes in this series are based on top of
https://patchwork.kernel.org/cover/10573121/ change.

Govind Singh (4):
  dt: bindings: add missing dt properties for WCN3990 wifi node
  dts: arm64/sdm845: Add WCN3990 WLAN module device node
  dt: bindings: add bindings for wifi iommu node
  dts: arm64/sdm845: Enable iommu for WCN3990 wifi module device node

 .../bindings/net/wireless/qcom,ath10k.txt | 27 ++-
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts   |  7 +
 arch/arm64/boot/dts/qcom/sdm845.dtsi  | 26 ++
 3 files changed, 53 insertions(+), 7 deletions(-)

-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/4] dts: arm64/sdm845: Add WCN3990 WLAN module device node

2018-09-21 Thread Govind Singh
Add device node for the ath10k SNOC platform driver probe
and add resources required for WCN3990 on SDM845 soc.

Signed-off-by: Govind Singh 
---
 arch/arm64/boot/dts/qcom/sdm845-mtp.dts |  7 +++
 arch/arm64/boot/dts/qcom/sdm845.dtsi| 25 +
 2 files changed, 32 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts 
b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
index eedfaf8922e2..4de57f7df93c 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts
@@ -440,3 +440,10 @@
bias-pull-up;
};
 };
+
+ {
+   vdd-0.8-cx-mx-supply = <_l5a_0p8>;
+   vdd-1.8-xo-supply = <_l7a_1p8>;
+   vdd-1.3-rfa-supply = <_l17a_1p3>;
+   vdd-3.3-ch0-supply = <_l25a_3p3>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi 
b/arch/arm64/boot/dts/qcom/sdm845.dtsi
index e080072cdfdb..b0b107641e74 100644
--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi
@@ -86,6 +86,11 @@
reg = <0 0x8620 0 0x2d0>;
no-map;
};
+
+   wlan_msa_mem: reserved-memory@9670 {
+   no-map;
+   reg = <0 0x9670 0 0x10>;
+   };
};
 
cpus {
@@ -1200,5 +1205,25 @@
status = "disabled";
};
};
+
+   qcom,wifi {
+   compatible = "qcom,wcn3990-wifi";
+   reg = <0x1880 0x80>;
+   reg-names = "membase";
+   memory-region = <_msa_mem>;
+   interrupts =
+   <0 413 0 /* CE0 */ >,
+   <0 414 0 /* CE1 */ >,
+   <0 415 0 /* CE2 */ >,
+   <0 416 0 /* CE3 */ >,
+   <0 417 0 /* CE4 */ >,
+   <0 418 0 /* CE5 */ >,
+   <0 420 0 /* CE6 */ >,
+   <0 421 0 /* CE7 */ >,
+   <0 422 0 /* CE8 */ >,
+   <0 423 0 /* CE9 */ >,
+   <0 424 0 /* CE10 */ >,
+   <0 425 0 /* CE11 */ >;
+   };
};
 };
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/2] ath10k: Disable napi before resource cleanup to avoid "use after free"

2018-09-19 Thread Govind Singh
CE buffers are cleaned up prior to napi disable and this is causing
NULL pointer dereference due to "use after free".

Disable napi before resource cleanup to avoid "use after free".

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index dd043b858c8e..6da951eea345 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -911,9 +911,9 @@ static void ath10k_snoc_buffer_cleanup(struct ath10k *ar)
 static void ath10k_snoc_hif_stop(struct ath10k *ar)
 {
ath10k_snoc_irq_disable(ar);
-   ath10k_snoc_buffer_cleanup(ar);
napi_synchronize(>napi);
napi_disable(>napi);
+   ath10k_snoc_buffer_cleanup(ar);
ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot hif stop\n");
 }
 
-- 
2.18.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/2] ath10k: Move napi_enable to hif_start for consistent pairing

2018-09-19 Thread Govind Singh
There is unbalanced napi_{enable,disable}() behavior as they
are being called from hif_snoc_{power_up/stop).

The fix is to call napi_enable() from ath10k_snoc_hif_start()
so that it matches with napi_disable() being called from
ath10k_snoc_hif_stop().

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/snoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index ed52a6308f76..dd043b858c8e 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -919,6 +919,7 @@ static void ath10k_snoc_hif_stop(struct ath10k *ar)
 
 static int ath10k_snoc_hif_start(struct ath10k *ar)
 {
+   napi_enable(>napi);
ath10k_snoc_irq_enable(ar);
ath10k_snoc_rx_post(ar);
 
@@ -1017,7 +1018,6 @@ static int ath10k_snoc_hif_power_up(struct ath10k *ar)
goto err_wlan_enable;
}
 
-   napi_enable(>napi);
return 0;
 
 err_wlan_enable:
-- 
2.18.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 2/2] ath10k: Enable pktlog for WCN3990 target

2018-08-27 Thread Govind Singh
WCN3990 target uses separate htc service for pktlog.
Add pktlog service request and support for pktlog
rx path handling.

Testing:
Tested on WCN3990 and QCA6174 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1,
   WLAN.RM.4.4.1-00109-QCARMSWPZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/htc.c  | 63 +-
 drivers/net/wireless/ath/ath10k/pci.c  |  2 +-
 drivers/net/wireless/ath/ath10k/snoc.c | 13 +-
 3 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c 
b/drivers/net/wireless/ath/ath10k/htc.c
index 8902720b4e49..ff91061cb3a9 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -803,8 +803,11 @@ int ath10k_htc_connect_service(struct ath10k_htc *htc,
ep->service_id,
>ul_pipe_id,
>dl_pipe_id);
-   if (status)
+   if (status) {
+   ath10k_warn(ar, "unsupported HTC service id: %d\n",
+   ep->service_id);
return status;
+   }
 
ath10k_dbg(ar, ATH10K_DBG_BOOT,
   "boot htc service '%s' ul pipe %d dl pipe %d eid %d ready\n",
@@ -838,6 +841,56 @@ struct sk_buff *ath10k_htc_alloc_skb(struct ath10k *ar, 
int size)
return skb;
 }
 
+static void ath10k_htc_pktlog_process_rx(struct ath10k *ar, struct sk_buff 
*skb)
+{
+   trace_ath10k_htt_pktlog(ar, skb->data, skb->len);
+   dev_kfree_skb_any(skb);
+}
+
+static int ath10k_htc_pktlog_connect(struct ath10k *ar)
+{
+   struct ath10k_htc_svc_conn_resp conn_resp;
+   struct ath10k_htc_svc_conn_req conn_req;
+   int status;
+
+   memset(_req, 0, sizeof(conn_req));
+   memset(_resp, 0, sizeof(conn_resp));
+
+   conn_req.ep_ops.ep_tx_complete = NULL;
+   conn_req.ep_ops.ep_rx_complete = ath10k_htc_pktlog_process_rx;
+   conn_req.ep_ops.ep_tx_credits = NULL;
+
+   /* connect to control service */
+   conn_req.service_id = ATH10K_HTC_SVC_ID_HTT_LOG_MSG;
+   status = ath10k_htc_connect_service(>htc, _req, _resp);
+   if (status) {
+   ath10k_warn(ar, "failed to connect to PKTLOG service: %d\n",
+   status);
+   return status;
+   }
+
+   return 0;
+}
+
+bool ath10k_htc_pktlog_svc_supported(struct ath10k *ar)
+{
+   u8 ul_pipe_id;
+   u8 dl_pipe_id;
+   int status;
+
+   status = ath10k_hif_map_service_to_pipe(ar, 
ATH10K_HTC_SVC_ID_HTT_LOG_MSG,
+   _pipe_id,
+   _pipe_id);
+   if (status) {
+   ath10k_warn(ar, "unsupported HTC service id: %d\n",
+   ATH10K_HTC_SVC_ID_HTT_LOG_MSG);
+
+   return false;
+   }
+
+   return true;
+}
+
 int ath10k_htc_start(struct ath10k_htc *htc)
 {
struct ath10k *ar = htc->ar;
@@ -871,6 +924,14 @@ int ath10k_htc_start(struct ath10k_htc *htc)
return status;
}
 
+   if (ath10k_htc_pktlog_svc_supported(ar)) {
+   status = ath10k_htc_pktlog_connect(ar);
+   if (status) {
+   ath10k_err(ar, "failed to connect to pktlog: %d\n", 
status);
+   return status;
+   }
+   }
+
return 0;
 }
 
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index 62fb16a4fa63..8816bcbaebad 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -1839,7 +1839,7 @@ int ath10k_pci_hif_map_service_to_pipe(struct ath10k *ar, 
u16 service_id,
}
}
 
-   if (WARN_ON(!ul_set || !dl_set))
+   if (!ul_set || !dl_set)
return -ENOENT;
 
return 0;
diff --git a/drivers/net/wireless/ath/ath10k/snoc.c 
b/drivers/net/wireless/ath/ath10k/snoc.c
index e9a6b3dc0c11..5a9c8faaed0e 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -62,6 +62,7 @@ static void ath10k_snoc_htt_tx_cb(struct ath10k_ce_pipe 
*ce_state);
 static void ath10k_snoc_htc_rx_cb(struct ath10k_ce_pipe *ce_state);
 static void ath10k_snoc_htt_rx_cb(struct ath10k_ce_pipe *ce_state);
 static void ath10k_snoc_htt_htc_rx_cb(struct ath10k_ce_pipe *ce_state);
+static void ath10k_snoc_pktlog_rx_cb(struct ath10k_ce_pipe *ce_state);
 
 static const struct ath10k_snoc_drv_priv drv_priv = {
.hw_rev = ATH10K_HW_WCN3990,
@@ -237,7 +238,7 @@ static struct ce_attr host_ce_config_wlan[] = {
.src_nentries = 0,
.src_sz_max = 2048,
.dest_nentries = 512,
-   .recv_cb = ath10k_snoc_htt_htc_rx_cb,
+   .recv_cb = a

[PATCH 0/2] ath10k: Enable pktlog for WCN3990 chipset

2018-08-27 Thread Govind Singh
WCN3990 target uses separate htc service(ATH10K_HTC_SVC_ID_HTT_LOG_MSG)
for pktlog. Add pktlog service request and support for pktlog
rx path handling.

Tested HW: WCN3990 and QCA6174.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1,
   WLAN.RM.4.4.1-00109-QCARMSWPZ-1

Govind Singh (2):
  ath10k: Introduce CE_ATTR_POLL attribute for polling pipe
  ath10k: Enable pktlog for WCN3990 target

 drivers/net/wireless/ath/ath10k/ce.c   | 18 ++--
 drivers/net/wireless/ath/ath10k/ce.h   | 11 +++--
 drivers/net/wireless/ath/ath10k/htc.c  | 63 +-
 drivers/net/wireless/ath/ath10k/pci.c  |  4 +-
 drivers/net/wireless/ath/ath10k/snoc.c | 13 +-
 5 files changed, 96 insertions(+), 13 deletions(-)

-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH 1/2] ath10k: Introduce CE_ATTR_POLL attribute for polling pipe

2018-08-27 Thread Govind Singh
Existing copy engine interrupt enable logic assumes that last
CE is using polling mode and due to this interrupt for last copy engine
are always disabled. WCN3990 uses last CE for pktlog and
interrupt remains disabled with existing logic.

To mitigate this issue, introduce CE_ATTR_POLL flag and control
the interrupt based on the flag which can be set in ce_attr.

Testing:
Tested on WCN3990 and QCA6174 HW.
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1,
   WLAN.RM.4.4.1-00109-QCARMSWPZ-1

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/ce.c  | 18 ++
 drivers/net/wireless/ath/ath10k/ce.h  | 11 +++
 drivers/net/wireless/ath/ath10k/pci.c |  2 +-
 3 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/ce.c 
b/drivers/net/wireless/ath/ath10k/ce.c
index 18c709c484e7..77bff557ef0d 100644
--- a/drivers/net/wireless/ath/ath10k/ce.c
+++ b/drivers/net/wireless/ath/ath10k/ce.c
@@ -1280,10 +1280,17 @@ static void ath10k_ce_per_engine_handler_adjust(struct 
ath10k_ce_pipe *ce_state)
 
 int ath10k_ce_disable_interrupts(struct ath10k *ar)
 {
+   struct ath10k_ce *ce = ath10k_ce_priv(ar);
+   struct ath10k_ce_pipe *ce_state;
+   u32 ctrl_addr;
int ce_id;
 
for (ce_id = 0; ce_id < CE_COUNT; ce_id++) {
-   u32 ctrl_addr = ath10k_ce_base_address(ar, ce_id);
+   ce_state  = >ce_states[ce_id];
+   if (ce_state->attr_flags & CE_ATTR_POLL)
+   continue;
+
+   ctrl_addr = ath10k_ce_base_address(ar, ce_id);
 
ath10k_ce_copy_complete_intr_disable(ar, ctrl_addr);
ath10k_ce_error_intr_disable(ar, ctrl_addr);
@@ -1300,11 +1307,14 @@ void ath10k_ce_enable_interrupts(struct ath10k *ar)
int ce_id;
struct ath10k_ce_pipe *ce_state;
 
-   /* Skip the last copy engine, CE7 the diagnostic window, as that
-* uses polling and isn't initialized for interrupts.
+   /* Enable interrupts for copy engine that
+* are not using polling mode.
 */
-   for (ce_id = 0; ce_id < CE_COUNT - 1; ce_id++) {
+   for (ce_id = 0; ce_id < CE_COUNT; ce_id++) {
ce_state  = >ce_states[ce_id];
+   if (ce_state->attr_flags & CE_ATTR_POLL)
+   continue;
+
ath10k_ce_per_engine_handler_adjust(ce_state);
}
 }
diff --git a/drivers/net/wireless/ath/ath10k/ce.h 
b/drivers/net/wireless/ath/ath10k/ce.h
index b8fb5382dede..ead9987c3259 100644
--- a/drivers/net/wireless/ath/ath10k/ce.h
+++ b/drivers/net/wireless/ath/ath10k/ce.h
@@ -275,16 +275,19 @@ void ath10k_ce_free_rri(struct ath10k *ar);
 
 /* ce_attr.flags values */
 /* Use NonSnooping PCIe accesses? */
-#define CE_ATTR_NO_SNOOP   1
+#define CE_ATTR_NO_SNOOP   BIT(0)
 
 /* Byte swap data words */
-#define CE_ATTR_BYTE_SWAP_DATA 2
+#define CE_ATTR_BYTE_SWAP_DATA BIT(1)
 
 /* Swizzle descriptors? */
-#define CE_ATTR_SWIZZLE_DESCRIPTORS4
+#define CE_ATTR_SWIZZLE_DESCRIPTORSBIT(2)
 
 /* no interrupt on copy completion */
-#define CE_ATTR_DIS_INTR   8
+#define CE_ATTR_DIS_INTR   BIT(3)
+
+/* no interrupt, only polling */
+#define CE_ATTR_POLL   BIT(4)
 
 /* Attributes of an instance of a Copy Engine */
 struct ce_attr {
diff --git a/drivers/net/wireless/ath/ath10k/pci.c 
b/drivers/net/wireless/ath/ath10k/pci.c
index af2cf55c4c1e..62fb16a4fa63 100644
--- a/drivers/net/wireless/ath/ath10k/pci.c
+++ b/drivers/net/wireless/ath/ath10k/pci.c
@@ -192,7 +192,7 @@ static struct ce_attr host_ce_config_wlan[] = {
 
/* CE7: ce_diag, the Diagnostic Window */
{
-   .flags = CE_ATTR_FLAGS,
+   .flags = CE_ATTR_FLAGS | CE_ATTR_POLL,
.src_nentries = 2,
.src_sz_max = DIAG_TRANSFER_LIMIT,
.dest_nentries = 2,
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v5 0/6] *** Add support for wifi QMI client handshakes ***

2018-08-15 Thread Govind Singh
Add QMI client handshakes for Q6 integrated WLAN connectivity subsystem.
This module is responsible for communicating WLAN control messages to FW
over QMI interface. This patch series enables the qmi handshakes required for
WCN3990 chipset.

QUALCOMM MSM Interface(QMI) provides the control interface between
components running b/w remote processors with underlying transport layer
based on integrated chipset(shared memory) or discrete 
chipset(PCI/USB/SDIO/UART).

QMI client driver implementation is based on qmi framework 
https://lwn.net/Articles/729924/.

Below is the sequence of qmi handshake.

   QMI CLIENT(APPS) QMI SERVER(FW 
in Q6)

 <--wlan service discoverd

   -connect to wlam qmi service->

   wlan info request->

   <wlan info resp

   msa info req>

 <msa info resp

 msa ready req>

 <msa ready resp

 <msa ready indication---

 capability req--->

<capability resp

qmi bdf req->

 <qmi bdf resp

  qmi cal trigger--->

  < QMI FW ready indication---

WLAN fw is running in modem Q6 dsp as user PD(protection domain).
Sequence of user PD loading is as following.

1) Remote proc PIL driver loads the modem fw/ROOT PD.
2) As part of ROOT pd boot-up it queries to a daemon(pd_mapper) running in apps
processor to determine how many usre pd's to be loaded by the remote 
processor(Q6).
3) Once user pd info is known to remote processor it loads the user pd via tftp
protocol.

https://github.com/andersson/pd-mapper
https://github.com/andersson/tqftpserv

Changes since V4:
Minor change in unload sequence, qmi handle is released prior work 
destroy.

Changes since V3:
Removed msa memory child node and used only memory-region property.
Fixed sparse warning reported in v3 change.
Changed qmi board id data type to u32 to align with fw defined value.

Changes since V2:
Addressed review comments from v2 version.
Removed msa-size from dt binding and added reference to 
reserved-memory/reserved-memory.txt.

Changes since V1:
Removed qmi client driver and integrated qmi client handshakes in snoc 
platform driver.
Addressed comments on v1 version.
Switched to ath10k bdf download infra(board-2.bin)
Added MSA fixed region support to support unload use-case.
Unified logging.

Testing:
Tested all qmi handshakes, driver load/unload and STA/SAP sanity 
testing.
Tested HW: SDM845(WCN3990)
Tested FW: WLAN.HL.2.0-01192-QCAHLSWMTPLZ-1


Govind Singh (5):
  ath10k: Add qmi service helpers for wcn3990 qmi client
  dt: bindings: add bindings for msa memory region
  firmware: qcom: scm: Add WLAN VMID for Qualcomm SCM interface
  ath10k: Add debug mask for QMI layer
  ath10k: Add QMI message handshake for wcn3990 client

Rakesh Pillai (1):
  ath10k: Add support to create boardname for non-bmi target

 .../bindings/net/wireless/qcom,ath10k.txt |6 +
 drivers/net/wireless/ath/ath10k/Kconfig   |1 +
 drivers/net/wireless/ath/ath10k/Makefile  |4 +-
 drivers/net/wireless/ath/ath10k/core.c|   14 +-
 drivers/net/wireless/ath/ath10k/core.h|4 +
 drivers/net/wireless/ath/ath10k/debug.h   |1 +
 drivers/net/wireless/ath/ath10k/qmi.c | 1019 
 drivers/net/wireless/ath/ath10k/qmi.h |  129 +
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.c| 2072 +
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.h|  677 ++
 drivers/net/wireless/ath/ath10k/snoc.c|  262 ++-
 drivers/net/wireless/ath/ath10k/snoc.h|4 +
 include/linux/qcom_scm.h  |4 +-
 13 files changed, 4186 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.c
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.h
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h

-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v5 6/6] ath10k: Add QMI message handshake for wcn3990 client

2018-08-15 Thread Govind Singh
Add WCN3990 QMI client handshakes for Q6 integrated WLAN connectivity
subsystem. This layer is responsible for communicating qmi control
messages to wifi fw QMI service using QMI messaging protocol.

Qualcomm MSM Interface(QMI) is a messaging format used to communicate
between components running between remote processors with underlying
transport layer based on integrated chipset(shared memory) or
discrete chipset(PCI/USB/SDIO/UART).

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/Kconfig  |1 +
 drivers/net/wireless/ath/ath10k/Makefile |4 +-
 drivers/net/wireless/ath/ath10k/core.c   |6 +-
 drivers/net/wireless/ath/ath10k/core.h   |2 +
 drivers/net/wireless/ath/ath10k/qmi.c| 1019 ++
 drivers/net/wireless/ath/ath10k/qmi.h|  129 +++
 drivers/net/wireless/ath/ath10k/snoc.c   |  262 +-
 drivers/net/wireless/ath/ath10k/snoc.h   |4 +
 8 files changed, 1417 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.c
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.h

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index 54ff5930126c..7bf3615bd89c 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -43,6 +43,7 @@ config ATH10K_USB
 config ATH10K_SNOC
tristate "Qualcomm ath10k SNOC support (EXPERIMENTAL)"
depends on ATH10K && ARCH_QCOM
+   select QCOM_QMI_HELPERS
---help---
  This module adds support for integrated WCN3990 chip connected
  to system NOC(SNOC). Currently work in progress and will not
diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index 44d60a61b242..66326b949ab1 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -36,7 +36,9 @@ obj-$(CONFIG_ATH10K_USB) += ath10k_usb.o
 ath10k_usb-y += usb.o
 
 obj-$(CONFIG_ATH10K_SNOC) += ath10k_snoc.o
-ath10k_snoc-y += snoc.o
+ath10k_snoc-y += qmi.o \
+qmi_wlfw_v01.o \
+snoc.o
 
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 840e301b6a6e..dfaf7e32ca32 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1145,7 +1145,7 @@ static int ath10k_download_fw(struct ath10k *ar)
return ret;
 }
 
-static void ath10k_core_free_board_files(struct ath10k *ar)
+void ath10k_core_free_board_files(struct ath10k *ar)
 {
if (!IS_ERR(ar->normal_mode_fw.board))
release_firmware(ar->normal_mode_fw.board);
@@ -1154,6 +1154,7 @@ static void ath10k_core_free_board_files(struct ath10k 
*ar)
ar->normal_mode_fw.board_data = NULL;
ar->normal_mode_fw.board_len = 0;
 }
+EXPORT_SYMBOL(ath10k_core_free_board_files);
 
 static void ath10k_core_free_firmware_files(struct ath10k *ar)
 {
@@ -1459,7 +1460,7 @@ static int ath10k_core_create_board_name(struct ath10k 
*ar, char *name,
return 0;
 }
 
-static int ath10k_core_fetch_board_file(struct ath10k *ar)
+int ath10k_core_fetch_board_file(struct ath10k *ar)
 {
char boardname[100], fallback_boardname[100];
int ret;
@@ -1497,6 +1498,7 @@ static int ath10k_core_fetch_board_file(struct ath10k *ar)
ath10k_dbg(ar, ATH10K_DBG_BOOT, "using board api %d\n", ar->bd_api);
return 0;
 }
+EXPORT_SYMBOL(ath10k_core_fetch_board_file);
 
 int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
 struct ath10k_fw_file *fw_file)
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3a4ac3c0d5a6..a4d70005c4fe 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1166,5 +1166,7 @@ int ath10k_wait_for_suspend(struct ath10k *ar, u32 
suspend_opt);
 void ath10k_core_stop(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar, u32 chip_id);
 void ath10k_core_unregister(struct ath10k *ar);
+int ath10k_core_fetch_board_file(struct ath10k *ar);
+void ath10k_core_free_board_files(struct ath10k *ar);
 
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
new file mode 100644
index ..784e082e4a28
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -0,0 +1,1019 @@
+/*
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE IN

[PATCH v5 2/6] ath10k: Add support to create boardname for non-bmi target

2018-08-15 Thread Govind Singh
From: Rakesh Pillai 

Add support to create the boardname for non-bmi targets
like WCN3990, which uses qmi for bdf download. This
boardname is used to parse the board data from board-2.bin.

Signed-off-by: Rakesh Pillai 
Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/core.c | 8 
 drivers/net/wireless/ath/ath10k/core.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 85c58ebbfb26..840e301b6a6e 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1440,6 +1440,14 @@ static int ath10k_core_create_board_name(struct ath10k 
*ar, char *name,
goto out;
}
 
+   if (ar->id.qmi_ids_valid) {
+   scnprintf(name, name_len,
+ "bus=%s,qmi-board-id=%x",
+ ath10k_bus_str(ar->hif.bus),
+ ar->id.qmi_board_id);
+   goto out;
+   }
+
scnprintf(name, name_len,
  
"bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s",
  ath10k_bus_str(ar->hif.bus),
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 427ee5752bb0..3a4ac3c0d5a6 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -941,6 +941,8 @@ struct ath10k {
u32 subsystem_device;
 
bool bmi_ids_valid;
+   bool qmi_ids_valid;
+   u32 qmi_board_id;
u8 bmi_board_id;
u8 bmi_chip_id;
 
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v5 3/6] dt: bindings: add bindings for msa memory region

2018-08-15 Thread Govind Singh
Add device tree binding documentation details of msa
memory region for ath10k qmi client for SDM845/APQ8098
SoC into "qcom,ath10k.txt".

Signed-off-by: Govind Singh 
---
 .../devicetree/bindings/net/wireless/qcom,ath10k.txt| 6 ++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
index 7fd4e8ce4149..2196d1ab3c8c 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -56,6 +56,11 @@ Optional properties:
 the length can vary between hw versions.
 - -supply: handle to the regulator device tree node
   optional "supply-name" is "vdd-0.8-cx-mx".
+- memory-region:
+   Usage: optional
+   Value type: 
+   Definition: reference to the reserved-memory for the msa region
+   used by the wifi firmware running in Q6.
 
 Example (to supply the calibration data alone):
 
@@ -149,4 +154,5 @@ wifi@1800 {
   <0 140 0 /* CE10 */ >,
   <0 141 0 /* CE11 */ >;
vdd-0.8-cx-mx-supply = <_l5>;
+   memory-region = <_msa_mem>;
 };
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v5 1/6] ath10k: Add qmi service helpers for wcn3990 qmi client

2018-08-15 Thread Govind Singh
WLAN qmi server running in Q6 exposes host to target
cold boot qmi handshakes. Add WLAN QMI service helpers
for ath10k wcn3990 qmi client.

Signed-off-by: Govind Singh 
---
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.c| 2072 +
 .../net/wireless/ath/ath10k/qmi_wlfw_v01.h|  677 ++
 2 files changed, 2749 insertions(+)
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.h

diff --git a/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c 
b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
new file mode 100644
index ..ba79c2e4aed6
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/qmi_wlfw_v01.c
@@ -0,0 +1,2072 @@
+/*
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include 
+#include 
+#include "qmi_wlfw_v01.h"
+
+static struct qmi_elem_info wlfw_ce_tgt_pipe_cfg_s_v01_ei[] = {
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_tgt_pipe_cfg_s_v01,
+  pipe_num),
+   },
+   {
+   .data_type  = QMI_SIGNED_4_BYTE_ENUM,
+   .elem_len   = 1,
+   .elem_size  = sizeof(enum wlfw_pipedir_enum_v01),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_tgt_pipe_cfg_s_v01,
+  pipe_dir),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_tgt_pipe_cfg_s_v01,
+  nentries),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_tgt_pipe_cfg_s_v01,
+  nbytes_max),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_tgt_pipe_cfg_s_v01,
+  flags),
+   },
+   {}
+};
+
+static struct qmi_elem_info wlfw_ce_svc_pipe_cfg_s_v01_ei[] = {
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_svc_pipe_cfg_s_v01,
+  service_id),
+   },
+   {
+   .data_type  = QMI_SIGNED_4_BYTE_ENUM,
+   .elem_len   = 1,
+   .elem_size  = sizeof(enum wlfw_pipedir_enum_v01),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_svc_pipe_cfg_s_v01,
+  pipe_dir),
+   },
+   {
+   .data_type  = QMI_UNSIGNED_4_BYTE,
+   .elem_len   = 1,
+   .elem_size  = sizeof(u32),
+   .array_type = NO_ARRAY,
+   .tlv_type   = 0,
+   .offset = offsetof(struct wlfw_ce_svc_pipe_cfg_s_v01,
+  pipe_num),
+   },
+   {}
+};
+
+static struct qmi_elem_info wlfw_shadow_reg_cfg_s_v01_ei[] = {
+   {
+   .data_type  = QMI_UNSIGNED_2_BYTE,
+   .elem_len   = 1,
+ 

[PATCH v5 4/6] firmware: qcom: scm: Add WLAN VMID for Qualcomm SCM interface

2018-08-15 Thread Govind Singh
Add WLAN related VMID's to support wlan driver to set up
the remote's permissions call via TrustZone.

Signed-off-by: Govind Singh 
---
 include/linux/qcom_scm.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h
index b401b962afff..da63d84e1e91 100644
--- a/include/linux/qcom_scm.h
+++ b/include/linux/qcom_scm.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2010-2015, 2018, The Linux Foundation. All rights reserved.
  * Copyright (C) 2015 Linaro Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,8 @@ struct qcom_scm_vmperm {
 
 #define QCOM_SCM_VMID_HLOS   0x3
 #define QCOM_SCM_VMID_MSS_MSA0xF
+#define QCOM_SCM_VMID_WLAN   0x18
+#define QCOM_SCM_VMID_WLAN_CE0x19
 #define QCOM_SCM_PERM_READ   0x4
 #define QCOM_SCM_PERM_WRITE  0x2
 #define QCOM_SCM_PERM_EXEC   0x1
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v5 5/6] ath10k: Add debug mask for QMI layer

2018-08-15 Thread Govind Singh
Add debug mask to control debug info of ath10k qmi
messaging layer.

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/debug.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/ath/ath10k/debug.h 
b/drivers/net/wireless/ath/ath10k/debug.h
index 0afca5c106b6..a2f84fdb9131 100644
--- a/drivers/net/wireless/ath/ath10k/debug.h
+++ b/drivers/net/wireless/ath/ath10k/debug.h
@@ -44,6 +44,7 @@ enum ath10k_debug_mask {
ATH10K_DBG_USB  = 0x0004,
ATH10K_DBG_USB_BULK = 0x0008,
ATH10K_DBG_SNOC = 0x0010,
+   ATH10K_DBG_QMI  = 0x0020,
ATH10K_DBG_ANY  = 0x,
 };
 
-- 
2.17.0


___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v4 6/6] ath10k: Add QMI message handshake for wcn3990 client

2018-08-14 Thread Govind Singh

Thanks Brian for the review.

On 2018-08-14 01:36, Brian Norris wrote:

Hi Govind,

On Mon, Jul 23, 2018 at 06:04:28PM +0530, Govind Singh wrote:

Add WCN3990 QMI client handshakes for Q6 integrated WLAN connectivity
subsystem. This layer is responsible for communicating qmi control
messages to wifi fw QMI service using QMI messaging protocol.

Qualcomm MSM Interface(QMI) is a messaging format used to communicate
between components running between remote processors with underlying
transport layer based on integrated chipset(shared memory) or
discrete chipset(PCI/USB/SDIO/UART).

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/Kconfig  |1 +
 drivers/net/wireless/ath/ath10k/Makefile |4 +-
 drivers/net/wireless/ath/ath10k/core.c   |6 +-
 drivers/net/wireless/ath/ath10k/core.h   |2 +
 drivers/net/wireless/ath/ath10k/qmi.c| 1019 
++

 drivers/net/wireless/ath/ath10k/qmi.h|  129 +++
 drivers/net/wireless/ath/ath10k/snoc.c   |  262 +-
 drivers/net/wireless/ath/ath10k/snoc.h   |4 +
 8 files changed, 1417 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.c
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.h



diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c

new file mode 100644
index ..d91499a7354c
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -0,0 +1,1019 @@


...


+int ath10k_qmi_deinit(struct ath10k *ar)
+{
+   struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
+   struct ath10k_qmi *qmi = ar_snoc->qmi;
+
+   cancel_work_sync(>event_work);
+   destroy_workqueue(qmi->event_wq);


I believe this is incorrect ordering. You should not be destroying the
work queue that handles QMI event responses before you release the QMI
handle. As it stands, this means you segfault during 'rmmod'.



Yes, correct. I will correct this in v5 as this is still not merged in 
ath10k-next.



+   qmi_handle_release(>qmi_hdl);


I think this should be:

qmi_handle_release(>qmi_hdl);
cancel_work_sync(>event_work);
destroy_workqueue(qmi->event_wq);


+   qmi = NULL;


This assignment is pointless, as 'qmi' is a local variable. Maybe you
meant to clear the struct member, as a precaution? So this would be:

ar_snoc->qmi = NULL;



Yes, i will correct this in v5.


Brian


+
+   return 0;
+}


Thanks,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v3 0/6] *** Add support for wifi QMI client handshakes ***

2018-07-23 Thread Govind Singh

Hi Niklas,

Thanks for the review.

On 2018-07-19 23:21, Niklas Cassel wrote:

On Fri, Jul 06, 2018 at 02:26:17PM +0530, Govind Singh wrote:
Add QMI client handshakes for Q6 integrated WLAN connectivity 
subsystem.
This module is responsible for communicating WLAN control messages to 
FW
over QMI interface. This patch series enables the qmi handshakes 
required for

WCN3990 chipset.


(cut)

Hello Govind,

I ran make W=1, sparse, and checkpatch on your new iteration of 
patches.
(I didn't do a full manual review this time, since I did that last 
time.)


Building with warnings and checkpatch looks good,
but sparse reports the two following warnings:

  CHECK   drivers/net/wireless/ath/ath10k//qmi.c
drivers/net/wireless/ath/ath10k//qmi.c:935:29: warning: incorrect type
in assignment (different address spaces)
drivers/net/wireless/ath/ath10k//qmi.c:935:29:expected void *msa_va
drivers/net/wireless/ath/ath10k//qmi.c:935:29:got void [noderef] 
*




Fixed in v4 version.


and

drivers/net/wireless/ath/ath10k//snoc.c:76:22: warning: incorrect type
in initializer (different base types)
drivers/net/wireless/ath/ath10k//snoc.c:76:22:expected restricted
__le16 [usertype] reg_offset
drivers/net/wireless/ath/ath10k//snoc.c:76:22:got int
drivers/net/wireless/ath/ath10k//snoc.c:77:19: warning: incorrect type
in initializer (different base types)
drivers/net/wireless/ath/ath10k//snoc.c:77:19:expected restricted
__le16 [usertype] ce_id
drivers/net/wireless/ath/ath10k//snoc.c:77:19:got int
drivers/net/wireless/ath/ath10k//snoc.c:77:22: warning: incorrect type
in initializer (different base types)
drivers/net/wireless/ath/ath10k//snoc.c:77:22:expected restricted
__le16 [usertype] reg_offset
drivers/net/wireless/ath/ath10k//snoc.c:77:22:got int
drivers/net/wireless/ath/ath10k//snoc.c:78:19: warning: incorrect type
in initializer (different base types)
drivers/net/wireless/ath/ath10k//snoc.c:78:19:expected restricted


Fixed in v4 version.

Thanks,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


Re: [PATCH v3 3/6] dt: bindings: add bindings for msa memory region

2018-07-23 Thread Govind Singh

Hi Rob,

On 2018-07-11 20:57, Rob Herring wrote:

On Fri, Jul 06, 2018 at 02:30:43PM +0530, Govind Singh wrote:

Add device tree binding documentation details of msa
memory region for ath10k qmi client for SDM845/APQ8098
SoC into "qcom,ath10k.txt".

Signed-off-by: Govind Singh 
---
 .../bindings/net/wireless/qcom,ath10k.txt   | 13 
+

 1 file changed, 13 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt 
b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt

index 7fd4e8ce4149..87489054aea5 100644
--- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
+++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt
@@ -57,6 +57,16 @@ Optional properties:
 - -supply: handle to the regulator device tree node
   optional "supply-name" is "vdd-0.8-cx-mx".

+= SUBNODES:
+wcn3990-wifi node may contain one subnode, named "msa" representing
+the fixed msa memory regions used by the wifi firmware running in Q6.
+This sub-node must contain:


Why do you need a sub-node? Just add memory-region property.


Fixed in v4 version.

Thanks,
Govind

___
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k


[PATCH v4 6/6] ath10k: Add QMI message handshake for wcn3990 client

2018-07-23 Thread Govind Singh
Add WCN3990 QMI client handshakes for Q6 integrated WLAN connectivity
subsystem. This layer is responsible for communicating qmi control
messages to wifi fw QMI service using QMI messaging protocol.

Qualcomm MSM Interface(QMI) is a messaging format used to communicate
between components running between remote processors with underlying
transport layer based on integrated chipset(shared memory) or
discrete chipset(PCI/USB/SDIO/UART).

Signed-off-by: Govind Singh 
---
 drivers/net/wireless/ath/ath10k/Kconfig  |1 +
 drivers/net/wireless/ath/ath10k/Makefile |4 +-
 drivers/net/wireless/ath/ath10k/core.c   |6 +-
 drivers/net/wireless/ath/ath10k/core.h   |2 +
 drivers/net/wireless/ath/ath10k/qmi.c| 1019 ++
 drivers/net/wireless/ath/ath10k/qmi.h|  129 +++
 drivers/net/wireless/ath/ath10k/snoc.c   |  262 +-
 drivers/net/wireless/ath/ath10k/snoc.h   |4 +
 8 files changed, 1417 insertions(+), 10 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.c
 create mode 100644 drivers/net/wireless/ath/ath10k/qmi.h

diff --git a/drivers/net/wireless/ath/ath10k/Kconfig 
b/drivers/net/wireless/ath/ath10k/Kconfig
index 54ff5930126c..7bf3615bd89c 100644
--- a/drivers/net/wireless/ath/ath10k/Kconfig
+++ b/drivers/net/wireless/ath/ath10k/Kconfig
@@ -43,6 +43,7 @@ config ATH10K_USB
 config ATH10K_SNOC
tristate "Qualcomm ath10k SNOC support (EXPERIMENTAL)"
depends on ATH10K && ARCH_QCOM
+   select QCOM_QMI_HELPERS
---help---
  This module adds support for integrated WCN3990 chip connected
  to system NOC(SNOC). Currently work in progress and will not
diff --git a/drivers/net/wireless/ath/ath10k/Makefile 
b/drivers/net/wireless/ath/ath10k/Makefile
index 44d60a61b242..66326b949ab1 100644
--- a/drivers/net/wireless/ath/ath10k/Makefile
+++ b/drivers/net/wireless/ath/ath10k/Makefile
@@ -36,7 +36,9 @@ obj-$(CONFIG_ATH10K_USB) += ath10k_usb.o
 ath10k_usb-y += usb.o
 
 obj-$(CONFIG_ATH10K_SNOC) += ath10k_snoc.o
-ath10k_snoc-y += snoc.o
+ath10k_snoc-y += qmi.o \
+qmi_wlfw_v01.o \
+snoc.o
 
 # for tracing framework to find trace.h
 CFLAGS_trace.o := -I$(src)
diff --git a/drivers/net/wireless/ath/ath10k/core.c 
b/drivers/net/wireless/ath/ath10k/core.c
index 840e301b6a6e..dfaf7e32ca32 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -1145,7 +1145,7 @@ static int ath10k_download_fw(struct ath10k *ar)
return ret;
 }
 
-static void ath10k_core_free_board_files(struct ath10k *ar)
+void ath10k_core_free_board_files(struct ath10k *ar)
 {
if (!IS_ERR(ar->normal_mode_fw.board))
release_firmware(ar->normal_mode_fw.board);
@@ -1154,6 +1154,7 @@ static void ath10k_core_free_board_files(struct ath10k 
*ar)
ar->normal_mode_fw.board_data = NULL;
ar->normal_mode_fw.board_len = 0;
 }
+EXPORT_SYMBOL(ath10k_core_free_board_files);
 
 static void ath10k_core_free_firmware_files(struct ath10k *ar)
 {
@@ -1459,7 +1460,7 @@ static int ath10k_core_create_board_name(struct ath10k 
*ar, char *name,
return 0;
 }
 
-static int ath10k_core_fetch_board_file(struct ath10k *ar)
+int ath10k_core_fetch_board_file(struct ath10k *ar)
 {
char boardname[100], fallback_boardname[100];
int ret;
@@ -1497,6 +1498,7 @@ static int ath10k_core_fetch_board_file(struct ath10k *ar)
ath10k_dbg(ar, ATH10K_DBG_BOOT, "using board api %d\n", ar->bd_api);
return 0;
 }
+EXPORT_SYMBOL(ath10k_core_fetch_board_file);
 
 int ath10k_core_fetch_firmware_api_n(struct ath10k *ar, const char *name,
 struct ath10k_fw_file *fw_file)
diff --git a/drivers/net/wireless/ath/ath10k/core.h 
b/drivers/net/wireless/ath/ath10k/core.h
index 3a4ac3c0d5a6..a4d70005c4fe 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -1166,5 +1166,7 @@ int ath10k_wait_for_suspend(struct ath10k *ar, u32 
suspend_opt);
 void ath10k_core_stop(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar, u32 chip_id);
 void ath10k_core_unregister(struct ath10k *ar);
+int ath10k_core_fetch_board_file(struct ath10k *ar);
+void ath10k_core_free_board_files(struct ath10k *ar);
 
 #endif /* _CORE_H_ */
diff --git a/drivers/net/wireless/ath/ath10k/qmi.c 
b/drivers/net/wireless/ath/ath10k/qmi.c
new file mode 100644
index ..d91499a7354c
--- /dev/null
+++ b/drivers/net/wireless/ath/ath10k/qmi.c
@@ -0,0 +1,1019 @@
+/*
+ * Copyright (c) 2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE IN

  1   2   3   >