MMC:(Multi Media Card)由西门子公司和首推CF的SanDisk于1997年推出的多媒体记忆卡标准。
SD:(Secure Digital Memory Card)由日本松下、东芝及美国SanDisk公司于1999年8月共同开发研制的新一代记忆卡标准,已完全兼容MMC标准。
SDIO:(Secure Digital Input and Output Card)安全数字输入输出卡。SDIO是在SD标准上定义了一种外设接口,通过SD的I/O接脚来连接外围设备,并且通过SD上的 I/O数据接位与这些外围设备进行数据传输。是目前较热门的技术,如下图中的一些设备:GPS、相机、Wi-Fi、调频广播、条形码读卡器、蓝牙等。
命令操作步骤: a. 写命令参数32位到SDICmdArg寄存器; b. 设置命令类型并通过设置SDICCON寄存器开始命令传输; c. 当SDICSTA寄存器的特殊标志被置位,确认命令操作完成; d. 如果命令类型相应,标志是RspFin,否则标志是CmdSend; e. 通过对相应位写1,清除SDICmdSta的标志。
数据操作步骤: a. 写数据超时时间到SDIDTimer寄存器; b. 写模块大小到SDIBSize寄存器(通常是0x80字节); c. 确定模块模式、总线线宽、DMA等且通过设置SDIDatCon寄存器开始数据传输; d. 发送数据->写数据到SDIDAT寄存器,当发送FIFO有效(TFDET置位),或一半(TFHalf置位),或空(TFEmpty置位); e. 接收数据->从数据寄存器SDIDAT读数据,当接收FIFO有效(RFDET置位),或满(RFFull置位),或一半(RFHalf置位),或准备最后数据(RFLast置位); f. 当SDIDatSta寄存器的DatFin标志置位,确认数据操作完成; g. 通过对相应位写1,清除SDIDatSta的标志。
#define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ #define MMC_VDD_21_22 0x00000200 /* VDD voltage 2.1 ~ 2.2 */ #define MMC_VDD_22_23 0x00000400 /* VDD voltage 2.2 ~ 2.3 */ #define MMC_VDD_23_24 0x00000800 /* VDD voltage 2.3 ~ 2.4 */ #define MMC_VDD_24_25 0x00001000 /* VDD voltage 2.4 ~ 2.5 */ #define MMC_VDD_25_26 0x00002000 /* VDD voltage 2.5 ~ 2.6 */ #define MMC_VDD_26_27 0x00004000 /* VDD voltage 2.6 ~ 2.7 */ #define MMC_VDD_27_28 0x00008000 /* VDD voltage 2.7 ~ 2.8 */ #define MMC_VDD_28_29 0x00010000 /* VDD voltage 2.8 ~ 2.9 */ #define MMC_VDD_29_30 0x00020000 /* VDD voltage 2.9 ~ 3.0 */ #define MMC_VDD_30_31 0x00040000 /* VDD voltage 3.0 ~ 3.1 */ #define MMC_VDD_31_32 0x00080000 /* VDD voltage 3.1 ~ 3.2 */ #define MMC_VDD_32_33 0x00100000 /* VDD voltage 3.2 ~ 3.3 */ #define MMC_VDD_33_34 0x00200000 /* VDD voltage 3.3 ~ 3.4 */ #define MMC_VDD_34_35 0x00400000 /* VDD voltage 3.4 ~ 3.5 */ #define MMC_VDD_35_36 0x00800000 /* VDD voltage 3.5 ~ 3.6 */
unsignedlong caps;/* Host capabilities */
#define MMC_CAP_4_BIT_DATA (1 << 0)/* Can the host do 4 bit transfers */ #define MMC_CAP_MMC_HIGHSPEED (1 << 1)/* Can do MMC high-speed timing */ #define MMC_CAP_SD_HIGHSPEED (1 << 2)/* Can do SD high-speed timing */ #define MMC_CAP_SDIO_IRQ (1 << 3)/* Can signal pending SDIO IRQs */ #define MMC_CAP_SPI (1 << 4)/* Talks only SPI protocols */ #define MMC_CAP_NEEDS_POLL (1 << 5)/* Needs polling for card-detection */ #define MMC_CAP_8_BIT_DATA (1 << 6)/* Can the host do 8 bit transfers */
/* host specific block data */ unsignedint max_seg_size;/* see blk_queue_max_segment_size */ unsignedshort max_hw_segs;/* see blk_queue_max_hw_segments */ unsignedshort max_phys_segs;/* see blk_queue_max_phys_segments */ unsignedshort unused; unsignedint max_req_size;/* maximum number of bytes in one req */ unsignedint max_blk_size;/* maximum size of one mmc block */ unsignedint max_blk_count;/* maximum number of blocks in one req */
/* private data */ spinlock_t lock;/* lock for claim and bus ops */
struct mmc_ios ios;/* current io bus settings */ u32 ocr;/* the current OCR setting */
/* group bitfields together to minimize padding */ unsignedint use_spi_crc:1; unsignedint claimed:1;/* host exclusively claimed */ unsignedint bus_dead:1;/* bus has been released */ #ifdef CONFIG_MMC_DEBUG unsignedint removed:1;/* host is being removed */ #endif
struct mmc_card *card;/* device attached to this host */
wait_queue_head_t wq;
struct delayed_work detect;
conststruct mmc_bus_ops *bus_ops;/* current bus driver */ unsignedint bus_refs;/* reference counter */