Running Wi-Fi/BT with ap6256 under kernel 6.1.59

Good day!

I’m trying to activate Wi-Fi and Bluetooth (AP6256) for Radxa E25 on kernel 6.1.59 using the Radxa’s ‘bsp’ (/linux/stable) and ‘debos-radxa’ (bullseye) development frameworks. Could you please help me with this question:

  1. I started trying with ‘brcmfmac’ driver and I created patches for device-tree and kernel configuration:
Additional device-tree params
sdio_pwrseq: sdio-pwrseq {
		status = "okay";
		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_PD4 GPIO_ACTIVE_LOW>;		//WIFI_REG_ON_H
	};

&pinctrl {
sdio-pwrseq {
		wifi_enable_h: wifi-enable-h {
			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_PD5 RK_FUNC_GPIO &pcfg_pull_down>;
		};
	};

	wireless-bluetooth {
		uart8_gpios: uart8-gpios {
			rockchip,pins = <2 RK_PB1 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_enable_h: bt-enable-h {
			rockchip,pins = <4 RK_PB2 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_host_wake_l: bt-host-wake-l {
			rockchip,pins = <4 RK_PB4 RK_FUNC_GPIO &pcfg_pull_none>;
		};

		bt_wake_l: bt-wake-l {
			rockchip,pins = <4 RK_PB5 RK_FUNC_GPIO &pcfg_pull_none>;
		};

	};
};

//wifi
&sdmmc2 {
	max-frequency = <150000000>;
	supports-sdio;
	bus-width = <4>;
	disable-wp;
	cap-sd-highspeed;
	cap-sdio-irq;
	keep-power-in-suspend;
	mmc-pwrseq = <&sdio_pwrseq>;
	non-removable;
	pinctrl-names = "default";
	pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>;
	sd-uhs-sdr104;
	status = "okay";
    vmmc-supply = <&vcc_3v3>;
	vqmmc-supply = <&vcc_1v8>;
	#address-cells = <1>;
	#size-cells = <0>;
    wifi@1 {
		compatible = "brcm,bcm4329-fmac";
		reg = <1>;
		//rockchip,grf = <&grf>;
		interrupt-parent = <&gpio3>;
		interrupts = <RK_PD5 IRQ_TYPE_LEVEL_HIGH>;
		interrupt-names = "host-wake";
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_host_wake_irq>;
		status = "okay";
	};
};

&uart8 {
        status = "okay";
	pinctrl-names = "default";
        dma-names = "rx", "tx";
	pinctrl-0 = <&uart8m0_xfer &uart8m0_ctsn &uart8m0_rtsn>;

	bluetooth {
		compatible = "brcm,bcm4345c5";
		clocks = <&rk809 1>;
		clock-names = "lpo";
		device-wakeup-gpios = <&gpio4 RK_PB5 GPIO_ACTIVE_HIGH>; //HOST_WAKE_BT_H
		host-wakeup-gpios = <&gpio4 RK_PB4 GPIO_ACTIVE_HIGH>;   //BT_WAKE_HOST_H
		shutdown-gpios = <&gpio4 RK_PB2 GPIO_ACTIVE_HIGH>;  //BT_REG_ON_H
		max-speed = <1500000>;
		pinctrl-names = "default";
		pinctrl-0 = <&bt_host_wake_l &bt_wake_l &bt_enable_h>;
		vbat-supply = <&vcc3v3_sys>;
		vddio-supply = <&vcc_1v8>;
	};
};
Additional kernel flags
> CONFIG_B43=m
> CONFIG_B43_BCMA=y
> CONFIG_B43_SSB=y
> CONFIG_B43_BUSES_BCMA_AND_SSB=y
> CONFIG_B43_PCI_AUTOSELECT=y
> CONFIG_B43_PCICORE_AUTOSELECT=y
> CONFIG_B43_BCMA_PIO=y
> CONFIG_B43_PIO=y
> CONFIG_B43_PHY_G=y
> CONFIG_B43_PHY_N=y
> CONFIG_B43_PHY_LP=y
> CONFIG_B43_PHY_HT=y
> CONFIG_B43_LEDS=y
> CONFIG_B43_HWRNG=y
> CONFIG_B43LEGACY=m
> CONFIG_B43LEGACY_PCI_AUTOSELECT=y
> CONFIG_B43LEGACY_PCICORE_AUTOSELECT=y
> CONFIG_B43LEGACY_LEDS=y
> CONFIG_B43LEGACY_HWRNG=y
> CONFIG_B43LEGACY_DEBUG=y
> CONFIG_B43LEGACY_DMA=y
> CONFIG_B43LEGACY_PIO=y
> CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y
> CONFIG_BRCMUTIL=m
> CONFIG_BRCMSMAC=m
> CONFIG_BRCMFMAC=m
> CONFIG_BRCMFMAC_PROTO_BCDC=y
> CONFIG_BRCMFMAC_PROTO_MSGBUF=y
> CONFIG_BRCMFMAC_SDIO=y
> CONFIG_BRCMFMAC_USB=y
> CONFIG_BRCMFMAC_PCIE=y
> CONFIG_BRCM_TRACING=y
> CONFIG_BRCMDBG=y
> 
> CONFIG_SSB=m
> CONFIG_SSB_SPROM=y
> CONFIG_SSB_BLOCKIO=y
> CONFIG_SSB_PCIHOST_POSSIBLE=y
> CONFIG_SSB_PCIHOST=y
> CONFIG_SSB_B43_PCI_BRIDGE=y
> CONFIG_SSB_SDIOHOST_POSSIBLE=y
> CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
> CONFIG_SSB_DRIVER_PCICORE=y
> CONFIG_BCMA_POSSIBLE=y
> CONFIG_BCMA=m
> CONFIG_BCMA_BLOCKIO=y
> CONFIG_BCMA_HOST_PCI_POSSIBLE=y
> CONFIG_BCMA_HOST_PCI=y
> CONFIG_BCMA_DRIVER_PCI=y
> 
> CONFIG_MUX_GPIO=m
> 
> CONFIG_BT_HS=y
> CONFIG_BT_LE=y
> CONFIG_BT_BNEP_MC_FILTER=y
> CONFIG_BT_BNEP_PROTO_FILTER=y
> CONFIG_CFG80211_DEFAULT_PS=n
> CONFIG_RFKILL_GPIO=m
> CONFIG_B43_SDIO=m

Base config is the same as /linux/stable in bsp. Also i added symbol link for firmware in firmare/brcm directory for board.
But kernel with these patches doesn’t start as expected:

Part of boot log

[ 1.151029] mmc2: new ultra high speed SDR104 SDIO card at address 0001

[ 13.667525] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 13.705378] cfg80211: Loaded X.509 cert ‘sforshee: 00b28ddf47aef9cea7’
[ 13.717326] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid
[ 13.801916] brcmfmac: F1 signature read @0x18000000=0x15294345
[ 13.844597] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[ 13.847678] usbcore: registered new interface driver brcmfmac
[ 13.854680] hantro-vpu fdea0000.video-codec: Adding to iommu group 0
[ 13.870480] hantro-vpu fdea0000.video-codec: registered rockchip,rk3568-vpu-dec as /dev/video0
[ 13.872932] hantro-vpu fdee0000.video-codec: Adding to iommu group 1
[ 13.896558] hantro-vpu fdee0000.video-codec: registered rockchip,rk3568-vepu-enc as /dev/video1
[ 14.032935] input: adc-keys as /devices/platform/adc-keys/input/input0
[ 14.040259] Bluetooth: Core ver 2.22
[ 14.040400] NET: Registered PF_BLUETOOTH protocol family
[ 14.040415] Bluetooth: HCI device and connection manager initialized
[ 14.040438] Bluetooth: HCI socket layer initialized
[ 14.040451] Bluetooth: L2CAP socket layer initialized
[ 14.040474] Bluetooth: SCO socket layer initialized
[ 14.103935] Bluetooth: HCI UART driver ver 2.3
[ 14.103975] Bluetooth: HCI UART protocol H4 registered
[ 14.104052] Bluetooth: HCI UART protocol LL registered
[ 14.104093] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 14.104619] Bluetooth: HCI UART protocol Broadcom registered
[ 14.104669] Bluetooth: HCI UART protocol QCA registered
[ 14.104822] Bluetooth: HCI UART protocol Marvell registered
[ 16.358243] Bluetooth: hci0: command 0xfc18 tx timeout
[ 18.879658] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 18.879702] Bluetooth: BNEP filters: protocol multicast
[ 18.879723] Bluetooth: BNEP socket layer initialized
[ 18.955797] bpfilter: Loaded bpfilter_umh pid 443
[ 18.957275] bpfilter: read fail 0
[ 19.043840] bpfilter: Loaded bpfilter_umh pid 448
[ 19.044540] bpfilter: read fail 0
[ 19.127793] bpfilter: Loaded bpfilter_umh pid 450
[ 19.128292] bpfilter: read fail 0
[ 19.230756] bpfilter: Loaded bpfilter_umh pid 462
[ 19.231253] bpfilter: read fail 0
[ 19.366842] bpfilter: Loaded bpfilter_umh pid 470
[ 19.367526] bpfilter: read fail 0
[ 19.459104] bpfilter: Loaded bpfilter_umh pid 484
[ 19.459637] bpfilter: read fail 0
[ 19.547901] bpfilter: Loaded bpfilter_umh pid 486
[ 19.548906] bpfilter: read fail 0
[ 19.639756] bpfilter: Loaded bpfilter_umh pid 488
[ 19.640544] bpfilter: read fail 0
[ 22.997334] bpfilter: Loaded bpfilter_umh pid 606
[ 22.999417] bpfilter: read fail 0
[ 23.115429] bpfilter: Loaded bpfilter_umh pid 610
[ 23.117160] bpfilter: read fail 0
[ 23.212574] bpfilter: Loaded bpfilter_umh pid 613
[ 23.214430] bpfilter: read fail 0
[ 23.296358] bpfilter: Loaded bpfilter_umh pid 615
[ 23.298083] bpfilter: read fail 0
[ 24.550291] Bluetooth: hci0: BCM: failed to write update baudrate (-110)
[ 24.550380] Bluetooth: hci0: Failed to set baudrate
[ 26.566322] Bluetooth: hci0: command 0x0c03 tx timeout

