MMC stack under CAM framework
The goal of the project is to reimplement the exisitng MMC/SD stack using the CAM framework. This will allow to utilize the well-tested CAM locking model and debug features. Additionally it will be possible to process interrupts generated by the inserted
card, which is a prerequisite for implementing SDIO interface.
The first version of the code was uploaded
on the Phabricator for review. The new stack is able to attach to the SD card and bring it to the operational state, so it's possible to read/write
Supported SD controller drivers are ti_sdhci (BeagleBone Black) and imx_sdhci (Wandboard and other IMX-based boards). Modifying other SDHCI-compliant drivers should not be a hard task.
How to test this?
- Checkout my Git repository, mmccam branch:
$ git clone https://github.com/kibab/freebsd
$ git checkout mmccam
- Compile FreeBSD as usual, use the kernel configuration file BEAGLEBONE-CAM or IMX6MMC.
$ make ARCH=armv6 TARGET_ARCH=armv6 buildkernel KERNCONF=BEAGLEBONE-CAM
- Boot Beaglebone Black, you'll get LOTS of debug messages -- sorry for that :-)
Remember that even if there is no SD card in the μSD slot, there is still onboard eMMC.
- Try commands like diskinfo, geom disk list and see what they report.
Testing in the virtual machine
To make testing easier I've created a special driver mmcnull that attaches to the cpu0.
This guarantees that it always attaches ;-) And then it hooks itself into CAM as new SIM (SDHCI cardreader).
After that it's able to receive MMC commands and emulate replies from the card.
To use it, just kldload mmcnull after booting the system.