接口设计
static const struct mmc_host_ops artinchip_mmc_ops = {
.request = artinchip_mmc_request,
.pre_req = artinchip_mmc_pre_req,
.post_req = artinchip_mmc_post_req,
.set_ios = artinchip_mmc_set_ios,
.get_ro = artinchip_mmc_get_ro,
.get_cd = artinchip_mmc_get_cd,
.hw_reset = artinchip_mmc_hw_reset,
.enable_sdio_irq = artinchip_mmc_enable_sdio_irq,
.ack_sdio_irq = artinchip_mmc_ack_sdio_irq,
.execute_tuning = artinchip_mmc_execute_tuning,
.card_busy = artinchip_mmc_card_busy,
.start_signal_voltage_switch = artinchip_mmc_switch_voltage,
.init_card = artinchip_mmc_init_card,
};|
函数原型 |
static void artinchip_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) |
|---|---|
|
功能说明 |
读取当前的 RTC 时间 |
|
功能说明 |
操作寄存器实现 request |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static void artinchip_mmc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq) |
|---|---|
|
功能说明 |
准备下一个 request |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
在准备下一个请求前,一般需要调用 artinchip_mmc_post_request |
|
函数原型 |
static void artinchip_mmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, int err) |
|---|---|
|
功能说明 |
送出一个 request |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static void artinchip_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) |
|---|---|
|
功能说明 |
对设备的位宽、DDR 模式、clock、power 模式等进行配置 |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static int artinchip_mmc_get_cd(struct mmc_host *mmc) |
|---|---|
|
功能说明 |
探测外部 SD 设备 |
|
参数定义 |
mmc:MMC 设备指针 |
|
返回值 |
执行成功则返回 1 |
|
注意事项 |
- |
|
函数原型 |
static void artinchip_mmc_hw_reset(struct mmc_host *mmc) |
|---|---|
|
功能说明 |
对 MMC 控制器、DMA 等进行一次 reset |
|
参数定义 |
mmc:MMC 设备指针 |
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static void artinchip_mmc_enable_sdio_irq(struct mmc_host *mmc, int enb) |
|---|---|
|
功能说明 |
使能或者关闭 MMC 控制器的中断 |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static void artinchip_mmc_ack_sdio_irq(struct mmc_host *mmc) |
|---|---|
|
功能说明 |
打开 MMC 控制器的中断 |
|
参数定义 |
mmc:MMC 设备指针 |
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static int artinchip_mmc_execute_tuning(struct mmc_host *mmc, u32 opcode) |
|---|---|
|
功能说明 |
MMC 的 tuning 功能接口 |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
- |
|
函数原型 |
static int artinchip_mmc_card_busy(struct mmc_host *mmc) |
|---|---|
|
功能说明 |
查看 MMC 设备是否处于 Busy 状态 |
|
参数定义 |
mmc:MMC 设备指针 |
|
返回值 |
若处于 idle 状态返回 0,busy 则返回 1 |
|
注意事项 |
- |
|
函数原型 |
static int artinchip_mmc_switch_voltage(struct mmc_host *mmc, struct mmc_ios *ios) |
|---|---|
|
功能说明 |
设置 MMC 设备的工作电压 |
|
参数定义 |
|
|
返回值 |
0,成功。 < 0,失败 |
|
注意事项 |
- |
|
函数原型 |
static void artinchip_mmc_init_card(struct mmc_host *mmc, struct mmc_card *card) |
|---|---|
|
功能说明 |
初始化外部 mmc 设备 |
|
参数定义 |
|
|
返回值 |
- |
|
注意事项 |
- |
