rk3568_linux5.10 调试6275p pcie wifi

a : config 部分必须选择

Device Drivers ---> Network device support ---> Wireless LAN ---> Rockchip Wireless LAN support --->

[*] build wifi ko modules

[*] Broadcom Wireless Device Driver Support --->

选择好路径:

(/system/etc/firmware/fw_bcm43752a2_pcie_ag.bin) Firmware path

(/system/etc/firmware/nvram_ap6275p.txt) NVRAM path

Enable Chip Interface (PCIe bus interface support) --->

选择好pcie 接口

(X) PCIe bus interface support

b:检查内核Wi-Fi配置,打开如下几个配置:

CONFIG_WL_ROCKCHIP=y

CONFIG_WIFI_BUILD_MODULE=y

CONFIG_BCMDHD=y

CONFIG_AP6XXX=m

CONFIG_BCMDHD_PCIE=y #PCIE接口,与SDIO互斥,不是PCIE可不配

CONFIG_BCMDHD_SDIO=y

c:确认6275p的几个需要的文件:

wifi:

clm_bcm43752a2_pcie_ag.blob

fw_bcm43752a2_pcie_ag.bin

fw_bcm43752a2_pcie_ag_apsta.bin

nvram_AP6275P.txt

BT:

BCM4362A2.hcd

fw_path=/system/etc/firmware/fw_bcm43752a2_pcie_ag.bin

nv_path=/system/etc/firmware/nvram_AP6275P.txt

clm_path=/system/etc/firmware/clm_bcm43752a2_pcie_ag.blob

conf_path=/system/etc/firmware/config.txt

确认以上文件在系统中

d:DTS 中配置:

vcc3v3_pcie: gpio-regulator {

compatible = "regulator-fixed";

regulator-name = "vcc3v3_pcie";

regulator-min-microvolt = <3300000>;

regulator-max-microvolt = <3300000>;

enable-active-high;

gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;

startup-delay-us = <5000>;

vin-supply = <&dc_12v>;

};

&pcie2x1 {

reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;

vpcie3v3-supply = <&vcc3v3_pcie>;

status = "okay";

};

&combphy1_usq {

status = "okay";

};

&combphy2_psq {

status = "okay";

};

&csi2_dphy_hw {

status = "okay";

};

&csi2_dphy0 {

status = "disabled";

ports {

#address-cells = <1>;

#size-cells = <0>;

port@0 {

reg = <0>;

#address-cells = <1>;

#size-cells = <0>;

mipi_in_ucam0: endpoint@1 {

reg = <1>;

data-lanes = <1 2>;

};

mipi_in_ucam1: endpoint@2 {

reg = <2>;

data-lanes = <1 2 3 4>;

};

};

port@1 {

reg = <1>;

#address-cells = <1>;

#size-cells = <0>;

csidphy_out: endpoint@1 {

reg = <1>;

remote-endpoint = <&isp0_in>;

};

};

};

};

其中 :

gpio = <&gpio0 RK_PB5 GPIO_ACTIVE_HIGH>;

reset-gpios = <&gpio0 RK_PB6 GPIO_ACTIVE_HIGH>;

对应原理图中:

注意:此io不能配置错误会导致一下问题:其中红色就是因为resetIO 无法获取导致无法使能PCIE设备无法工作 出现PCIE 获取不到任何设备信息dhdpcie_dongle_attach : failed to read PCI configuration space!,导致无法load fireware

[ 558.123677] [dhd] _dhd_module_init: in Dongle Host Driver, version 101.10.361.20 (wlan=r892223-20220701-3)

[ 558.123677] drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd compiled on Mar 17 2023 at 11:55:16

[ 558.123677]

[ 558.123787] [dhd] ANDROID_VERSION = 12

[ 558.123802] [dhd] ======== dhd_wlan_init_plat_data ========

[ 558.123810] [dhd] dhd_wlan_init_gpio: WL_REG_ON=-1

[ 558.123818] [dhd] dhd_wifi_platform_load: Enter

[ 558.124112] pcieh 0000:01:00.0: of_irq_parse_pci: failed with rc=134

