openwrt/package/kernel/ath10k-ct/patches/130-ath10k-read-qcom-coexist-support-as-a-u32.patch
Vincent Tremblay 9e4ede8344 ipq40xx: add support for Linksys WHW03 V2
SOC:             Qualcomm IPQ4019
WiFi 1:          QCA4019 IEEE 802.11b/g/n
WiFi 2:          QCA4019 IEEE 802.11a/n/ac
WiFi 3:          QCA8888 IEEE 802.11a/n/ac
Bluetooth:       Qualcomm CSR8811 (A12U)
Zigbee:          Silicon Labs EM3581 NCP + Skyworks SE2432L
Ethernet:        Qualcomm Atheros QCA8072 (2-port)
Flash 1:         Mactronix MX30LF4G18AC-XKI
RAM (NAND):      SK hynix H5TC4G63CFR-PBA (512MB)
LED Controller:  NXP PCA9633 (I2C)
Buttons:         Single reset button (GPIO).

- The three WiFis were fully tested and are configured with the same settings as in the vendor firmware.
- The specific board files were submitted to the ATH10k mailing list but I'm still waiting for a reply. They can be removed once they are approved upstream.
- Two ethernet ports are accessible on the device. By default one is configured as WAN and the other one is LAN. They are fully working.

Bluetooth:
========
- Fully working with the following caveats:
  - RFKILL need to be enabled in the kernel.
  - An older version of bluez is needed as bccmd is needed to configure the chip.

Zigbee:
======
- The spidev device is available in the /dev directory.
- GPIOs are configured the same way as in the vendor firmware.
- Tests are on-going. I am working on getting access to the Silicon Labs stack to validate that it is fully working.

Installation:
=========
The squash-factory image can be installed via the Linksys Web UI:
1. Open "http://192.168.1.1/ca" (Change the IP with the IP of your device).
2. Login with your admin password.
3. To enter into the support mode, click on the "CA" link and the bottom of the page.
4. Open the "Connectivity" menu and upload the squash-factory image with the "Choose file" button.
5. Click start. Ignore all the prompts and warnings by click "yes" in all the popups.

The device uses a dual partition mechanism. The device automatically revert to the previous partition after 3 failed boot attempts.
If you want to force the previous firmware to load, you can turn off and then turn on the device for 2 seconds, 3 times in a row.

It can also be done via TFTP:
1. Setup a local TFTP server and configure its IP to 192.168.1.100.
2. Rename your image to "nodes_v2.img" and put it to the TFTP root of your server.
3. Connect to the device through the serial console.
4. Power on device and press enter when prompted to drop into U-Boot.
5. Flash the partition of your choice by typing "run flashimg" or "run flashimg2".
6. Once flashed, enter "reset" to reboot the device.

Reviewed-by: Robert Marko <robimarko@gmail.com>
Signed-off-by: Vincent Tremblay <vincent@vtremblay.dev>
2023-01-15 12:55:38 +01:00

61 lines
1.8 KiB
Diff

From 630df9786fdaeb78c21f1e28c9b70ac83a1b482c Mon Sep 17 00:00:00 2001
From: Vincent Tremblay <vincent@vtremblay.dev>
Date: Sat, 31 Dec 2022 09:24:00 -0500
Subject: [PATCH] ath10k: read qcom,coexist-support as a u32
Read qcom,coexist-support as a u32 instead of a u8
When we set the property to <1> in the DT (as specified in the doc),
"of_property_read_u8" read 0 instead of 1. This is because of the data format.
By default <1> is written with 32 bits.
The problem is that the driver is trying to read a u8.
The difference can be visualized using hexdump in a running device:
Default 32 bits output:
=======================
0000000 0000 0100
0000004
8 bits output:
==============
0000000 0001
0000001
By changing "of_property_read_u8" by "of_property_read_u32", the driver
is aligned with the documentation and is able to read the value without
modifying the DT.
The other solution would be to force the value in the DT to be saved as
an 8 bits value (qcom,coexist-support = /bits/ 8 <1>),
which is against the doc and less intuitive.
Validation:
===========
The patch was tested on a real device and we can see in the debug logs
that the feature is properly initialized:
[ 109.102097] ath10k_ahb a000000.wifi: boot coex_support 1 coex_gpio_pin 52
Signed-off-by: Vincent Tremblay <vincent@vtremblay.dev>
--- a/ath10k-5.15/core.c
+++ b/ath10k-5.15/core.c
@@ -2798,14 +2798,14 @@ done:
static void ath10k_core_fetch_btcoex_dt(struct ath10k *ar)
{
struct device_node *node;
- u8 coex_support = 0;
+ u32 coex_support = 0;
int ret;
node = ar->dev->of_node;
if (!node)
goto out;
- ret = of_property_read_u8(node, "qcom,coexist-support", &coex_support);
+ ret = of_property_read_u32(node, "qcom,coexist-support", &coex_support);
if (ret) {
ar->coex_support = true;
goto out;