当前位置:   article > 正文

RK3588 & Android12 调试 RTL8852BE(wifi篇)_rk8852be

rk8852be

平台:RK3588 & Android12

模块:RTL8852BE

接口:PCIE

内容:调试RTL8852BE模块的WiFi功能

=================================================================

一、内核

1.1 dts配置

首先是配置PCIE,查看原理图,看一下模块用的哪一个PCIE

--------------------------------------------------------------------------------------------------------------------------------

很明显,这里接到了Mux1上,Mux1的 PHY(combphy1_ps)配合PCIe30x1_0(dts命名为pcie2x1l0),所以配置如下:

  1. vcc3v3_pcie20_wifi: vcc3v3-pcie20-wifi {
  2. compatible = "regulator-fixed";
  3. regulator-name = "vcc3v3_pcie20_wifi";
  4. regulator-min-microvolt = <3300000>;
  5. regulator-max-microvolt = <3300000>;
  6. enable-active-high;
  7. /*
  8. * wifi_reg_on 是在vbat、vddio稳定后才使能,在reset-gpios前拉高,所以
  9. * 放到PCIe的电源节点中才满足模块时序。
  10. */
  11. gpios = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
  12. startup-delay-us = <5000>;
  13. vin-supply = <&vcc12v_dcin>;
  14. };
  15. &combphy1_ps {
  16. status = "okay";
  17. };
  18. &pcie2x1l0 {
  19. reset-gpios = <&gpio1 RK_PB2 GPIO_ACTIVE_HIGH>;
  20. rockchip,skip-scan-in-resume;
  21. status = "okay";
  22. };

然后配置WiFi:

  1. wireless_wlan: wireless-wlan {
  2. compatible = "wlan-platdata";
  3. wifi_chip_type = "rtl8852be";
  4. pinctrl-names = "default";
  5. pinctrl-0 = <&wifi_host_wake_irq>, <&wifi_poweren_gpio>;
  6. WIFI,host_wake_irq = <&gpio0 RK_PB2 GPIO_ACTIVE_HIGH>;
  7. /* 不能这里控制wifi_reg_on管脚,请挪到vcc3v3_pcie20_wifi */
  8. //WIFI,poweren_gpio = <&gpio0 RK_PC4 GPIO_ACTIVE_HIGH>;
  9. status = "okay";
  10. };