[ 33.766881] vdd_npu: disabling
[ 33.768318] vdda0v9_image: disabling
[ 33.769720] vcca1v8_image: disabling
[ 34.790305] Bluetooth: hci0: BCM: Reset failed (-110)

Debug output of brcmfmac (0x120016 - TRACE, INFO and WIFI_FW_LOG, SDIO):

brcmfmac debug output

[ 71.941611] brcmfmac: brcmfmac_module_init No platform data available.
[ 71.942551] brcmfmac: brcmf_ops_sdio_probe Enter
[ 71.942585] brcmfmac: brcmf_ops_sdio_probe Class=0
[ 71.942604] brcmfmac: brcmf_ops_sdio_probe sdio vendor ID: 0x02d0
[ 71.942622] brcmfmac: brcmf_ops_sdio_probe sdio device ID: 0xa9bf
[ 71.942638] brcmfmac: brcmf_ops_sdio_probe Function#: 1
[ 71.943105] brcmfmac: brcmf_ops_sdio_probe Enter
[ 71.943133] brcmfmac: brcmf_ops_sdio_probe Class=0
[ 71.943152] brcmfmac: brcmf_ops_sdio_probe sdio vendor ID: 0x02d0
[ 71.943169] brcmfmac: brcmf_ops_sdio_probe sdio device ID: 0xa9bf
[ 71.943184] brcmfmac: brcmf_ops_sdio_probe Function#: 2
[ 71.943205] brcmfmac: brcmf_ops_sdio_probe F2 found, calling brcmf_sdiod_probe…
[ 71.943445] brcmfmac: brcmf_sdiod_probe set F2 blocksize to 512
[ 71.943642] brcmfmac: brcmf_sdio_probe Enter
[ 71.944508] brcmfmac: F1 signature read @0x18000000=0x15294345
[ 71.945080] brcmfmac: brcmf_chip_recognition found AXI chip: BCM4345/9
[ 71.952957] brcmfmac: brcmf_chip_cores_check [1 ] core 0x800:51 base 0x18000000 wrap 0x18100000
[ 71.953023] brcmfmac: brcmf_chip_cores_check [2 ] core 0x812:54 base 0x18001000 wrap 0x18101000
[ 71.953050] brcmfmac: brcmf_chip_cores_check [3 ] core 0x83e:9 base 0x18002000 wrap 0x18102000
[ 71.953075] brcmfmac: brcmf_chip_cores_check [4 ] core 0x83c:14 base 0x18003000 wrap 0x18103000
[ 71.953098] brcmfmac: brcmf_chip_cores_check [5 ] core 0x829:21 base 0x18004000 wrap 0x18104000
[ 71.953121] brcmfmac: brcmf_chip_cores_check [6 ] core 0x135:0 base 0x00000000 wrap 0x18107000
[ 71.953145] brcmfmac: brcmf_chip_cores_check [7 ] core 0x240:0 base 0x00000000 wrap 0x00000000
[ 71.953168] brcmfmac: brcmf_chip_set_passive Enter
[ 71.956881] brcmfmac: brcmf_chip_get_raminfo RAM: base=0x198000 size=819200 (0xc8000) sr=0 (0x0)
[ 71.957143] brcmfmac: brcmf_chip_setup ccrev=51, pmurev=27, pmucaps=0x39d05f1b
[ 71.957180] brcmfmac: brcmf_get_module_param Enter, bus=0, chip=17221, rev=9
[ 71.957604] brcmfmac: brcmf_sdiod_sgtable_alloc nents=35
[ 71.957707] brcmfmac: brcmf_sdio_kso_init Enter
[ 71.957798] brcmfmac: brcmf_sdio_drivestrengthinit No SDIO driver strength init needed for chip BCM4345/9 rev 9 pmurev 27
[ 71.958604] brcmfmac: brcmf_sdio_probe completed!!
[ 71.958646] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[ 71.958726] brcmfmac: brcmf_fw_get_firmwares enter: dev=mmc2:0001:1
[ 71.958759] brcmfmac: brcm_alt_fw_path FW alt path: brcm/brcmfmac43456-sdio.radxa,e25.bin
[ 71.959331] brcmfmac: brcmf_ops_sdio_probe F2 init completed…
[ 71.959818] brcmfmac: brcmf_ops_sdio_probe Enter
[ 71.959846] brcmfmac: brcmf_ops_sdio_probe Class=2
[ 71.959864] brcmfmac: brcmf_ops_sdio_probe sdio vendor ID: 0x02d0
[ 71.959882] brcmfmac: brcmf_ops_sdio_probe sdio device ID: 0xa9bf
[ 71.959898] brcmfmac: brcmf_ops_sdio_probe Function#: 3
[ 71.960223] usbcore: registered new interface driver brcmfmac
[ 72.589590] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac43456-sdio.bin found
[ 72.589783] brcmfmac: brcm_alt_fw_path FW alt path: brcm/brcmfmac43456-sdio.radxa,e25.txt
[ 72.593253] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac43456-sdio.txt found
[ 72.593290] brcmfmac: brcmf_fw_request_nvram_done enter: dev=mmc2:0001:1
[ 72.593797] brcmfmac: brcmf_fw_request_nvram_done nvram 00000000b2b99bff len 1492
[ 72.593846] brcmfmac: brcm_alt_fw_path FW alt path: brcm/brcmfmac43456-sdio.radxa,e25.clm_blob
[ 72.596099] brcmfmac: brcmf_fw_complete_request firmware brcm/brcmfmac43456-sdio.clm_blob found
[ 72.596140] brcmfmac: brcmf_sdio_firmware_callback Enter: dev=mmc2:0001:1, err=0
[ 72.596178] brcmfmac: brcmf_sdio_clkctl Enter
[ 72.596195] brcmfmac: brcmf_sdio_htclk Enter
[ 72.596342] brcmfmac: brcmf_sdio_htclk CLKCTL: turned ON
[ 72.596366] brcmfmac: brcmf_sdio_clkctl 1 -> 3
[ 72.596387] brcmfmac: brcmf_sdio_download_firmware firmware rstvec: b83ef198
[ 72.596403] brcmfmac: brcmf_sdio_download_code_file Enter
[ 72.596588] brcmfmac: brcmf_sdiod_ramrw write 32768 bytes at offset 0x00000000 in window 0x00198000

