Support onboard WIFI module MT6625 in Linux kernel 4.4.70

We’re debuging the MT6625 wifi module driver, now it’s working at 2.4G, please check below link for details.

2 Likes

Good Job:grinning::grinning:

Great! Looking good.

Some code remarks, which GCC7 errors about:

In file ‘drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p.c’ on line 3039:

iwe.u.data.length = 8 + sizeof("p2p_cap=");

should be:

iwe.u.data.length = 9 + sizeof("p2p_cap=");

because: “p2p_cap=%02x%02x%02x%02x%c” on line 3043 is 2+2+2+2+1 bytes long

Same issue also on line 3055 :slight_smile:

Compiling and testing now, will come back with results!

Edit: Hm i seem to end up in some kind of deadlock:

WARNING: CPU: 3 PID: 0 at kernel/watchdog.c:352 watchdog_timer_fn+0x1bc/0x388()

I did copy the firmware files to /etc.

Edit 2: I managed to circumvent the deadlock by disabling CONFIG_MTK_COMBO_BT in the kernel config.

Now the wlan0 device shows up! Didn’t try to scan or connect yet.

[root@alarm ~]# wmt_loader 
init combo devic[   85.904595] [WMT-DETECT][I]wmt_detect_open:open major 154 minor 0 (pid 436)
e
Opened combo dev[   85.913108] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191037),arg(0)
ice
[   85.921920] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (1074034433),arg(30243)
get device id : [   85.929645] set current consys chipid (0x7623)
30243
[   85.935407] [WMT-DETECT][I]wmt_detect_unlocked_ioctl:cmd (-2147191036),arg(30243)
set device id : [   85.943549] [WMT-MOD-INIT][I]do_common_drv_init:start to do common driver init, chipid:0x00007623
30243
[   85.959694] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[   85.967352] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[   85.975736] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[   85.983280] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[   85.991621] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[   85.999139] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[   86.009567] [WMT-CONSYS-HW][E]mtk_wmt_probe(122):Wmt Cannot find pinctrl default!
[   86.017875] [WMT-MOD-INIT][I]do_common_drv_init:finish common driver init
[   86.024874] [BT-MOD-INIT][I]do_bluetooth_drv_init:CONFIG_MTK_COMBO_BT is not defined
[   86.032782] [WCN-MOD-INIT][E]do_connectivity_driver_init(57):do common driver init failed, ret:-1
[   86.041835] [GPS-MOD-INIT][I]do_gps_drv_init:CONFIG_MTK_COMBO_GPS is not defined
[   86.049352] [WCN-MOD-INIT][E]do_connectivity_driver_init(62):do common driver init failed, ret:-1
[   86.058389] [FM-MOD-INIT][I]do_fm_drv_init:start to do fm module init
[   86.064955] [FM-MOD-INIT][I]do_fm_drv_init:finish fm module init
[   86.071076] [WLAN-MOD-INIT][I]do_wlan_drv_init:start to do wlan module init 0x7623
[   86.079093] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major 153) installed.
[   86.086920] [WLAN-MOD-INIT][I]do_wlan_drv_init:WMT-WIFI char dev init, ret:0
[   86.095450] [WLAN-MOD-INIT][I]do_wlan_drv_init:WLAN-GEN2 driver init, ret:0
[   86.102652] [WLAN-MOD-INIT][I]do_wlan_drv_init:finish wlan module init
do module init: [   86.110602] [WMT-DETECT][I]wmt_detect_close:close major 154 minor 0 (pid 436)
30243
failed to init module 
[root@alarm ~]# stp_uart_launcher -p /etc/firmware/ &
[1] 450
open device node[  114.615453] [WMT-DEV][W]WMT_unlocked_ioctl:chipid = 0x7623
 succeed.(Node:/[  114.622580] [WMT-LIB][W]wmt_lib_set_hif:new hifType: 2, fm:2
dev/stpwmt, fd:3[  114.629617] [WMT-DEV][W]WMT_unlocked_ioctl:unknown cmd (-2147180516)
) 
chip id is 0[  114.629619] [WMT-CORE][E]opfunc_hif_conf(874):WMT-CORE: WMT HIF info added
x7623
chiId:0x7[  114.646106] vcn18: mode operation not allowed
623, setting to property((null))[  114.653203] [WMT-CONSYS-HW][E]mtk_wcn_consys_hw_reg_ctrl(292):Read CONSYS chipId(0xfffff093)
chiId:0x7623
run SOC chip flow
[root@alarm ~]# create pwr on thread ok

