linux sdio card睡眠治疗 sdio card removed解决方案
近期调试几款sdio card suspend时都会出现sdio card removed,之后
要么死机要么模块不能正常工作。根本原因也就是休眠没有处理好。昨天最终找到了
解决方法。
1:host端须要设置nonremovable,软件设置:mmc->caps |=
MMC_CAP_NONREMOVABLE;
2:host端须要设置keep power,在sdio card suspend时 软件设
置:host->pm_flags | = MMC_PM_KEEP_POWER;
眼下我所接触到的4g网卡,博通网卡,sdio加密t卡等都会出现card
removed问题。
关于2补充下须要在sdio card pm中置host keep power:
static int XXX_suspend(struct device *pdev)
{
struct sdio_func *func = dev_to_sdio_func(pdev); /* keep power while host suspended */
ret = sdio_set_host_pm_flags(func, MMC_PM_KEEP_POWER);
if (ret) {
sd_err(("%s: error while trying to keep power\n", __FUNCTION__));
return ret;
} return 0;
} static const struct dev_pm_ops XXX_pm_ops = {
.suspend = XXX_suspend,
.resume = XXX_resume,
};
今天花了点时间理清了card removed的原因。
出现1错误的原因是在resume 时pm_notify调用到了msm_rescan,假设没
有置nonremovable,将会跑进detect,而进去就会detect出了card removed,
进而进行了移除操作。
void mmc_rescan(struct work_struct *work)
{
struct mmc_host *host =
container_of(work, struct mmc_host, detect.work);
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);
---------
}
以下是dump_stack()打印的调用信息:
<4>[ 48.709320] [<c0013d4c>] (unwind_backtrace+0x0/0x11c) from
[<bf011d74>] (dhdsdio_disconnect+0xc/0x10c [bcmdhd])
<4>[ 48.720214] [<bf011d74>] (dhdsdio_disconnect+0xc/0x10c [bcmdhd])
from [<bf01f9a8>] (bcmsdh_remove+0x1c/0x98 [bcmdhd])
<4>[ 48.730041] [<bf01f9a8>] (bcmsdh_remove+0x1c/0x98 [bcmdhd]) from
[<bf001a00>] (bcmsdh_sdmmc_remove+0x28/0x70 [bcmdhd])
<4>[ 48.740600] [<bf001a00>] (bcmsdh_sdmmc_remove+0x28/0x70 [bcmdhd])
from [<c05855e0>] (sdio_bus_remove+0x38/0xf0)
<4>[ 48.753021] [<c05855e0>] (sdio_bus_remove+0x38/0xf0) from
[<c03a26c8>] (__device_release_driver+0x9c/0xe0)
<4>[ 48.762725] [<c03a26c8>] (__device_release_driver+0x9c/0xe0) from
[<c03a2728>] (device_release_driver+0x1c/0x28)
<4>[ 48.771881] [<c03a2728>] (device_release_driver+0x1c/0x28) from
[<c03a21f8>] (bus_remove_device+0x124/0x140)
<4>[ 48.781829] [<c03a21f8>] (bus_remove_device+0x124/0x140) from
[<c039fe30>] (device_del+0x108/0x16c)
<4>[ 48.790802] [<c039fe30>] (device_del+0x108/0x16c) from
[<c058596c>] (sdio_remove_func+0x1c/0x28)
<4>[ 48.799560] [<c058596c>] (sdio_remove_func+0x1c/0x28) from
[<c0584bfc>] (mmc_sdio_remove+0x3c/0x68)
<4>[ 48.808593] [<c0584bfc>] (mmc_sdio_remove+0x3c/0x68) from
[<c0584cb4>] (mmc_sdio_detect+0x8c/0xb4)
<4>[ 48.817565] [<c0584cb4>] (mmc_sdio_detect+0x8c/0xb4) from
[<c057e0c8>] (mmc_rescan+0x7c/0x2d8)
<4>[ 48.826141] [<c057e0c8>] (mmc_rescan+0x7c/0x2d8) from [<c0099dd8>]
(process_one_work+0x27c/0x484)
<4>[ 48.834991] [<c0099dd8>] (process_one_work+0x27c/0x484) from
[<c009a1f0>] (worker_thread+0x210/0x3b0)
<4>[ 48.844177] [<c009a1f0>] (worker_thread+0x210/0x3b0) from
[<c009e08c>] (kthread+0x80/0x8c)
<4>[ 48.852355] [<c009e08c>] (kthread+0x80/0x8c) from [<c000eaa8>]
(kernel_thread_exit+0x0/0x8)
<6>[ 49.083587] mmc2: card 0001 removed
出现2错误的原因是在sdio resume时,假设没有设置keep power就会
跑sdio reset与go idle(CMD 0)后进入init_card第一个CMD就不会响应了。也就是
这2个操作后card异常了。
static int mmc_sdio_resume(struct mmc_host *host)
{
int i, err = 0; BUG_ON(!host);
BUG_ON(!host->card); /* Basic card reinitialization. */
mmc_claim_host(host); /* No need to reinitialize powered-resumed nonremovable cards */
if (mmc_card_is_removable(host) || !mmc_card_keep_power(host)) {
sdio_reset(host);
mmc_go_idle(host);
err = mmc_sdio_init_card(host, host->ocr, host->card,
mmc_card_keep_power(host));
---------
}
下面是dump_stack()信息打印:
<4>[ 55.269378] [<c0013d4c>] (unwind_backtrace+0x0/0x11c) from
[<c057d650>] (mmc_resume_host+0xec/0x15c)
<4>[ 55.269439] [<c057d650>] (mmc_resume_host+0xec/0x15c) from
[<c058bfdc>] (msmsdcc_runtime_resume+0xb8/0x17c)
<4>[ 55.269500] [<c058bfdc>] (msmsdcc_runtime_resume+0xb8/0x17c) from
[<c058c2ac>] (msmsdcc_pm_resume+0x44/0xa8)
<4>[ 55.269561] [<c058c2ac>] (msmsdcc_pm_resume+0x44/0xa8) from
[<c03a4074>] (platform_pm_resume+0x40/0x54)
<4>[ 55.269653] [<c03a4074>] (platform_pm_resume+0x40/0x54) from
[<c03a8160>] (dpm_run_callback+0x44/0x7c)
<4>[ 55.269683] [<c03a8160>] (dpm_run_callback+0x44/0x7c) from
[<c03a8c18>] (device_resume+0x140/0x184)
<4>[ 55.269744] [<c03a8c18>] (device_resume+0x140/0x184) from
[<c03a94ec>] (dpm_resume+0xfc/0x234)
<4>[ 55.269805] [<c03a94ec>] (dpm_resume+0xfc/0x234) from [<c03a97f0>]
(dpm_resume_end+0xc/0x18)
<4>[ 55.269866] [<c03a97f0>] (dpm_resume_end+0xc/0x18) from
[<c00b63bc>] (suspend_devices_and_enter+0x240/0x314)
<4>[ 55.269927] [<c00b63bc>] (suspend_devices_and_enter+0x240/0x314)
from [<c00b65b0>] (pm_suspend+0x120/0x200)
<4>[ 55.269958] [<c00b65b0>] (pm_suspend+0x120/0x200) from
[<c00b7508>] (suspend+0x68/0x180)
<4>[ 55.270019] [<c00b7508>] (suspend+0x68/0x180) from [<c0099dd8>]
(process_one_work+0x27c/0x484)
<4>[ 55.270080] [<c0099dd8>] (process_one_work+0x27c/0x484) from
[<c009a1f0>] (worker_thread+0x210/0x3b0)
<4>[ 55.270141] [<c009a1f0>] (worker_thread+0x210/0x3b0) from
[<c009e08c>] (kthread+0x80/0x8c)
<4>[ 55.270202] [<c009e08c>] (kthread+0x80/0x8c) from [<c000eaa8>]
(kernel_thread_exit+0x0/0x8)
<4>[ 55.270233] mmc2: error -110 during resume (card was removed? )
以上2点做到了理论上kernel能够正常睡眠了,以下是正常的睡眠log:
版权声明:本文博客原创文章,博客,未经同意,不得转载。
linux sdio card睡眠治疗 sdio card removed解决方案的更多相关文章
- Linux内核之mmc子系统-sdio
现在的Linux内核中,mmc不仅是一个驱动,而是一个子系统.这里通过分析Linux3.2.0内核,结合TI的arm335x平台及omap_hsmmcd host分析下mmc子系统,重点关注sdio及 ...
- Linux进程的睡眠和唤醒简析
COPY FROM:http://www.2cto.com/os/201204/127771.html 1 Linux进程的睡眠和唤醒 在Linux中,仅等待CPU时间的进程称为就绪进程,它们被放置在 ...
- Linux进程的睡眠和唤醒
1 Linux进程的睡眠和唤醒 在Linux中,仅等待CPU时间的进程称为就绪进程,它们被放置在一个运行队列中,一个就绪进程的状态标志位为TASK_RUNNING.一旦一个运行中的进程时间片用完, ...
- linux进程简单睡眠
当一个进程睡眠, 它这样做以期望某些条件在以后会成真. 如我们之前注意到的, 任何睡 眠的进程必须在它再次醒来时检查来确保它在等待的条件真正为真. Linux 内核中睡眠的 最简单方式是一个宏定义, ...
- 【转载】linux 工作队列上睡眠的认识--不要在默认共享队列上睡眠
最近项目组做xen底层,我已经被完爆无数遍了,关键在于对内核.驱动这块不熟悉,导致分析xen代码非常吃力.于是准备细细的将 几本 linux 书籍慢慢啃啃. 正好看到LINUX内核设计与实现,对于内核 ...
- Linux启动vi编辑器时提示E325: ATTENTION解决方案
Linux启动vi编辑器时提示E325: ATTENTION解决方案 Vi编辑器是Linux的文本编辑器,在Linux系统的运用非常广泛,不少朋友在打开Vi编辑器的时候提示E325: ATTENTIO ...
- Linux版MonoDevelop无法连接调试器的解决方案(Could not connet to the debugger)
安装了Linux版本的MonoDevelop之后,在运行程序的时候会提示Could not connnet to the debugger.的错误. 原因是新版本的Gnome Terminal不再接受 ...
- 存储linux RAID6被重建成RAID5的数据恢复解决方案
数据恢复故障描述:原存储为12块2T硬盘组成的Linux RAID6,文件系统均为EXT3,此存储上划有3个LUN,每个均为6TB大小,某天在RAID失效后,维护人员为了抢救数据,对此失效的存储重进行 ...
- VMWare、KVM、Virtualbox克隆或复制Linux虚拟机后eth0找不到的解决方案
快速处理办法: cat /etc/sysconfig/network-scripts/ifcfg-eth0 sed -i '/UUID/d' /etc/sysconfig/network-script ...
随机推荐
- Objective-C路成魔【18-复制对象】
郝萌主倾心贡献,尊重作者的劳动成果,请勿转载. 假设文章对您有所帮助,欢迎给作者捐赠,支持郝萌主,捐赠数额任意.重在心意^_^ 我要捐赠: 点击捐赠 Cocos2d-X源代码下载:点我传送 将一个变量 ...
- 设计模式10---设计模式之原型模式(Prototype)
1.场景模式 考虑这样一个实际应用:订单处理系统 里面有一个保存订单的功能,当产品数量超过1000份以后,拆成两份订单,再超,那么就再拆.直到每份订单不超过1000为止,订单有两种,一个是个人订单,一 ...
- Vector Clock理解
背景近期在重读"Dynamo: Amazon's Highly Available Key-value Store"(经典好文,推荐!).文章4.4 中聊到了Data Versio ...
- Android 通过系统使用NotificationListenerService 监听各种Notification的用法
NotificationListenerService是通过系统调起的服务,当有应用发起通知的时候,系统会将通知的动作和信息回调给NotificationListenerService. 在继承Not ...
- DOMContentLoaded和window.onload
相信写js的.都知道window.onload吧,可是并非每一个人都知道DOMContentLoaded,事实上即使你不知道.非常有可能你也常常使用了这个东西. 普通情况下,DOMContentLoa ...
- Blend4精选案例图解教程(五):可视数据管理
原文:Blend4精选案例图解教程(五):可视数据管理 应用程序中我们会经常需要操作数据,在程序设计之初示例数据一般都是手工添加,Blend4提供了非常方便的数据管理能力,包括丰富的数据类型和内置示例 ...
- 【leetCode百题成就】Gas Station解题报告
题目: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. ...
- poj 2478 Farey Sequence(欧拉函数是基于寻求筛法素数)
http://poj.org/problem?id=2478 求欧拉函数的模板. 初涉欧拉函数,先学一学它主要的性质. 1.欧拉函数是求小于n且和n互质(包含1)的正整数的个数. 记为φ(n). 2. ...
- quick 2.23 它们的定义c++代码lua与总结的一些细节
它们的定义c++代码lua与总结的一些细节 参考:点击打开链接 1.自己定义 XXX.cpp .XXX.h 2.D:\quick\quick-cocos2d-x-2.2.3-rc\lib\cocos2 ...
- C#中对于float,double,decimal的误解
原文:C#中对于float,double,decimal的误解 一直很奇怪C#的预定义数据类型中为什么加了一个decimal,有float和double不就够了吗?今天来挖一挖. 浮点型 如果我们在代 ...