SDIO
Introduction
SDIO is an interface designed as an extension for the existing SD card standard, to allow connecting different peripherals to the host with the standard SD controller. Nowadays it's extensively used to connect WiFi/Bluetooth chips on ARM boards, like Wandboard, Raspberry Pi 3/4 or Banana Pi. GlobalScale DreamPlug has an internal SDIO slot with the Marvell WLAN/Bluetooth module.
Status
FreeBSD 13 gained SDIO support in r348805 and is now able to talk to the peripheral devices behind SDIO. Work is ongoing to create a WiFi driver for the Broadcom chips. Earlier version used DreamPlug hardware, which has Marvell SD8787 chip (WiFi, BT and FM).
In order to use the SDIO bus one has to compile the kernel with the MMC stack using the CAM framework, which allows to handle interrupts generated by SDIO cards and hopefully fix several other issues with the old stack.
SDIO Wireless Chipsets
The first version of MMCCAM stack was committed to FreeBSD 12 in r320844, minimum FreeBSD_version is 1200038. This means that it's now possible to work on drivers for the WiFi devices sitting on the SDIO bus.
Board |
Device |
Linux driver |
More Info |
Contact |
Wandboard |
Broadcom BCM4339 802.11 a/b/g/n/ac |
|
||
Raspberry Pi 3/4 |
Broadcom BCM43438, etc. |
|||
Banana Pro |
AMPAK AP6181 (Broadcom BCM43362) |
wikidevi |
|
|
Beaglebone Black Wireless and Green Wireless |
TI WL1835MOD |
|
So, basically the Broadcom driver is the most important to get as it's used in IMX6-based boards and RPi3/4.
Get hands dirty
Prerequisites: working Beaglebone Black / IMX6-based board (Wandboard, Hummingboard,...) / Raspberry Pi, serial console access.
- Get FreeBSD-CURRENT
If you have Wandboard rev C, apply this patch so that the second SDHC controller, where SDIO WiFi sits, is probed;
- Build world for armv7 (armv6 in case of older Rpi) and for arm64.
- Build kernel using kernel config file named GENERIC-MMCCAM;
Run camcontrol devlist
You should see something like this (this is on Beaglebone Black with MMC card inserted into the uSD slot using adapter) (TODO: updated output for rpi with sdiob):
# camcontrol devlist <MMC 000000 1.1 SN 10000036 MFG 00/2006 > at scbus0 target 0 lun 0 (pass1,sdda1) <MMC MMC02G 3.10 SN D685362C MFG 02/1997> at scbus1 target 0 lun 0 (sdda0,pass0)
Or, in case of Wandboard:
camcontrol devlist -v scbus0 on sdhci_slot0 bus 0: scbus1 on sdhci_slot1 bus 0: <SDIO card> at scbus1 target 0 lun 0 (pass0) <> at scbus1 target 0 lun 1 () <> at scbus1 target 0 lun 2 () scbus2 on sdhci_slot2 bus 0: <SDHC 00000 1.0 SN 84280657 MFG 09/2014 > at scbus2 target 0 lun 0 (pass1,sdda0) scbus-1 on xpt0 bus 0: <> at scbus-1 target -1 lun ffffffff (xpt0)
Here, "SDIO card" on pass0 is built-in WiFi module with lun 1 and 2 representing SDIO functions 1 and 2; SDHC card on pass1 is a SDHC card inserted into the internal uSD slot.
You can try getting controller information:
# camcontrol mmcsdcmd pass1 -I Host controller information Host OCR: 0x60000 Min frequency: 375 KHz Max frequency: 96 MHz Supported bus width: 4 bit Current settings: Bus width: 4 bit Freq: 24.000 MHz(high-speed timing)
In general, camcontrol mmcsdcmd can be used to send MMC commands directly to the card from the userland.
There is also usr.bin/sdiotool that is a highly experimental way of prototyping the SDIO device drivers in userland. Currently it's possible to get chip revision for Broadcom-based SDIO devices.