SDIO WiFi问题排查
背景
- Platform: RK3399
- OS: Android7.1.2
- Kernel: v4.4.103
问题:
Android系统没法打开wifi,10几台机器,有1,2台可以,其他要么一直不行,要么时好时坏,不稳定。
log打印,SDIO传输下载wifi固件失败:
[ 32.446909] sdioh_buffer_tofrom_bus: TX FAILED ffffffc07aac3000, addr=0x0c000,pkt_len=2048, ERR=-84
[ 32.446937] dhdsdio_membytes: membytes transfer failed
[ 32.448113] dwmmc_rockchip fe310000.dwmmc: All phases bad!
[ 32.448167] mmc1: tuning execution failed
[ 32.448195] bcmsdh_sdmmc: Failed to Write byte F1:@0x1000a=00, Err: -5
原因
配置的SDIO的时钟太高,硬件PCB设计不满足。
解决
SDIO3.0配置的最高时钟为208M,改为150M正常
调试
检查DTS配置
/*SDIO配置*/
&sdio0 {
/*clock-frequency = <208000000>;
clock-freq-min-max = <200000 208000000>;*/
clock-frequency = <150000000>; /*时钟修改的地方*/
clock-freq-min-max = <200000 150000000>; /*时钟修改的地方*/
supports-sdio; /*SDIO功能*/
bus-width = <4>; /*4线模式,调试可改为1线测试*/
disable-wp;
cap-sd-highspeed; /*highspeed的SDIO外设*/
cap-sdio-irq; /*SDIO中断*/
keep-power-in-suspend; /*睡眠不断电*/
mmc-pwrseq = <&sdio_pwrseq>;/*电源控制*/
non-removable;
num-slots = <1>;
pinctrl-names = "default";
pinctrl-0 = <&sdio0_bus4 &sdio0_cmd &sdio0_clk>;
sd-uhs-sdr104; /* SDIO3.0 模式*/
status = "okay";
};
/*SDIO外设电源控制,即WiFi电源控制配置*/
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
clocks = <&rk818 1>; /*提供32.768 LPO*/
clock-names = "ext_clock"; /*外部时钟源*/
pinctrl-names = "default";
pinctrl-0 = <&wifi_enable_h>;
//控制WiFi电源的GPIO
reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */
};
/*WiFi配置*/
wireless-wlan {
compatible = "wlan-platdata";
rockchip,grf = <&grf>;
wifi_chip_type = "ap6354";
sdio_vref = <1800>;
WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /*wifi wake host GPIO0_a3 */
status = "okay";
};
/*pinctrl检查*/
sys/bus/sdio/devices
查看设备有没有注册成功
检查IOMUX
busybox find /d/pinctrl -name pinmux-pins
cat xxx/xxx/pinmux-pins
检查GPIO
使用GPIO的调试方法,详见xxx
- IOMUX配置为GPIO
- 方向配置为输出
- 测试高低电平
- 使用
io
命令io -4 -w 0xFF77e008 0x0fff0000
- sysfs使用
echo
命令echo xxx > /sys/class/gpio/export echo out > /sys/class/gpio/gpioxxx/direction echo 0 > /sys/class/gpio/gpioxxx/value echo 1 > /sys/class/gpio/gpioxxx/value
- 使用debugfs查看
检查电压电平
电源电压,VDDIO、VBAT的电压,WIFI_REG_ON上电及复位控制信号
电源控制:
echo 0 > /sys/class/rkwifi/power //对wifi模块掉电
echo 1 > /sys/class/rkwifi/power//对wifi模块上电
检查时钟
32.768K的LPO, 37.4M晶振主时钟,SDIO_CLK、SDIO_CMD 的波形
参考
- https://blog.csdn.net/kris_fei/article/details/80923673
- 《Rockhip android 7.1 WIFI/BT 配置说明》
- 《Rockchip SDMMC SDIO eMMC 开发指南》
评论