Re: [PATCH v3 2/2] arm64: dts: qcom: add TP-Link Archer AX55 v1

From: Gabor Juhos
Date: Thu Mar 14 2024 - 03:53:35 EST


2024. 03. 13. 19:27 keltezéssel, Konrad Dybcio írta:
>
>
> On 3/13/24 19:25, Gabor Juhos wrote:
>> Add device tree source for the TP-Link Archer AX55 v1 [1]
>> which is a dual-band WiFi router based on the IPQ5018 SoC.
>>
>> At the moment, only the UART, the GPIO LEDs and buttons
>> are usable, but it makes it possible to boot an initramfs
>> image on the device.
>>
>> The device tree can be extended in the future, once support
>> for other periherals will be available for the platform.
>>
>> 1. https://www.tp-link.com/en/home-networking/wifi-router/archer-ax55/v1/
>>
>> Signed-off-by: Gabor Juhos <j4g8y7@xxxxxxxxx>
>> ---
>> Changes in v3:
>>    - change pin configuration to use "gpio20" and "gpio21" for UART pins
>>    - rebase on top of v6.8.
>
> Did you actually check this?

Yes, I have tested this.

> And how so?

First, I have checked the stock firmware which uses the same pinctrl configuration:

root@Archer_AX55:~# uname -a
Linux Archer_AX55 4.4.60 #1 SMP PREEMPT Tue Mar 14 18:25:29 CST 2023 armv7l
GNU/Linux
root@Archer_AX55:~# strings
/sys/firmware/devicetree/base/soc/pinctrl@1000000/uart_pins/blsp0_uart_rx_tx/pins
gpio20
gpio21
root@Archer_AX55:~# strings
/sys/firmware/devicetree/base/soc/pinctrl@1000000/uart_pins/blsp0_uart_rx_tx/function
blsp0_uart0

It is also visible in pinctrl-maps:

root@Archer_AX55:~# cat /sys/kernel/debug/pinctrl/pinctrl-maps
Pinctrl maps:
device 1000000.pinctrl
state default
type MUX_GROUP (2)
controlling device 1000000.pinctrl
group gpio20
function blsp0_uart0

device 1000000.pinctrl
state default
type CONFIGS_GROUP (4)
controlling device 1000000.pinctrl
group gpio20
config 00000001

device 1000000.pinctrl
state default
type MUX_GROUP (2)
controlling device 1000000.pinctrl
group gpio21
function blsp0_uart0

device 1000000.pinctrl
state default
type CONFIGS_GROUP (4)
controlling device 1000000.pinctrl
group gpio21
config 00000001
...

Additionally, this is what debug/gpio says:

root@Archer_AX55:~# grep -E 'gpio2[01]' /sys/kernel/debug/gpio
gpio20 : in 1 8mA no pull
gpio21 : in 1 8mA no pull


Then I have tested the following with v6.8 and with the previous version of the
patch.

Exported GPIO20 via sysfs ...

root@test:/# gpio=$((512+20)); echo $gpio > /sys/class/gpio/export; while
true; do for dir in high low; do echo $dir >/sys/class/gpio/gpio$gpio/direction;
sleep 3; done; done

.. and measured the voltage on the UART pin header. Then I did the same with
GPIO21 as well.

This revealed that GPIO20 corresponds to RX and GPIO21 to TX.

If that matters, the downstream kernel also uses this 'trick' for some boards:

https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/blob/NHSS.QSDK.12.4/arch/arm64/boot/dts/qcom/ipq5018-db-mp03.1.dts?ref_type=heads#L443
https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/blob/NHSS.QSDK.12.4/arch/arm64/boot/dts/qcom/ipq5018-mp03.1.dts?ref_type=heads#L565


Regards,
Gabor