mmc rescan简析
来源:互联网 发布:南京财经大学网络 编辑:程序博客网 时间:2024/06/03 21:41
mmc rescan是mmc host的detect work的功能函数,该函数用于探测目标卡的类型并且根据mmc/sd/sdio协议进行comm的初始化。
void mmc_rescan(struct work_struct *work){static const unsigned freqs[] = { 400000, 300000, 200000, 100000 };struct mmc_host *host =container_of(work, struct mmc_host, detect.work);int i;bool extend_wakelock = false;if (host->rescan_disable)return;mmc_bus_get(host);/* * if there is a _removable_ card registered, check whether it is * still present */if (host->bus_ops && host->bus_ops->detect && !host->bus_dead && !(host->caps & MMC_CAP_NONREMOVABLE))host->bus_ops->detect(host);//这里所做的事情:当我们进入delay work时,我们首先要检查一下,目标卡是否依然存在,如果仍然存在而且目标卡是可插拔的,那么我们需要先将该卡在内核留下的一些痕迹清除,重新探测该卡。所以一般如果是目标卡复位的话,一般是调用内核提供的专用的复位接口(如sdio_reset_comm等),而不是调度host的这个delay work,host->detect_change = 0;/* If the card was removed the bus will be marked * as dead - extend the wakelock so userspace * can respond */if (host->bus_dead)extend_wakelock = 1;/* * Let mmc_bus_put() free the bus/bus_ops if we've found that * the card is no longer present. */mmc_bus_put(host);mmc_bus_get(host);/* if there still is a card present, stop here */if (host->bus_ops != NULL) { //判断是否bus的引用计数是否为0,如果不为0 ,说明bus仍然被引用,不能再继续下面的探测了。mmc_bus_put(host);goto out;}/* * Only we can add a new handler, so it's safe to * release the lock here. */mmc_bus_put(host);if (host->ops->get_cd && host->ops->get_cd(host) == 0)goto out;mmc_claim_host(host);for (i = 0; i < ARRAY_SIZE(freqs); i++) {if (!mmc_rescan_try_freq(host, max(freqs[i], host->f_min))) {extend_wakelock = true;break;}if (freqs[i] <= host->f_min)break;}mmc_release_host(host); out:if (extend_wakelock)wake_lock_timeout(&host->detect_wake_lock, HZ / 2);elsewake_unlock(&host->detect_wake_lock);if (host->caps & MMC_CAP_NEEDS_POLL) {wake_lock(&host->detect_wake_lock);mmc_schedule_delayed_work(&host->detect, HZ);}}
0 0
- mmc rescan简析
- [RK3288][Android6.0] 调试笔记 --- 开机提示mmc rescan错误
- CentOS7 Juno Cinder块重启后 实例起不来 --rescan Exit code: 21
- 如何用程序实现“rescan windows device manager"
- xp mmc
- MMC卡
- MMC 3.0
- mmc driver
- mmc driver
- mmc驱动
- 什么是MMC
- linux-mmc
- mmc流程
- SD/MMC
- mmc子系统
- mmc命令
- MMC驱动之mmc host
- Documentation/mmc/mmc-dev-parts.txt
- ImageLoader加载图片慢的问题
- 谈谈/system/xbin/su与JHACNBA13.0的root开关
- 内部类
- 基础:BroadcastReceiver应用详解
- printk和printf的区别
- mmc rescan简析
- 关机充电 分析 -- charger代码分析(Android4.2)
- PKU 2362
- 黑马程序员——面向对象(一)
- break和continue区别及使用场合
- Java IO完全总结
- 设计模式之工厂设计模式(二:抽象工厂模式)
- Codeforces Round #128 (Div. 2)
- 深刻理解Python中的元类(metaclass)