WiFI SDIO Broadcom, Infineon 43455, Notes to learn from for FreeBSD / GhostBSD-Arm64

WiFI SDIO Broadcom, Infineon 43455,  Notes to learn from for FreeBSD / GhostBSD-Arm64


WiFi

WiFi needs three firmware files from in /lib/firmware/brcm/:

brcmfmac43455-sdio.bin
brcmfmac43455-sdio.clm_blob
brcmfmac43455-sdio.txt

Which is almost but not quite the same as the Pi3. The catch is in brcmfmac43455-sdio.txt where grep boardflags3 produces different results for the Pi3 and Pi4 files.

The Pi4 version returns boardflags3=0x44200100
The Pi3 version returns boardflags3=0x48200100

With the wrong brcmfmac43455-sdio.txt file, bluetooth will work but not WiFi.

These files, including the Pi 4 version of above file, are found in sys-firmware/raspberrypi-wifi-ucode, to install it you'll also need to install sys-kernel/linux-firmware with the savedconfig USE flag and remove the conflicting files from the saved configuration, and then re-emerge linux-firmware to apply the new de-conflicted saved configuration:

/lib/firmware/brcm/brcmfmac43430-sdio.bin
/lib/firmware/brcm/brcmfmac43430-sdio.txt
/lib/firmware/brcm/brcmfmac43436-sdio.bin
/lib/firmware/brcm/brcmfmac43436-sdio.clm_blob
/lib/firmware/brcm/brcmfmac43436-sdio.txt
/lib/firmware/brcm/brcmfmac43455-sdio.bin
/lib/firmware/brcm/brcmfmac43455-sdio.clm_blob
/lib/firmware/brcm/brcmfmac43455-sdio.txt
/lib/firmware/brcm/brcmfmac43456-sdio.bin
/lib/firmware/brcm/brcmfmac43456-sdio.clm_blob
/lib/firmware/brcm/brcmfmac43456-sdio.txt

https://openwrt.org/toh/raspberry_pi_foundation/raspberry_pi

Tables to the various Pi models,  Wifi  CYW43455, 43456  4B,400,CM4, 5
 

Setting the Country Code under Network → Wireless in LuCI does not work with the Raspberry Pi, you will need to set the country code in the latest Raspberry Pi OS. Then you can go back to OpenWrt where the new country code will be used. Starting with Raspberry Pi 3 B+, the on-board WiFi won't even start if there is no country code.

The following is only necessary prior to OpenWrt 21.02.3 as per this pull request.

With older versions of OpenWrt with the Pi 4B, you may have trouble connecting to the higher 5 GHz channels. For example, I was able to scan for and connect to an 802.11ac wireless network on channel 44 but not on channel 153. The logs were also flooded with `daemon.warn wpa_supplicant[681]: wlan0: Failed to initiate sched scan`.

Updating the firmware files in `/lib/firmware/brcm/` fixed this problem. The latest firmware files can be downloaded from the linux-firmware repository:

New, working:

# sha256sum <files>
d408faa9d0d5b1a2f9912dcea53ab0be48217288e398406d117f0edafe7c3edd  brcmfmac43455-sdio.bin
15f50a27020b263d1bea215c8f68d0550d912932d1d9ef19ffd59f18d82dd460  brcmfmac43455-sdio.clm_blob
edb6f4e4fb19e18940004124feb4ffe160d72fc607243a07a4480338a28b2748  brcmfmac43455-sdio.raspberrypi,4-model-b.txt
# dmesg | grep 'Firmware: BCM4345/6'
[162004.725511] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/6 wl0: Apr 15 2021 03:03:20 version 7.45.234 (4ca95bb CY) FWID 01-996384e2
Place these files at this location in the FreeBSD / GhostBSD-Arm64 file tree:
/boot/firmware  ???  check where it should go, ok?
 
https://pinout.xyz/pinout/sdio   SDIO Pinout Table for 40 pin header on Raspi4B
 

SDIO WiFi pinout for Raspberry Pi 4B board
GPIO 22 CLK pin 15
GPIO 23 CMD pin 16
GPIO 24 DAT0 pin 18
GPIO 25 DAT1 pin 22
GPIO 26 DAT2 pin 37
GPIO 27 DAT3 pin 13
 
I believe these pins interfere with the ALT4 JTAG pinout. Select ALT5 JTAG Pinout? 
 
 
https://lairdcp.github.io/guides/Sterling-60-Tutorials/1.0/raspberry-pi-wifi-bt.html
Great Hardware pictures of connecting an external Radio to the SDIO GPIO pins, 
GPIO 17 as the select enable HIGH (1) pin for the radio.
Preparation

The Raspberry Pi offers a neat way to disable and enable on board hardware with overlays.

To do so, edit the file /boot/config.txt on the SD card you just prepared and add this to the end of the file:

#to disable on-board Wifi

dtoverlay=disable-wifi

#to enable SDIO lines for Wifi module on GPIO pins 22-27 (default) at
low speed (2MHz) to accomodate for \"loose\" wiring

dtoverlay=sdio,sdio_overclock=2,poll_once=off

Important: Reboot the device for the changes to take effect.


For reference: https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README


Further reading
===============

This is only meant to be a quick introduction to the subject of Device Tree on
Raspberry Pi. There is a more complete explanation here:

http://www.raspberrypi.org/documentation/configuration/device-tree.md 
http://blog.khubla.com/freebsd/the-freebsd-fdt-the-raspberry-pi-spi
FreeBSD Flat Device Tree FDT for the raspberry pi spi pins.
https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&url=https://community.silabs.com/s/article/linux-sdio-detection&ved=2ahUKEwiRtOCNk7yFAxXPMzQIHV-FDXg4FBAWegQIIRAB&usg=AOvVaw2TsxBoCVEn6UwpGmcQjtT1
https://vitaminac.github.io/RaspberryPi4B-Setup/ Great Rpi4B SOC Diagram, SDIO & WIFI

Buy a Raspberry Pi 4B

Choose SD Card

Raspberry Pi has no internal storage, relying instead on a removable micro SD card as his primary boot drives. Raspberry Pi 3 doesn’t support UHS mode because it requires 1.8v signaling while Raspberry Pi 3 is fixed at 3.3v. This is technically the upper bound of write speed (25MB/sec) for non-UHS SD cards. Now Raspberry Pi 4B provides a SD card socket runs on DDR50 bus speed mode and a legacy SDIO interface is available on the GPIO pins.

5.1.4 SD/SDIO Interface
The Pi4B has a dedicated SD card socket which supports 1.8V, DDR50 mode (at a peak bandwidth of
50 Megabytes / sec). In addition, a legacy SDIO interface is available on the GPIO pins.

https://pinout.xyz/pinout/sdio

 
 
https://www.infineon.com/dgdl/Infineon-SDIO_platform_support_guide-UserManual-v01_00-EN.pdf?fileId=8ac78c8c8c3de074018c8ba3a9973619  
https://www.sdcard.org/downloads/pls/ SDIO card specification
https://forum.odroid.com/viewtopic.php?t=38124   ESP8089 WifiBoard and DTS files, Kicad PCB fil
Pictures, Schematics, etc

Re: Re-enabling SDIO Port?


Post by joy »

Hi @racerxdl,
It looks your dts is OK.

Which type of sdio device do you use?
If it supports SDIO2.0, you need to add cap-sd-highspeed; in sdio dts to support max 50MHz.
or for SDIO3.0, needs sd-uhs-sdr104.

For example, to support sdio2.0 (max 50MHz)...

Code: Select all

&sdio {
  bus-width = <4>;
  supports-sdio;
  cap-sd-highspeed;
  ignore-pm-notify;
  keep-power-in-suspend;
  status = "okay";
};
Then, you will have this log.

Code: Select all

[    1.737171] dwmmc_rockchip ff380000.dwmmc: 1 slots initialized
[    1.789572] mmc1: queuing unknown CIS tuple 0x01 (3 bytes)
[    1.799561] mmc_host mmc0: Bus speed (slot 0) = 150000000Hz (slot req 150000000Hz, actual 150000000HZ div = )
[    1.814911] mmc1: queuing unknown CIS tuple 0x1a (5 bytes)
[    1.826651] mmc1: queuing unknown CIS tuple 0x1b (8 bytes)
[    1.827711] mmc_host mmc1: Bus speed (slot 0) = 50000000Hz (slot req 50000000Hz, actual 50000000HZ div = 0)
[    1.878256] mmc1: queuing unknown CIS tuple 0x80 (1 bytes)
[    1.878329] mmc1: queuing unknown CIS tuple 0x81 (1 bytes)
[    1.878399] mmc1: queuing unknown CIS tuple 0x82 (1 bytes)
[    1.878439] mmc1: new high speed SDIO card at address 0001

Code: Select all

# cat /sys/kernel/debug/mmc1/ios 
clock:          50000000 Hz
vdd:            21 (3.3 ~ 3.4 V)
bus mode:       2 (push-pull)
chip select:    0 (don't care)
power mode:     2 (on)
bus width:      2 (4 bits)
timing spec:    2 (sd high-speed)
signal voltage: 0 (3.30 V)
driver type:    0 (driver type B)
If 25MHz sdio speed is enough to communicate with your SDIO device, you need to check (1) HW connection or (2) device driver level.
 
 
 
https://bootlin.com/blog/enabling-new-hardware-on-raspberry-pi-with-device-tree-overlays/ 
https://www.raspberrypi.org/documentation/computers/configuration.html#ensure-wireless-operation 
 
Source Code for SDIO 4-bit wifi driver can be found in OpenBSD github source code.
April 21, 2025  New Code URL links and miscellaneous stuff
 
https://forums.freebsd.org/threads/rpi4-wifi-driver.80426/
SDIO integration https://freebsdfoundation.org/project/sdio-integration/ 
 
There is a device driver for the RPI4 CYW43455 wifi chip, from OpenBSD, then developed further by NetBSD.

I have absolutely never done this before, but here are some references, there are probably people porting this driver to FreeBSD currently (or possibly developing one on their own) :

Writing FreeBSD Device Drivers

Cypress CYW43455 single-chip device

Simple I/O device driver for RaspberryPi This URL has a great written article on the GPIO Input / Output pins with a Linux Device Driver. Learn for us in FreeBSD device driver.

BWFM(4) NetBSD Kernel Interfaces Manual

NetBSD src code search on github

NetBSD cvsweb driver src code 
 
 Openbsd BWFM  manual page  https://man.openbsd.org/bwfm 
 

Comments

Popular posts from this blog

HDMI Audio sound patches into GhostBSD source code /usr/ghost14/ghostbsd-src SOLVED Jan20 2024

How to install GhostBSD-Arm64 into a USB Flash Drive stick April 24, 2024 update edition.

January 19, 2024 Howto Download a Raspberry Pi 4B bootable image from http://ghostbsdarm64.hopto.org/packages/