lwfinger / rtw88

A backport of the Realtek Wifi 5 drivers from the wireless-next repo.
553 stars 169 forks source link

WLAN0 had shown but network is down #157

Closed briansune closed 7 months ago

briansune commented 11 months ago

wlan0: flags=4098<BROADCAST,MULTICAST> mtu 1500 ether ff:ff:ff:ff:ff:ff txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wlan0 Interface doesn't support scanning : Network is down

sit0 Interface doesn't support scanning.

lo Interface doesn't support scanning.

Had tried nmcli radio wifi on and restart service.

Module Size Used by rtw_8723ds 16384 0 rtw_8723d 45056 1 rtw_8723ds rtw_sdio 20480 1 rtw_8723ds rtw_core 151552 2 rtw_sdio,rtw_8723d

lwfinger commented 11 months ago

Bringing your interface up is not the driver's responsibility. That is done by your user-space network control software. What are you using? I recommend NetworkManager. It Just Works.

briansune commented 11 months ago

Do you mean the driver is working? This is a cross-compiled insert module method.

I am using networkmanager

` Docs: man:NetworkManager(8) Main PID: 498 (NetworkManager) CGroup: /system.slice/NetworkManager.service └─498 /usr/sbin/NetworkManager --no-daemon

Jul 26 02:08:52 localhost.localdomain NetworkManager[498]:

[1690308532.0498] Error: failed to open /run/network/ifstate Jul 26 02:08:52 localhost.localdomain NetworkManager[498]: [1690308532.0 960] modem-manager: ModemManager available Jul 26 02:08:52 localhost.localdomain NetworkManager[498]: [1690308532.0 969] supplicant: wpa_supplicant running Jul 26 02:08:52 localhost.localdomain NetworkManager[498]: [1690308532.0 973] device (wlan0): supplicant interface state: init -> starting Jul 26 02:08:52 localhost.localdomain NetworkManager[498]: [1690308532.1108] sup-iface[0x633538,wlan0]: error adding interface: wpa_supplicant couldn't grab this interface. Jul 26 02:08:52 localhost.localdomain NetworkManager[498]: [1690308532.1 110] device (wlan0): supplicant interface state: starting -> down Jul 26 02:08:52 localhost.localdomain NetworkManager[498]: [1690308532.1 115] manager: startup complete Jul 26 02:09:02 localhost.localdomain NetworkManager[498]: 39m [1690308542.4543] device (wlan0): re-acquiring supplicant interface ( #1). Jul 26 02:09:02 localhost.localdomain NetworkManager[498]: 31m [1690308542.4711] sup-iface[0x6335a0,wlan0]: error adding interface: wpa_supplicant couldn't grab this interface. Jul 26 02:09:02 localhost.localdomain NetworkManager[498]: [1690308542.4 713] device (wlan0): supplicant interface state: starting -> down `
briansune commented 11 months ago

Let me attach the dmesg:

[ 99.221393] rtw_core: loading out-of-tree module taints kernel. [ 110.501543] rtw_8723ds mmc1:0001:1: Firmware version 48.0.0, H2C version 0

RadxaYuntian commented 8 months ago

I'm also having this issue. The wired thing is I did have this working before on 8723DS :/ I also have ff:ff:ff:ff:ff:ff as MAC address, and I tried both iwd and wpa_supplicant as NetworkManager backend on Debian 12. None of them helps.

iwd ``` radxa@rock-pi-s:~$ sudo journalctl -u iwd | cat Nov 02 17:37:25 rock-pi-s systemd[1]: Starting iwd.service - Wireless service... Nov 02 17:37:26 rock-pi-s iwd[538]: Wireless daemon version 2.3 Nov 02 17:37:26 rock-pi-s iwd[538]: Loaded configuration from /etc/iwd/main.conf Nov 02 17:37:26 rock-pi-s systemd[1]: Started iwd.service - Wireless service. Nov 02 17:37:26 rock-pi-s iwd[538]: station: Network configuration is disabled. Nov 02 17:37:26 rock-pi-s iwd[538]: Wiphy: 0, Name: phy0 Nov 02 17:37:26 rock-pi-s iwd[538]: Permanent Address: ff:ff:ff:ff:ff:ff Nov 02 17:37:26 rock-pi-s iwd[538]: 2.4Ghz Band: Nov 02 17:37:26 rock-pi-s iwd[538]: Bitrates (non-HT): Nov 02 17:37:26 rock-pi-s iwd[538]: 1.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 2.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 5.5 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 11.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 6.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 9.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 12.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 18.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 24.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 36.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 48.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: 54.0 Mbps Nov 02 17:37:26 rock-pi-s iwd[538]: HT Capabilities: Nov 02 17:37:26 rock-pi-s iwd[538]: HT40 Nov 02 17:37:26 rock-pi-s iwd[538]: Short GI for 20Mhz Nov 02 17:37:26 rock-pi-s iwd[538]: Short GI for 40Mhz Nov 02 17:37:26 rock-pi-s iwd[538]: HT RX MCS indexes: Nov 02 17:37:26 rock-pi-s iwd[538]: 0-7 Nov 02 17:37:26 rock-pi-s iwd[538]: 32 Nov 02 17:37:26 rock-pi-s iwd[538]: Ciphers: BIP-CMAC-256 BIP-GMAC-256 BIP-GMAC-128 CCMP-256 Nov 02 17:37:26 rock-pi-s iwd[538]: GCMP-256 GCMP-128 BIP-CMAC-128 CCMP-128 Nov 02 17:37:26 rock-pi-s iwd[538]: TKIP Nov 02 17:37:26 rock-pi-s iwd[538]: Supported iftypes: ad-hoc station ap Nov 02 17:37:26 rock-pi-s iwd[538]: Wiphy phy0 will only use the default interface Nov 02 17:37:26 rock-pi-s iwd[538]: Error bringing interface 3 up: Cannot assign requested address ```
dmesg with debug_mask == -1 ``` [ 991.996901] rtw_8723ds mmc2:0001:1: rtw88 SDIO probe: vendor=0x024c device=d723 class=ff [ 991.997188] rtw_8723ds mmc2:0001:1: Firmware version 48.0.0, H2C version 0 [ 992.315527] rtw_8723ds mmc2:0001:1: hw cap: hci=0x06, bw=0x03, ptcl=0x02, ant_num=2, nss=1 [ 992.315570] rtw_8723ds mmc2:0001:1: use rfe_def[0] [ 992.317161] rtw_8723ds mmc2:0001:1: use rfe_def[0] [ 992.317176] rtw_8723ds mmc2:0001:1: phy cond=0x0304f400 [ 992.317231] rtw_8723ds mmc2:0001:1: txpwr regd 3 does not be configured [ 992.317243] rtw_8723ds mmc2:0001:1: cfg txpwr regd 3 by regd 0 as alternative [ 992.317262] rtw_8723ds mmc2:0001:1: txpwr regd 4 does not be configured [ 992.317274] rtw_8723ds mmc2:0001:1: cfg txpwr regd 4 by regd 2 as alternative [ 992.317294] rtw_8723ds mmc2:0001:1: txpwr regd 5 does not be configured [ 992.317305] rtw_8723ds mmc2:0001:1: cfg txpwr regd 5 by regd 2 as alternative [ 992.317325] rtw_8723ds mmc2:0001:1: txpwr regd 6 does not be configured [ 992.317337] rtw_8723ds mmc2:0001:1: cfg txpwr regd 6 by regd 0 as alternative [ 992.317357] rtw_8723ds mmc2:0001:1: txpwr regd 7 does not be configured [ 992.317368] rtw_8723ds mmc2:0001:1: cfg txpwr regd 7 by regd 2 as alternative [ 992.317388] rtw_8723ds mmc2:0001:1: txpwr regd 8 does not be configured [ 992.317400] rtw_8723ds mmc2:0001:1: cfg txpwr regd 8 by regd 0 as alternative [ 992.317420] rtw_8723ds mmc2:0001:1: txpwr regd 9 does not be configured [ 992.317430] rtw_8723ds mmc2:0001:1: cfg txpwr regd 9 by regd 2 as alternative [ 992.317631] rtw_8723ds mmc2:0001:1: regd init state 0: apply alpha2 00, regd {10, 10}, dfs_region 0 [ 992.318698] rtw_8723ds mmc2:0001:1: regd state: 0 -> 0 [ 992.318741] rtw_8723ds mmc2:0001:1: get alpha2 00 from initiator 0: apply alpha2 00, regd {10, 10}, dfs_region 0 ```

