1. 介绍
Linux中,将包括MMC、SD、SDIO统称为MMC子系统
MMC子系统从功能上可分为三个层次
-card层: Card驱动, 或称client驱动-core层: MMC的核心层, 完成不同协议和规范的实现, 为host层和设备驱动层提供接口函数- host层: Host驱动, 针对不同主机端的SDHC、MMC控制器的驱动
2. 数据结构
MMC中包含的主要数据结构如下
-mmc_host 表示一个mmc host控制器-mmc_card 表示一个mmc设备-mmc_ios IO总线相关设置-mmc_driver 表示一个card drive-mmc_bus_ops 总线操作函数集, 有mmc、sd、sdio三种-mmc_host_ops Host Controller操作函数集-mmc_command 表示一个mmc命令-mmc_data 表示一个mmc数据-mmc_request 表示一个mmc请求- sdio_func 表示一个SDIO功能设备
mmc_host主要字段如下
structmmc_host {intindex;const struct mmc_host_ops *ops;
u32 ocr_avail;
u32 ocr_avail_sdio;/*SDIO-specific OCR*/u32 ocr_avail_sd;/*SD-specific OCR*/u32 ocr_avail_mmc;/*MMC-specific OCR*/u32 caps;/*Host能力标志*/u32 caps2;/*Host更多能力标志*/
struct mmc_ios ios; /*current io bus settings*/
int rescan_disable; /*disable card detection*/
int rescan_entered; /*used with nonremovable devices*/
struct mmc_card *card; /*device attached to this host*/
structdelayed_work detect;int detect_change; /*card检测标志*/
structmmc_slot slot;const struct mmc_bus_ops *bus_ops; /*current bus driver*/
structmmc_supply supply;
unsignedint slotno; /*used for sdio acpi binding*/
int dsr_req; /*DSR value is valid*/u32 dsr;/*optional driver stage (DSR) value*/unsignedlong private[0];
};
mmc_card主要字段如下
structmmc_card {struct mmc_host *host; /*the host this device belongs to*/
struct device dev; /*the device*/u32 ocr;/*the current OCR setting*/unsignedint rca; /*relative card address of device*/unsignedint type; /*Card类型: MMC、SD、SDIO、COMBO*/unsignedint state; /*(our) card state*/unsignedint quirks; /*card quirks*/
struct mmc_cid cid; /*card identification*/
struct mmc_csd csd; /*card specific*/
struct mmc_ext_csd ext_csd; /*mmc v4