OpenHarmony6.0研究笔记(二):Wifi适配
·
1. 在源码目录device/soc/rockchip/rk3568/hardware/wifi下新建目录ap6256
2. 将【ap6256_wifi_蓝牙模块固件】文件夹中的所有文件上传到device/soc/rockchip/rk3568/hardware/wifi/ap6256
3. 修改文件device/soc/rockchip/rk3568/hardware/wifi/BUILD.gn
import("//build/ohos.gni")
AP6XXX_ETC_DIR = "//device/soc/rockchip/rk3568/hardware/wifi/ap6xxx"
AP6256_ETC_DIR = "//device/soc/rockchip/rk3568/hardware/wifi/ap6256" # 新增AP6256固件目录
DNS_CONFIG_DIR = "//device/soc/rockchip/rk3568/hardware/wifi"
ohos_prebuilt_etc("clm_bcm43752a2_ag.blob") {
source = "$AP6XXX_ETC_DIR/clm_bcm43752a2_ag.blob"
install_images = [ chipset_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("fw_bcm43752a2_ag_apsta.bin") {
source = "$AP6XXX_ETC_DIR/fw_bcm43752a2_ag_apsta.bin"
install_images = [ chipset_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("fw_bcm43752a2_ag.bin") {
source = "$AP6XXX_ETC_DIR/fw_bcm43752a2_ag.bin"
install_images = [ chipset_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("nvram_ap6275s.txt") {
source = "$AP6XXX_ETC_DIR/nvram_ap6275s.txt"
install_images = [ chipset_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
# ======== ap6256 START ========
ohos_prebuilt_etc("fw_bcm43456c5_ag.bin") {
source = "$AP6256_ETC_DIR/fw_bcm43456c5_ag.bin"
install_images = [ vendor_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("fw_bcm43456c5_ag_p2p.bin") {
source = "$AP6256_ETC_DIR/fw_bcm43456c5_ag_p2p.bin"
install_images = [ vendor_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("fw_bcm43456c5_ag_apsta.bin") {
source = "$AP6256_ETC_DIR/fw_bcm43456c5_ag_apsta.bin"
install_images = [ vendor_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("nvram_ap6256.txt") {
source = "$AP6256_ETC_DIR/nvram_ap6256.txt"
install_images = [ vendor_base_dir ]
relative_install_dir = "firmware"
part_name = "rockchip_products"
install_enable = true
}
ohos_prebuilt_etc("resolv.conf") {
source = "$DNS_CONFIG_DIR/etc/resolv.conf"
install_images = [ "system" ]
part_name = "rockchip_products"
install_enable = true
}
group("ap6256") {
deps = [
":fw_bcm43456c5_ag.bin",
":fw_bcm43456c5_ag_p2p.bin",
":fw_bcm43456c5_ag_apsta.bin",
":nvram_ap6256.txt",
":resolv.conf",
]
}
# ======== ap6256 END ========
group("ap6xxx") {
deps = [
":clm_bcm43752a2_ag.blob",
":fw_bcm43752a2_ag.bin",
":fw_bcm43752a2_ag_apsta.bin",
":nvram_ap6275s.txt",
":resolv.conf",
]
}
4. 修改文件device/soc/rockchip/rk3568/hardware/BUILD.gn
import("//build/ohos.gni")
if (linux_kernel_version == "linux-6.6") {
ISP_VERSION_DIR =
"//device/soc/rockchip/rk3568/hardware/isp-$linux_kernel_version:isp"
} else {
ISP_VERSION_DIR = "//device/soc/rockchip/rk3568/hardware/isp:isp"
}
group("hardware_group") {
deps = [
"//device/soc/rockchip/rk3568/hardware/gpu:mali-bifrost-g52-g7p0-ohos",
"//device/soc/rockchip/rk3568/hardware/mpp:mpp",
# "//device/soc/rockchip/rk3568/hardware/wifi:ap6xxx",
"//device/soc/rockchip/rk3568/hardware/wifi:ap6256",
ISP_VERSION_DIR,
]
}
5. 修改设备树,这里给出补丁
diff --git a/linux-5.10/arch/arm64/boot/dts/rockchip/rk3568-toybrick-x0.dtsi b/linux-5.10/arch/arm64/boot/dts/rockchip/rk3568-toybrick-x0.dtsi
index b6ec191b0..a2831bcff 100755
--- a/linux-5.10/arch/arm64/boot/dts/rockchip/rk3568-toybrick-x0.dtsi
+++ b/linux-5.10/arch/arm64/boot/dts/rockchip/rk3568-toybrick-x0.dtsi
@@ -19,6 +19,48 @@
io-channels = <&saradc 1>;
};
+ sdio_pwrseq: sdio-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ clocks = <&rk809 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)
+ */
+ post-power-on-delay-ms = <200>;
+ reset-gpios = <&gpio3 RK_PD4 GPIO_ACTIVE_LOW>;
+ };
+
+ wireless_wlan: wireless-wlan {
+ compatible = "wlan-platdata";
+ rockchip,grf = <&grf>;
+ wifi_chip_type = "ap6256";
+ pinctrl-names = "default";
+ pinctrl-0 = <&wifi_host_wake_irq>;
+ WIFI,host_wake_irq = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+ };
+
+ wireless_bluetooth: wireless-bluetooth {
+ compatible = "bluetooth-platdata";
+ clocks = <&rk809 1>;
+ clock-names = "ext_clock";
+ //wifi-bt-power-toggle;
+ uart_rts_gpios = <&gpio2 RK_PB5 GPIO_ACTIVE_LOW>;
+ pinctrl-names = "default", "rts_gpio";
+ pinctrl-0 = <&uart1m0_rtsn>;
+ pinctrl-1 = <&uart1_gpios>;
+ BT,reset_gpio = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;
+ BT,wake_gpio = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>;
+ BT,wake_host_irq = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>;
+ status = "okay";
+ };
+
gpio_leds: gpio-leds {
compatible = "gpio-leds";
led@1 {
@@ -256,7 +298,7 @@
* when dsi0 is enabled
*/
&dsi0 {
- status = "okay";
+ status = "disabled";
};
&dsi0_in_vp0 {
@@ -646,27 +688,22 @@
};
};
*/
+
sdio-pwrseq {
wifi_enable_h: wifi-enable-h {
- rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
- };
-/*
- wifi_32k: wifi-32k {//csqerr
- rockchip,pins = <2 RK_PC6 1 &pcfg_pull_none>;
+ rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_none>;
};
-*/
-
};
wireless-wlan {
wifi_host_wake_irq: wifi-host-wake-irq {
- rockchip,pins = <3 RK_PD4 RK_FUNC_GPIO &pcfg_pull_down>;
+ rockchip,pins = <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_down>;
};
};
wireless-bluetooth {
- uart8_gpios: uart8-gpios {
- rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
+ uart1_gpios: uart1-gpios {
+ rockchip,pins = <2 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
};
};
@@ -757,24 +794,6 @@
connect = <&vp1_out_dsi0>;
};
-&sdio_pwrseq {
- compatible = "mmc-pwrseq-simple";
- clocks = <&rk809 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_PD5 GPIO_ACTIVE_LOW>;
- post-power-on-delay-ms = <20>;
- status = "okay";
-};
-
&sdmmc1 {
status = "disabled";
};
@@ -782,7 +801,7 @@
&sdmmc2 {
max-frequency = <150000000>;
supports-sdio;
- bus-width = <4>;
+ bus-width = <1>;
disable-wp;
cap-sd-highspeed;
cap-sdio-irq;
@@ -829,27 +848,6 @@
enable-active-high;
};
-&wireless_wlan {
- pinctrl-names = "default";
- pinctrl-0 = <&wifi_host_wake_irq>;
- WIFI,host_wake_irq = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>;
-};
-
-&wireless_bluetooth {
- compatible = "bluetooth-platdata";
- clocks = <&rk809 1>;
- clock-names = "ext_clock";
- //wifi-bt-power-toggle;
- uart_rts_gpios = <&gpio2 RK_PB1 GPIO_ACTIVE_LOW>;
- pinctrl-names = "default", "rts_gpio";
- pinctrl-0 = <&uart8m0_rtsn>;
- pinctrl-1 = <&uart8_gpios>;
- BT,reset_gpio = <&gpio3 RK_PA0 GPIO_ACTIVE_HIGH>;
- BT,wake_gpio = <&gpio3 RK_PA2 GPIO_ACTIVE_HIGH>;
- BT,wake_host_irq = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>;
- status = "okay";
-};
-
&sata2 {
status = "okay";
};
@@ -858,7 +856,6 @@
status = "disabled";
};
-
&dsi0 {
status = "disabled";
};
- 重新编译和烧录,在源码目录下执行命令
./build.sh --product-name rk3568 --ccache --gn-args linux_kernel_version="linux-5.10"
更多推荐



所有评论(0)