原理图
上图为USB-WiFi
\rk3568\kernel\arch\arm64\boot\dts\rockchip\rk3568-evb.dtsi
wireless_wlan: wireless-wlan {
compatible = "wlan-platdata";
rockchip,grf = <&grf>;
wifi_chip_type = ""; //rtl8821cu
WIFI,vbat_gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_LOW>; //电源引脚
status = "okay";
};
第一步,配置WIFI,vbat_gpio = <&gpio0 RK_PC1 GPIO_ACTIVE_LOW>;
可以看到WIFI模块有供电了
第二步,串口输入lsusb
第三步 路径:kernel\arch\arm64\boot\dts\rockchip\rk3568-evb1-ddr4-v10.dtsi
删除sdio-pwrseq,sdmmc1/2和wireless_bluetooth
第四步 移植驱动
1.修改成 “rtl8821cu” 放在路径:\rk3568\kernel\drivers\net\wireless\rockchip_wlan
2.路径:.kernel\drivers\net\wireless\rockchip_wlan\Makefile
obj-$(CONFIG_RTL8821CS) += rtl8821cs/
+obj-$(CONFIG_RTL8821CU) += rtl8821cu/
obj-$(CONFIG_RTL8822BS) += rtl8822bs/
3.路径:.kernel\drivers\net\wireless\rockchip_wlan\Kconfig
source "drivers/net/wireless/rockchip_wlan/rtl8821cs/Kconfig"
+source "drivers/net/wireless/rockchip_wlan/rtl8821cu/Kconfig"
source "drivers/net/wireless/rockchip_wlan/rtl8822bs/Kconfig"
4.路径:.kernel\arch\arm64\configs\rockchip_defconfig
CONFIG_RTC_DRV_HYM8563=y
+CONFIG_BT_RTKBTUSB=y
+CONFIG_RTL8821CU=m
5.路径:\kernel\drivers\net\wireless\rockchip_wlan\rtl8821cu\Makefile
########################## Android ###########################
# CONFIG_RTW_ANDROID - 0: no Android, 4/5/6/7/8/9/10/11 : Android version
CONFIG_RTW_ANDROID = 11
ifeq ($(shell test $(CONFIG_RTW_ANDROID) -gt 0; echo $$?), 0)
EXTRA_CFLAGS += -DCONFIG_RTW_ANDROID=$(CONFIG_RTW_ANDROID)
endif
########################## Debug ###########################
CONFIG_RTW_DEBUG = y
# default log level is _DRV_INFO_ = 4,
# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
CONFIG_RTW_LOG_LEVEL = 2
# enable /proc/net/rtlxxxx/ debug interfaces
CONFIG_PROC_DEBUG = y
######################## Wake On Lan ##########################
CONFIG_WOWLAN = y
#bit3: ARP enable, bit2: deauth, bit1: unicast, bit0: magic pkt.
CONFIG_WAKEUP_TYPE = 0xf
CONFIG_WOW_LPS_MODE = default
#bit0: disBBRF off, #bit1: Wireless remote controller (WRC)
CONFIG_SUSPEND_TYPE = 0
CONFIG_WOW_STA_MIX = n
CONFIG_GPIO_WAKEUP = y
##### Platform Related #######################
CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ANDROID_X86 = n
CONFIG_PLATFORM_ANDROID_INTEL_X86 = n
CONFIG_PLATFORM_JB_X86 = n
CONFIG_PLATFORM_ARM_S3C2K4 = n
CONFIG_PLATFORM_ARM_PXA2XX = n
CONFIG_PLATFORM_ARM_S3C6K4 = n
CONFIG_PLATFORM_MIPS_RMI = n
CONFIG_PLATFORM_RTD2880B = n
CONFIG_PLATFORM_MIPS_AR9132 = n
CONFIG_PLATFORM_RTK_DMP = n
CONFIG_PLATFORM_MIPS_PLM = n
CONFIG_PLATFORM_MSTAR389 = n
CONFIG_PLATFORM_MT53XX = n
CONFIG_PLATFORM_ARM_MX51_241H = n
CONFIG_PLATFORM_FS_MX61 = n
CONFIG_PLATFORM_ACTIONS_ATJ227X = n
CONFIG_PLATFORM_TEGRA3_CARDHU = n
CONFIG_PLATFORM_TEGRA4_DALMORE = n
CONFIG_PLATFORM_ARM_TCC8900 = n
CONFIG_PLATFORM_ARM_TCC8920 = n
CONFIG_PLATFORM_ARM_TCC8920_JB42 = n
CONFIG_PLATFORM_ARM_TCC8930_JB42 = n
CONFIG_PLATFORM_ARM_RK2818 = n
CONFIG_PLATFORM_ARM_RK3066 = n
CONFIG_PLATFORM_ARM_RK3188 = y
CONFIG_PLATFORM_ARM_URBETTER = n
#EFUSE_MAP_PATH
USER_EFUSE_MAP_PATH ?=
ifneq ($(USER_EFUSE_MAP_PATH),)
EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"$(USER_EFUSE_MAP_PATH)\"
else ifeq ($(MODULE_NAME), 8189es)
EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8189e.map\"
else ifeq ($(MODULE_NAME), 8723bs)
EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/system/etc/wifi/wifi_efuse_8723bs.map\"
else
EXTRA_CFLAGS += -DEFUSE_MAP_PATH=\"/vendor/etc/firmware/wifi_efuse_$(MODULE_NAME).map\"
endif
ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
# default setting for Android 4.1, 4.2, 4.3, 4.4
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
# default setting for Power control
#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC
ifeq ($(CONFIG_SDIO_HCI), y)
EXTRA_CFLAGS += -DRTW_SUPPORT_PLATFORM_SHUTDOWN
endif
# default setting for Special function
ARCH := arm
CROSS_COMPILE := /home/android_sdk/Rockchip/Rk3188/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-
KSRC := /home/android_sdk/Rockchip/Rk3188/kernel
MODULE_NAME := 8821cu
endif
第五步:添加设备ID
路径:frameworks\opt\net\wifi\libwifi_hal\rk_wifi_ctrl.cpp
static wifi_device supported_wifi_devices[] = {
{"RTL8812AU", "0bda:8812"},
{"RTL8821CS", "024c:c821"},
+ {"RTL8821CU", "0bda:c820"},
{"RTL8822CU", "0bda:c82c"},
......
}
第六步:添加模块加载的宏定义
路径:.frameworks\opt\net\wifi\libwifi_hal\wifi_hal_common.cpp
#define RTL8821CS_DRIVER_MODULE_PATH WIFI_MODULE_PATH"8821cs.ko"
+#define RTL8821CU_DRIVER_MODULE_PATH WIFI_MODULE_PATH"8821cu.ko"
#define RTL8822CU_DRIVER_MODULE_PATH WIFI_MODULE_PATH"8822cu.ko"
#define RTL8821CS_DRIVER_MODULE_NAME "8821cs"
+#define RTL8821CU_DRIVER_MODULE_NAME "8821cu"
#define RTL8822CU_DRIVER_MODULE_NAME "8822cu"
wifi_ko_file_name module_list[] =
{"RTL8821CS", RTL8821CS_DRIVER_MODULE_NAME, RTL8821CS_DRIVER_MODULE_PATH, UNKKOWN_DRIVER_MODULE_ARG},
+ {"RTL8821CU", RTL8821CU_DRIVER_MODULE_NAME, RTL8821CU_DRIVER_MODULE_PATH, UNKKOWN_DRIVER_MODULE_ARG},
{"RTL8822CU", RTL8822CU_DRIVER_MODULE_NAME, RTL8822CU_DRIVER_MODULE_PATH, UNKKOWN_DRIVER_MODULE_ARG},
第七步:修改加载设备节点
路径:hardware\realtek\rtkbt\vendor\etc\bluetooth\rtkbt.conf
#Indicate USB or UART driver bluetooth
+BtDeviceNode=/dev/rtkbt_dev
+#BtDeviceNode=?/dev/ttyS1:H5
第八步:本机蓝牙设备名称:(默认为rk3566,更改为rk3568:)
路径:device\rockchip\rk356x\bluetooth\bdroid_buildcfg.h
+ //#define BTM_DEF_LOCAL_NAME "rk3566"
+ #define BTM_DEF_LOCAL_NAME "rk3568"