This is an old revision of the document!
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 or Banana Pi. GlobalScale DreamPlug has an internal SDIO slot with the Marvell WLAN/Bluetooth module.
FreeBSD lacks SDIO support and is not able to talk to the peripheral devices behind SDIO. Work is going on to create a driver for the FreeBSD. Earlier version used DreamPlug hardware, which has Marvell SD8787 chip (WiFi, BT and FM).
Currently the MMC stack is being moved onto CAM framework, this will allow to handle interrupts generated by SDIO cards and hopefully fix several other issues with the old stack.
SDIO WiFi chipsets overview
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 |
| Wandboard | Broadcom BCM4339 802.11 a/b/g/n/ac | brcmfmac | Linux Wireless |
| Raspberry Pi 3 | Broadcom BCM43438 | brcmfmac | Linux Wireless |
| Banana Pro | AMPAK AP6181 (Broadcom BCM43362) | brcmfmac | wikidevi |
| Beaglebone Black Wireless and Green Wireless | TI ML1835MOD | wl18xx | TI Wiki |
So, basically the Broadcom driver is the most important to get as it's used in IMX6-based boards and RPi3.
Get hands dirty
Prerequisites: working Beaglebone Black or iIMX6-based board (Wandboard, Hummingboard,…) serial console access.
- Get FreeBSD-CURRENT
- Build world for armv6;
- Build kernel using kernel config file named BEAGLEBONE-MMCCAM for BBB or IMX6-MMCCAM for Wandboard;
- Run
camcontrol devlist
You should see something like this (this is on Beaglebone Black with MMC card inserted into the uSD slot using adapter):
# 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.
Useful links
- The old source code is kept here: https://github.com/kibab/freebsd/tree/kibab-dplug
- Version of MMC stack based on CAM framework: https://github.com/kibab/freebsd/tree/mmccam
- Wikipedia article about SD and SDIO: http://en.wikipedia.org/wiki/Secure_Digital#SDIO
- SDIO specification: https://www.sdcard.org/developers/overview/sdio/sdio_spec/
- SDIO status report slides for BSDCam'2017: sdio_bsdcam.pdf