ophub / amlogic-s9xxx-armbian

Support for Armbian in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
5.7k stars 1.83k forks source link

TX9(s905x) Bluetooth and Wireless(rtl8723cs) works fine #645

Closed thumsl closed 1 year ago

thumsl commented 1 year ago

I have a s905x board with a rtl8703bs wireless chip, this chip works with the rtl8723cs driver.

How can I build a kernel that includes this specific driver?

ophub commented 1 year ago

https://github.com/ophub/amlogic-s9xxx-armbian/blob/main/compile-kernel/tools/config/config-5.15#L6267

armbian: find / -name rtl8723bs*

thumsl commented 1 year ago

unfortunately only the 8723cs driver works from what I've seen, the one you mentions (ends in bs) does not

I can modprobe the 8723bs driver in my installation (it's already enabled) however the wifi network device is not created

ophub commented 1 year ago

What box are you and which dtb file are you using? Which version of firmware?

dmesg | grep Bluetooth

thumsl commented 1 year ago

What box are you and which dtb file are you using? Which version of firmware?

dmesg | grep Bluetooth

The case reads "TX9" but the splash screen on boot says "TX3 mini", however it's not a s905w as other TX3 Minis. I can see on the board a s905x and rtl8703s; 1GB of RAM

I've tried:

dtb/amlogic/meson-gxl-s905x-b860h.dtb dtb/amlogic/meson-gxl-s905x-libretech-cc.dtb dtb/amlogic/meson-gxl-s905x-p212.dtb dtb/amlogic/meson-gxl-s905x-hwacom-amazetv.dtb dtb/amlogic/meson-gxl-s905x-libretech-cc-v2.dtb dtb/amlogic/meson-gxl-s905x-khadas-vim.dtb dtb/amlogic/meson-gxl-s905x-nexbox-a95x.dtb

they all work, boots normally and eth0 works fine as well, but no wifi device is found. emmc storage is also accessible.

On a fresh burn of Armbian_22.11.0_Aml_s905x_jammy_5.15.74_server_2022.10.21.img (from thre releases page) there are no attemps at initializing bluetooth, however I'm sure I saw some bluetooth errors in other images

dmesg | grep Bluetooth returns nothing

dmesg | grep 8723 returns nothing

ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/tunnel6 :: brd :: permaddr 3210:35d7:c8a9::
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:15:18:01:81:31 brd ff:ff:ff:ff:ff:ff

On discussions on other Armbian kernels it's stated that this wifi device needs the 8723cs driver

ophub commented 1 year ago

Okay, I'm going to get out of class, I'll try to add it to you after class. Not sure if this works for you: realtek,rtl8723bs-bt, realtek,rtl8723ds-bt

https://github.com/ophub/amlogic-s9xxx-armbian/issues/639

thumsl commented 1 year ago

Okay, I'm going to get out of class, I'll try to add it to you after class. Not sure if this works for you: realtek,rtl8723bs-bt, realtek,rtl8723ds-bt

Thank you so much! Those drivers did not work unfortunately.

It seems LibreElec has this driver included and it works with s905 chips

ophub commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

Unzip the file and upload it to the /boot/dtb/amlogic/meson-gxl-s905x-tx9.dtb

Modify the file name in /boot/uEnv.txt, then save and restart.

thumsl commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

Unzip the file and upload it to the /boot/dtb/amlogic/meson-gxl-s905x-tx9.dtb

Modify the file name in /boot/uEnv.txt, then save and restart.

Thank you again for your efforts.

Bluetooth works with this DTB but WiFi still doesnt

armbian:~:# dmesg | grep bluetooth -i

[   13.492782] Bluetooth: Core ver 2.22
[   13.499895] Bluetooth: Starting self testing
[   13.520958] Bluetooth: ECDH test passed in 13928 usecs
[   13.532583] Bluetooth: SMP test passed in 4591 usecs
[   13.539310] Bluetooth: Finished self testing
[   13.546004] NET: Registered PF_BLUETOOTH protocol family
[   13.563204] Bluetooth: HCI device and connection manager initialized
[   13.570613] Bluetooth: HCI socket layer initialized
[   13.577469] Bluetooth: L2CAP socket layer initialized
[   13.585718] Bluetooth: SCO socket layer initialized
[   13.812988] Bluetooth: HCI UART driver ver 2.3
[   13.820136] Bluetooth: HCI UART protocol H4 registered
[   13.826719] Bluetooth: HCI UART protocol BCSP registered
[   13.833498] Bluetooth: HCI UART protocol LL registered
[   13.839898] Bluetooth: HCI UART protocol ATH3K registered
[   13.853741] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   13.867416] Bluetooth: HCI UART protocol Intel registered
[   13.875321] Bluetooth: HCI UART protocol Broadcom registered
[   13.891061] Bluetooth: HCI UART protocol QCA registered
[   13.902719] Bluetooth: HCI UART protocol AG6XX registered
[   13.908878] Bluetooth: HCI UART protocol Marvell registered
[   14.491982] Bluetooth: hci0: RTL: examining hci_ver=04 hci_rev=000b lmp_ver=04 lmp_subver=8703
[   14.501957] Bluetooth: hci0: RTL: unknown IC info, lmp subver 8703, hci rev 000b, hci ver 0004
[   14.515177] Bluetooth: hci0: RTL: no config loaded
[   16.880665] systemd[1]: Reached target Bluetooth Support.