usbcore register new brcmfmac device and…no further work with the device: wlan0 doesn’t appear in system. Driver always stuck on brcmf_sdiod_ramrw().

What am i missing with device-tree/kernel flags?

P.S. On Linux kernel 4/5, Rockchip provided a custom “wlan-platdata” and “bluetooth-platdata” drivers. What main difference between these drivers and brcmfmac?

Thank you in advance for your help,
aylour

After some problem investigation, I can say that activation of the node ‘usb_host1_ohci’ in device-tree finally leads to the appearance of the interface ‘wl0’ in the system. So boot for now is:

dmesg

[ 11.995959] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[ 12.017293] cfg80211: Loaded X.509 cert ‘sforshee: 00b28ddf47aef9cea7’
[ 12.024175] cfg80211: loaded regulatory.db is malformed or signature is missing/invalid
[ 12.146395] brcmfmac: F1 signature read @0x18000000=0x15294345
[ 12.158290] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[ 12.161480] usbcore: registered new interface driver brcmfmac
[ 12.222933] input: adc-keys as /devices/platform/adc-keys/input/input0
[ 12.387841] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/9 wl0: Feb 11 2020 11:54:51 version 7.45.96.61 (be7af2d@shgit) (r745790) FWID 01-a41d86bd es7.c5.n4.a3
[ 12.457663] Bluetooth: Core ver 2.22
[ 12.457805] NET: Registered PF_BLUETOOTH protocol family
[ 12.457821] Bluetooth: HCI device and connection manager initialized
[ 12.457844] Bluetooth: HCI socket layer initialized
[ 12.457857] Bluetooth: L2CAP socket layer initialized
[ 12.457880] Bluetooth: SCO socket layer initialized
[ 12.467419] btsdio: probe of mmc2:0001:3 failed with error -110
[ 12.574087] Bluetooth: HCI UART driver ver 2.3
[ 12.574138] Bluetooth: HCI UART protocol H4 registered
[ 12.575116] Bluetooth: HCI UART protocol LL registered
[ 12.577596] Bluetooth: HCI UART protocol Three-wire (H5) registered
[ 12.579421] Bluetooth: HCI UART protocol Broadcom registered
[ 12.579687] Bluetooth: HCI UART protocol QCA registered
[ 12.579754] Bluetooth: HCI UART protocol Marvell registered
[ 12.701578] of_dma_request_slave_channel: dma-names property of node ‘/serial@fe6c0000’ missing or empty
[ 12.701664] dw-apb-uart fe6c0000.serial: failed to request DMA
[ 12.931050] Bluetooth: hci0: BCM: chip id 130
[ 12.931403] Bluetooth: hci0: BCM: features 0x0f
[ 12.933485] Bluetooth: hci0: BCM4345C5
[ 12.933496] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0000
[ 12.950847] Bluetooth: hci0: BCM4345C5 ‘brcm/BCM4345C5.hcd’ Patch
[ 13.784002] Bluetooth: hci0: BCM: features 0x0f
[ 13.786821] Bluetooth: hci0: BCM4345C5 Ampak_CL1 UART 37.4 MHz BT 5.0 [Version: Version: 0039.0089]
[ 13.786878] Bluetooth: hci0: BCM4345C5 (003.006.006) build 0089
[ 17.277145] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 17.277183] Bluetooth: BNEP filters: protocol multicast
[ 17.277204] Bluetooth: BNEP socket layer initialized
[ 17.291817] Bluetooth: MGMT ver 1.22
[ 17.345780] NET: Registered PF_ALG protocol family
[ 17.348807] bpfilter: Loaded bpfilter_umh pid 474
[ 17.355294] Started bpfilter
[ 19.558368] Bluetooth: hci0: Opcode 0x c03 failed: -110
[ 21.209168] 8021q: 802.1Q VLAN Support v1.8
[ 21.574398] Bluetooth: hci0: Opcode 0x c03 failed: -110
[ 33.767062] vdd_npu: disabling
[ 33.768551] vdda0v9_image: disabling
[ 33.770009] vcca1v8_image: disabling

The problems with bluetooth still here.

Hi,
Maybe you can first check whether the Bluetooth firmware is correctly placed in the specified path.