[ 558.124root@linaro-alip:~# 133] [dhd] dhdpcie_pci_probe : no mutex held

[ 558.124140] [dhd] dhdpcie_pci_probe : set mutex lock

[ 558.124151] [dhd] PCI_PROBE: bus 1, slot 0,vendor 14E4, device 449D(good PCI location)

[ 558.124165] [dhd] dhdpcie_init: found adapter info 'DHD generic adapter'

[ 558.124175] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : sectoin 3, size 139264

[ 558.124277] [dhd] succeed to alloc static buf

[ 558.124284] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : sectoin 4, size 0

[ 558.124318] pcieh 0000:01:00.0: can't change power state from D3cold to D0 (config space inaccessible)

[ 558.124428] [dhd] Disable CTO

[ 558.124445] [dhd] dhdpcie_dongle_attach : failed to read PCI configuration space!

[ 558.124493] [dhd] status_cmd(0x4)=0xffffffff, pmcsr(0x4c)=0xffffffff base_addr0(0x10)=0xffffffff base_addr1(0x18)=0xffffffff linkctl(0xbc)=0xffffffff l1ssctrl(0x248)=0xffffffff devctl(0xb4)=0xffffffff devctl2(0xd4)=0xffffffff

[ 558.124506] [dhd] dhdpcie_bus_attach: dhdpcie_probe_attach failed

[ 558.124515] [dhd] dhdpcie_init:dhdpcie_bus_attach() failed

[ 558.124529] [dhd] dhdpcie_pci_probe: PCIe Enumeration failed

[ 558.124537] [dhd] dhdpcie_pci_probe : mutex is released.

[ 558.124759] [dhd] dhdpcie_bus_register: dhdpcie initialize failed.

[ 558.124817] [dhd] dhd_wifi_platform_load_pcie: pcie_register_driver failed

[ 558.124830] [dhd] unregister wifi platform drivers

[ 558.124840] [dhd] wifi_platform_bus_enumerate device present 0

[ 558.124850] [dhd] ======== Card detection to remove PCIE card! ========

[ 558.124857] [dhd] ======== dhd_wlan_deinit_plat_data ========

[ 558.124867] [dhd] _dhd_module_init: Failed to load the driver, try cnt 0

[ 558.124926] [dhd] _dhd_module_init: Failed to load driver max retry reached**

[ 558.124937] [dhd] _dhd_module_init: Exit err=-1

[ 918.408538] rockchip-vop2 fe040000.vop: [drm:vop2_crtc_atomic_disable] Crtc atomic disable vp0

[ 921.005166] rockchip-vop2 fe040000.vop: [drm:vop2_crtc_atomic_enable] Update mode to 1366x768p60, type: 11(if:800) for vp0 dclk: 85500000

任何无法开启wifi 的问题应该先测试以下IO 要均为高

rk3568_linux5.10 调试6275p pcie wifi_第1张图片

另外linux 5.10的版本buildroot使用的Z:\linux-arm\rk3568_linux5.10\external\rkwifibt\drivers\bcmdhd 下的驱动,和kernel 驱动无关系

external/rkwifibt/

firmware目录:包含各个厂家WiFiBT的firmware文件

drivers目录:包含各个厂家的WiFiBT驱动

bin目录:主要是原厂预置的一些二进制文件

sh目录:主要是开机的WIFIBT的加载脚本,及测试脚本等

S36load_*: WiFiBT开机ko加载及初始化脚本

标准配置:

device/rockchip/rk3xxx/BoardConfig-xxxxxx.mk

export RK_WIFIBT_CHIP=AP6275_PCIE

# Define BT ttySX

export RK_WIFIBT_TTY=ttyS8

单独编译

./build.sh rootfs && ./build.sh firmware

开机自动加载WIFI KO 重要

# 原始文件位置如下,它经过./build.sh 或者make rkwifibt-rebuild编译后会被拷贝

到/etc/init.d/目录下(每次修改后需要重新编译打包)

catexternal/rkwifibt/SXXload_wifi_xxx_modules

...

insmod WIFI_KO # 内容为通用的名字,在编译期间会根据rkwifibt的配置进行替换

...

# 通过menuconfig的配置及buildroot/package/rockchip/rkwifibt/Config.in & rkwifibt.mk

的编译规则.

# rkwifibt.mk 内容节选如下,WIFI_KO被替换成实际配置的ko名字

$(SED)'s/WIFI_KO/\/$(FIRMWARE_DIR)\/lib\/modules\ ... ...

# 查看编译后的文件内容

catbuildroot/output/rockchip_rk3xxxx/target/etc/init.d/SXXload_wifi_xxx_modules

... ...

#可以看到Wi-Fi KO被替换成实际配置的ko,

正常的加载log:

no interfaces have a carrier

[ 6.403580] rk_gmac-dwmac fe010000.ethernet eth0: PHY [stmmac-1:00] driver [Generic PHY] (irq=POLL)

[ 6.413599] dwmac4: Master AXI performs any burst length

[ 6.413722] rk_gmac-dwmac fe010000.ethernet eth0: No Safety Features support found

[ 6.413792] rk_gmac-dwmac fe010000.ethernet eth0: IEEE 1588-2008 Advanced Timestamp supported

[ 6.414423] rk_gmac-dwmac fe010000.ethernet eth0: registered PTP clock

[ 6.416619] rk_gmac-dwmac fe010000.ethernet eth0: configuring for phy/rgmii link mode

[ 6.419100] [dhd] dhd_pri_open : no mutex held

[ 6.419142] [dhd] dhd_pri_open : set mutex lock

[ 6.419151] [dhd] [wlan0] dhd_open : Enter

[ 6.419159] [dhd] Dongle Host Driver, version 101.10.361.25 (wlan=r892223-20220929-2)

[ 6.419159] /home/malei/work/rk/external/rkwifibt/drivers/bcmdhd compiled on Mar 20 2023 at 10:45:56

[ 6.419159]

[ 6S.t4a1r9t1i7n4g] n[tpd: hd] dhd_open: ######### called for ifidx=0 #########

[ 6.419193] [dhd] [wlan0] wl_android_wifi_on : in g_wifi_on=0

[ 6.419202] [dhd] wifi_platform_set_power = 1, delay: 200 msec

[ 6.419209] [dhd] ======== PULL WL_REG_ON(-1) HIGH! ========

[ 6.419217] [WLAN_RFKILL]: rockchip_wifi_power: 1

[ 6.419225] [WLAN_RFKILL]: rockchip_wifi_power: toggle = false

[ 6.419233] [WLAN_RFKILL]: wifi turn on power [GPIO-1-0]

[ 6.725684] [dhd] dhd_bus_devreset: == Power ON ==

[ 6.725799] [dhd] dhd_bus_devreset: dhdpcie_bus_start_host_dev OK

[ 6.726774] [dhd] Disable CTO

[ 6.728136] [dhd] DHD: dongle ram size is set to 1310720(orig 1310720) at 0x170000

[ 6.728193] [dhd] dhdpcie_bar1_window_switch_enab: bar1_switch_enab=0 ramstart=0x170000 ramend=0x2affff bar1_size=0x400000

[ 6.728381] [dhd] dhdpcie_request_irq: INTx enabled, irq=80

[ 6.728507] [dhd] dhd_bus_download_firmware: firmware path=/system/etc/firmware/fw_bcm43752a2_pcie_ag.bin, nvram path=/system/etc/firmware/nvram_ap6275p.txt

[ 6.728552] [dhd] dhdpcie_dump_resource: BAR0(VA): 0x00000000850dbe7a, BAR0(PA): 0x00000000f4200000, SIZE: 32768

[ 6.728578] [dhd] dhdpcie_dump_resource: BAR1(VA): 0x00000000daafc15e, BAR1(PA): 0x00000000f4400000, SIZE: 4194304

[ 6.728654] [dhd] dhd_conf_set_path_params : Final fw_path=/system/etc/firmware/fw_bcm43752a2_pcie_ag.bin

[ 6.728677] [dhd] dhd_conf_set_path_params : Final nv_path=/system/etc/firmware/nvram_AP6275P.txt

[ 6.728697] [dhd] dhd_conf_set_path_params : Final clm_path=/system/etc/firmware/clm_bcm43752a2_pcie_ag.blob

[ 6.728717] [dhd] dhd_conf_set_path_params : Final conf_path=/system/etc/firmware/config.txt

[ 6.728900] [dhd] dhd_get_download_buffer: Open image file failed /system/etc/firmware/config.txt

[ 6.728941] [dhd] dhd_conf_read_config : Ignore config file /system/etc/firmware/config.txt

[ 6.728988] [dhd] d2h_intr_method -> PCIE_INTX(0); d2h_intr_control -> D2H_INTMASK(0)

[ 6.729258] [dhd] dhdpcie_download_code_file: dhd_tcm_test_enable 0

[ 6.729283] [dhd] dhdpcie_download_code_file: download firmware /system/etc/firmware/fw_bcm43752a2_pcie_ag.bin

[ 6.729424] [dhd] dhd_os_open_image1: /system/etc/firmware/fw_bcm43752a2_pcie_ag.bin (936074 bytes) open success

[ 6.797091] [dhd] dhd_os_open_image1: /system/etc/firmware/nvram_AP6275P.txt (7458 bytes) open success

[ 6.797202] [dhd] dhdpcie_download_nvram: dhd_get_download_buffer len 7458

[ 6.797213] [dhd] # AP6275P_NVRAM_V1.2_20210918A

[ 6.797277] [dhd] dhdpcie_download_nvram: process_nvram_vars len 6036

[ 6.811836] [dhd] dhdpcie_bus_write_vars: Download, Upload and compare of NVRAM succeeded.

[ 6.812040] [dhd] dhd_bus_aer_config: Configure AER registers for EP

[ 6.812091] [dhd] dhd_bus_aer_config: Configure AER registers for RC

[ 6.914142] [dhd] ### Total time ARM OOR to Readshared pass took 102143 usec ###

[ 6.914185] [dhd] dhdpcie_readshared: PCIe shared addr (0x0020a584) read took 100000 usec before dongle is ready

[ 6.914728] [dhd] H2D DMA WR INDX : array size 172 = 4 * 43

[ 6.914742] [dhd] D2H DMA RD INDX : array size 16 = 4 * 4

[ 6.914754] [dhd] D2H DMA WR INDX : array size 16 = 4 * 4

[ 6.914766] [dhd] H2D DMA RD INDX : array size 172 = 4 * 43

[ 6.914780] [dhd] dhdpcie_readshared: max H2D queues 40

[ 6.914790] [dhd] FW supports debug buf dest ? N

[ 6.914964] [dhd] dhd_bus_init: Enabling bus->intr_enabled

[ 6.914981] [dhd] dhdpcie_oob_intr_register OOB irq=112 flags=0x4

[ 6.915064] [dhd] dhdpcie_oob_intr_register: enable_irq_wake

[ 6.915088] [dhd] dhd_bus_start: Initializing 43 h2drings

[ 6.915141] [dhd] STATIC-MSG) dhd_wlan_mem_prealloc : section 9, size 32896