armbian:~:# ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/tunnel6 :: brd :: permaddr 5ec8:1de9:f17b::
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:15:18:01:81:31 brd ff:ff:ff:ff:ff:ff

armbian:/:# find ./ -type f -name '*8723*'

./usr/src/linux-headers-5.15.74-flippy-78+o/include/config/RTW88_8723D
./usr/src/linux-headers-5.15.74-flippy-78+o/include/config/RTL8723_COMMON
./usr/src/linux-headers-5.15.74-flippy-78+o/include/config/RTW88_8723DE
./usr/src/linux-headers-5.15.74-flippy-78+o/include/config/RTL8723BE
./usr/src/linux-headers-5.15.74-flippy-78+o/include/config/RTL8723BS
./usr/src/linux-headers-5.15.74-flippy-78+o/include/config/RTL8723AE
./usr/lib/modules/5.15.74-flippy-78+o/kernel/drivers/net/wireless/realtek/rtw88/rtw88_8723de.ko
./usr/lib/modules/5.15.74-flippy-78+o/kernel/drivers/net/wireless/realtek/rtw88/rtw88_8723d.ko
./usr/lib/modules/5.15.74-flippy-78+o/kernel/drivers/net/wireless/realtek/rtlwifi/rtl8723ae/rtl8723ae.ko
./usr/lib/modules/5.15.74-flippy-78+o/kernel/drivers/net/wireless/realtek/rtlwifi/rtl8723com/rtl8723-common.ko
./usr/lib/modules/5.15.74-flippy-78+o/kernel/drivers/net/wireless/realtek/rtlwifi/rtl8723be/rtl8723be.ko
./usr/lib/modules/5.15.74-flippy-78+o/kernel/drivers/staging/rtl8723bs/r8723bs.ko
./usr/lib/firmware/rtlbt/rtl8723b_config_2Ant_S0
./usr/lib/firmware/rtlbt/rtl8723b_VQ0_fw
./usr/lib/firmware/rtlbt/rtl8723cs_cg_fw
./usr/lib/firmware/rtlbt/rtl8723cs_cg_config
./usr/lib/firmware/rtlbt/rtl8723cs_xx_fw
./usr/lib/firmware/rtlbt/rtl8723b_config
./usr/lib/firmware/rtlbt/rtl8723cs_vf_config
./usr/lib/firmware/rtlbt/rtl8723b_fw
./usr/lib/firmware/rtlbt/rtl8723a_config
./usr/lib/firmware/rtlbt/rtl8723cs_vf_fw
./usr/lib/firmware/rtlbt/rtl8723cs_xx_config
./usr/lib/firmware/rtlbt/rtl8723b_VQ0_config
./usr/lib/firmware/rtlbt/rtl8723a_fw
./usr/lib/firmware/rtl_bt/rtl8723bs_config-OBDA0623.bin
./usr/lib/firmware/rtl_bt/rtl8723b_fw.bin
./usr/lib/firmware/rtl_bt/rtl8723bs_config-OBDA8723.bin
./usr/lib/firmware/rtl_bt/rtl8723d_config.bin
./usr/lib/firmware/rtl_bt/rtl8723ds_config.bin
./usr/lib/firmware/rtl_bt/rtl8723bs_config-pine64.bin
./usr/lib/firmware/rtl_bt/rtl8723d_fw.bin
./usr/lib/firmware/rtl_bt/rtl8723a_fw.bin
./usr/lib/firmware/rtl_bt/rtl8723b_config.bin
./usr/lib/firmware/rtl_bt/rtl8723bs_fw.bin
./usr/lib/firmware/rtl_bt/rtl8723ds_fw.bin
./usr/lib/firmware/rtw88/rtw8723d_fw.bin
./usr/lib/firmware/rtlwifi/rtl8723bu_wowlan.bin
./usr/lib/firmware/rtlwifi/rtl8723aufw_B.bin
./usr/lib/firmware/rtlwifi/rtl8723bs_nic.bin
./usr/lib/firmware/rtlwifi/rtl8723bu_nic.bin
./usr/lib/firmware/rtlwifi/rtl8723aufw_B_NoBT.bin
./usr/lib/firmware/rtlwifi/rtl8723bs_wowlan.bin
./usr/lib/firmware/rtlwifi/rtl8723defw.bin
./usr/lib/firmware/rtlwifi/rtl8723befw_36.bin
./usr/lib/firmware/rtlwifi/rtl8723fw.bin
./usr/lib/firmware/rtlwifi/rtl8723bu_ap_wowlan.bin
./usr/lib/firmware/rtlwifi/rtl8723bs_ap_wowlan.bin
./usr/lib/firmware/rtlwifi/rtl8723aufw_A.bin
./usr/lib/firmware/rtlwifi/rtl8723fw_B.bin
./usr/lib/firmware/rtlwifi/rtl8723bs_bt.bin
./usr/lib/firmware/rtlwifi/rtl8723befw.bin
./usr/lib/firmware/rkwifi/wifi_efuse_8723bs-vq0.map
./etc/modprobe.d/r8723bs.conf

