diff mbox series

ath10k: do not enforce interrupt trigger type

Message ID 20220513151516.357549-1-krzysztof.kozlowski@linaro.org
State New
Headers show
Series ath10k: do not enforce interrupt trigger type | expand

Commit Message

Krzysztof Kozlowski May 13, 2022, 3:15 p.m. UTC
Interrupt line can be configured on different hardware in different way,
even inverted.  Therefore driver should not enforce specific trigger
type - edge rising - but instead rely on Devicetree to configure it.

All Qualcomm DTSI with WCN3990 define the interrupt type as level high,
so the mismatch between DTSI and driver causes rebind issues:

  $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind
  $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind
  [   44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-controller@17a00000!
  [   44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not found
  [   44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: -6

Fixes: c963a683e701 ("ath10k: add resource init and deinit for WCN3990")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Separate question is whether DTS has a proper interrupt type (level
high) configured...
---
 drivers/net/wireless/ath/ath10k/snoc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Steev Klimaszewski May 14, 2022, 5:05 a.m. UTC | #1
On 5/13/22 10:57 AM, Kalle Valo wrote:
> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> writes:
>
>> Interrupt line can be configured on different hardware in different way,
>> even inverted.  Therefore driver should not enforce specific trigger
>> type - edge rising - but instead rely on Devicetree to configure it.
>>
>> All Qualcomm DTSI with WCN3990 define the interrupt type as level high,
>> so the mismatch between DTSI and driver causes rebind issues:
>>
>>    $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind
>>    $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind
>>    [   44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-controller@17a00000!
>>    [   44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not found
>>    [   44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: -6
> So you tested on WCN3990? On what firmware version? I can add the
> Tested-on tag if you provide that.
>
Hello Krzystof, Kalle,

I have seen this issue as well on a Lenovo Flex 5G, which has a WCN3990:

wcn3990 hw1.0 target 0x00000008 chip_id 0x00000000 sub 0000:0000
kconfig debug 0 debugfs 0 tracing 0 dfs 0 testmode 0
firmware ver  api 5 features wowlan,mgmt-tx-by-reference,non-bmi crc32 
b3d4b790
htt-ver 3.86 wmi-op 4 htt-op 3 cal file max-sta 32 raw 0 hwcrypto 1

With this patch applied, I no longer see the error message in the commit 
message, when I unbind/bind when wifi stops working.

Tested-by: Steev Klimaszewski <steev@kali.org>

-- Steev
Krzysztof Kozlowski May 14, 2022, 7:32 p.m. UTC | #2
On 13/05/2022 17:57, Kalle Valo wrote:
> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> writes:
> 
>> Interrupt line can be configured on different hardware in different way,
>> even inverted.  Therefore driver should not enforce specific trigger
>> type - edge rising - but instead rely on Devicetree to configure it.
>>
>> All Qualcomm DTSI with WCN3990 define the interrupt type as level high,
>> so the mismatch between DTSI and driver causes rebind issues:
>>
>>   $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind
>>   $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind
>>   [   44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-controller@17a00000!
>>   [   44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not found
>>   [   44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: -6
> 
> So you tested on WCN3990? On what firmware version?


I run it on a Qualcomm RB3 board with Qualcomm SDM845 and WCN3990.
However on that kernel I did not manage to WiFi actually work -
regardless of that patch - so I would no count it yet as fully tested.

It would be great if someone would provide some tests. I saw Steev's
replies - thanks!

Best regards,
Krzysztof
Krzysztof Kozlowski May 14, 2022, 7:32 p.m. UTC | #3
On 14/05/2022 20:09, Steev Klimaszewski wrote:

>> wcn3990 hw1.0 target 0x00000008 chip_id 0x00000000 sub 0000:0000
>> kconfig debug 0 debugfs 0 tracing 0 dfs 0 testmode 0
>> firmware ver  api 5 features wowlan,mgmt-tx-by-reference,non-bmi crc32 
>> b3d4b790
>> htt-ver 3.86 wmi-op 4 htt-op 3 cal file max-sta 32 raw 0 hwcrypto 1
>>
>> With this patch applied, I no longer see the error message in the 
>> commit message, when I unbind/bind when wifi stops working.
>>
>> Tested-by: Steev Klimaszewski <steev@kali.org>
>>
>> -- Steev
>>
> Apologies for the second email - I've tested this now on both the Lenovo 
> Flex 5G, as I have seen the issue on it as well, as well as on the 
> Lenovo Yoga C630, where I did not but I did have issues with attempting 
> to rebind the device, prior to this patch.
> 
> Firmware version for the Flex 5G is
> 
> qmi chip_id 0x30224 chip_family 0x4001 board_id 0xff soc_id 0x40060000
> qmi fw_version 0x32080009 fw_build_timestamp 2020-11-16 14:44 
> fw_build_id 
> QC_IMAGE_VERSION_STRING=WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1
> 
> Firmware version on the Yoga C630 is
> 
> qmi chip_id 0x30214 chip_family 0x4001 board_id 0xff soc_id 0x40030001
> qmi fw_version 0x2009856b fw_build_timestamp 2018-07-19 12:28 
> fw_build_id QC_IMAGE_VERSION_STRING=WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1
> 

Thanks for testing, much appreciated!


Best regards,
Krzysztof
Kalle Valo May 18, 2022, 7:18 a.m. UTC | #4
Steev Klimaszewski <steev@kali.org> writes:

> On 5/14/22 12:05 AM, Steev Klimaszewski wrote:
>>
>> On 5/13/22 10:57 AM, Kalle Valo wrote:
>>> Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> writes:
>>>
>>>> Interrupt line can be configured on different hardware in
>>>> different way,
>>>> even inverted.  Therefore driver should not enforce specific trigger
>>>> type - edge rising - but instead rely on Devicetree to configure it.
>>>>
>>>> All Qualcomm DTSI with WCN3990 define the interrupt type as level high,
>>>> so the mismatch between DTSI and driver causes rebind issues:
>>>>
>>>>    $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind
>>>>    $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind
>>>>    [   44.763114] irq: type mismatch, failed to map hwirq-446 for
>>>> interrupt-controller@17a00000!
>>>>    [   44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ
>>>> index 0 not found
>>>>    [   44.763140] ath10k_snoc 18800000.wifi: failed to initialize
>>>> resource: -6
>>> So you tested on WCN3990? On what firmware version? I can add the
>>> Tested-on tag if you provide that.
>>>
>> Hello Krzystof, Kalle,
>>
>> I have seen this issue as well on a Lenovo Flex 5G, which has a WCN3990:
>>
>> wcn3990 hw1.0 target 0x00000008 chip_id 0x00000000 sub 0000:0000
>> kconfig debug 0 debugfs 0 tracing 0 dfs 0 testmode 0
>> firmware ver  api 5 features wowlan,mgmt-tx-by-reference,non-bmi
>> crc32 b3d4b790
>> htt-ver 3.86 wmi-op 4 htt-op 3 cal file max-sta 32 raw 0 hwcrypto 1
>>
>> With this patch applied, I no longer see the error message in the
>> commit message, when I unbind/bind when wifi stops working.
>>
>> Tested-by: Steev Klimaszewski <steev@kali.org>
>>
>> -- Steev
>>
> Apologies for the second email - I've tested this now on both the
> Lenovo Flex 5G, as I have seen the issue on it as well, as well as on
> the Lenovo Yoga C630, where I did not but I did have issues with
> attempting to rebind the device, prior to this patch.
>
> Firmware version for the Flex 5G is
>
> qmi chip_id 0x30224 chip_family 0x4001 board_id 0xff soc_id 0x40060000
> qmi fw_version 0x32080009 fw_build_timestamp 2020-11-16 14:44
> fw_build_id
> QC_IMAGE_VERSION_STRING=WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1
>
> Firmware version on the Yoga C630 is
>
> qmi chip_id 0x30214 chip_family 0x4001 board_id 0xff soc_id 0x40030001
> qmi fw_version 0x2009856b fw_build_timestamp 2018-07-19 12:28
> fw_build_id QC_IMAGE_VERSION_STRING=WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

In the pending branch I added these to the commit log:

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1
Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1

Thanks for testing, very much appreciated!
Kalle Valo May 22, 2022, 12:22 p.m. UTC | #5
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote:

> Interrupt line can be configured on different hardware in different way,
> even inverted.  Therefore driver should not enforce specific trigger
> type - edge rising - but instead rely on Devicetree to configure it.
> 
> All Qualcomm DTSI with WCN3990 define the interrupt type as level high,
> so the mismatch between DTSI and driver causes rebind issues:
> 
>   $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind
>   $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind
>   [   44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-controller@17a00000!
>   [   44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not found
>   [   44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: -6
> 
> Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1
> Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1
> 
> Fixes: c963a683e701 ("ath10k: add resource init and deinit for WCN3990")
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Tested-by: Steev Klimaszewski <steev@kali.org>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

Patch applied to ath-next branch of ath.git, thanks.

1ee6c5abebd3 ath10k: do not enforce interrupt trigger type
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index 607e8164bf98..5576ad9fd116 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1249,13 +1249,12 @@  static void ath10k_snoc_init_napi(struct ath10k *ar)
 static int ath10k_snoc_request_irq(struct ath10k *ar)
 {
 	struct ath10k_snoc *ar_snoc = ath10k_snoc_priv(ar);
-	int irqflags = IRQF_TRIGGER_RISING;
 	int ret, id;
 
 	for (id = 0; id < CE_COUNT_MAX; id++) {
 		ret = request_irq(ar_snoc->ce_irqs[id].irq_line,
-				  ath10k_snoc_per_engine_handler,
-				  irqflags, ce_name[id], ar);
+				  ath10k_snoc_per_engine_handler, 0,
+				  ce_name[id], ar);
 		if (ret) {
 			ath10k_err(ar,
 				   "failed to register IRQ handler for CE %d: %d\n",