[RK3399][Android7.1] SDIO WiFi调试步骤小结

Platform: RK3399
OS: Android 7.1
Kernel: v4.4.83

用的是SDIO接口的AP6356S。
此文主要记录下调试的过程和方法。

原因:

硬件电源上有个0欧姆电阻没焊。


调试:

检查DTS配置有没有出错:

sdio_pwrseq: sdio-pwrseq {
    compatible = "mmc-pwrseq-simple";
    clocks = <&rk818 1>;
    clock-names = "ext_clock";
    pinctrl-names = "default";
    pinctrl-0 = <&wifi_enable_h>;
    //控制WiFi电源的GPIO
    reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; /* GPIO0_B2 */
};

wireless-wlan {
    compatible = "wlan-platdata";
    rockchip,grf = <&grf>;
    wifi_chip_type = "ap6354";
    sdio_vref = <1800>;
    //控制WiFi中断的GPIO
    WIFI,host_wake_irq = <&gpio0 3 GPIO_ACTIVE_HIGH>; /* GPIO0_a3 */
    status = "okay";
};

SDIO WiFi注册成功会有如下Log:

mmc2: new ultra high speed SDR104 SDIO card at address 0001 

查看sys/bus/sdio/devices也能看到设备,如果没有说明硬件有异常。

检查硬件:
命令做SDIO导通性测试,万用表量测拉低拉高是否可控。

GPIO2_C4/SDIO0_D0/SPI5_RXD
GPIO2_C5/SDIO0_D1/SPI5_TXD
GPIO2_C6/SDIO0_D2/SPI5_CLK
GPIO2_C7/SDIO0_D3/SPI5_CS
GPIO2_D0/SDIO0_CMD_u
GPIO2_D1/SDIO0_CLKOUT/TEST_CLKOUT1


GRF base  0xFF770000
GRF_GPIO2C_IOMUX 0x0e008
GRF_GPIO2D_IOMUX 0x0e00c


io -4 -r 0xff77e008     //bit[15]~bit[8] //5500
io -4 -r 0xff77e00C     //bit[0]~bit[3] //5
rk3399_mid:/ # io -4 0xff77e008 
ff77e008: 00005555
rk3399_mid:/ # io -4 0xff77e00C
ff77e00c: 00000005

导通性测试
配制为GPIO
io -4 -w 0xFF77e008 0x0fff0000
io -4 -w 0xFF770e00c 0x000f0000

配制为输出FF78_0000
io -4 -w 0xFF780004 0x03f00000

配制为高电平
io -4 -w 0xFF780000 0x03f00000

配制为低电平
io -4 -w 0xFF780000 0x00000000


GPIO2_C4/SDIO0_D0/SPI5_RXD


GPIO0_B2(WIFI_REG_ON)

io -4 -w 0xFF720004 0x04000400
io -4 -w 0xFF720000 0x04000400

io -4 -w 0xFF720004 0x00000000
io -4 -w 0xFF720000 0x00000000


echo 1084 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1084/direction

echo 1085 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1085/direction

echo 1086 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1086/direction

echo 1087 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1087/direction

echo 1088 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1088/direction

echo 1089 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio1089/direction

echo 1 > /sys/class/gpio/gpio1084/value
echo 1 > /sys/class/gpio/gpio1085/value
echo 1 > /sys/class/gpio/gpio1086/value
echo 1 > /sys/class/gpio/gpio1087/value
echo 1 > /sys/class/gpio/gpio1088/value
echo 1 > /sys/class/gpio/gpio1089/value

cat /sys/kernel/debug/gpio

echo 0 > /sys/class/gpio/gpio1084/value
echo 0 > /sys/class/gpio/gpio1085/value
echo 0 > /sys/class/gpio/gpio1086/value
echo 0 > /sys/class/gpio/gpio1087/value
echo 0 > /sys/class/gpio/gpio1088/value
echo 0 > /sys/class/gpio/gpio1089/value

示波器接上量 VDDIO VBAT 电压, 启动时WIFI_REG_ON是否有拉高, 32K是否有给,37.4M是否有起振, SDIO_CLK SDIO_CMD 的波形。

IOMUX检查:
检查sdio对应的pin的IOMUX关系是否正确,
busybox find /d/pinctrl -name pinmux-pins
cat xxx/xxx/pinmux-pins

pin 84 (gpio2-20): fe310000.dwmmc (GPIO UNCLAIMED) function sdio0 group sdio0-bus4
pin 85 (gpio2-21): fe310000.dwmmc (GPIO UNCLAIMED) function sdio0 group sdio0-bus4
pin 86 (gpio2-22): fe310000.dwmmc (GPIO UNCLAIMED) function sdio0 group sdio0-bus4
pin 87 (gpio2-23): fe310000.dwmmc (GPIO UNCLAIMED) function sdio0 group sdio0-bus4
pin 88 (gpio2-24): fe310000.dwmmc (GPIO UNCLAIMED) function sdio0 group sdio0-cmd
pin 89 (gpio2-25): fe310000.dwmmc (GPIO UNCLAIMED) function sdio0 group sdio0-clk

参考:

Rockchip-Developer-Guide-linux4.4-SDMMC-SDIO-eMMC.pdf

你可能感兴趣的:(RK3399,子类__SD,EMMC,子类__WiFi)