mmc: SPI-mode support for SD cards.

Introduce SPI-mode support which allows an SD card to communicate with a
host system using SPI protocol, as described in the SD Card Specification.

This feature is useful for low-end, FPGA or RISC-V research systems when a
SoC is limited in terms of peripherals available (e.g. lack of a dedicated
MMC controller in hardware). Examples of such systems include Codasip,
lowRISC and CVA6.

Project timeline:
2007: Warner first discussed SPI operational mode in his MMC presentation:
      https://people.freebsd.org/~imp/bsdcan2007.pdf
2012: Patrick Kelsey engineered the support.
2025: Ruslan cleaned up, tested on Codasip X730 platform (RISC-V FPGA)
      and put the patch to review.
2025: Patrick Kelsey reviewed the patch and aligned with the current MMC
      code.

Reviewed by:	pkelsey
Sponsored by:	UKRI
Differential Revision:	https://reviews.freebsd.org/D49248
This commit is contained in:
Ruslan Bukin 2025-04-09 11:23:48 +01:00
parent 07da3bb5d5
commit 253c83058d
2 changed files with 2379 additions and 0 deletions

View file

@ -2427,6 +2427,7 @@ dev/mmc/mmc.c optional mmc !mmccam
dev/mmc/mmcbr_if.m standard
dev/mmc/mmcbus_if.m standard
dev/mmc/mmcsd.c optional mmcsd !mmccam
dev/mmc/mmcspi.c optional mmcsd spibus !mmccam
dev/mmc/mmc_fdt_helpers.c optional mmc regulator clk fdt | mmccam regulator clk fdt
dev/mmc/mmc_helpers.c optional mmc gpio regulator clk | mmccam gpio regulator clk
dev/mmc/mmc_pwrseq.c optional mmc clk regulator fdt | mmccam clk regulator fdt

2378
sys/dev/mmc/mmcspi.c Normal file

File diff suppressed because it is too large Load diff