[ 6.915176] [dhd] dhd_prot_init:3921: h2d_max_txpost = 512

[ 6.915311] [dhd] dhd_prot_init:3936: MAX_RXBUFPOST = 511

[ 6.915327] [dhd] ENABLING DW:0

[ 6.915338] [dhd] IDMA inited

[ 6.915348] [dhd] IFRM not enabled in FW !!

[ 6.915358] [dhd] DAR not enabled in FW !!

[ 6.915368] [dhd] Enable hostcap: EXTD TXS in txcpl

[ 6.915712] [dhd] dhd_prot_d2h_sync_init(): D2H sync mechanism is NONE

[ 6.915751] [dhd] dhd_bus_hostready : Read PCICMD Reg: 0x00100006

[ 6.915789] [dhd] dhd_bus_dump_dar_registers: dar_clk_ctrl(0xa08:0x10b0040) dar_pwr_ctrl(0xa0c:0x30000) dar_intstat(0xa10:0x0)

[ 6.915814] [dhd] dhd_bus_dump_dar_registers: dar_errlog(0xa60:0x0) dar_erraddr(0xa64:0x0) dar_pcie_mbint(0xa68:0x0)

[ 6.915958] [dhd] dhd_bus_hostready: Ring Hostready:1

[ 6.915971] [dhd] iDMA enabled PCIEControl = 00000001