armbian:/:# modprobe r8723bs

armbian:/:# dmesg | grep r8723

[  143.252057] r8723bs: module is from the staging directory, the quality is unknown, you have been warned.
[  143.268728] r8723bs: unknown parameter 'rtw_enusbss' ignored
thumsl commented 1 year ago

I'm trying to build this driver out of tree https://github.com/Icenowy/rtl8723cs

but the kernel headers are missing Kconfig, can you point me out in that right direction to be able to build this on armbian?

thumsl commented 1 year ago

I managed to compile unifreq 5.15-y kernel just fine with this driver added: https://github.com/megous/linux/tree/orange-pi-5.15/drivers/staging/rtl8723cs

the ./recompile script works (*pointed it to my modified source instead of unifreq/5.15-y) and generates the root, how do I build an image from that root?

ophub commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

I added the code for wireless. Unzip, upload, restart and test to see if wireless and bluetooth work.

armbian-config dmesg | grep Bluetooth

thumsl commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

I added the code for wireless. Unzip, upload, restart and test to see if wireless and bluetooth work.

armbian-config dmesg | grep Bluetooth

Same as before armbian:~:# dmesg | grep -i bluetooth

[   14.223276] Bluetooth: Core ver 2.22
[   14.232011] Bluetooth: Starting self testing
[   14.259127] Bluetooth: ECDH test passed in 18873 usecs
[   14.270695] Bluetooth: SMP test passed in 4622 usecs
[   14.279620] Bluetooth: Finished self testing
[   14.286441] NET: Registered PF_BLUETOOTH protocol family
[   14.292946] Bluetooth: HCI device and connection manager initialized
[   14.300121] Bluetooth: HCI socket layer initialized
[   14.306551] Bluetooth: L2CAP socket layer initialized
[   14.313053] Bluetooth: SCO socket layer initialized
[   14.542647] Bluetooth: HCI UART driver ver 2.3
[   14.559340] Bluetooth: HCI UART protocol H4 registered
[   14.569844] Bluetooth: HCI UART protocol BCSP registered
[   14.576548] Bluetooth: HCI UART protocol LL registered
[   14.584728] Bluetooth: HCI UART protocol ATH3K registered
[   14.607876] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   14.642677] Bluetooth: HCI UART protocol Intel registered
[   14.667169] Bluetooth: HCI UART protocol Broadcom registered
[   14.686326] Bluetooth: HCI UART protocol QCA registered
[   14.692483] Bluetooth: HCI UART protocol AG6XX registered
[   14.698899] Bluetooth: HCI UART protocol Marvell registered
[   15.242589] Bluetooth: hci0: RTL: examining hci_ver=04 hci_rev=000b lmp_ver=04 lmp_subver=8703
[   15.242623] Bluetooth: hci0: RTL: unknown IC info, lmp subver 8703, hci rev 000b, hci ver 0004
[   15.242631] Bluetooth: hci0: RTL: no config loaded
[   15.845372] systemd[1]: Reached target Bluetooth Support.