Edit: rtl8723ds worked on the same hardware and system.

briansune commented 8 months ago

@RadxaYuntian

I am not sure the root cause but what I had discussed with @lwfinger is that the RTW88 have not default firmware loading when IC is not fused with a firmware and this is my case.

The board hardware is fully custom and IC is not from OEM or broker, which causes the IC is not fused with any default firmware. @lwfinger I am not sure you had update the driver with a default firmware like rtl8723ds old repository or not?

BR Brian

RadxaYuntian commented 8 months ago

The board hardware is fully custom and IC is not from OEM or broker, which causes the IC is not fused with any default firmware.

Same thing here. We are a SBC manufacturer and the affected is one of our product.

I don't quite understand what you mean by firmware. From dmesg it appears to be loaded: Firmware version 48.0.0, H2C version 0. I assume it is using /lib/firmware/rtw88/rtw8723d_fw.bin.

I think you might mean eFUSE. I'll take a look at related code as well.

briansune commented 8 months ago

@RadxaYuntian

Opps typo, it should be IC settings aka EFUSE not firmware. The EFUSE is controlling the TX LUT power and DCDC, XTAL settings.

You are right eFUSE is what I am discussing.

BR

briansune commented 8 months ago

@RadxaYuntian

Why I will discuss @lwfinger with the EFUSE setting is because the XTAL is mostly the case along side with the DCDC. If XTAL is not aligned with the EFUSE then the WIFI 100% won't work. If DCDC is not aligned with EFUSE, the voltage you can measure is off the normal range. Either way will cause the WIFI chip not working, so as long as RTW88 is not update there are not way it could happen.

BR

lwfinger commented 8 months ago

I looked into providing a default EFUSE when it is not programmed, but I got diverted. If the MAC address is all ones, the EFUSE is not programmed.

briansune commented 8 months ago

@lwfinger

Yes, if all ones are shown then EFUSE is not preloaded for the IC. Then the driver need to take place to preload a default one which the old RTL8723DS had provided. But RTW88 does not, which you need to update or extract those from the old repository.

BR

briansune commented 8 months ago

@lwfinger

I am afraid I don't have that ability to transfer the old driver to the new old. I am mostly hardware engineer so this is really out of my scope and I would like to.

=S

RadxaYuntian commented 8 months ago

I see there is Efuse_Read1ByteFromFakeContent in rtl8723ds, but I did not find where fakeEfuseContent got initialized. It appears it has a default value of all 0 and then memset to all 0xFF, and neither looks like some real eFuse data.

briansune commented 8 months ago

@RadxaYuntian

My method to see the EFUSE is using old RTL8723DS repository and make the debug flag to 4 and during driver load there is a series of message that shown the EFUSE are all ZERO and then it will say loading a default one.

RadxaYuntian commented 8 months ago

Thanks for the hint. I have located Hal_InitPGData for detecting invalid eFuse and then a bunch of parse functions. An example of falling back to driver defaults can be found in hal_load_pg_txpwr_info for loading TX LUT.

I'll see what will happen if I inject them in rtw88's rtw8723d_read_efuse.

briansune commented 8 months ago

@RadxaYuntian

Great, would be nice to push back to this repository.

RadxaYuntian commented 8 months ago

Spent last 2 days on this hack: https://github.com/radxa-pkg/rtw88/commit/9d2ffb52718d33f6ecba909e5715d28e5197c16d

Current status and insight learnt:

[  947.839160] wlan0: authenticate with c8:3a:35:9e:43:61
[  947.839258] wlan0: 80 MHz not supported, disabling VHT
[  948.570820] wlan0: send auth to c8:3a:35:9e:43:61 (try 1/3)
[  949.844179] wlan0: send auth to c8:3a:35:9e:43:61 (try 2/3)
[  950.836181] wlan0: send auth to c8:3a:35:9e:43:61 (try 3/3)
[  951.828260] wlan0: authentication with c8:3a:35:9e:43:61 timed out

I think to fix it is currently beyond my scope, so we will have to use rtl8723ds in the mean time.

briansune commented 8 months ago

@RadxaYuntian

Do a manual MAC assign make the LO lock? And able to scan WIFI? If a scan is able to get WIFI device then this is much easy to fix otherwise it is just back to beginning.

RadxaYuntian commented 8 months ago

Do a manual MAC assign make the LO lock?

I'm not sure what you mean by LO lock. Also I did not try assigning MAC from user space. The MAC address was hardcoded in the driver for now.

And able to scan WIFI?

Yes, albeit much less that what is available here.

briansune commented 8 months ago

@RadxaYuntian

So the updated driver can work? Could you forward and let me give it a try and see the different? Thank you

As for LO = local oscillator: A simple measurement at the LDO output or the DCDC output when power on the voltage should be low. Once the driver is attached or the EFUSE is loaded then the voltage will be raised to a point that very obvious. And may I ask what XTAL you are using?

RadxaYuntian commented 8 months ago

In case I wasn't clear the driver DOES NOT work for me. I was not able to connect to any network.

