/* SDIO接口Wi-Fi專用配置:SDIO接口節(jié)點(diǎn) */&sdio {max-frequency = < 150000000 >; /* sdio接口的最大頻率,可調(diào)整 */supports-sdio;bus-width = < 4 >; /* 4線模式,可調(diào)整1線模式 */disable-wp;cap-sd-highspeed;cap-sdio-irq;keep-power-in-suspend;mmc-pwrseq = < &sdio_pwrseq >;non-removable;num-slots = < 1 >;pinctrl-names = "default";pinctrl-0 = < &sdiom0_pins >;sd-uhs-sdr104; /* 支持SDIO3.0 */status = "okay";};
/* SDIO接口Wi-Fi專用配置: WIFI_REG_ON: Wi-Fi的電源使能PIN腳 */sdio_pwrseq: sdio-pwrseq {compatible = "mmc-pwrseq-simple";clocks = < &hym8563 >;clock-names = "ext_clock";pinctrl-names = "default";pinctrl-0 = < &wifi_enable_h >;reset-gpios = < &gpio0 RK_PC4 GPIO_ACTIVE_LOW >; /*跟電源使能狀態(tài)恰好相反:高有效為L(zhǎng)OW,低有效則為HIGH。切記:這個(gè)配置跟下面的WIFI,poweren_gpio是互斥的,不能同時(shí)配置?。。?/ /*特別注意:reset-gpios的GPIO_ACTIVE 配置跟poweren_gpio配置的電源使能狀態(tài)恰好是相反的*/};/* SDIO接口Wi-Fi專用配置:WIFI_REG_ON腳的pinctrl的配置 */&pinctrl {sdio-pwrseq {wifi_enable_h: wifi-enable-h {rockchip,pins = < 0 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none >; /* 對(duì)應(yīng)上面的WIFI_REG_ON,關(guān)掉上下拉,防止不能拉高或拉低 */};};}
WIFI節(jié)點(diǎn)配置/* Wi-Fi節(jié)點(diǎn) */wireless_wlan: wireless-wlan {compatible = "wlan-platdata";wifi_chip_type = "ap6256"; //模塊名稱pinctrl-names = "default";pinctrl-0 = < &wifi_host_wake_irq >;WIFI,host_wake_irq = < &gpio0 RK_PB2 GPIO_ACTIVE_HIGH >; //WIFI模塊喚醒CPU的//WIFI,poweren_gpio = < &gpio0 RK_PC4 GPIO_ACTIVE_HIGH >; //控制WIFI模塊電源的GPIO,配置了sdio_pwrseq就不需要再配置poweren_gpio status = "okay";};
WIFI,host_wake_irq的配置說(shuō)明:WIFI,host_wake_irq = < &gpio0 RK_PB2 GPIO_ACTIVE_HIGH >; /* WIFI_WAKE_HOST: Wi-Fi中斷通知主控的PIN腳。* 特別注意:確認(rèn)下這個(gè)Wi-Fi pin腳跟主控的pin的硬件連接關(guān)系,直連的話就是GPIO_ACTIVE_HIGH;* 如果中間加了一個(gè)反向管就要改成低電平GPIO_ACTIVE_LOW觸發(fā)*/
WIFI_WAKE_HOST腳的pinctrl的配置:&pinctrl {wireless-wlan {wifi_host_wake_irq: wifi-host-wake-irq {rockchip,pins = < 0 RK_PB2 RK_FUNC_GPIO &pcfg_pull_down >;};};}/* 注意一般Wi-Fi的wake host pin都是高電平觸發(fā),* 所以默認(rèn)這里要配置為下拉; 如果客戶的硬件設(shè)計(jì)* 是反向的則要改為上拉,總之要初始化為與觸發(fā)電平* 相反的狀態(tài)*/
以下UART相關(guān)的都要配置為實(shí)際使用的UART口的所對(duì)應(yīng)PIN,注意RTS/CTS pin一定要按照SDK設(shè)計(jì)
接(具體接法參考7.3章節(jié)的UART描述),很多客戶反饋的異常都是因?yàn)檫@兩個(gè)PIN腳沒(méi)有接導(dǎo)致初始化
【資料圖】
異常,下面假設(shè)藍(lán)牙使用UART4:
bt_uart6: wireless_bluetooth: wireless-bluetooth {compatible = "bluetooth-platdata";clocks = < &hym8563 >; //外部時(shí)鐘clock-names = "ext_clock"; uart_rts_gpios = < &gpio1 RK_PA2 GPIO_ACTIVE_LOW >; //uart的rts腳pinctrl-names = "default", "rts_gpio";pinctrl-0 = < &uart6m1_rtsn >;pinctrl-1 = < &uart6_gpios >;BT,reset_gpio = < &gpio3 RK_PA6 GPIO_ACTIVE_HIGH >; //藍(lán)牙的復(fù)位腳BT,wake_host_irq = < &gpio0 RK_PC5 GPIO_ACTIVE_HIGH >; //藍(lán)牙模塊喚醒CPU的GPIOstatus = "okay";};&pinctrl {wireless-bluetooth {uart6_gpios: uart6-gpios {rockchip,pins = < 1 RK_PA2 RK_FUNC_GPIO &pcfg_pull_none >;};};}
藍(lán)牙對(duì)應(yīng)的uart6配置/* 打開(kāi)對(duì)應(yīng)的UART配置 */&uart6 {pinctrl-names = "default";/* 這里配置對(duì)應(yīng)主控UART的TX/RX/CTS PIN ,不要配置RTS PIN*/pinctrl-0 = < &uart6m1_xfer &uart6m1_ctsn >;status = "okay";};
# Kernel defconfigexport RK_KERNEL_DEFCONFIG=rockchip_linux_defconfig
cd kernelmake ARCH=arm64 menuconfigmake savedefconfig
選擇:Device Drivers ---> Network device support ---> Wireless LAN ---> Rockchip Wireless LAN support
Wi-Fi驅(qū)動(dòng)可編譯到內(nèi)核或者ko方式, 切記下面兩個(gè)配置必須二選一,否則Wi-Fi無(wú)法加載!
KO 配置:[* ] build wifi ko modules
CONFIG_WIFI_BUILD_MODULE=y# CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP is not set
buildin 配置:[* ] Wifi load driver when kernel bootup
CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP=y# CONFIG_WIFI_BUILD_MODULE is not set
buildin 只能選擇一個(gè)型號(hào),realtek 模組和 ap6xxx 模組不能同時(shí)選擇為y,且realtek的也只能選擇其
中一個(gè);
ap6xxx 和 cypress也是互斥的,只能選擇一個(gè)且如果選擇ap6xxx,cypress的配置自動(dòng)消失,去掉ap
配置,cypress自動(dòng)出現(xiàn);
ko方式則可以選擇多個(gè)Wi-Fi
cd kernelmake ARCH=arm64 menuconfigmake savedefconfig
選擇: Networking support ---> Bluetooth subsystem support ---> Bluetooth device drivers
注意:配置完成后要保存到對(duì)應(yīng)的defconfig
external/rkwifibt/firmware/broadcom/AP6256/├── bt│ └── BCM4345C5.hcd└── wifi├── fw_bcm43456c5_ag.bin├── fw_bcm43456c5_ag_mfg.bin└── nvram_ap6256.txt
經(jīng)過(guò)編譯規(guī)則編譯后,對(duì)應(yīng)的文件被拷貝到工程的output目錄:(kernel4.19內(nèi)核由system變更為vendor目錄)buildroot/output/rockchip_rk3xxxx/target//system(vendor)/lib/modules/bcmdhd.ko #驅(qū)動(dòng)ko(如果是ko編譯的話)/system(vendor)/etc/firmware/fw_bcm43456c5_ag.bin #驅(qū)動(dòng)firmware文件存放位置/system(vendor)/etc/firmware/fw_bcm43456c5_ag_mfg.bin #驅(qū)動(dòng)firmware文件存放位置/system(vendor)/etc/firmware/nvram_ap6256.txt #驅(qū)動(dòng)nvram文件存放位置/system(vendor)/etc/firmware/BCM4345C5.hcd #藍(lán)牙firmware文件(如果有藍(lán)牙功能)
最終燒錄到機(jī)器中后,Wi-Fi運(yùn)行時(shí)所需的文件及存放位置:/system(vendor)/lib/modules/bcmdhd.ko #驅(qū)動(dòng)ko(如果是ko編譯的話)/system(vendor)/etc/firmware/fw_bcm43456c5_ag.bin #驅(qū)動(dòng)firmware文件存放位置/system(vendor)/etc/firmware/fw_bcm43456c5_ag_mfg.bin #驅(qū)動(dòng)firmware文件存放位置/system(vendor)/etc/firmware/nvram_ap6256.txt #驅(qū)動(dòng)nvram文件存放位置/system(vendor)/etc/firmware/BCM4345C5.hcd #藍(lán)牙firmware文件(如果有藍(lán)牙功能)
# Define WiFi BT chip# Compatible with Realtek and AP6XXX WiFi : RK_WIFIBT_CHIP=ALL_AP# Compatible with Realtek and CYWXXX WiFi : RK_WIFIBT_CHIP=ALL_CY# Single WiFi configuration: AP6256 or CYW43455: RK_WIFIBT_CHIP=AP6256export RK_WIFIBT_CHIP=ALL_AP# Define BT ttySXexport RK_WIFIBT_TTY=ttyS6
審核編輯:湯梓紅
責(zé)任編輯: