赞
踩
SDIO接口与PCIE接口无线模块二选一,若二者蓝牙共用同一个串口,则需要单独供电,不可同时上电。
参考文件:Rockchip_Developer_Guide_Linux_WIFI_BT_CN_20220928.pdf
SDIO 接口Wi-Fi:WL_REG_ON由sdio_pwrseq节点进行管理控制,不需要在wireless-wlan节点下面重复添加WIFI,poweren_gpio配置;
/* SDIO接口Wi-Fi专用配置: WIFI_REG_ON: Wi-Fi的电源使能PIN脚 */
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
pinctrl-names = "default";
pinctrl-0 = <&wifi_enable_h>;
/* 特别注意:WIFI_REG_ON GPIO_ACTIVE 配置跟使能状态恰好是相反的,
* 高有效为LOW,低有效则为HIGH
* 切记:这个配置跟下面的WIFI,poweren_gpio是互斥的,不能同时配置!!!
*/
reset-gpios = <&gpio0 RK_PA2 GPIO_ACTIVE_LOW>;
};
/* SDIO接口Wi-Fi专用配置:WIFI_REG_ON脚的pinctrl的配置 */
&pinctrl {
sdio-pwrseq {
wifi_enable_h: wifi-enable-h {
rockchip,pins =
/* 对应上面的WIFI_REG_ON,关掉上下拉,防止不能拉高或拉低 */
<0 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
&sdio {
max-frequency = <100000000>;/* sdio接口的最大频率,可调整 */
supports-sdio;
bus-width = <4>;/* 4线模式 */
disable-wp;
cap-sd-highspeed;
cap-sdio-irq;
keep-power-in-suspend;
mmc-pwrseq = <&sdio_pwrseq>;
non-removable;
num-slots = <1>;
rockchip,default-sample-phase = <90>;
pinctrl-names = "default";
pinctrl-0 = <&sdiom0_pins>;
sd-uhs-sdr50;
sd-uhs-sdr104;/* 支持SDIO3.0 */
status = "okay";
};
/* Wi-Fi节点 */
wireless-wlan {
compatible = "wlan-platdata";
rockchip,grf = <&sys_grf>;
/* 注意:如果排查发现Wi-Fi模块没有32.768K波形,且硬件上是有
* RK PMU供给的,则打开下面的clock属性,按照实际使用的PMU型号填写,
* 否在SDIO/Wi-Fi无法使用.
*/
clocks = <&rk809 1>; //如果使用RK809,只能配置一个
clocks = <&hym8563>; //如果使用hym8563,只能配置一个
clock-names = "ext_clock";
/* 按实际名字填写 */
wifi_chip_type = "ap6255";
/* WIFI_WAKE_HOST: Wi-Fi中断通知主控的PIN脚。
* 特别注意:确认下这个Wi-Fi pin脚跟主控的pin的
* 硬件连接关系,直连的话就是GPIO_ACTIVE_HIGH;
* 如果中间加了一个反向管就要改成低电平GPIO_ACTIVE_LOW触发
*/
WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
//SDIO Wi-Fi 无需此配置,除非有动态加载协助驱动ko的需求,参考11.8章节
//WIFI,poweren_gpio = <&gpio0 RK_PA2 GPIO_ACTIVE_HIGH>;
status = "okay";
};
/* WIFI_WAKE_HOST脚的pinctrl的配置 */
wireless-wlan {
wifi_wake_host: wifi-wake-host {
/* 注意一般Wi-Fi的wake host pin都是高电平触发,
* 所以默认这里要配置为下拉; 如果客户的硬件设计
* 是反向的则要改为上拉,总之要初始化为与触发电平
* 相反的状态
*/
rockchip,pins = <0 RK_PA0 0 &pcfg_pull_down>;
};
};
PCIe配置有两个关键点:
一是对照原理图找到如下三个关键点:
PCIe接口的WiFi基本有两种:贴在板子上模块及M2接口,但它们关键点是一样的:
VBAT/VCC3V3 :总的3.3V电源,确保正常;
WIFI_REG_ON :芯片的复位/使能管脚,确保为高电平;
PCIE_PERST_L/PERSTO:芯片PCIe部分的复位管脚,DTS对应的PCIE节点下务必配置正确;
二是根据原理图正确配置Controller及phy。
参考docs\Common\PCIe\Rockchip_Developer_Guide_PCIe_CN.pdf
//Wi-Fi节点配置
wireless_wlan: wireless-wlan {
compatible = "wlan-platdata";
wifi_chip_type = "ap6275p";
... ...
//配置:WIFI_HOST_WAKE,如果有的话
WIFI,host_wake_irq = <&gpio0 RK_PA0 GPIO_ACTIVE_HIGH>;
status = "okay";
};
//添加WIFI_REG_ON的配置
wifi_regon: wifi-regon {
compatible = "regulator-fixed";
regulator-name = "wifi_regon";
regulator-boot-on;
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
enable-active-high; //LEVEL高有效,如果是低有效改为LOW
gpio = <&gpioX RK_PXX GPIO_ACTIVE_HIGH>; //修改为对应的GPIO,LEVEL同上
startup-delay-us = <5000>;
};
//PHY的节点,不同芯片名字不一样,有的叫做&combphy2_psq,实际名称参考上面的三个文档;
&pcieXXphy {
status = "okay";
};
//控制器节点,具体接到哪个控制器节点
&pcixxx {
/* 此项是设置 PCIe 接口的 PERST#复位信号;不论是插槽还是
* 焊贴的设备,请在原理图上找到该引脚,并正确配
* 置,否则将无法完成链路建立。
*/
ep-gpios = <&gpio3 13 GPIO_ACTIVE_HIGH>; //RK3399平台
reset-gpios = <&gpio4 RK_PA5 GPIO_ACTIVE_HIGH>; //RK356X/3588平台
/* 下面三个配置是可选项,用于配置PCIe外设的1V8/3V3供电;
* 是板级针对PCIe外设供电需要控制使能的配置项
*/
vpcie3v3-supply = <&vdd_pcie3v3>;
num-lanes = <4>;
pinctrl-names = "default";
pinctrl-0 = <&pcie_clkreqn_cpm>; //无需修改,按照平台默认即可;
status = "okay";
};
/* 蓝牙节点 */
/* 注意下面关于UART的配置:uart4_xfer/uart4_rts/uart4_ctsn
* 每个平台的名字可能不一样,要在对应芯片平台的dts/dtsi里面找下对
* 应的uart写法,比如uart4_ctsn有些平台的名字为uart4_cts.
*/
wireless-bluetooth {
compatible = "bluetooth-platdata"
/* 这里要配置对应主控UART的RTS脚 */
uart_rts_gpios = <&gpio4 RK_PA7 GPIO_ACTIVE_LOW>;
pinctrl-names = "default", "rts_gpio";
pinctrl-0 = <&uart4_rts>;
pinctrl-1 = <&uart4_rts_gpio>;
/* BT_REG_ON 蓝牙电源的开关 */
BT,power_gpio = <&gpio4 RK_PB3 GPIO_ACTIVE_HIGH>;
BT,wake_host_irq = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>; /* BT_WAKE_HOST */
BT,wake_gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>; /* HOST_WAKE_BT */
status = "okay";
};
/* 打开对应的UART配置 */
&uart4 {
pinctrl-names = "default";
/* 这里配置对应主控UART的TX/RX/CTS PIN ,不要配置RTS PIN*/
pinctrl-0 = <&uart4_ xfer &uart4_ctsn>;
status = "okay";
};
/* uart4_rts_gpio */
&pinctrl {
wireless-bluetooth {
uart4_rts_gpio: uart4-rts-gpio {
rockchip,pins = <4 RK_PA7 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
};
内核配置正确,wifi蓝牙打开相应开关
[ 118.856578][ T321] type=1400 audit(1698301147.620:505): avc: denied { search } for comm="HwBinder:2373_2" name="bluetooth" dev="dm-7" ino=44 scontext=u:r:hal_bluetooth_default:s0 tcontext=u:object_r:bluetooth_data_file:s0 tclass=dir permissive=1
[ 118.856628][ T2375] [BT_RFKILL]: bt shut off power
[ 118.856714][ T321] type=1400 audit(1698301147.620:506): avc: denied { read } for comm="HwBinder:2373_2" name="u:object_r:default_prop:s0" dev="tmpfs" ino=126 scontext=u:r:hal_bluetooth_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1
[ 118.856807][ T321] type=1400 audit(1698301147.620:507): avc: denied { open } for comm="HwBinder:2373_2" path="/dev/__properties__/u:object_r:default_prop:s0" dev="tmpfs" ino=126 scontext=u:r:hal_bluetooth_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1
[ 118.856895][ T321] type=1400 audit(1698301147.620:508): avc: denied { getattr } for comm="HwBinder:2373_2" path="/dev/__properties__/u:object_r:default_prop:s0" dev="tmpfs" ino=126 scontext=u:r:hal_bluetooth_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1
[ 118.856984][ T321] type=1400 audit(1698301147.620:509): avc: denied { map } for comm="HwBinder:2373_2" path="/dev/__properties__/u:object_r:default_prop:s0" dev="tmpfs" ino=126 scontext=u:r:hal_bluetooth_default:s0 tcontext=u:object_r:default_prop:s0 tclass=file permissive=1
[ 118.909547][ T2375] [BT_RFKILL]: ENABLE UART_RTS
[ 119.016203][ T2375] [BT_RFKILL]: DISABLE UART_RTS
[ 119.016261][ T2375] [BT_RFKILL]: bt turn on power
[ 119.058260][ T321] type=1400 audit(1698301147.820:510): avc: denied { open } for comm="crash_dump64" path="/dev/__properties__/u:object_r:bluetooth_prop:s0" dev="tmpfs" ino=71 scontext=u:r:crash_dump:s0 tcontext=u:object_r:bluetooth_prop:s0 tclass=file permissive=1
[ 119.058263][ T2499] audit: audit_lost=331 audit_rate_limit=5 audit_backlog_limit=64
[ 119.058273][ T2499] audit: rate limit exceeded
[ 119.058383][ T321] type=1400 audit(1698301147.820:511): avc: denied { getattr } for comm="crash_dump64" path="/dev/__properties__/u:object_r:bluetooth_prop:s0" dev="tmpfs" ino=71 scontext=u:r:crash_dump:s0 tcontext=u:object_r:bluetooth_prop:s0 tclass=file permissive=1
[ 119.058464][ T321] type=1400 audit(1698301147.820:512): avc: denied { map } for comm="crash_dump64" path="/dev/__properties__/u:object_r:bluetooth_prop:s0" dev="tmpfs" ino=71 scontext=u:r:crash_dump:s0 tcontext=u:object_r:bluetooth_prop:s0 tclass=file permissive=1
[ 119.058546][ T321] type=1400 audit(1698301147.820:513): avc: denied { open } for comm="crash_dump64" path="/dev/__properties__/u:object_r:exported_bluetooth_prop:s0" dev="tmpfs" ino=152 scontext=u:r:crash_dump:s0 tcontext=u:object_r:exported_bluetooth_prop:s0 tclass=file permissive=1
[ 119.065804][ T308] logd: logdr: UID=1002 GID=1002 PID=2499 n tail=0 logMask=8 pid=2373 start=0ns deadline=0ns
[ 119.099689][ T1] init: Untracked pid 2499 exited with status 0
[ 119.099819][ T1] init: Service 'vendor.bluetooth-1-0' (pid 2373) received signal 6
[ 119.099849][ T1] init: Sending signal 9 to service 'vendor.bluetooth-1-0' (pid 2373) process group...
[ 119.105270][ T1] libprocessgroup: Successfully killed process cgroup uid 1002 pid 2373 in 5ms
[ 119.106040][ T1] init: Untracked pid 2501 exited with status 0
[ 119.106619][ T1] init: starting service 'vendor.bluetooth-1-0'...
[ 119.113593][ T2505] libprocessgroup: Failed to open /dev/stune/foreground/tasks: No such file or directory
[ 119.113650][ T2505] libprocessgroup: Failed to apply HighPerformance task profile: No such file or directory
[ 119.403588][ T183] binder: undelivered death notification, b400007128249d70
[ 119.405662][ T1] init: Untracked pid 2507 exited with status 0
[ 119.409071][ T1] init: Untracked pid 2511 received signal 9
[ 120.564482][ T2509] [BT_RFKILL]: bt shut off power
[ 120.616237][ T2509] [BT_RFKILL]: ENABLE UART_RTS
[ 120.722884][ T2509] [BT_RFKILL]: DISABLE UART_RTS
[ 120.722937][ T2509] [BT_RFKILL]: bt turn on power
[ 120.768002][ T2564] audit: audit_lost=372 audit_rate_limit=5 audit_backlog_limit=64
[ 120.768028][ T2564] audit: rate limit exceeded
[ 121.092339][ T205] binder: undelivered death notification, b40000712824dc00
[ 124.109655][ T1] init: starting service 'vendor.bluetooth-1-0'...
[ 124.113480][ T2581] libprocessgroup: Failed to open /dev/stune/foreground/tasks: No such file or directory
[ 124.113504][ T2581] libprocessgroup: Failed to apply HighPerformance task profile: No such file or directory
导致原因:pcie接口模块与sdio接口模块共用电源、蓝牙开关以及串口,串口发送数据,两个模块同时接收导致数据异常,关闭其中一个模块电源恢复正常。
将RX、TX短接,进行回环测试,
在adb root 、adb shell下执行:cat /dev/ttyS6 & echo 123 > /dev/ttyS6
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。