If you still want to try it here is a Debian dkms package in zip (since GitHub doesn't allow deb uploading).

rtw88.zip

I don't have the BOM but I think it is a 24M 12pF crystal. If you are curious here is the schematic for our product:

https://dl.radxa.com/rockpis/docs/hw/ROCK-PI-S_v13_sch_200910.pdf

Search 8723 to see the related page.

briansune commented 8 months ago

@RadxaYuntian

I need a source to cross compile as my platform is not Debian but ubuntu on different ARM system. I think you had only update this sections? https://github.com/radxa-pkg/rtw88/commit/9d2ffb52718d33f6ecba909e5715d28e5197c16d

briansune commented 8 months ago

@RadxaYuntian

As for schematic short review show you are using DCDC setting. The custom board we had here do tired both LDO and DCDC on old RTL8723DS driver. Result both are normal, but DCDC sometime is more easier to be unstable as noise is more subjected to board layout.

RadxaYuntian commented 8 months ago

If you want source code it is available here: https://github.com/radxa-pkg/rtw88/tree/issue_157

RadxaYuntian commented 8 months ago

Looking back I forgot to run with debug_mask and see what was wrong.

briansune commented 8 months ago

@RadxaYuntian

Let's compare and see if the issue is aligned.

briansune commented 8 months ago

@RadxaYuntian

I got the current message:

[ 27.285840] rtw_core: loading out-of-tree module taints kernel. [ 37.657580] rtw_8723ds mmc1:0001:1: rtw88 SDIO probe: vendor=0x024c device=d723 class=ff [ 37.667085] rtw_8723ds mmc1:0001:1: Firmware version 48.0.0, H2C version 0 [ 38.148561] rtw_8723ds mmc1:0001:1: hw cap: hci=0x06, bw=0x03, ptcl=0x02, ant_num=2, nss=1 [ 38.148576] rtw_8723ds mmc1:0001:1: use rfe_def[17] [ 38.148586] rtw_8723ds mmc1:0001:1: rfe 17 isn't supported [ 38.154981] rtw_8723ds mmc1:0001:1: failed to setup chip efuse info [ 38.159943] rtw_8723ds mmc1:0001:1: failed to setup chip information

RadxaYuntian commented 8 months ago

Your eFuse must have been partially populated, as I changed rfe to come from eFuse first: https://github.com/radxa-pkg/rtw88/commit/9d2ffb52718d33f6ecba909e5715d28e5197c16d#diff-bda2ebb54a6c298b057cfa4da3534fd505b263989ec51d3663e3f40d9f3a0ebaL233-R261

You can change line 261 back to efuse->rfe_option = 0;

briansune commented 8 months ago

@RadxaYuntian

Network can scan and WIFI devices are showing up. Compared to previous this RTW88 driver it cannot list WIFI devices. Looks like you had made a different.

And WIFI can ping and connect as well but not sure why nmcli works but not nmtui =S I don't know much kernel stuff.

image

LOG ``` [ 651.687345] rtw_8723ds mmc1:0001:1: [IQK] path S0 RXIQK Step1!! [ 651.687417] rtw_8723ds mmc1:0001:1: [IQK] 0x67 @S0 RXIQK1 = 0xac [ 651.690200] rtw_8723ds mmc1:0001:1: [IQK] RF0x1@ path S0 RXIQK1 = 0xe6d [ 651.690735] rtw_8723ds mmc1:0001:1: [IQK] RF0x2@ path S0 RXIQK1 = 0x66d [ 651.692222] rtw_8723ds mmc1:0001:1: [IQK] GNT_BT @S0 RXIQK1 = 0xc [ 651.692301] rtw_8723ds mmc1:0001:1: [IQK] 0x948 @S0 RXIQK1 = 0x99000280 [ 651.696716] rtw_8723ds mmc1:0001:1: [IQK] 0xeac = 0x4002000 [ 651.696844] rtw_8723ds mmc1:0001:1: [IQK] 0xe94 = 0x1000000, 0xe9c = 0x30000 [ 651.696970] rtw_8723ds mmc1:0001:1: [IQK] 0xe90(before IQK)= 0x6d0, 0xe98(afer IQK) = 0x44 [ 651.697365] rtw_8723ds mmc1:0001:1: [IQK] 0xe40 = 0x81007c03 u4tmp = 0x81007c03 [ 651.697377] rtw_8723ds mmc1:0001:1: [IQK] path S0 RXIQK STEP2!! [ 651.697445] rtw_8723ds mmc1:0001:1: [IQK] 0x67 @S0 RXIQK2 = 0xac [ 651.700377] rtw_8723ds mmc1:0001:1: [IQK] RF0x1 @S0 RXIQK2 = 0xe6d [ 651.700903] rtw_8723ds mmc1:0001:1: [IQK] RF0x2 @S0 RXIQK2 = 0x66d [ 651.702390] rtw_8723ds mmc1:0001:1: [IQK] GNT_BT @S0 RXIQK1 = 0xc [ 651.702471] rtw_8723ds mmc1:0001:1: [IQK] 0x948 @S0 RXIQK1 = 0x99000280 [ 651.706357] rtw_8723ds mmc1:0001:1: [IQK] 0xea4 = 0xfb0000, 0xeac = 0x4072000 [ 651.706487] rtw_8723ds mmc1:0001:1: [IQK] 0xea0(before IQK)= 0x3e500c, 0xea8(afer IQK) = 0x81a0 [ 651.709733] rtw_8723ds mmc1:0001:1: [IQK] path S0 Rx IQK Success!! [ 651.710965] rtw_8723ds mmc1:0001:1: [IQK] back to BB mode, load original value! [ 651.713405] rtw_8723ds mmc1:0001:1: [IQK] restore 0x67 = 0xac [ 651.713420] rtw_8723ds mmc1:0001:1: [IQK] cmp 0:1 final_candidate is 0 [ 651.714033] rtw_8723ds mmc1:0001:1: [IQK] X = 0xfd, TX1_A = 0xe1, oldval_1 0xe4 [ 651.714046] rtw_8723ds mmc1:0001:1: [IQK] Y = 0x2, TX1_C = 0x1 [ 651.715137] rtw_8723ds mmc1:0001:1: [IQK] final_candidate is 0 [ 651.715157] rtw_8723ds mmc1:0001:1: [IQK] Result 0: rege94_s1=fd rege9c_s1=2 regea4_s1=100 regeac_s1=7 rege94_s0=fd rege9c_s0=4 regea4_s0=fa regeac_s0=8 (final candidate) [ 651.715174] rtw_8723ds mmc1:0001:1: [IQK] Result 1: rege94_s1=fd rege9c_s1=2 regea4_s1=100 regeac_s1=7 rege94_s0=fd rege9c_s0=4 regea4_s0=fb regeac_s0=7 [ 651.715190] rtw_8723ds mmc1:0001:1: [IQK] Result 2: rege94_s1=0 rege9c_s1=0 regea4_s1=0 regeac_s1=0 rege94_s0=0 rege9c_s0=0 regea4_s0=0 regeac_s0=0 [ 651.715205] rtw_8723ds mmc1:0001:1: [IQK] Result 3: rege94_s1=0 rege9c_s1=0 regea4_s1=0 regeac_s1=0 rege94_s0=0 rege9c_s0=0 regea4_s0=0 regeac_s0=0 [ 651.715450] rtw_8723ds mmc1:0001:1: [IQK]0xc80 = 0x390100e1 0xc94 = 0x0 0xc14 = 0x40001d00 0xca0 = 0x12000 [ 651.715629] rtw_8723ds mmc1:0001:1: [IQK]0xcd0 = 0x1c2 0xcd4 = 0x1c8007 0xcd8 = 0x80fa [ 651.715639] rtw_8723ds mmc1:0001:1: [IQK] finished [ 651.715650] wlan0: send auth to 04:d4:c4:45:9c:98 (try 1/3) [ 651.721490] wlan0: authenticated [ 651.761467] wlan0: associate with 04:d4:c4:45:9c:98 (try 1/3) [ 651.761520] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_connect_notify(): 2G start [ 651.761532] rtw_8723ds mmc1:0001:1: [BTCoex], (Before Ant Setup) Delay by IQK [ 651.761682] rtw_8723ds mmc1:0001:1: [BTCoex], coex_stat->bt_disabled = 0x1 [ 651.761695] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_set_ant_path() - PHASE_2G_RUNTIME [ 651.763266] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_run_coex(): reason = 5 [ 651.763281] rtw_8723ds mmc1:0001:1: [BTCoex], wl_noisy_level = 0 [ 651.763369] rtw_8723ds mmc1:0001:1: [BTCoex], WiFi is single-port 2G!! [ 651.763382] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_action_wl_not_connected() [ 651.763394] rtw_8723ds mmc1:0001:1: [BTCoex], Coex_Table - 1 [ 651.763547] rtw_8723ds mmc1:0001:1: [BTCoex], Skip TDMA because no change TDMA(off, 0) [ 651.768130] wlan0: RX AssocResp from 04:d4:c4:45:9c:98 (capab=0x1011 status=0 aid=4) [ 651.768180] rtw_8723ds mmc1:0001:1: send H2C content 40a30040 000ff015 [ 651.768391] rtw_8723ds mmc1:0001:1: send H2C content 00000101 00000000 [ 651.768575] rtw_8723ds mmc1:0001:1: sta 04:d4:c4:45:9c:98 joined with macid 0 [ 651.771026] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_connect_notify(): 2G finish [ 651.771042] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_run_coex(): reason = 7 [ 651.771053] rtw_8723ds mmc1:0001:1: [BTCoex], wl_noisy_level = 1 [ 651.772056] rtw_8723ds mmc1:0001:1: [BTCoex], WiFi is single-port 2G!! [ 651.772069] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_action_wl_only() [ 651.772083] rtw_8723ds mmc1:0001:1: [BTCoex], Coex_Table - 2 [ 651.772351] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_set_table(): 0x6c0 = 66555555, 0x6c4 = 66555555 [ 651.772366] rtw_8723ds mmc1:0001:1: [BTCoex], Skip TDMA because no change TDMA(off, 0) [ 651.773736] rtw_8723ds mmc1:0001:1: RSVD_PROBE_RESP loc: 0 [ 651.773750] rtw_8723ds mmc1:0001:1: RSVD_PS_POLL loc: 1 [ 651.773760] rtw_8723ds mmc1:0001:1: RSVD_NULL loc: 3 [ 651.773769] rtw_8723ds mmc1:0001:1: RSVD_QOS_NULL loc: 2 [ 651.773782] rtw_8723ds mmc1:0001:1: send H2C content 03010000 00000002 [ 651.773970] rtw_8723ds mmc1:0001:1: send H2C content 0000002c 00000000 [ 651.774142] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_media_status_notify(): 2G [ 651.774155] rtw_8723ds mmc1:0001:1: [BTCoex], (Before Ant Setup) Delay by IQK [ 651.774279] rtw_8723ds mmc1:0001:1: [BTCoex], coex_stat->bt_disabled = 0x1 [ 651.774292] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_set_ant_path() - PHASE_2G_RUNTIME [ 651.775870] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_run_coex(): reason = 9 [ 651.775884] rtw_8723ds mmc1:0001:1: [BTCoex], wl_noisy_level = 1 [ 651.775971] rtw_8723ds mmc1:0001:1: [BTCoex], WiFi is single-port 2G!! [ 651.775983] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_action_wl_only() [ 651.775995] rtw_8723ds mmc1:0001:1: [BTCoex], Coex_Table - 2 [ 651.776138] rtw_8723ds mmc1:0001:1: [BTCoex], Skip TDMA because no change TDMA(off, 0) [ 651.776155] rtw_8723ds mmc1:0001:1: send H2C content 00000066 00000000 [ 651.776327] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_update_wl_ch_info: para[0:2] = 0x0 0x0 0x0 [ 651.776604] wlan0: associated [ 652.000564] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x00, len=7 [ 652.102126] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x01, len=7 [ 652.920536] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x02, len=7 [ 653.601433] rtw_8723ds mmc1:0001:1: [BTCoex], WL connecting stop!! [ 653.601450] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_run_coex(): reason = 14 [ 653.601461] rtw_8723ds mmc1:0001:1: [BTCoex], wl_noisy_level = 1 [ 653.601550] rtw_8723ds mmc1:0001:1: [BTCoex], WiFi is single-port 2G!! [ 653.601562] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_action_wl_only() [ 653.601574] rtw_8723ds mmc1:0001:1: [BTCoex], Coex_Table - 2 [ 653.601714] rtw_8723ds mmc1:0001:1: [BTCoex], Skip TDMA because no change TDMA(off, 0) [ 654.001703] rtw_8723ds mmc1:0001:1: [BTCoex], Hi-Pri Rx/Tx: 0/0, Lo-Pri Rx/Tx: 0/0 [ 654.001726] rtw_8723ds mmc1:0001:1: send H2C content 17000042 00000000 [ 654.004099] rtw_8723ds mmc1:0001:1: IGI=0x20, rssi_min=23, cck_fa=459 [ 654.004112] rtw_8723ds mmc1:0001:1: cck_fa_avg=0, cck_pd_default=16 [ 654.004123] rtw_8723ds mmc1:0001:1: lv: (0) -> (0) [ 654.004136] rtw_8723ds mmc1:0001:1: send H2C content 00000058 0000000d [ 656.001703] rtw_8723ds mmc1:0001:1: [BTCoex], Hi-Pri Rx/Tx: 0/0, Lo-Pri Rx/Tx: 0/0 [ 656.001727] rtw_8723ds mmc1:0001:1: send H2C content 16000042 00000000 [ 656.004282] rtw_8723ds mmc1:0001:1: IGI=0x24, rssi_min=22, cck_fa=1238 [ 656.004295] rtw_8723ds mmc1:0001:1: cck_fa_avg=213, cck_pd_default=16 [ 656.004306] rtw_8723ds mmc1:0001:1: lv: (0) -> (0) [ 656.004319] rtw_8723ds mmc1:0001:1: send H2C content 00000058 0000000d [ 656.004478] rtw_8723ds mmc1:0001:1: send H2C content 40830040 000ff010 [ 656.194064] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x03, len=7 [ 656.561441] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_run_coex(): reason = 14 [ 656.561474] rtw_8723ds mmc1:0001:1: [BTCoex], wl_noisy_level = 1 [ 656.561552] rtw_8723ds mmc1:0001:1: [BTCoex], WiFi is single-port 2G!! [ 656.561563] rtw_8723ds mmc1:0001:1: [BTCoex], rtw_coex_action_wl_only() [ 656.561575] rtw_8723ds mmc1:0001:1: [BTCoex], Coex_Table - 2 [ 656.561718] rtw_8723ds mmc1:0001:1: [BTCoex], Skip TDMA because no change TDMA(off, 0) [ 658.001725] rtw_8723ds mmc1:0001:1: [BTCoex], Hi-Pri Rx/Tx: 0/0, Lo-Pri Rx/Tx: 0/0 [ 658.001748] rtw_8723ds mmc1:0001:1: send H2C content 17000042 00000000 [ 658.004329] rtw_8723ds mmc1:0001:1: IGI=0x25, rssi_min=23, cck_fa=523 [ 658.004342] rtw_8723ds mmc1:0001:1: cck_fa_avg=255, cck_pd_default=16 [ 658.004353] rtw_8723ds mmc1:0001:1: lv: (0) -> (2) [ 658.004407] rtw_8723ds mmc1:0001:1: is_linked=1, lv=2, n_rx=1, cs_ratio=0x14, pd_th=0xd, cck_fa_avg=255 [ 658.004633] rtw_8723ds mmc1:0001:1: send H2C content 00000058 0000000e [ 659.672210] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x04, len=7 [ 660.001704] rtw_8723ds mmc1:0001:1: [BTCoex], Hi-Pri Rx/Tx: 0/0, Lo-Pri Rx/Tx: 0/0 [ 660.001727] rtw_8723ds mmc1:0001:1: send H2C content 17000042 00000000 [ 660.004111] rtw_8723ds mmc1:0001:1: IGI=0x25, rssi_min=23, cck_fa=357 [ 660.004124] rtw_8723ds mmc1:0001:1: cck_fa_avg=230, cck_pd_default=16 [ 660.004135] rtw_8723ds mmc1:0001:1: lv: (2) -> (2) [ 660.004148] rtw_8723ds mmc1:0001:1: send H2C content 00000058 0000000f [ 661.718179] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x05, len=7 [ 662.001722] rtw_8723ds mmc1:0001:1: [BTCoex], Hi-Pri Rx/Tx: 0/0, Lo-Pri Rx/Tx: 0/0 [ 662.001745] rtw_8723ds mmc1:0001:1: send H2C content 17000042 00000000 [ 662.004335] rtw_8723ds mmc1:0001:1: IGI=0x23, rssi_min=23, cck_fa=239 [ 662.004348] rtw_8723ds mmc1:0001:1: cck_fa_avg=204, cck_pd_default=16 [ 662.004359] rtw_8723ds mmc1:0001:1: lv: (2) -> (0) [ 662.004412] rtw_8723ds mmc1:0001:1: is_linked=1, lv=0, n_rx=1, cs_ratio=0x10, pd_th=0x3, cck_fa_avg=204 [ 662.004639] rtw_8723ds mmc1:0001:1: send H2C content 00000058 00000010 [ 664.001752] rtw_8723ds mmc1:0001:1: [BTCoex], Hi-Pri Rx/Tx: 0/0, Lo-Pri Rx/Tx: 0/0 [ 664.001776] rtw_8723ds mmc1:0001:1: send H2C content 16000042 00000000 [ 664.004361] rtw_8723ds mmc1:0001:1: IGI=0x27, rssi_min=22, cck_fa=934 [ 664.004374] rtw_8723ds mmc1:0001:1: cck_fa_avg=499, cck_pd_default=16 [ 664.004385] rtw_8723ds mmc1:0001:1: lv: (0) -> (2) [ 664.004439] rtw_8723ds mmc1:0001:1: is_linked=1, lv=2, n_rx=1, cs_ratio=0x14, pd_th=0xd, cck_fa_avg=499 [ 664.004666] rtw_8723ds mmc1:0001:1: send H2C content 00000058 00000010 [ 664.004827] rtw_8723ds mmc1:0001:1: send H2C content 40830040 000ff010 [ 664.173301] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x06, len=7 [ 664.889400] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x07, len=7 [ 665.810090] rtw_8723ds mmc1:0001:1: recv C2H, id=0x0c, seq=0x08, len=7 ```
briansune commented 8 months ago

@RadxaYuntian

But I don't understand what is the major reason to use RTW88 rather than RTL8723DS driver?

@lwfinger What are the different compare between new RTW88-based RTL8723DS and old RTL8723DS driver?

briansune commented 8 months ago

@RadxaYuntian

And there is a catch that looks like it is not too stable compared to old RTL8723DS:

image

RadxaYuntian commented 8 months ago

That's actually amazing. Although I suspect your chip might have some eFuse fields prepopulated with correct value. On my chip where everything is basically 0xFF I could not get it to work.

Can you run old 8723ds driver with debug enable and output level to 4? It should dump your eFuse content on boot, and I could compare both to see if the default values need to be adjusted.

briansune commented 8 months ago

@RadxaYuntian

Okay I give it a try but that is not possible about all 0XFF because the first few bytes must exist to determine the chip. Otherwise it will be very wrongly defined.

RadxaYuntian commented 8 months ago

Yeah I know the very beginning is not 0xFF as I also saw the eFuse dump. But for my chip at least rfe is also 0xFF which is why I changed the code to test it, instead of simply passing 0 in the orignial.

briansune commented 8 months ago

@RadxaYuntian

LOG ```log mmc1: new high speed SDIO card at address 0001 mmc0: new high speed SDHC card at address b36b RTW: sdio_init: sdio clk rate: 25000000 RTW: CHIP TYPE: RTL8723D RTW: rtw_hal_config_rftype RF_Type is 3 TotalTxPath is 1 RTW: Chip Version Info: CHIP_8723D_Normal_Chip_TSMC_D_CUT_1T1R_RomVer(0) NET: Registered protocol family 10 RTW: SetHwReg: bMacPwrCtrlOn=1 mmcblk0: p1 p2 random: fast init done RTW: sdio_power_on_check: val_mix:0x0000063f, res:0x0000063f Segment Routing with IPv6 RTW: sdio_power_on_check: 0x100 the result of cmd52 and cmd53 is the same. sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver RTW: sdio_power_on_check: 0x1B8 test Pass. NET: Registered protocol family 17 RTW: ReadAdapterInfo8723DS, 0x4e=0xc2 can: controller area network core (rev 20170425 abi 9) RTW: EEPROM type is E-FUSE NET: Registered protocol family 29 RTW: hal_EfuseSwitchToBank: Efuse switch bank to 0 can: raw protocol (rev 20170425) can: broadcast manager protocol (rev 20170425 t) can: netlink gateway (rev 20190810) max_hops=1 Bluetooth: RFCOMM TTY layer initialized Bluetooth: RFCOMM socket layer initialized Bluetooth: RFCOMM ver 1.11 Bluetooth: BNEP (Ethernet Emulation) ver 1.3 Bluetooth: BNEP filters: protocol multicast RTW: hal_ReadEFuse_WiFi: data end at address=0xae Bluetooth: BNEP socket layer initialized RTW: HW EFUSE Bluetooth: HIDP (Human Interface Emulation) ver 1.2 Bluetooth: HIDP socket layer initialized RTW: 0x000: 29 Registering SWP/SWPB emulation handler 81 00 Loading compiled-in X.509 certificates 7C E1 of-fpga-region fpga-full: FPGA Region probed 88 07 hctosys: unable to open rtc device (rtc0) 00 A0 04 EC 35 12 C0 A2 of_cfs_init D8 of_cfs_init: OK RTW: 0x010: 2B cfg80211: Loading compiled-in X.509 certificates for regulatory database 2A 2A 2B cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7' 2C 2C platform regulatory.0: Direct firmware load for regulatory.db failed with error -2 2F 2E cfg80211: failed to load regulatory.db 2D 2E ALSA device list: 2E 02 #0: xlnx-i2s-snd-card-0 FF FF FF FF RTW: 0x020: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x030: FF FF FF FF FF FF FF FF FF FF 22 22 22 22 22 22 RTW: 0x040: 21 21 21 21 21 02 FF FF FF FF FF FF FF FF FF FF RTW: 0x050: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x060: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x070: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x080: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x090: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x0a0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x0b0: FF FF FF FF FF FF FF FF 20 24 1C 00 00 00 FF FF RTW: 0x0c0: FF 29 20 11 00 00 00 FF 00 FF 11 FF FF FF FF FF RTW: 0x0d0: 3E 10 01 12 23 FF FF FF 20 04 4C 02 23 D7 21 02 RTW: 0x0e0: 0C 00 22 04 00 08 00 32 FF 21 02 0C 00 22 2A 01 RTW: 0x0f0: 01 00 00 00 00 00 00 00 00 00 00 00 02 00 FF FF RTW: 0x100: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 RTW: 0x110: 00 EB 00 6E 01 00 00 00 00 FF D8 2F E6 09 C4 4B RTW: 0x120: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x130: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x140: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x150: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x160: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x170: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x180: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x190: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x1a0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x1b0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x1c0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x1d0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x1e0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: 0x1f0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF RTW: Hal_EfuseParseBTCoexistInfo_8723D: Enable BT-coex, ant_num=1 RTW: hal_com_config_channel_plan chplan:0x20 RTW: Hal_EfuseParseVoltage_8723D hwinfo[EEPROM_Voltage_ADDR_8723D] =a0 RTW: Hal_EfuseParseVoltage_8723D pHalData->adjuseVoltageVal =a RTW: kfree Pwr Trim flag:0 RTW: rtl8723d_FirmwareDownload fw: FW_NIC, size: 27506 RTW: rtl8723d_FirmwareDownload: fw_ver=1b fw_subver=0000 sig=0x23d1, Month=12, Date=07, Hour=14, Minute=07 RTW: rtl8723d_FirmwareDownload(): Shift for fw header! RTW: rtl8723d_FirmwareDownload by IO write! RTW: polling_fwdl_chksum: Checksum report OK! (1, 0ms), REG_MCUFWDL:0x07060305 RTW: rtl8723d_FirmwareDownload: download FW count:1 RTW: _8051Reset8723: Finish RTW: _FWFreeToGo: Polling FW ready OK! (151, 20ms), REG_MCUFWDL:0x070603c6 RTW: rtl8723d_FirmwareDownload success. write_fw:1, 390ms RTW: <=== rtl8723d_FirmwareDownload() RTW: hal_read_mac_hidden_rpt OK! (1, 0ms), fwdl:1, id:0x19 RTW: SetHwReg: bMacPwrCtrlOn=0 RTW: rtw_hal_read_chip_info in 870 ms RTW: init_mlme_default_rate_set: support CCK RTW: init_mlme_default_rate_set: support OFDM RTW: init_channel_set((null)) ChannelPlan ID:0x20, ch num:13 RTW: rtw_alloc_macid((null)) if1, hwaddr:ff:ff:ff:ff:ff:ff macid:1 RTW: Init_ODM_ComInfo_8723d(): fab_ver=0 cut_ver=3 RTW: rtw_regsty_chk_target_tx_power_valid return _FALSE for band:0, path:0, rs:0, t:-1 RTW: phy_ConfigBBWithPgParaFile(): No File PHY_REG_PG.txt, Load from HWImg Array! RTW: default power by rate loaded RTW: phy_txpwr_by_rate_chk_for_path_dup duplicate 2.4G [A] to [B] RTW: rtw_macaddr_cfg mac addr:d8:2f:e6:09:c4:4b RTW: bDriverStopped:True, bSurpriseRemoved:False, bup:0, hw_init_completed:0 RTW: init_mlme_default_rate_set: support CCK RTW: init_mlme_default_rate_set: support OFDM RTW: init_channel_set((null)) ChannelPlan ID:0x20, ch num:13 RTW: rtw_alloc_macid((null)) if2, hwaddr:ff:ff:ff:ff:ff:ff macid:1 RTW: rtw_drv_add_vir_if if2 mac_addr : da:2f:e6:09:c4:4b RTW: rtw_wiphy_alloc(phy0) RTW: rtw_wdev_alloc(padapter=(ptrval)) RTW: rtw_wiphy_alloc(phy1) RTW: rtw_wdev_alloc(padapter=(ptrval)) RTW: rtw_wiphy_register(phy0) RTW: Register RTW cfg80211 vendor cmd(0x67) interface RTW: _rtw_reg_notifier RTW: _rtw_reg_notifier_apply: NL80211_REGDOM_SET_BY_CORE to DRV RTW: rtw_ndev_init(wlan0) if1 mac_addr=d8:2f:e6:09:c4:4b RTW: rtw_ndev_notifier_call(wlan0) state:17 RTW: cfg80211_rtw_get_txpower RTW: rtw_ndev_notifier_call(wlan0) state:5 RTW: rtw_wiphy_register(phy1) RTW: Register RTW cfg80211 vendor cmd(0x67) interface RTW: _rtw_reg_notifier RTW: _rtw_reg_notifier_apply: NL80211_REGDOM_SET_BY_CORE to DRV RTW: rtw_ndev_init(wlan1) if2 mac_addr=da:2f:e6:09:c4:4b RTW: rtw_ndev_notifier_call(wlan1) state:17 RTW: cfg80211_rtw_get_txpower RTW: rtw_ndev_notifier_call(wlan1) state:5 ```
lwfinger commented 8 months ago

@briansune - The main difference between the 2 drivers is the one in rtw88 is maintained. The old one from Realtek is not.

The difference in sensitivity is that you are not setting the RX and TX gains. You need to read the old driver to see what it shows, and do the same in your simulated EFUSE. That is where this information should be.

briansune commented 8 months ago

@lwfinger

I didn't mention any sensitivity nor trying to simulated the EFUSE that is what @RadxaYuntian trying to move the old repository RTL8723DS to the new RTW88. Maybe the sensitivity you trying to refer is about the stability of the ping test.

BTW, it is maintained then the EFUSE preloaded feature is also included? As grabbing the old EFUSE is just a temporary fix,

lwfinger commented 8 months ago

The stability of the ping test, the sensitivity of the scan, and the ease of making a connection will all depend on the TX/RX gains. If the device has the EFUSE programmed, then the gains will come from the EFUSE. If not, it will need to be set the way the MAC address is.

RadxaYuntian commented 8 months ago

Do you mean Hal_ReadRFGainOffset? PPG_THERMAL_OFFSET_8723D and PPG_BB_GAIN_2G_TX_OFFSET_8723D are defined as 0xFF in Brian's eFuse, so I guess I'm not looking at the right place. The related power_trim function also seems to be only available for rtw8822.c in rtw88 driver. It appears to be a lot of missing functionality for rtl8723ds.

briansune commented 8 months ago

@RadxaYuntian

I am afraid my expertise's are out of the scope of these coding stuff. I can help on hardware testing and simple cross-compile stuff =S. As for the EFUSE are my extracted same as yours?

lwfinger commented 8 months ago

@RadxaYuntian - There could be missing functionality in the 8723ds code, but it works in the PCI and USB drivers, and for the SDIO drivers that have properly coded EFUSE.

In file rtw8723ds.h, struct rtw8723d_efuse shows the layout of the EFUSE that the program expects. In array txpwr_idx_table should be the parameters that the program expects. I have no idea what the vendor driver does.

briansune commented 8 months ago

@lwfinger

It is possible to add a printout function or debug to the exist RTW88 and allow @RadxaYuntian to compare with a pre-FUSED IC?

lwfinger commented 8 months ago

Of course it is possible, but I won't do it. @RadxaYuntian should tell you what variables he wants to see or send you a patch file. The main repository has to be kept clean.

RadxaYuntian commented 8 months ago

As for the EFUSE are my extracted same as yours?

My eFuse dump ``` [ 12.084581] RTW: HW EFUSE [ 12.084595] RTW: 0x000: [ 12.084604] 29 [ 12.084611] 81 [ 12.084617] 00 [ 12.084622] 7C [ 12.084628] E1 [ 12.084633] 88 [ 12.084638] 07 [ 12.084644] 00 [ 12.084650] A0 [ 12.084656] 04 [ 12.084661] EC [ 12.084667] 35 [ 12.084672] 12 [ 12.084678] C0 [ 12.084683] A2 [ 12.084689] D8 [ 12.084696] RTW: 0x010: [ 12.084701] FF [ 12.084706] FF [ 12.084712] FF [ 12.084718] FF [ 12.084723] FF [ 12.084730] FF [ 12.084736] FF [ 12.084741] FF [ 12.084747] FF [ 12.084753] FF [ 12.084758] FF [ 12.084764] FF [ 12.084769] FF [ 12.084775] FF [ 12.084780] FF [ 12.084786] FF [ 12.084793] RTW: 0x020: [ 12.084798] FF [ 12.084804] FF [ 12.084809] FF [ 12.084822] FF [ 12.084846] FF [ 12.084854] FF [ 12.084859] FF [ 12.084865] FF [ 12.084870] FF [ 12.084876] FF [ 12.084881] FF [ 12.084887] FF [ 12.084892] FF [ 12.084898] FF [ 12.084904] FF [ 12.084910] FF [ 12.084917] RTW: 0x030: [ 12.084922] FF [ 12.084927] FF [ 12.084933] FF [ 12.084938] FF [ 12.084944] FF [ 12.084949] FF [ 12.084955] FF [ 12.084960] FF [ 12.084966] FF [ 12.084971] FF [ 12.084977] FF [ 12.084982] FF [ 12.084988] FF [ 12.084993] FF [ 12.085000] FF [ 12.085005] FF [ 12.085011] RTW: 0x040: [ 12.085017] FF [ 12.085022] FF [ 12.085028] FF [ 12.085033] FF [ 12.085038] FF [ 12.085044] FF [ 12.085051] FF [ 12.085057] FF [ 12.085063] FF [ 12.085068] FF [ 12.085074] FF [ 12.085079] FF [ 12.085085] FF [ 12.085091] FF [ 12.085096] FF [ 12.085102] FF [ 12.085108] RTW: 0x050: [ 12.085114] FF [ 12.085119] FF [ 12.085125] FF [ 12.085130] FF [ 12.085136] FF [ 12.085142] FF [ 12.085148] FF [ 12.085153] FF [ 12.085158] FF [ 12.085164] FF [ 12.085170] FF [ 12.085175] FF [ 12.085181] FF [ 12.085186] FF [ 12.085192] FF [ 12.085197] FF [ 12.085204] RTW: 0x060: [ 12.085208] FF [ 12.085214] FF [ 12.085219] FF [ 12.085226] FF [ 12.085231] FF [ 12.085236] FF [ 12.085242] FF [ 12.085248] FF [ 12.085253] FF [ 12.085259] FF [ 12.085264] FF [ 12.085270] FF [ 12.085276] FF [ 12.085281] FF [ 12.085287] FF [ 12.085292] FF [ 12.085299] RTW: 0x070: [ 12.085304] FF [ 12.085309] FF [ 12.085315] FF [ 12.085321] FF [ 12.085326] FF [ 12.085331] FF [ 12.085337] FF [ 12.085343] FF [ 12.085349] FF [ 12.085354] FF [ 12.085361] FF [ 12.085366] FF [ 12.085371] FF [ 12.085377] FF [ 12.085382] FF [ 12.085388] FF [ 12.085394] RTW: 0x080: [ 12.085399] FF [ 12.085405] FF [ 12.085410] FF [ 12.085416] FF [ 12.085421] FF [ 12.085427] FF [ 12.085432] FF [ 12.085438] FF [ 12.085444] FF [ 12.085450] FF [ 12.085455] FF [ 12.085461] FF [ 12.085466] FF [ 12.085472] FF [ 12.085477] FF [ 12.085483] FF [ 12.085490] RTW: 0x090: [ 12.085494] FF [ 12.085500] FF [ 12.085505] FF [ 12.085511] FF [ 12.085516] FF [ 12.085522] FF [ 12.085528] FF [ 12.085533] FF [ 12.085539] FF [ 12.085545] FF [ 12.085550] FF [ 12.085556] FF [ 12.085561] FF [ 12.085567] FF [ 12.085573] FF [ 12.085578] FF [ 12.085585] RTW: 0x0a0: [ 12.085590] FF [ 12.085595] FF [ 12.085601] FF [ 12.085606] FF [ 12.085612] FF [ 12.085618] FF [ 12.085623] FF [ 12.085629] FF [ 12.085634] FF [ 12.085640] FF [ 12.085646] FF [ 12.085651] FF [ 12.085657] FF [ 12.085662] FF [ 12.085668] FF [ 12.085674] FF [ 12.085680] RTW: 0x0b0: [ 12.085685] FF [ 12.085690] FF [ 12.085696] FF [ 12.085701] FF [ 12.085707] FF [ 12.085713] FF [ 12.085719] FF [ 12.085725] FF [ 12.085730] FF [ 12.085736] FF [ 12.085741] FF [ 12.085747] FF [ 12.085752] FF [ 12.085758] FF [ 12.085763] FF [ 12.085769] FF [ 12.085776] RTW: 0x0c0: [ 12.085780] FF [ 12.085786] FF [ 12.085791] FF [ 12.085797] FF [ 12.085802] FF [ 12.085809] FF [ 12.085814] FF [ 12.085819] FF [ 12.085825] FF [ 12.085830] FF [ 12.085836] FF [ 12.085842] FF [ 12.085847] FF [ 12.085853] FF [ 12.085858] FF [ 12.085864] FF [ 12.085871] RTW: 0x0d0: [ 12.085875] FF [ 12.085881] FF [ 12.085886] FF [ 12.085892] FF [ 12.085898] FF [ 12.085903] FF [ 12.085909] FF [ 12.085914] FF [ 12.085920] FF [ 12.085926] FF [ 12.085932] FF [ 12.085937] FF [ 12.085943] FF [ 12.085949] FF [ 12.085954] FF [ 12.085960] FF [ 12.085966] RTW: 0x0e0: [ 12.085972] FF [ 12.085977] FF [ 12.085982] FF [ 12.085988] FF [ 12.085994] FF [ 12.085999] FF [ 12.086005] FF [ 12.086010] FF [ 12.086016] FF [ 12.086021] FF [ 12.086026] FF [ 12.086033] FF [ 12.086038] FF [ 12.086044] FF [ 12.086049] FF [ 12.086055] FF [ 12.086061] RTW: 0x0f0: [ 12.086066] FF [ 12.086071] FF [ 12.086078] FF [ 12.086083] FF [ 12.086088] FF [ 12.086094] FF [ 12.086100] FF [ 12.086105] FF [ 12.086111] FF [ 12.086116] FF [ 12.086123] FF [ 12.086128] FF [ 12.086134] FF [ 12.086139] FF [ 12.086144] FF [ 12.086150] FF [ 12.086157] RTW: 0x100: [ 12.086162] FF [ 12.086167] FF [ 12.086173] FF [ 12.086178] FF [ 12.086184] FF [ 12.086189] FF [ 12.086195] FF [ 12.086200] FF [ 12.086206] FF [ 12.086212] FF [ 12.086217] FF [ 12.086223] FF [ 12.086228] FF [ 12.086234] FF [ 12.086240] FF [ 12.093688] FF [ 12.093728] RTW: 0x110: [ 12.093736] FF [ 12.093742] FF [ 12.093747] FF [ 12.093753] FF [ 12.093758] FF [ 12.093764] FF [ 12.093769] FF [ 12.093775] FF [ 12.093781] FF [ 12.093787] FF [ 12.093792] FF [ 12.093797] FF [ 12.093803] FF [ 12.093808] FF [ 12.093814] FF [ 12.093820] FF [ 12.093827] RTW: 0x120: [ 12.093832] FF [ 12.093837] FF [ 12.093846] FF [ 12.093852] FF [ 12.093857] FF [ 12.093863] FF [ 12.093868] FF [ 12.093874] FF [ 12.093880] FF [ 12.093885] FF [ 12.093890] FF [ 12.093896] FF [ 12.093902] FF [ 12.093907] FF [ 12.093913] FF [ 12.093919] FF [ 12.093926] RTW: 0x130: [ 12.093931] FF [ 12.093936] FF [ 12.093941] FF [ 12.093947] FF [ 12.093953] FF [ 12.093958] FF [ 12.093964] FF [ 12.093969] FF [ 12.093975] FF [ 12.093980] FF [ 12.093986] FF [ 12.093992] FF [ 12.093997] FF [ 12.094003] FF [ 12.094009] FF [ 12.094014] FF [ 12.094021] RTW: 0x140: [ 12.094028] FF [ 12.094033] FF [ 12.094039] FF [ 12.094044] FF [ 12.094049] FF [ 12.094055] FF [ 12.094061] FF [ 12.094066] FF [ 12.094072] FF [ 12.094078] FF [ 12.094083] FF [ 12.094090] FF [ 12.094095] FF [ 12.094101] FF [ 12.094106] FF [ 12.094111] FF [ 12.094118] RTW: 0x150: [ 12.094122] FF [ 12.094128] FF [ 12.094134] FF [ 12.094139] FF [ 12.094145] FF [ 12.094150] FF [ 12.094156] FF [ 12.094161] FF [ 12.094167] FF [ 12.094172] FF [ 12.094179] FF [ 12.094186] FF [ 12.094194] FF [ 12.094199] FF [ 12.094205] FF [ 12.094212] FF [ 12.094219] RTW: 0x160: [ 12.094223] FF [ 12.094229] FF [ 12.094234] FF [ 12.094240] FF [ 12.094262] FF [ 12.094270] FF [ 12.094275] FF [ 12.094281] FF [ 12.094287] FF [ 12.094292] FF [ 12.094298] FF [ 12.094304] FF [ 12.094309] FF [ 12.094315] FF [ 12.094321] FF [ 12.094327] FF [ 12.094333] RTW: 0x170: [ 12.094339] FF [ 12.094344] FF [ 12.094351] FF [ 12.094356] FF [ 12.094362] FF [ 12.094367] FF [ 12.094373] FF [ 12.094378] FF [ 12.094384] FF [ 12.094389] FF [ 12.094396] FF [ 12.094401] FF [ 12.094407] FF [ 12.094412] FF [ 12.094418] FF [ 12.094423] FF [ 12.094430] RTW: 0x180: [ 12.094434] FF [ 12.094440] FF [ 12.094446] FF [ 12.094451] FF [ 12.094457] FF [ 12.094462] FF [ 12.094468] FF [ 12.094473] FF [ 12.094479] FF [ 12.094485] FF [ 12.094491] FF [ 12.094496] FF [ 12.094501] FF [ 12.094507] FF [ 12.094513] FF [ 12.094518] FF [ 12.094525] RTW: 0x190: [ 12.094530] FF [ 12.094535] FF [ 12.094541] FF [ 12.094546] FF [ 12.094552] FF [ 12.094559] FF [ 12.094565] FF [ 12.094571] FF [ 12.094577] FF [ 12.094582] FF [ 12.094587] FF [ 12.094593] FF [ 12.094599] FF [ 12.094604] FF [ 12.094610] FF [ 12.094615] FF [ 12.094623] RTW: 0x1a0: [ 12.094628] FF [ 12.094633] FF [ 12.094639] FF [ 12.094644] FF [ 12.094649] FF [ 12.094655] FF [ 12.094660] FF [ 12.094666] FF [ 12.094672] FF [ 12.094677] FF [ 12.094683] FF [ 12.094688] FF [ 12.094694] FF [ 12.094699] FF [ 12.094705] FF [ 12.094711] FF [ 12.094717] RTW: 0x1b0: [ 12.094722] FF [ 12.094727] FF [ 12.094734] FF [ 12.094739] FF [ 12.094744] FF [ 12.094750] FF [ 12.094762] FF [ 12.094769] FF [ 12.094775] FF [ 12.094788] FF [ 12.094793] FF [ 12.094798] FF [ 12.094804] FF [ 12.094810] FF [ 12.094818] FF [ 12.094823] FF [ 12.094830] RTW: 0x1c0: [ 12.094835] FF [ 12.094840] FF [ 12.094846] FF [ 12.094851] FF [ 12.094856] FF [ 12.094863] FF [ 12.094868] FF [ 12.094873] FF [ 12.094879] FF [ 12.094884] FF [ 12.094890] FF [ 12.094896] FF [ 12.094901] FF [ 12.094907] FF [ 12.094913] FF [ 12.094918] FF [ 12.094925] RTW: 0x1d0: [ 12.094929] FF [ 12.094935] FF [ 12.094941] FF [ 12.094946] FF [ 12.094952] FF [ 12.094957] FF [ 12.094963] FF [ 12.094968] FF [ 12.094974] FF [ 12.094980] FF [ 12.094985] FF [ 12.094991] FF [ 12.094997] FF [ 12.095003] FF [ 12.095008] FF [ 12.095013] FF [ 12.095020] RTW: 0x1e0: [ 12.095025] FF [ 12.095030] FF [ 12.095036] FF [ 12.095042] FF [ 12.095047] FF [ 12.095053] FF [ 12.095058] FF [ 12.095064] FF [ 12.095070] FF [ 12.095075] FF [ 12.095081] FF [ 12.095087] FF [ 12.095092] FF [ 12.095098] FF [ 12.095103] FF [ 12.095109] FF [ 12.095115] RTW: 0x1f0: [ 12.095120] FF [ 12.095125] FF [ 12.095132] FF [ 12.095137] FF [ 12.095143] FF [ 12.095148] FF [ 12.095153] FF [ 12.095159] FF [ 12.095165] FF [ 12.095170] FF [ 12.095177] FF [ 12.095182] FF [ 12.095187] FF [ 12.095193] FF [ 12.095199] FF [ 12.095204] FF ```

TL;DR: it is really all 0xFF past first 16 bytes.

In array txpwr_idx_table should be the parameters that the program expects. I have no idea what the vendor driver does.

Vendor driver supplies a device-specific fallback rtl8723d_pg_txpwr_def_info and a generic fallback pg_txpwr_def_info when the value from eFuse or the more specific fallback failed to meet the hal_chk_pg_txpwr_info_2g and hal_chk_pg_txpwr_info_5g checks in hal_load_pg_txpwr_info. I have tested both data on my device but they did not provide good performance. So I think the issue is in the other fields where Brian's eFuse has a different value than the defaults I included from rtl8723ds vendor driver.

Although even if I could make it to work by adjusting my included defaults to match Brian's eFuse dump, we still need a way to notify the network stack that the Phy does not have a MAC address, so user space configuration daemon could handle this task. Hardcoding a MAC in the driver is not acceptable for production use.

briansune commented 8 months ago

@RadxaYuntian

Did you do a read back sanity check after loading those value or the dump is after the write? If you can guide me where should I add the code and do a 2nd read back after write on the old repository driver.

Ignore those meaning behind the seen, just simply clone a working eFUSE and compare the stability first. I am really confused by RTW88 is maintained but some basic features are missing.

RadxaYuntian commented 8 months ago

That is just what the vendor rtl8723ds prints when debug is enabled and log level is set to 4. I believe this is the raw data on the eFuse.

If you want to override the entire eFuse, you need to first update struct rtw8723ds_efuse so the final struct rtw8723d_efuse has the same size of the physical eFuse (0x200):

struct rtw8723ds_efuse {
    u8 res4[0x1f];              /* 0xd0 */
    u8 ppg_thermal;             /* 0xef */
    u8 res5[0x2a];              /* 0xf0 */
    u8 mac_addr[ETH_ALEN];      /* 0x11a */
    u8 res6[0xce];              /* 0x120 */
    u8 ppg_bb_gain;             /* 0x1ee */
    u8 res7[0x10];              /* 0x1ef */
};

Then in the rtw8723d_read_efuse function you can overwrite the content of log_map to be that of your emulated eFuse.

briansune commented 8 months ago

@RadxaYuntian

What I am trying to say is that: At the old RTL8723DS do you also print the eFUSE content after the driver have loaded a default eFUSE setting after checking it is incorrect? If so I can also cross-check and provide my dump to compare.

RadxaYuntian commented 8 months ago

The eFuse dumped by vendor driver is the raw eFuse data: https://github.com/lwfinger/rtl8723ds/blob/master/core/efuse/rtw_efuse.c#L2312

You can see the driver check the validity of the eFuse AFTER it was dumped: https://github.com/lwfinger/rtl8723ds/blob/master/hal/rtl8723d/rtl8723d_hal_init.c#L3634-L3649

The vendor driver also did not update the in-memory eFuse dump. The default value is plugged in at run-time, after it checks the eFuse provided value. This is also how I implemented the default value in rtw88 HACK: https://github.com/lwfinger/rtl8723ds/blob/master/hal/rtl8723d/rtl8723d_hal_init.c#L3973-L3975

briansune commented 8 months ago

@RadxaYuntian

First two explains are clear. So the dump is before default settings are loaded in. And printout is also before load.

As for the last then I would suggest why not simply reuse the before loaded print and print out the after load settings and let us do a cross-check if it is the same? (use result to debug should be more easy I guess)

Then after we had confirm both eFUSE after default settings loading the hack can be more sure to start with (I hope)?

lwfinger commented 8 months ago

@RadxaYuntian - Yes, there are features missing for rtw8723ds, but the underllying code for rtw8723d is maintained. If you/we come up with code changes, they can be introduced into wireless-next, and they will ultimately be applied to the kernel. That is what "maintained" means. It does not mean that it is complete at the moment, but the mechanism exists to make it better. BTW, the guy that wrote the kernel's rtw8723ds could not envision that there would be models in the wild with empty EFUSEs. I still cannot believe that vendors would do this!!

As to assigning a MAC address. The first 3 digits should be the Realtek manufacturer values, and the last 3 assigned from a random number. To give reproducibility, we could also set up a module parameter so that the MAC address is read at boot time. Module parameters are frowned upon, but the case could be made for a new one here.

briansune commented 8 months ago

@lwfinger

According to my previous RF company experience the EFUSE is what defines the conformance test and standard. If CE standard then the max power of the TX has to be fixed to a level as well as EMC to fit the location of sell. This do make sense as 3rd party distributor can only got blank IC.

The EFUSE is preloaded between supplier broker and the company agreement. While user can adjust the TX LUT and RX filter but from first place it much be preprogrammed to fit the standard that country going to distribute or sell. Realtek won't even response to small company and this is why WIFI module exist (USB SDIO or PCIE) as they provide 100% verified by the local conformance test and standard.