&pinctrl添加:

  1. wireless-wlan {
  2. wifi_host_wake_irq: wifi-host-wake-irq {
  3. rockchip,pins = <0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down>;
  4. };
  5. wifi_poweren_gpio: wifi-poweren-gpio {
  6. rockchip,pins = <0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_up>;
  7. };

配好这些模块应该就挂到pcie上了:

2.1 驱动

RK3588似乎并没有兼容RTL8852BE这个模块,驱动需要问供应商要,存放路径

SDK\kernel-5.10\drivers\net\wireless\rockchip_wlan

二、系统层

由于SDK没有兼容RTL8852BE,所以要修改一些文件,让系统自动加载对应的ko文件

SDK\frameworks\opt\net\wifi\libwifi_hal\rk_wifi_ctrl.cpp

  1. ++ #define RTL8852BE_DRIVER_MODULE_PATH WIFI_MODULE_PATH"8852be.ko"
  2. ++ #define RTL8852BE_DRIVER_MODULE_NAME "8852be"
  3. static wifi_device supported_wifi_devices[] = {
  4. ++ {"RTL8852BE", "10ec:b852"},
  5. ...
  6. const wifi_file_name module_list[] = {
  7. ++ {"RTL8852BE", RTL8852BE_DRIVER_MODULE_NAME, RTL8852BE_DRIVER_MODULE_PATH, UNKOWN_DRIVER_MODULE_ARG, REALTEK_WIFI_HAL},
  8. ...

其实就是照葫芦画瓢,对着兼容的模块的写法去写。

三、遇到的问题

3.1 驱动报错

1)报错信息:

  1. drivers/net/wireless/rockchip_wlan/rtl8852be/Kconfig:5: syntax error
  2. drivers/net/wireless/rockchip_wlan/rtl8852be/Kconfig:4: unknown statement "---help---"
  3. drivers/net/wireless/rockchip_wlan/rtl8852be/Kconfig:5: unknown statement "Help"

Kconfig语法有错,---help---改成help即可

2)报错信息:

  1. error: "Must be LITTLE/BIG Endian Host"
  2. error: declaration of 'struct cfg80211_csa_settings' will not be visible outside of this function [-Werror,-Wvisibility]

没有选择对应的平台

修改Makefile:

  1. -- CONFIG_PLATFORM_I386_PC = y
  2. ++ CONFIG_PLATFORM_I386_PC = n
  3. -- CONFIG_PLATFORM_ARM_ROCKCHIP = n
  4. ++ CONFIG_PLATFORM_ARM_ROCKCHIP = y
  5. # Import platform assigned KSRC and CROSS_COMPILE
  6. -- include $(wildcard $(DRV_PATH)/platform/*.mk)
  7. ++ include $(src)/platform/arm_rk.mk

需要查看驱动 platform 目录下的相关文件,看包含哪个。

3)报错信息:

  1. drivers/net/wireless/rockchip_wlan/rtl8852be/core/rtw_mlme.c:5359:27: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
  2. if ((pregpriv->wifi_spec == 1))
  3. drivers/net/wireless/rockchip_wlan/rtl8852be/phl/hal_g6/mac/mac_ax/trxcfg.c:1253:9: error: explicitly assigning value of variable of type 'u32' (aka 'unsigned int') to itself [-Werror,-Wself-assign]
  4. val32 = val32;

报类似上面的错误,改了一个又出来另一个,直接修改 Makefile 禁止此类报错

  1. EXTRA_CFLAGS += -Wno-tautological-overlap-compare
  2. EXTRA_CFLAGS += -Wno-pointer-bool-conversion
  3. ++ EXTRA_CFLAGS += -Wno-parentheses-equality
  4. ++ EXTRA_CFLAGS += -Wno-self-assign

加的编译选项其实和报错信息差不多,其它类似报错照葫芦画瓢,大概用途:

  1. -Wno-uninitialized:禁止未初始化变量的警告
  2. -Wno-enum-conversion:禁止枚举类型转换警告
  3. -Wno-fortify-source:禁止源码加固警告
  4. -Wno-invalid-source-encoding:禁止无效的源码编码警告
  5. -Wno-tautological-pointer-compare:禁止指针比较警告
  6. -Wno-tautological-overlap-compare:禁止重叠比较警告
  7. -Wno-pointer-bool-conversion:禁止指针转布尔型警告
  8. -Wno-parentheses-equality:禁止多余括号的比较警告
  9. -Wno-self-assign:禁止变量自赋值警告
  10. -Wno-header-guard:禁止头文件守卫重复定义警告

4)报错信息:

  1. ERROR: modpost: module 8852be uses symbol kernel_write from namespace VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver, but does not import it.
  2. ERROR: modpost: module 8852be uses symbol kernel_read from namespace VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver, but does not import it.
  3. ERROR: modpost: module 8852be uses symbol filp_open from namespace VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver, but does not import it.

缺少相关命名空间,查找引用了 kernel_write 的文件,加入命名空间:

MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);

四、参考文章

高版本linux内核编译驱动报错记录_uses symbol kernel_write from namespace vfs_intern-CSDN博客

RK3568-B2-ANDROID11-WIFI-RTL8821CU_rk平台rtl8821cu调试-CSDN博客

五、资料包

内含改好编好的驱动以及相关参考文档

  1. 链接:https://pan.baidu.com/s/1xU_dgcywp86gLfZOceabFA 
  2. 提取码:zesv 
  3. --来自百度网盘超级会员V1的分享 

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号