[ 6.918382] [dhd] dhd_send_d2h_ringcreate ringid: 3 idx: 46 max_h2d: 43

[ 6.918655] [dhd] dhd_prot_process_d2h_ring_create_complete ring create Response status = 0 ring 3, id 0xfffc

[ 6.918700] [dhd] info buffer post after ring create

[ 6.920647] [dhd] wlc_ver_major 12, wlc_ver_minor 1

[ 6.923447] [dhd] dhd_sync_with_dongle: GET_REVINFO device 0x449d, vendor 0x14e4, chipnum 0xaae8

[ 6.926218] [dhd] dhd_sync_with_dongle: RxBuf Post : 2048

[ 6.933888] [dhd] dhd_preinit_ioctls: preinit_status IOVAR not supported, use legacy preinit

[ 6.933988] [dhd] dhd_tcpack_suppress_set: TCP ACK Suppress mode 0 -> mode 3

[ 6.934015] [dhd] dhd_tcpack_suppress_set: TCPACK_INFO_MAXNUM=10, TCPDATA_INFO_MAXNUM=10

[ 6.937791] [dhd] dhd_legacy_preinit_ioctls: hostwake_oob enabled

[ 6.940590] [dhd] dhd_legacy_preinit_ioctls: use firmware generated mac_address d4:9c:dd:dd:07:30

