MSDC is MediaTek's SD and eMMC host controller [1]. The driver
supports the one in the MT7986. On the Banana Pi BPI-R3 it serves
either the SD slot or the eMMC, selected by a DIP switch.
Requests are interrupt driven and use descriptor DMA below 4 GiB, up
to 512 KiB per request. A callout bounds each phase; writes get 30
seconds, since card programming can take longer than ten. When
DMA_STOP leaves the engine running, a controller reset stopped it on
the board; if that fails as well, the driver panics.
The eMMC bus test write (CMD19) goes through the TX FIFO by PIO. Fed
by descriptor DMA, its data never leaves the controller, and the card
then ignores commands until it is power cycled.
Default and high speed are supported, up to 52 MHz. Not supported
yet: DDR52, UHS and 1.8 V signaling, HS200 and HS400 with the binding's
tuning properties, SDIO and MMCCAM. Until there is an MT7986 pinctrl
driver, the controller relies on the firmware's pin setup.
The registers follow the reference manual [1] and the MT7986 settings
MediaTek's TF-A driver [2]. The GPD and BD descriptor format, which
neither describes, follows the Linux driver [3], used for hardware
facts only.
[1] MT7986A Reference Manual for BPI-R3, v1.0, section 2.3, MMC and SD
Controller. Distributed by Banana Pi:
https://wiki.banana-pi.org/Banana_Pi_BPI-R3
[2] https://github.com/mtk-openwrt/arm-trusted-firmware/blob/a229810586d8/plat/mediatek/apsoc_common/drivers/mmc/mtk-sd.c
[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/mmc/host/mtk-sd.c?h=v6.12
Sponsored by: Alchemilla Ventures Private Limited