一、host相關 1、struct mmc_host struct mmc_host是mmc core由host controller抽象出來的結構體,用於代表一個mmc host控制器。 數據結構如下: ocr值各個位代表的電壓意義如下: host屬性2(mmc_host caps2)支持的屬性如 ...
一、host相關
1、struct mmc_host
struct mmc_host是mmc core由host controller抽象出來的結構體,用於代表一個mmc host控制器。
- 數據結構如下:
struct mmc_host {
struct device *parent; // 對應的host controller的device
struct device class_dev; // mmc_host的device結構體,會掛在class/mmc_host下
int index; // 該host的索引號
const struct mmc_host_ops *ops; // 該host的操作集,由host controller設置,後面說明
unsigned int f_min; // 該host支持的最低頻率
unsigned int f_max; // 該host支持的最大頻率
unsigned int f_init; // 該host使用的初始化頻率
u32 ocr_avail; // 該host可用的ocr值(電壓相關)
u32 ocr_avail_sdio; /* SDIO-specific OCR */
u32 ocr_avail_sd; /* SD-specific OCR */
u32 ocr_avail_mmc; /* MMC-specific OCR */
struct notifier_block pm_notify;
u32 max_current_330; // 3.3V時的最大電流
u32 max_current_300; // 3.0V時的最大電流
u32 max_current_180; // 1.8V時的最大電流
u32 caps; /* Host capabilities */ // host屬性
u32 caps2; /* More host capabilities */ // host屬性2
mmc_pm_flag_t pm_caps; /* supported pm features */ // 電源管理屬性
/////////////////////////////////////////////////////// 以下是和clock相關的成員
int clk_requests; /* internal reference counter */
unsigned int clk_delay; /* number of MCI clk hold cycles */
bool clk_gated; /* clock gated */
struct delayed_work clk_gate_work; /* delayed clock gate */
unsigned int clk_old; /* old clock value cache */
spinlock_t clk_lock; /* lock for clk fields */
struct mutex clk_gate_mutex; /* mutex for clock gating */
struct device_attribute clkgate_delay_attr;
unsigned long clkgate_delay;
/* host specific block data */
////////////////////////////////////////////////////// 和塊相關的成員
unsigned int max_seg_size; /* see blk_queue_max_segment_size */
unsigned short max_segs; /* see blk_queue_max_segments */
unsigned short unused;
unsigned int max_req_size; /* maximum number of bytes in one req */
unsigned int max_blk_size; /* maximum size of one mmc block */
unsigned int max_blk_count; /* maximum number of blocks in one req */
unsigned int max_discard_to; /* max. discard timeout in ms */
/* private data */
spinlock_t lock; /* lock for claim and bus ops */ // host的bus使用的鎖
struct mmc_ios ios; /* current io bus settings */ // io setting,後續說明
u32 ocr; /* the current OCR setting */ // 當前使用的ocr的值
/* group bitfields together to minimize padding */
unsigned int use_spi_crc:1;
unsigned int claimed:1; /* host exclusively claimed */ // host是否已經被占用
unsigned int bus_dead:1; /* bus has been released */ // host的bus是否處於激活狀態
int rescan_disable; /* disable card detection */ // 禁止rescan的標識,禁止搜索card
int rescan_entered; /* used with nonremovable devices */ // 是否已經rescan過的標識,對應不可移除的設備只能rescan一次
struct mmc_card *card; /* device attached to this host */ // 和該host綁定在一起的card
wait_queue_head_t wq;
struct task_struct *claimer; /* task that has host claimed */ // 該host的占有者進程
struct task_struct *suspend_task;
int claim_cnt; /* "claim" nesting count */ // 占有者進程對該host的占用計數
struct delayed_work detect; // 檢測卡槽變化的工作
struct wake_lock detect_wake_lock; // 檢測卡槽變化的工作使用的鎖
const char *wlock_name; // 鎖名稱
int detect_change; /* card detect flag */ // 需要檢測卡槽變化的標識
struct mmc_slot slot; // 卡槽的結構體
const struct mmc_bus_ops *bus_ops; /* current bus driver */ // host的mmc匯流排的操作集,後面說明
unsigned int bus_refs; /* reference counter */ // host的mmc匯流排的使用計數
unsigned int bus_resume_flags; // host的mmc匯流排的resume標識
mmc_pm_flag_t pm_flags; /* requested pm features */
#ifdef CONFIG_REGULATOR
bool regulator_enabled; /* regulator state */ // 代表regulator(LDO)的狀態
#endif
struct mmc_supply supply;
struct dentry *debugfs_root; // 對應的debug目錄結構體
struct mmc_async_req *areq; /* active async req */ // 當前正在處理的非同步請求
struct mmc_context_info context_info; /* async synchronization info */ // 非同步請求的信息
unsigned int actual_clock; /* Actual HC clock rate */ // 實際的時鐘頻率
};
ocr值各個位代表的電壓意義如下:
#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 */
host屬性2(mmc_host->caps2)支持的屬性如下
#define MMC_CAP2_BOOTPART_NOACC (1 << 0) /* Boot partition no access */
#define MMC_CAP2_CACHE_CTRL (1 << 1) /* Allow cache control */
#define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */
#define MMC_CAP2_NO_MULTI_READ (1 << 3) /* Multiblock reads don't work */
#define MMC_CAP2_NO_SLEEP_CMD (1 << 4) /* Don't allow sleep command */
#define MMC_CAP2_HS200_1_8V_SDR (1 << 5) /* can support */
#define MMC_CAP2_HS200_1_2V_SDR (1 << 6) /* can support */
#define MMC_CAP2_HS200 (MMC_CAP2_HS200_1_8V_SDR | \
MMC_CAP2_HS200_1_2V_SDR)
#define MMC_CAP2_BROKEN_VOLTAGE (1 << 7) /* Use the broken voltage */
#define MMC_CAP2_DETECT_ON_ERR (1 << 8) /* On I/O err check card removal */
#define MMC_CAP2_HC_ERASE_SZ (1 << 9) /* High-capacity erase size */
#define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
#define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
#define MMC_CAP2_PACKED_RD (1 << 12) /* Allow packed read */
#define MMC_CAP2_PACKED_WR (1 << 13) /* Allow packed write */
#define MMC_CAP2_PACKED_CMD (MMC_CAP2_PACKED_RD | \
MMC_CAP2_PACKED_WR)
#define MMC_CAP2_NO_PRESCAN_POWERUP (1 << 14) /* Don't power up before scan */
#define MMC_CAP2_INIT_BKOPS (1 << 15) /* Need to set BKOPS_EN */
#define MMC_CAP2_PACKED_WR_CONTROL (1 << 16) /* Allow write packing control */
#define MMC_CAP2_CLK_SCALE (1 << 17) /* Allow dynamic clk scaling */
#define MMC_CAP2_STOP_REQUEST (1 << 18) /* Allow stop ongoing request */
/* Use runtime PM framework provided by MMC core */
#define MMC_CAP2_CORE_RUNTIME_PM (1 << 19)
#define MMC_CAP2_SANITIZE (1 << 20) /* Support Sanitize */
/* Allows Asynchronous SDIO irq while card is in 4-bit mode */
#define MMC_CAP2_ASYNC_SDIO_IRQ_4BIT_MODE (1 << 21)
#define MMC_CAP2_HS400_1_8V (1 << 22) /* can support */
#define MMC_CAP2_HS400_1_2V (1 << 23) /* can support */
#define MMC_CAP2_CORE_PM (1 << 24) /* use PM framework */
#define MMC_CAP2_HS400 (MMC_CAP2_HS400_1_8V | \
MMC_CAP2_HS400_1_2V)
#define MMC_CAP2_NONHOTPLUG (1 << 25) /*Don't support hotplug*/
2、struct mmc_host_ops
mmc core將host需要提供的一些操作方法封裝成struct mmc_host_ops。
mmc core主模塊的很多介面都是基於這裡面的操作方法來實現的,通過這些方法來操作host硬體達到對應的目的。
所以struct mmc_host_ops也是host controller driver需要實現的核心部分。
struct mmc_host_ops {
/*
* 'enable' is called when the host is claimed and 'disable' is called
* when the host is released. 'enable' and 'disable' are deprecated.
*/
int (*enable)(struct mmc_host *host); // 使能host,當host被占用時(第一次調用mmc_claim_host)調用
int (*disable)(struct mmc_host *host); // 禁用host,當host被釋放時(第一次調用mmc_release_host)調用
/*
* It is optional for the host to implement pre_req and post_req in
* order to support double buffering of requests (prepare one
* request while another request is active).
* pre_req() must always be followed by a post_req().
* To undo a call made to pre_req(), call post_req() with
* a nonzero err condition.
*/
// post_req和pre_req是為了實現非同步請求處理而設置的
// 非同步請求處理就是指,當另外一個非同步請求還沒有處理完成的時候,可以先準備另外一個非同步請求而不必等待
// 具體參考《mmc core主模塊》
void (*post_req)(struct mmc_host *host, struct mmc_request *req,
int err);
void (*pre_req)(struct mmc_host *host, struct mmc_request *req,
bool is_first_req);
void (*request)(struct mmc_host *host, struct mmc_request *req); // host處理mmc請求的方法,在mmc_start_request中會調用
void (*set_ios)(struct mmc_host *host, struct mmc_ios *ios); // 設置host的匯流排的io setting
int (*get_ro)(struct mmc_host *host); // 獲取host上的card的讀寫屬性
int (*get_cd)(struct mmc_host *host); // 檢測host的卡槽中card的插入狀態
/* optional callback for HC quirks */
void (*init_card)(struct mmc_host *host, struct mmc_card *card); // 初始化card的方法
int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios); // 切換信號電壓的方法
/* Check if the card is pulling dat[0:3] low */
int (*card_busy)(struct mmc_host *host); // 用於檢測card是否處於busy狀態
/* The tuning command opcode value is different for SD and eMMC cards */
int (*execute_tuning)(struct mmc_host *host, u32 opcode); // 執行tuning操作,為card選擇一個合適的採樣點
int (*select_drive_strength)(unsigned int max_dtr, int host_drv, int card_drv); // 選擇信號的驅動強度
void (*hw_reset)(struct mmc_host *host); // 硬體複位
void (*card_event)(struct mmc_host *host); //
unsigned long (*get_max_frequency)(struct mmc_host *host); // 獲取host支持的最大頻率的方法
unsigned long (*get_min_frequency)(struct mmc_host *host); // 獲取host支持的最小頻率的方法
int (*notify_load)(struct mmc_host *, enum mmc_load);
int (*stop_request)(struct mmc_host *host); // 停止請求處理的方法
unsigned int (*get_xfer_remain)(struct mmc_host *host);
};
二、card相關
1、struct mmc_card
struct mmc_card是mmc core由mmc設備抽象出來的card設備的結構體,用於代表一個mmc設備。
數據結構如下:
struct mmc_card {
struct mmc_host *host; /* the host this device belongs to */ // 該mmc_card所屬host
struct device dev; /* the device */ // 對應的device
unsigned int rca; /* relative card address of device */ // 該card的RCA地址
unsigned int type; /* card type */ // card類型,後面說明
unsigned int state; /* (our) card state */ // card的當前狀態,後面說明
unsigned int quirks; /* card quirks */ // 該card的一些特點
unsigned int erase_size; /* erase size in sectors */
unsigned int erase_shift; /* if erase unit is power 2 */
unsigned int pref_erase; /* in sectors */
u8 erased_byte; /* value of erased bytes */
u32 raw_cid[4]; /* raw card CID */ // 原始的cid寄存器的值
u32 raw_csd[4]; /* raw card CSD */ // 原始的csd寄存器的值
u32 raw_scr[2]; /* raw card SCR */ // 原始的scr寄存器的值
struct mmc_cid cid; /* card identification */ // 從cid寄存器的值解析出來的信息
struct mmc_csd csd; /* card specific */ // 從csd寄存器的值解析出來的信息
struct mmc_ext_csd ext_csd; /* mmc v4 extended card specific */ // 從ext_csd寄存器的值解析出來的信息
struct sd_scr scr; /* extra SD information */ // 外部sdcard的信息
struct sd_ssr ssr; /* yet more SD information */ // 更多關於sd card的信息
struct sd_switch_caps sw_caps; /* switch (CMD6) caps */ // sd的切換屬性
unsigned int sd_bus_speed; /* Bus Speed Mode set for the card */
struct dentry *debugfs_root; // 對應debug目錄的結構體
struct mmc_part part[MMC_NUM_PHY_PARTITION]; /* physical partitions */ // 物理分區
unsigned int nr_parts; // 分區數量
unsigned int part_curr; // 當前分區
struct mmc_wr_pack_stats wr_pack_stats; /* packed commands stats*/
struct mmc_bkops_info bkops_info;
struct device_attribute rpm_attrib; // rpm屬性
unsigned int idle_timeout;
struct notifier_block reboot_notify;
bool issue_long_pon;
u8 *cached_ext_csd;
};
- mmc card類型(mmc_card->type)如下:
#define MMC_TYPE_MMC 0 /* MMC card */
#define MMC_TYPE_SD 1 /* SD card */
#define MMC_TYPE_SDIO 2 /* SDIO card */
#define MMC_TYPE_SD_COMBO 3 /* SD combo (IO+mem) card */
- mmc card狀態(mmc_card->state)如下:
#define MMC_STATE_PRESENT (1<<0) /* present in sysfs */
#define MMC_STATE_READONLY (1<<1) /* card is read-only */
#define MMC_STATE_HIGHSPEED (1<<2) /* card is in high speed mode */
#define MMC_STATE_BLOCKADDR (1<<3) /* card uses block-addressing */
#define MMC_STATE_HIGHSPEED_DDR (1<<4) /* card is in high speed mode */
#define MMC_STATE_ULTRAHIGHSPEED (1<<5) /* card is in ultra high speed mode */
#define MMC_CARD_SDXC (1<<6) /* card is SDXC */
#define MMC_CARD_REMOVED (1<<7) /* card has been removed */
#define MMC_STATE_HIGHSPEED_200 (1<<8) /* card is in HS200 mode */
#define MMC_STATE_HIGHSPEED_400 (1<<9) /* card is in HS400 mode */
#define MMC_STATE_DOING_BKOPS (1<<10) /* card is doing BKOPS */
#define MMC_STATE_NEED_BKOPS (1<<11) /* card needs to do BKOPS */
- mmc card的一些特寫標識(mmc_card->quirks)如下:
#define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */
#define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */
/* for byte mode */
#define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */
/* (missing CIA registers) */
#define MMC_QUIRK_BROKEN_CLK_GATING (1<<3) /* clock gating the sdio bus will make card fail */
#define MMC_QUIRK_NONSTD_FUNC_IF (1<<4) /* SDIO card has nonstd function interfaces */
#define MMC_QUIRK_DISABLE_CD (1<<5) /* disconnect CD/DAT[3] resistor */
#define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */
#define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */
#define MMC_QUIRK_BROKEN_BYTE_MODE_512 (1<<8) /* Avoid sending 512 bytes in */
#define MMC_QUIRK_LONG_READ_TIME (1<<9) /* Data read time > CSD says */
#define MMC_QUIRK_SEC_ERASE_TRIM_BROKEN (1<<10) /* Skip secure for erase/trim */
/* byte mode */
#define MMC_QUIRK_INAND_DATA_TIMEOUT (1<<11) /* For incorrect data timeout */
/* To avoid eMMC device getting broken permanently due to HPI feature */
#define MMC_QUIRK_BROKEN_HPI (1 << 12)
/* Skip data-timeout advertised by card */
#define MMC_QUIRK_BROKEN_DATA_TIMEOUT (1<<13)
#define MMC_QUIRK_CACHE_DISABLE (1 << 14) /* prevent cache enable */
三、host的匯流排相關
1、struct mmc_bus_ops
host的mmc匯流排的操作集,由host插入的card決定。
不同類型的card對mmc匯流排的操作有所不同。
結構體如下:
struct mmc_bus_ops {
int (*awake)(struct mmc_host *); // 喚醒mmc匯流排上的card
int (*sleep)(struct mmc_host *); // 休眠mmc匯流排上的card
void (*remove)(struct mmc_host *); // 從軟體上註銷mmc匯流排上的card
void (*detect)(struct mmc_host *); // 檢測mmc匯流排上的card是否被移除
int (*suspend)(struct mmc_host *); // 對應mmc匯流排的suspend操作
int (*resume)(struct mmc_host *); // 對應mmc匯流排的resume操作
int (*power_save)(struct mmc_host *); // 存儲電源狀態
int (*power_restore)(struct mmc_host *); // 恢覆電源狀態
int (*alive)(struct mmc_host *); // 檢測mmc匯流排上的card的激活狀態
int (*change_bus_speed)(struct mmc_host *, unsigned long *); // 修改mmc匯流排的工作時鐘
};
2、struct mmc_ios
struct mmc_ios 由mmc core定義的規範的結構,用來維護mmc匯流排相關的一些io setting。如下:
struct mmc_ios {
unsigned int clock; /* clock rate */ // 當前工作頻率
unsigned int old_rate; /* saved clock rate */ // 上一次的工作頻率
unsigned long clk_ts; /* time stamp of last updated clock */ // 上一次更新工作頻率的時間戳
unsigned short vdd;/* vdd stores the bit number of the selected voltage range from below. */ // 支持的電壓表
unsigned char bus_mode; /* command output mode */ // 匯流排輸出模式,包括開漏模式和上拉模式
unsigned char chip_select; /* SPI chip select */ // spi片選
unsigned char power_mode; /* power supply mode */ // 電源狀態模式
unsigned char bus_width; /* data bus width */ // 匯流排寬度
unsigned char timing; /* timing specification used */ // 時序類型
unsigned char signal_voltage; /* signalling voltage (1.8V or 3.3V) */ // 信號的工作電壓
unsigned char drv_type; /* driver type (A, B, C, D) */ // 驅動類型
};
四、請求相關
1、struct mmc_command
數據結構如下:
struct mmc_command {
u32 opcode; // 命令的操作碼,如MMC_GO_IDLE_STATE、MMC_SEND_OP_COND等等
u32 arg; // 命令的參數
u32 resp[4]; // response值
unsigned int flags; /* expected response type */ // 期待的response的類型,具體參考後面的命令類型和response類型
#define mmc_resp_type(cmd) ((cmd)->flags & (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC|MMC_RSP_BUSY|MMC_RSP_OPCODE))
#define mmc_cmd_type(cmd) ((cmd)->flags & MMC_CMD_MASK)
unsigned int retries; /* max number of retries */ // 失敗時的重覆嘗試次數
unsigned int error; /* command error */ // 命令的錯誤碼
unsigned int cmd_timeout_ms; /* in milliseconds */ // 命令執行的等待超時事件
struct mmc_data *data; /* data segment associated with cmd */ // 和該命令關聯在一起的數據段
struct mmc_request *mrq; /* associated request */ // 該命令關聯到哪個request
};
命令類型如下(和協議相關):
#define MMC_CMD_MASK (3 << 5) /* non-SPI command type */
#define MMC_CMD_AC (0 << 5)
#define MMC_CMD_ADTC (1 << 5)
#define MMC_CMD_BC (2 << 5)
#define MMC_CMD_BCR (3 << 5)
response類型如下(和協議相關):
#define MMC_RSP_PRESENT (1 << 0)
#define MMC_RSP_136 (1 << 1) /* 136 bit response */
#define MMC_RSP_CRC (1 << 2) /* expect valid crc */
#define MMC_RSP_BUSY (1 << 3) /* card may send busy */
#define MMC_RSP_OPCODE (1 << 4) /* response contains opcode */
#define MMC_RSP_NONE (0)
#define MMC_RSP_R1 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
#define MMC_RSP_R1B (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE|MMC_RSP_BUSY)
#define MMC_RSP_R2 (MMC_RSP_PRESENT|MMC_RSP_136|MMC_RSP_CRC)
#define MMC_RSP_R3 (MMC_RSP_PRESENT)
#define MMC_RSP_R4 (MMC_RSP_PRESENT)
#define MMC_RSP_R5 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
#define MMC_RSP_R6 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
#define MMC_RSP_R7 (MMC_RSP_PRESENT|MMC_RSP_CRC|MMC_RSP_OPCODE)
2、struct mmc_data
mmc core用struct mmc_data來表示一個命令包
struct mmc_data {
unsigned int timeout_ns; /* data timeout (in ns, max 80ms) */ // 超時時間,以ns為單位
unsigned int timeout_clks; /* data timeout (in clocks) */ // 超時時間,以clock為單位
unsigned int blksz; /* data block size */ // 塊大小
unsigned int blocks; /* number of blocks */ // 塊數量
unsigned int error; /* data error */ // 傳輸的錯誤碼
unsigned int flags; // 傳輸標識
unsigned int bytes_xfered;
struct mmc_command *stop; /* stop command */ // 結束傳輸的命令
struct mmc_request *mrq; /* associated request */ // 該命令關聯到哪個request
unsigned int sg_len; /* size of scatter list */
struct scatterlist *sg; /* I/O scatter list */
s32 host_cookie; /* host private data */
bool fault_injected; /* fault injected */
};
3、struct mmc_request
struct mmc_request是mmc core向host controller發起命令請求的處理單位。
其包含了要傳輸的命令和數據。
struct mmc_request {
struct mmc_command *sbc; /* SET_BLOCK_COUNT for multiblock */ // 設置塊數量的命令,怎麼用的後續再補充
struct mmc_command *cmd; // 要傳輸的命令
struct mmc_data *data; // 要傳輸的數據
struct mmc_command *stop; // 結束命令,怎麼用的後續再補充
struct completion completion; // 完成量
void (*done)(struct mmc_request *);/* completion function */ // 傳輸結束後的回調函數
struct mmc_host *host; // 所屬host
};
4、struct mmc_async_req
非同步請求的結構體。封裝了struct mmc_request請求結構體。具體參考《mmc core主模塊說明》
struct mmc_async_req {
/* active mmc request */
struct mmc_request *mrq; // mmc請求
unsigned int cmd_flags; /* copied from struct request */ // 命令標識
/*
* Check error status of completed mmc request.
* Returns 0 if success otherwise non zero.
*/
int (*err_check) (struct mmc_card *, struct mmc_async_req *);
/* Reinserts request back to the block layer */
void (*reinsert_req) (struct mmc_async_req *);
/* update what part of request is not done (packed_fail_idx) */
int (*update_interrupted_req) (struct mmc_card *,
struct mmc_async_req *);
};