WIFI / BT 驱动之—设备树配置

时间:2024-03-11 10:25:21

                                                                    WIFI / 蓝牙模块设备树配置

 

AP6212 模块在设备树中配置如下:

    wireless-bluetooth {
        compatible = "bluetooth-platdata";
        clocks = <&rk818 1>;
        clock-names = "ext_clock";
    
        pinctrl-names = "default","rts_gpio";
        pinctrl-0 = <&uart0_rts>;
        pinctrl-1 = <&uart0_gpios>;                                                                                                            
        uart_rts_gpios = <&gpio2 RK_PD3 GPIO_ACTIVE_LOW>;
    
        BT,power_gpio = <&gpio3 RK_PA3 GPIO_ACTIVE_HIGH>;
        BT,wake_gpio = <&gpio3 RK_PA2 GPIO_ACTIVE_HIGH>;
        BT,wake_host_irq = <&gpio3 RK_PA7 GPIO_ACTIVE_LOW>;
        status = "okay";
    }; 
    wireless-wlan {                                                                                                                            
        compatible = "wlan-platdata";
        rockchip,grf = <&grf>;
        /* wifi_chip_type - wifi chip define
        * ap6210, ap6330, ap6335
        * rtl8188eu, rtl8723bs, rtl8723bu
        * esp8089
        */
        wifi_chip_type = "ap6212";
        sdio_vref = <1800>;
        WIFI,host_wake_irq = <&gpio3 RK_PA6 GPIO_ACTIVE_LOW>;
        status = "okay";
    };

    sdio_pwrseq: sdio-pwrseq {                                                                                                                 
        compatible = "mmc-pwrseq-simple";
        clocks = <&rk818 1>;
        clock-names = "ext_clock";
        pinctrl-names = "default";
        pinctrl-0 = <&wifi_enable_h>;

        /*
         * On the module itself this is one of these (depending
         * on the actual card populated):
         * - SDIO_RESET_L_WL_REG_ON
         * - PDN (power down when low)
         */
        reset-gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>; /* GPIO3_A4 */
    };

&uart0 {
    status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&uart0_xfer>, <&uart0_cts>;                                                                                                   
};

蓝牙驱动代码路径:

net/rfkill/rfkill-bt.c,net/bluetooth,drivers/bluetooth/

WIFI 驱动代码路径:

配置wifi固件路径 drivers/net/wireless/rockchip_wlan/rkwifi/rk_wifi_config.c ,wifi 模块驱动 net/rfkill/rfkill-wlan.c