[  114.741235] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6620.defAnt'.
[  114.748951] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6620.defAnt, mt6620_ant_m3.cfg, -1)
[  114.757320] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6628.defAnt'.
[  114.764873] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6628.defAnt, mt6628_ant_m1.cfg, -1)
[  114.773212] [WMT-CONF][E]wmt_conf_parse_pair(323):unknown field 'mt6630.defAnt'.
[  114.780731] [WMT-CONF][W]wmt_conf_parse:parse fail (mt6630.defAnt, mt6630_ant_m1.cfg, -1)
[  114.791056] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: read hw_ver (hw version) (0x8a00)
[  114.799677] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: read fw_ver (rom version) (0x8a00)
[  114.807849] [WMT-IC][W]mtk_wcn_soc_ver_check:0x7623: ic info: SOC_CONSYS.E1 (0x8a00/0x8a00, WMTHWVER:0, patch_ext:_e1)
enter power on connsys flowpatch name pre-fix:ROMv2_lm_patch
fwVersion:0x8a00
/etc/firmware//ROMv2_lm_patch_1_0_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x22,0x00,0x06,0x00
gpatchnum = [2]
gdwonseq = [2]
/etc/firmware//ROMv2_lm_patch_1_1_hdr.bin
fw Ver in patch: 0x8a00
read patch info:0x21,0x00,0x0e,0xf0
gdwonseq = [1]
cmd(srh_patch) resp(ok)
[  114.916986] [WMT-IC][W]mtk_wcn_soc_patch_dwn:wmt_core: patch dwn:0 frag(51, 268) ok
[  115.066776] [WMT-IC][W]mtk_wcn_soc_patch_dwn:wmt_core: patch dwn:0 frag(114, 52) ok
[  115.402711] [WMT-IC][W]mtk_wcn_soc_sw_init:co-clock disabled.
[  115.409353] [STP] mtk_wcn_stp_psm_enable:[W] STP Not Ready, Dont do Sleep/Wakeup
[  115.416915] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:0 lpbk:2 coredump:0 wmt:2 stp:0)
[  115.427613] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(9) ok

[root@alarm ~]# echo 1 >/dev/wmtWifi 
[  127.621171] [MTK-WIFI] WIFI_open: WIFI_open: major 153 minor 0 (pid 409)
[  127.628096] [MTK-WIFI] WIFI_write: WIFI_write 1
[  127.628096] 
[  127.660905] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt wlan func on before wlan probe
[  128.712158] [MTK-WIFI] register_set_p2p_mode_handler: (pid 441) register set p2p mode handler c071e8e0
[  128.721748] [WMT-FUNC][W]wmt_func_wifi_on:WMT-FUNC: wmt call wlan probe ok
[  128.728758] [WMT-CORE][W]wmt_core_dump_func_state:[AF FUNC ON]status(b:0 f:0 g:0 w:2 lpbk:2 coredump:0 wmt:2 stp:0)
[  128.739631] [WMT-EXP][W]mtk_wcn_wmt_func_ctrl:OPID(3) type(3) ok
[  128.745907] [MTK-WIFI] WIFI_write: WMT turn on WIFI success!
[  128.751796] [MTK-WIFI] WIFI_close: WIFI_close: major 153 minor 0 (pid 409)
[root@alarm ~]# ip addr
**snip**
7: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:08:22:b4:62:fd brd ff:ff:ff:ff:ff:ff
1 Like

Thanks, BitMaster.

I will check these errors. And I found the iwlist can’t show all available wifi AP, so I usually use wpa_supplicant to connect AP.

Let me know if you have any question.

I am not sure how I got the deadlock (watchdog trigger) yesterday, but I’ve tried several configuration options and I am no longer able to reproduce it. It now works for me with mt7623n_evb_bpi_defconfig (and some GCC7 patches). It might have been related to: https://github.com/BPI-SINOVOIP/BPI-R2-bsp/issues/5

I tried a WiFi scan with wpa_supplicant, but i don’t have an antenna yet. It does find my home network though, which is very close.

I have some questions:

  • Will you eventually add the fairly cumbersome initialization sequence to the kernel?
  • Do you appreciate pull requests?

Hi BitMaster,

Do you have the log for deadlock issue? If yes, can you share it with me?

For your questions:

  1. I don’t have plan to add the initialization sequence to kernel, but I will make a script for them, is it okay for you?
  2. Any pull request is appreciated, but please let me know what issue is fixed, so I’ll test it in next release.

Thanks Gary

The wifi module works fine at 5G mode, please see https://github.com/BPI-SINOVOIP/BPI-R2-bsp/issues/1 for details. But there is a balance issue at 5G mode, will focus on this issue right now