I compiled 5.6-main and ran it while bringing up hci0 and scanned for my phone. Hope this is helpful… Did you want me to try 5.15? Or for the purposes of this discussion, does that not quality as a “working kernel”?
btmon_5.6.log (17.2 KB)
I compiled 5.6-main and ran it while bringing up hci0 and scanned for my phone. Hope this is helpful… Did you want me to try 5.15? Or for the purposes of this discussion, does that not quality as a “working kernel”?
btmon_5.6.log (17.2 KB)
thanks for the log, alex have an idea where the problem can be, it is a new codeblock in BT core and needs a flag in driver to skip it.
no need to try later kernel at the moment as we know 5.7+ is broken
Yay! You’re welcome!
could you try if this fixes the issue?
diff --git a/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c b/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c
index 5a85f68b092f..2347183c874a 100644
--- a/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c
+++ b/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c
@@ -473,6 +473,8 @@ int mtk_bt_hci_init(void)
mtk_hci.hdev->notify = mtk_bt_hci_notify;
SET_HCIDEV_DEV(mtk_hci.hdev, stpbt_dev);
+ set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &mtk_hci.hdev->quirks);
+
hci_set_drvdata(mtk_hci.hdev, &mtk_hci);
mtk_wcn_stp_register_if_rx(mtk_bt_hci_receive);
Made that change in 5.15-main and recompiled. It does fix the issue! Thank you!
Also tested on 5.16 - hci0 brings up successfully. Not yet any other tests.
Compiling 5.7-main and 5.8-main gives me these errors:
from drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c:16:
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c: In function 'mtk_bt_hci_init':
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c:476:10: error: 'HCI_QUIRK_BROKEN_ERR_DATA_REPORTING' undeclared (first use in this function); did you mean 'HCI_OP_READ_DEF_ERR_DATA_REPORTING'?
set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &mtk_hci.hdev->quirks);
^
./arch/arm/include/asm/bitops.h:183:42: note: in definition of macro 'ATOMIC_BITOP'
#define ATOMIC_BITOP(name,nr,p) _##name(nr,p)
^~
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c:476:2: note: in expansion of macro 'set_bit'
set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &mtk_hci.hdev->quirks);
^~~~~~~
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c:476:10: note: each undeclared identifier is reported only once for each function it appears in
set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &mtk_hci.hdev->quirks);
^
./arch/arm/include/asm/bitops.h:183:42: note: in definition of macro 'ATOMIC_BITOP'
#define ATOMIC_BITOP(name,nr,p) _##name(nr,p)
^~
drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.c:476:2: note: in expansion of macro 'set_bit'
set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &mtk_hci.hdev->quirks);
^~~~~~~
scripts/Makefile.build:266: recipe for target 'drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.o' failed
scripts/Makefile.build:488: recipe for target 'drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub' failed
make[8]: *** [drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.o] Error 1
5.9-main and 5.10-main compiles correctly and each is able to bring up the hci0 interface.
EDIT #1: I just pulled the latest version of the kernel. Let me try 5.7-main and 5.8-main again…
EDIT #2: 5.7-main and 5.8-main are still unable to compile for me.
mhm, this quirk and code for skipping the data_reporting was added in 5.7.16/5.8.2
thx for testing
i’ll update these 2 branches, edit: done
Pulled lastest 5.7-main and attempted to compile. No dice.
i can compile 5.7-main and module is built
frank@frank-G5-U20:/media/data_nvme/git/kernel/BPI-R2-4.14 (5.7-main) [1M26U]
$ find ../build/ -iname '*stp*.ko'
../build/drivers/misc/mediatek/connectivity/common/conn_soc/linux/pub/stp_chrdev_bt.ko
which error did you get? but i guess your code is not same as on github, maybe you need a make clean/mrproper
Pull changes to the repository again. Dunno what you did, but both branches 5.7-main and 5.8-main compile successfully now! Thank you again!
My last change was 1 hour ago in these 2 branches that was the push after the updates
Hold up, I thought 5.8-main compiled correctly. Instead, I found this error:
CC drivers/crypto/mediatek/mtk-aes.o
drivers/mmc/host/mtk-sd.c:439:24: error: duplicate member 'reset'
struct reset_control *reset;
^~~~~
scripts/Makefile.build:280: recipe for target 'drivers/mmc/host/mtk-sd.o' failed
scripts/Makefile.build:497: recipe for target 'drivers/mmc/host' failed
scripts/Makefile.build:497: recipe for target 'drivers/mmc' failed
make[3]: *** [drivers/mmc/host/mtk-sd.o] Error 1
make[2]: *** [drivers/mmc/host] Error 2
make[1]: *** [drivers/mmc] Error 2
make[1]: *** Waiting for unfinished jobs....
seems i had added patches to this file to fix mmc issue (afair for r64 emmc)
https://elixir.bootlin.com/linux/v5.8.18/source/drivers/mmc/host/mtk-sd.c#L418
just drop the resetcontrol from end of the struct…i do this too and make compile-test, but i will take some time
I just dropped that line as recommended, then branch 5.8-main compiles correctly.
thx, but i guess the reset is done twice now…will fix this too, so do not yet boot it up, only compile-test
edit: it seems only the struct-member was twice, so you can try booting it
Cool, it looks like 5.8 boots up fine on my R2 (don’t have a R64). hci0 can also be brought up.
in 5.17 i get the error
drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c: In function 'wmt_detect_unlocked_ioctl':
drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.c:120:12: error: implicit declaration of function 'wmt_plat_get_soc_chipid' [-Werror=implicit-function-declaration]
120 | retval = wmt_plat_get_soc_chipid();
| ^~~~~~~~~~~~~~~~~~~~~~~
as far as i debugged, this filter in drivers/misc/mediatek/connectivity/common/Makefile does not match and do not include the conn_soc directory:
ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)
MTK_COMBO_CHIP is set to this [=CONSYS_7623] so imho it should be included
but the filter seems not working, it returns empty string
$(warning $$MTK_PLATFORM is [${MTK_PLATFORM}])
$(warning $$CONFIG_MTK_COMBO_CHIP is [$(CONFIG_MTK_COMBO_CHIP)] (should not be empty))
$(warning filter-result: $(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)))
shows this:
drivers/misc/mediatek/connectivity/common/Makefile:4: $MTK_PLATFORM is [mt7623]
drivers/misc/mediatek/connectivity/common/Makefile:5: $CONFIG_MTK_COMBO_CHIP is [CONSYS_7623] (should not be empty)
drivers/misc/mediatek/connectivity/common/Makefile:7: filter-result:
does anyone have an idea?
if i skip the check and always include the conn_soc, i get the same error about implicit declaration, but i have it in sourcefile defined, and it seems this is compiled
drivers/misc/mediatek/connectivity/common/conn_soc/mt7623/wmt_plat_alps.c:1019:UINT32 wmt_plat_get_soc_chipid(void)
drivers/misc/mediatek/connectivity/common/conn_soc/mt7623/wmt_plat_alps.c:1026:EXPORT_SYMBOL(wmt_plat_get_soc_chipid);
uploaded my current state to 5.17-rc tree
seems problem is again the filter command in a makefile…
drivers/misc/mediatek/connectivity/common/common_detect/Makefile
-ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)
+#ifneq ($(filter "CONSYS_%",$(CONFIG_MTK_COMBO_CHIP)),)
subdir-ccflags-y += -D MTK_WCN_SOC_CHIP_SUPPORT
ccflags-y += -I$(srctree)/$(src)/../conn_soc/linux/include
-endif
+#endif
MTK_WCN_SOC_CHIP_SUPPORT is guarding the extern function declaration in drivers/misc/mediatek/connectivity/common/common_detect/wmt_detect.h
The problem are the quotes around filter string…without them compiling works
but in system i get a
root@bpi-r2:~# echo A > /dev/wmtWifi
-bash: echo: write error: Input/output error
this had same rootcause…there were many other filter statements.got it solved so far.wifi is working.only see a trace on poweroff.
noticed some errors (maybe false positives) with wifi driver in gcc11 (gcc10 does not show this error)
drivers/misc/mediatek/connectivity/common/conn_soc/core/btm_core.c: In function '_stp_btm_put_dump_to_nl':
drivers/misc/mediatek/connectivity/common/conn_soc/core/btm_core.c:139:34: error: array subscript 'STP_PACKET_T {aka struct stp_dbg_pkt}[0]' is partly outside array bounds of 'UINT8[2048]' {aka 'unsigned char[2048]'} [-Werror=array-bounds]
139 | len = pkt->hdr.len;
| ^~
drivers/misc/mediatek/connectivity/common/conn_soc/core/btm_core.c:116:22: note: while referencing 'buf'
116 | static UINT8 buf[2048];
| ^~~
drivers/misc/mediatek/connectivity/common/conn_soc/core/btm_core.c: In function '_stp_btm_handler':
drivers/misc/mediatek/connectivity/common/conn_soc/core/btm_core.c:257:33: error: array subscript 'STP_PACKET_T {aka struct stp_dbg_pkt}[0]' is partly outside array bounds of 'UINT8[2048]' {aka 'unsigned char[2048]'} [-Werror=array-bounds]
257 | memcpy(&tmp[0], pkt->raw, pkt->hdr.len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/misc/mediatek/connectivity/common/conn_soc/core/btm_core.c:239:22: note: while referencing 'buf'
239 | static UINT8 buf[2048];
| ^~~
imho buffer is large enough
#define STP_DMP_SZ 16
typedef struct stp_dbg_pkt_hdr {
/* packet information */
unsigned int sec;
unsigned int usec;
unsigned int dbg_type;
unsigned int dmy;
unsigned int no;
unsigned int dir;
/* packet content */
unsigned int type;
unsigned int len;
unsigned int ack;
unsigned int seq;
unsigned int chs;
unsigned int crc;
} STP_DBG_HDR_T;
typedef struct stp_dbg_pkt {
struct stp_dbg_pkt_hdr hdr;
unsigned char raw[STP_DMP_SZ];
} STP_PACKET_T;
so we have 12 x uint32 + 16 = 62 bytes, buffer is 2028, i guess the error comes because array is defined as bytes and types are uint32 so using 4 array-elements each
maybe anybody has an idea how to fix it (@BitMaster @deadmeat )…
the only solution i’ve found till now is adding “-Wno-array-bounds” to cflags…but maybe there is a better solution
hi,
currently i try to update driver for linux 6.0…@deadmeat and i already fixed some problems, but now we are hanging on these:
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_cfg80211.c: In function 'mtk_p2p_cfg80211_start_ap':
drivers/misc/mediatek/connectivity/wlan/gen2/os/linux/gl_p2p_cfg80211.c:582:50: error: 'struct wireless_dev' has no member named 'preset_chandef'
582 | struct cfg80211_chan_def *chandef = &wdev->preset_chandef;
| ^~
the preset_chandef
has been removed in 6.0
some modern drivers use cfg80211_chandef_create
even in kernels before 6.0 e.g.:
https://elixir.bootlin.com/linux/v6.0-rc1/source/drivers/net/wireless/ath/ath6kl/cfg80211.c#L1115
looks like in this commit the member was deleted: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=7b0a0e3c3a88260b6fcb017e49f198463aa62ed1
any help @BitMaster @abbradar @LeXa2 @asac @dfiloni or maybe @graphine ?
@dougiefresh i dropped the quirk for bluetooth,if we get driver compilable can you please check the bluetooth function?