armbian:~:# ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/tunnel6 :: brd :: permaddr b2d1:f413:e5c8::
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:15:18:01:81:31 brd ff:ff:ff:ff:ff:ff

armbian:~:# neofetch

                                 root@armbian 
                                 ------------ 
      █ █ █ █ █ █ █ █ █ █ █      OS: Armbian (22.11.0-trunk) aarch64 
     ███████████████████████     Host: tx9 
   ▄▄██                   ██▄▄   Kernel: 5.15.74-flippy-78+o 

I believe driver 8723cs is needed. I was able to cross compile a kernel however I cannot get chroot to work from my host (arch linux) to generate the uinit. I think I'll install ubuntu to retry your scripts without any modifications

ophub commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

try rtl8823cs

thumsl commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

try rtl8823cs

did you mean 8823cs or was that a typo?

with this one bluetooth doesnt seem to work, wireless doesnt either

I have a 8703bs chip and the 8723cs is the only driver that works for it apparently armbian:~:# dmesg | grep -i bluetooth<- returns nothing armbian:~:# find / -type f -name '\*8823\*' <- returns nothing

ophub commented 1 year ago

find /usr/lib/firmware/ -name rtl8723cs*

thumsl commented 1 year ago

find /usr/lib/firmware/ -name rtl8723cs*

armbian:~:# find /usr/lib/firmware/ -name rtl8723cs zsh: no matches found: rtl8723cs

this is on Armbian_22.11.0_Aml_s905x_jammy_5.15.74_server_2022.10.21.img

ophub commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

try

thumsl commented 1 year ago

meson-gxl-s905x-tx9.dtb.zip

try

bluetooth works, wifi does not

I tested it now with a kernel that I compiled, it includes 8723cs. I can modprobe it but still see no wifi device

Assuming this is the right module, would it not work if I'm using an incompatible dtb?

EDIT: Success! Wifi works with s905w-tx3-mini DTB and 8723cs module. I compiled a 5.15-y kernel from unifreq and used this version of the 8723cs module https://github.com/megous/linux/tree/orange-pi-5.15/drivers/staging/rtl8723cs

Bluetooth does not work with this DTB. So we probably need the bluetooth settings we had on your DTB and the 8723cs module

ophub commented 1 year ago

Upload meson-gxl-s905x-tx9.dts to only the https://github.com/unifreq/linux-5.15.y/blob/main/arch/arm64/boot/dts/amlogic/ directory, and add a line to the https://github.com/unifreq/linux-5.15.y/blob/main/arch/arm64/boot/dts/amlogic/Makefile file:

dtb-$(CONFIG_ARCH_MESON) += meson-gxl-s905x-tx9.dtb

meson-gxl-s905x-tx9.dts.zip The source code is as follows:


// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2016 Endless Computers, Inc.
 * Author: Carlo Caione <carlo@endlessm.com>
 */

/dts-v1/;

#include "meson-gxl-s905x-p212.dts"

/ {
    compatible = "tx9", "amlogic,p212";
    model = "tx9";

    aliases {
        ethernet0 = &ethmac;
    };
};

&sdio_pwrseq {
    reset-gpios = <&gpio GPIODV_27 GPIO_ACTIVE_LOW>;
};

/* Realtek Wireless SDIO Module */
&sd_emmc_a {
    /delete-node/ brcmf;

    rtl8723bs: wifi@1 {
        reg = <1>;
        compatible = "realtek,rtl8723bs";
    };
};

/* Connected to the Bluetooth module */
&uart_A {
    status = "okay";
    pinctrl-0 = <&uart_a_pins>, <&uart_a_cts_rts_pins>;
    pinctrl-names = "default";
    uart-has-rtscts;

    bluetooth {
        compatible = "realtek,rtl8723bs-bt";
        enable-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
        max-speed = <2000000>;
        clocks = <&wifi32k>;
        clock-names = "lpo";
    };
};
thumsl commented 1 year ago

rtl8723bs: wifi@1 {

shouldnt it be cs?

armbian:~:# lsmod

Module                  Size  Used by
tls                    65536  0
cpufreq_powersave      20480  0
cpufreq_conservative    16384  0
cpufreq_userspace      20480  0
sunrpc                274432  1
zram                   28672  4
8723cs               1536000  0
cfg80211              380928  1 8723cs

armbian:~:# ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/tunnel6 :: brd :: permaddr f6f0:26fc:ad0::
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether 00:15:18:01:81:31 brd ff:ff:ff:ff:ff:ff
5: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether 00:e0:4c:16:b4:d3 brd ff:ff:ff:ff:ff:ff
ophub commented 1 year ago

Your network card shows that it has been successfully driven?

You modify the test to see if it can be driven.

Install your newly compiled kernel into the system and test it.

thumsl commented 1 year ago

Your network card shows that it has been successfully driven?

You modify the test to see if it can be driven.

Install your newly compiled kernel into the system and test it.

Sorry, perhaps you didnt see my edited post https://github.com/ophub/amlogic-s9xxx-armbian/issues/645#issuecomment-1291563121

I compiled a new kernel adding that missing module, wifi works with this module and s905w-tx3-mini dtb. With this dtb bluetooth does not work

ophub commented 1 year ago

Then you add the bluetooth part of s905w-tx3-mini to see if it can be used

thumsl commented 1 year ago

yes, I never built a dtb but i'll research it

where do I find source code for the dtbs?

ophub commented 1 year ago

https://github.com/unifreq/linux-5.15.y/blob/main/arch/arm64/boot/dts/amlogic/meson-gxl-s905w-tx3-mini.dts

ophub commented 1 year ago

Feedback as the test progresses

thumsl commented 1 year ago

Everything is working with this https://github.com/thumsl/linux-5.15.y/blob/main/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-tx9.dts

(added 8723cs to that kernel)

ophub commented 1 year ago

Good news, I'll talk to unifreq and add this driver to a few kernels when he's free.

Send an online product link for your device, and take a photo of your box exterior, front and back of the motherboard. I'll archive it and add it to the support list. Do you have the Android firmware for this device, and a schematic of the shorting contacts?

thumsl commented 1 year ago

Send an online product link for your device, and take a photo of your box exterior, front and back of the motherboard. I'll archive it and add it to the support list. Do you have the Android firmware for this device, and a schematic of the shorting contacts?

It's an older device, not many online listings any more, here's one

Unfortunately I've already overwritten the Android firmware. The splash screen logo says "Tx3 Mini" so I assume it's gotta be similar to that

20221026_123904 20221026_123927 20221026_124012

ophub commented 1 year ago

I see that you submitted the 5.15 kernel repository, and several others have also submitted one, 5.4.y, 5.10.y, 6.0.y kernel repository.

xcray commented 1 year ago

bluetooth still works after reboot (not power recovery)?