[ 6.940771] [dhd] dhd_os_open_image1: /system/etc/firmware/clm_bcm43752a2_pcie_ag.blob (30993 bytes) open success

[ 6.943428] [dhd] dhd_check_current_clm_data: ----- This FW is not included CLM data -----

[ 7.013696] [dhd] dhd_check_current_clm_data: ----- This FW is included CLM data -----

[ 7.024996] [dhd] Firmware up: op_mode=0x0005, MAC=d4:9c:dd:dd:07:30

[ 7.067872] [dhd] dhd_legacy_preinit_ioctls: event_log_max_sets: 26 ret: 0

[ 7.075547] [dhd] arp_enable:1 arp_ol:0

[ 7.083064] [dhd] Driver: 101.10.361.25 (wlan=r892223-20220929-2)

[ 7.083064] [dhd] Firmware: wl0: Jul 12 2022 18:54:54 version 18.35.387.23.146 (g412cc5ec) FWID 01-93c53be6

[ 7.083064] [dhd] CLM: 9.9.12_SS (2021-10-12 17:03:28)

[ 7.083895] [dhd] dhd_pno_init: Support Android Location Service

[ 7.101059] [dhd] [INIT] logset:8 is preserve/chatty

[ 7.103542] [dhd] [INIT] logset:10 is preserve/chatty

[ 7.124429] [dhd] dhd_ecounter_autoconfig Ecounter autoconfig in FW not supported

[ 7.129060] [dhd] dhd_rx_frame: net device is NOT registered. drop event packet

[ 7.130291] [dhd] dhd_conf_country : country code = CN/0 is already configured

[ 7.146307] [dhd] dhd_bus_devreset: WLAN Power On Done

[ 7.146377] [dhd] [wlan0] wl_android_wifi_on : Success

[ 7.178876] [dhd] dhd_rx_frame: net device is NOT registered. drop event packet

[ 7.196127] [dhd] [wlan0] wl_cfg80211_up : Roam channel cache enabled

[ 7.198039] [dhd] [wlan0] dhd_open : Exit ret=0

[ 7.198072] [dhd] [wlan0] dhd_pri_open : tx queue started

[ 7.198118] [dhd] [wlan0] custom_xps_map_set : Done. mapping cpu

[ 7.198131] [dhd] dhd_pri_open : mutex is released.

你可能感兴趣的:(wifi,android)