3. 3
Host Structure
struct mmc_host {
……
const struct mmc_host_ops *ops;
/* minimum frequency */
unsigned int f_min;
/* maximum frequency */
unsigned int f_max;
/* provided voltages */
u32 ocr_avail;
unsigned long caps;
/* host specific block data */
unsigned int max_seg_size;
unsigned short max_hw_segs;
unsigned short max_phys_segs;
unsigned short unused;
unsigned int max_req_size;
unsigned int max_blk_size;
unsigned int max_blk_count;
……
};
4. 4
host allocation
struct mmc_host *mmc;
//private host data, hw dependent info is saved here.
struct foo_host *host;
//allocate mmc_host structure with private data size
//pdev is the pointer of platform_device
mmc = mmc_alloc_host(sizeof(struct foo_host), &pdev->dev);
////////////// initialization after allocation ///////////////////
////////////// private host data pointer is get as below
struct foo_host *host;
host = mmc_priv(mmc);
6. 6
request
struct mmc_request {
/* command to be issued */
struct mmc_command *cmd;
/* data transmission, NULL means no transmission */
struct mmc_data *data;
/*stop command after data transmission */
struct mmc_command *stop;
/* completion data, used by core layer for sync. */
void *done_data;
/* request post processing function */
void (*done)(struct mmc_request *);
};
7. 7
request handling flow
req->data == NULLsendcmd(req->cmd)
Data Transmission req>stop == NULL
mmc_request_done
sendcmd(req->stop)
N
Y
Y
N
mmc_request
cmd
data
stop