numbqq
December 18, 2019, 1:13pm
#34
Hello @chewitt
I just sync patches from your LE repo: https://github.com/chewitt/LibreELEC.tv/tree/amlogic-master/packages/linux/patches/amlogic
But it seems not very stable, sometimes work but sometimes not and I got the error:
[ 5.149743] brcmfmac: F1 signature read @0x18000000=0x17294359
[ 5.157179] ------------[ cut here ]------------
[ 5.158863] WARNING: CPU: 5 PID: 42 at brcmf_sdiod_sgtable_alloc+0x130/0x138 [brcmfmac]
[ 5.158866] Modules linked in: brcmfmac brcmutil cfg80211 rfkill ip_tables x_tables btrfs blake2b_generic xor xor_neon zstd_compress lzo_compress zlib_deflate raid6_pq libcrc32c gpio_pca953x rtc_hym8563 rtc_meson_vrtc
[ 5.184894] CPU: 5 PID: 42 Comm: kworker/5:1 Not tainted 5.5.0-rc2+ #0.7
[ 5.184895] Hardware name: Khadas VIM3 (DT)
[ 5.184922] Workqueue: events brcmf_driver_register [brcmfmac]
[ 5.201445] pstate: 80000005 (Nzcv daif -PAN -UAO)
[ 5.201466] pc : brcmf_sdiod_sgtable_alloc+0x130/0x138 [brcmfmac]
[ 5.212253] lr : brcmf_sdio_probe+0x2a8/0x920 [brcmfmac]
[ 5.212255] sp : ffff8000101aba70
[ 5.220759] x29: ffff8000101aba70 x28: 0000000000000000
[ 5.220761] x27: 0000000000000000 x26: ffff800009cc61a0
[ 5.220763] x25: ffff800009cce000 x24: ffff0000af955400
[ 5.220764] x23: ffff800012108000 x22: ffff0000ada67000
[ 5.220765] x21: ffff800009cc6000 x20: 0000000000000023
[ 5.220766] x19: ffff0000af955000 x18: 0000000000000000
[ 5.220768] x17: 0000000000000000 x16: 0000000000000000
[ 5.220769] x15: 0000000000000000 x14: 0000000000000000
[ 5.220770] x13: 0000000000000001 x12: 00000000002bb626
[ 5.220771] x11: 0000000000000005 x10: 0101010101010101
[ 5.220773] x9 : ffffffffffffffff x8 : 7f7f7f7f7f7f7f7f
[ 5.220774] x7 : 00000000000001ff x6 : 0000000000000080
[ 5.220775] x5 : 0000000000000600 x4 : 0000000000000003
[ 5.220776] x3 : ffff0000ace48980 x2 : 0000000000000021
[ 5.257704] x1 : 0000000000000003 x0 : ffff0000ada67000
[ 5.257708] Call trace:
[ 5.257728] brcmf_sdiod_sgtable_alloc+0x130/0x138 [brcmfmac]
[ 5.257736] brcmf_sdio_probe+0x2a8/0x920 [brcmfmac]
[ 5.257744] brcmf_sdiod_probe+0x11c/0x1b0 [brcmfmac]
[ 5.257752] brcmf_ops_sdio_probe+0x140/0x1e8 [brcmfmac]
[ 5.257759] sdio_bus_probe+0x14c/0x1d0
[ 5.257763] really_probe+0x27c/0x458
[ 5.257765] driver_probe_device+0x12c/0x148
[ 5.257767] device_driver_attach+0x6c/0x90
[ 5.257768] __driver_attach+0xb0/0x160
[ 5.257772] bus_for_each_dev+0x74/0xc8
[ 5.257773] driver_attach+0x20/0x28
[ 5.257775] bus_add_driver+0x154/0x238
[ 5.257776] driver_register+0x60/0x110
[ 5.257777] sdio_register_driver+0x24/0x30
[ 5.257785] brcmf_sdio_register+0x14/0x40 [brcmfmac]
[ 5.257794] brcmf_driver_register+0xc/0x18 [brcmfmac]
[ 5.257797] process_one_work+0x1fc/0x3d0
[ 5.257798] worker_thread+0x140/0x548
[ 5.257801] kthread+0x118/0x120
[ 5.257804] ret_from_fork+0x10/0x1c
[ 5.257806] ---[ end trace b4816f2be4cfa30f ]---
[ 5.271786] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9
[ 5.280085] systemd-journald[395]: Received request to flush runtime journal from PID 1
[ 5.322773] brcmfmac: brcmf_sdiod_ramrw: membytes transfer failed
[ 5.325041] brcmfmac: brcmf_sdio_download_code_file: error -84 on writing 595758 membytes at 0x00160000
[ 5.334329] brcmfmac: brcmf_sdio_download_firmware: dongle image file download failed
[ 5.347674] mmc0: tuning execution failed: -5
[ 5.347694] brcmfmac: brcmf_sdio_htclk: Failed access turning clock off: -5
[ 5.348138] brcmfmac: brcmf_sdio_htclk: HT Avail request error: -5
Do you ever meet this?
And I find an error about mmc0
:
mmc0: tuning execution failed: -5
So I try to slow down the speed, disable sd-uhs-sdr50
diff --git a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
index 3d19b5c..86d99c1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi
@@ -347,7 +347,7 @@
bus-width = <4>;
cap-sd-highspeed;
- sd-uhs-sdr50;
+// sd-uhs-sdr50;
max-frequency = <100000000>;
non-removable;
Now it seems been more stable, at least I can see the wlan0
node.
chewitt
December 18, 2019, 2:25pm
#35
Yes, i’ve reported the same warning splat here https://patchwork.kernel.org/cover/11286567/ and I’d like to run some tests with VIM3L and some other G12A and G12B devices I have to see if the issue is related to board or SoC or … something else. I’m travelling with work so it will be a couple of days before I can do much testing.
1 Like
numbqq
December 18, 2019, 2:31pm
#36
It’s not only a warning, there is en error in the end.
[ 5.271786] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9
[ 5.280085] systemd-journald[395]: Received request to flush runtime journal from PID 1
[ 5.322773] brcmfmac: brcmf_sdiod_ramrw: membytes transfer failed
[ 5.325041] brcmfmac: brcmf_sdio_download_code_file: error -84 on writing 595758 membytes at 0x00160000
[ 5.334329] brcmfmac: brcmf_sdio_download_firmware: dongle image file download failed
[ 5.347674] mmc0: tuning execution failed: -5
[ 5.347694] brcmfmac: brcmf_sdio_htclk: Failed access turning clock off: -5
[ 5.348138] brcmfmac: brcmf_sdio_htclk: HT Avail request error: -5
Load firmware failed, and mmc0
report an error, if I remove sd-uhs-sdr50
in mmc0 it works.
So I’m not sure whether it is a SDIO issue.
Anyway, have a nice vacation.
chewitt
December 19, 2019, 8:12am
#37
I added https://github.com/chewitt/linux/commit/85c6fd04de6741d4751930968ab7e1a13d14a255 to my branch, but I haven’t seen issues with loading firmware.
I do see errors in dmesg after connecting to a network:
Dec 19 08:08:19 VIM3 kernel: brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -5
Dec 19 08:08:19 VIM3 kernel: brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
Dec 19 08:08:47 VIM3 kernel: brcmfmac: brcmf_sdio_readframes: RXHEADER FAILED: -5
Dec 19 08:08:47 VIM3 kernel: brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame, send NAK
Dec 19 08:08:47 VIM3 kernel: brcmfmac: brcmf_sdio_hdparse: HW superframe header length error
Dec 19 08:08:47 VIM3 kernel: brcmfmac: brcmf_sdio_rxfail: abort command, terminate frame
numbqq
December 19, 2019, 8:16am
#38
Yes, If I remove sd-uhs-sdr50
the firmware loaded well.
I get patches from : https://github.com/chewitt/LibreELEC.tv/tree/amlogic-master/packages/linux/patches/amlogic
But this commit is not in.
chewitt
December 19, 2019, 12:09pm
#39
I’m using https://github.com/chewitt/linux/commits/amlogic-5.5-integ as a working kernel branch. I sync the commits to patches in https://github.com/chewitt/LibreELEC.tv/commits/amlogic-master every few days, but it’s usually behind. Everything is “work in progress” at the moment.
1 Like
numbqq
December 19, 2019, 2:21pm
#40
Some update:
Linux 5.5-rc2 + AP6398S test results:
VIM2
: Works without errors.
VIM3L
: Works without errors.
VIM3
: Works with some errors. (Need remove sd-uhs-sdr50
)
Edge
: Works without errors.
Stability still need to be confirm.
hyphop
December 21, 2019, 2:31am
#41
yes wifi works! but for VIM3 is not usable - very unstable - slow speed , gaps , lags, lost connection, and error!
NOTE: all another boards works - OK !
chewitt
December 21, 2019, 4:18am
#42
The X96-Max box I have (S905X2) uses BCM4356 but shows the same issues http://ix.io/24YV so I think there’s an issue with SDIO somewhere.
chewitt
December 21, 2019, 1:52pm
#43
Neil says “Oh I see why, we should disable sg_support since we support only a single sg…” but he’s on vaction for 14-days over Christmas and New Year so unless that means something to you (or anyone who writes code) further investigation might take a while.
1 Like
hyphop
December 23, 2019, 9:24am
#44
OK! i have done test for all VIMx boards
i have test both AP and CLIENT wifi modes
VIM3 notes
all errors possible to fix (but with lost some speed performance ) im not very competent at this linux drivers parts - maybe smbdy can make it more properly and elegant
yes we need remove this one from dts sd-uhs-sdr50
, but its not enough ( AP mode - not stable )
cap-sd-highspeed
- dont remove this node!!! ( this param make speed limit to 50Mhz - !!! 100Mhz not stable!!! )
/sys/kernel/debug/mmc0/ios:clock: 50000000 Hz
/sys/kernel/debug/mmc0/ios:actual clock: 50000000 Hz
( but dts still must have this one max-frequency = <100000000>;
)
and we need apply next my patch
NOTE: i think something wrong with mmc host driver for VIM3
need force setup another value for stable wifi work
[ 13.660868] brcmfmac: brcmf_sdiod_sgtable_alloc: !!!! WIFI VIM3 hack applay
[ 13.660874] brcmfmac: brcmf_sdiod_sgtable_alloc: !!!! WIFI DEBUG khadas,vim3: host->max_segs: 1
host->max_seg_size: 1 host->max_blk_count: 1536 sdiodev->max_request_size: 256
sdiodev->max_segment_count: 1 max_blocks: 1 host->max_req_size: 1536
for example this one workable DEFAULT parameters for VIM3L (but same parameters don’t wok for VIM3 ;-( )
[ 15.295165] brcmfmac: brcmf_sdiod_sgtable_alloc: !!!! WIFI DEBUG khadas,vim3l: host->max_segs: 256
host->max_seg_size: 511 host->max_blk_count: 261632 sdiodev->max_request_size: 130816
sdiodev->max_segment_count: 128 max_blocks: 511 host->max_req_size: 261632
PS: other patches for 5.4.5 => https://github.com/hyphop/khadas-linux-kernel/tree/master/patches/linux-5.4.5 + https://github.com/hyphop/khadas-linux-kernel/tree/master/patches/wifi_4359
2 Likes
chewitt
December 23, 2019, 9:51am
#45
G12A and G12B devices have a chipset bug that impacts SDIO - I see the same issue on a GT-King Pro and X96-Max box (both using BCM4356). GXL/GXM and SM1 don’t have the chip bug. I’ll pick the patch into my branch as a tempoarary workaround (tagged as HACK) but it needs to look for the g12a/g12b SoC compatible rather than board as the issue is not limited to VIM3. The real fix needs to be done in the mmc driver not brcmfmac, but that will take time due to Christmas and New Year.
hyphop
December 23, 2019, 9:58am
#47
NOTE: this openwrt image https://dl.khadas.com/Firmware/Krescue/images/VIMx.OpenWrt.servers.test.emmc.kresq - already have this patches + and we can test it for any khadas VIMx boards VIM1 VIM2 VIM3 VIM3L
chewitt
December 24, 2019, 6:22am
#49
The previous patch is flawed due to my general ignorance of c++ … it always evaluates to true so the hack is applied to all hardware. Below is an alternative approach that forces values in the mmc driver when amlogic,dram-access-quirk
is in the device-tree, which only applies to g12a and g12b:
committed 05:50AM - 24 Dec 19 UTC
Temporary workaround for the G12A and G12B SDIO chip bug that causes sdio
issues with brcmfmac. Patch is based on [1] by...
2 Likes
odibox
September 23, 2020, 12:12pm
#50
Hello
Should this problem be solved in kernel Linux Khadas 5.9.0-rc2? Or ist the Wifi of VIM3 V12 still buggy?
I would like to use it as a AP. With a mobile I can see the ssid, somtimes I can connect, but the connection is very unstable.
I get error messages like this:
[ 3.729255] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9
[ 3.737525] brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac4359-sdio.khadas,vim3.txt failed with error -2
[ 6.215359] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9
[ 6.218270] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 6.239368] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4359/9 wl0: Sep 20 2019 20:22:36 version 9.87.51.11.34 (edb7293@shgit) (r711217) FWID 01-c7feb1ee
[ 6.711304] ieee80211 phy0: brcmf_dongle_roam: WLC_SET_ROAM_TRIGGER error (-52)
[ 8.631375] ieee80211 phy0: brcmf_fweh_call_event_handler: no interface object
[ 554.785992] ieee80211 phy0: brcmf_p2p_send_action_frame: Unknown Frame: category 0x8a, action 0x6
[ 613.533757] ieee80211 phy0: brcmf_netdev_wait_pend8021x: Timed out waiting for no pending 802.1x packets
[ 614.557747] ieee80211 phy0: brcmf_netdev_wait_pend8021x: Timed out waiting for no pending 802.1x packets
Thanks in advice
Andreas
numbqq
September 23, 2020, 12:21pm
#51
In Linux 5.9-RC*
, the Wi-Fi driver is broken again…
Please use 5.7 kernel.
odibox
September 23, 2020, 2:48pm
#52
Thank you very much.
I compiled a fenix 0.9.4 Version with Kernel 5.7 and Debian.
Now, errors are still there, but the hostapd access point works.
[ 5.228669] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 5.239821] systemd-journald[1671]: Received request to flush runtime journal from PID 1
[ 5.257128] cfg80211: Loaded X.509 cert ‘sforshee: 00b28ddf47aef9cea7’
[ 5.263580] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[ 5.266584] cfg80211: failed to load regulatory.db
[ 5.334829] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9
[ 5.384304] brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac4359-sdio.khadas,vim3.txt failed with error -2
[ 5.970832] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac4359-sdio for chip BCM4359/9
[ 5.979305] brcmfmac: brcmf_c_process_clm_blob: no clm_blob available (err=-2), device may have limited channels available
[ 5.993740] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4359/9 wl0: Sep 20 2019 20:22:36 version 9.87.51.11.34 (edb7293@shgit) (r711217) FWID 01-c7feb1ee
[ 8.913853] ieee80211 phy0: brcmf_dongle_roam: WLC_SET_ROAM_TRIGGER error (-52)
[ 51.721872] ieee80211 phy0: brcmf_fweh_call_event_handler: no interface object
[ 51.834486] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 52.229840] ieee80211 phy0: brcmf_cfg80211_get_channel: chanspec failed (-512)
[ 52.237874] ieee80211 phy0: brcmf_cfg80211_get_tx_power: error (-512)
[ 52.737836] ieee80211 phy0: brcmf_vif_set_mgmt_ie: vndr ie set error : -52
[ 52.741816] ieee80211 phy0: brcmf_vif_set_mgmt_ie: vndr ie set error : -52
[ 55.697800] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
odibox
September 23, 2020, 2:54pm
#53
To remove the “Direct firmware load error” rename or copy the file
/lib/firmware/brcm/brcmfmac4359-sdio.txt
to
/lib/firmware/brcm/brcmfmac4359-sdio.khadas,vim3.txt
and reboot.
brcmfmac mmc0:0001:1: Direct firmware load for brcm/brcmfmac4359-sdio.khadas,vim3.txt failed with error -2