由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Micro-SD card 驱动程序 (转载)
相关主题
VC++ release VS debugSQL debug step into a store procedure from another one (转载)
how to debug mpi?大家不觉得这篇文章很有道理么?未来语言的趋势?
能否给些讲debug经验的文章和书籍 (转载)g++ for Windows
一个debug的问题segfault
不同compiler速度可以差很远吗?并口驱动的一个问题 (转载)
After build,how to run the program on visual C# 2008哪位用过tty_flip_buffer_push()?
问个超简单的C问题A thread question
C++现在写起来真舒服啊How to initialize object in constructor?
相关话题的讨论汇总
话题: sdio话题: adsp话题: audio话题: msm话题: sd
进入Programming版参与讨论
1 (共1页)
i**p
发帖数: 902
1
【 以下文字转载自 Linux 讨论区 】
发信人: isup (No), 信区: Linux
标 题: Micro-SD card 驱动程序
发信站: BBS 未名空间站 (Fri Jun 20 12:48:55 2014, 美东)
写了一个card层的sdio驱动程序,用于读Micro-SD card。
sdio_register_driver(&my_sdio_driver) 成功返回,可是my_sdio_probe()从没被
sdio core调用(卡已插入,插拔都试过)。
请有经验的大牛指点。
static int my_sdio_probe(struct sdio_func *func,
const struct sdio_device_id *id)
{
printk(KERN_DEBUG "my_sdio_probe()");
....
return 0;
}
static const struct sdio_device_id my_sdio_ids[] = {
{ .class=SDIO_ANY_ID, .vendor=SDIO_ANY_ID, .device=SDIO_ANY_ID},
{ },
};
static struct sdio_driver my_sdio_driver = {
.name = "my_sdio",
.id_table = my_sdio_ids,
.probe = my_sdio_probe,
...
};
static int __init init(void)
{
...
if (sdio_register_driver(&my_sdio_driver) != 0)
{
printk(KERN_DEBUG "Registration Failedn");
return -ENODEV;
}
...
return 0;
}
h**i
发帖数: 712
2
这两个有没有?
module_init(init);
module_exit(exit);

【在 i**p 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: isup (No), 信区: Linux
: 标 题: Micro-SD card 驱动程序
: 发信站: BBS 未名空间站 (Fri Jun 20 12:48:55 2014, 美东)
: 写了一个card层的sdio驱动程序,用于读Micro-SD card。
: sdio_register_driver(&my_sdio_driver) 成功返回,可是my_sdio_probe()从没被
: sdio core调用(卡已插入,插拔都试过)。
: 请有经验的大牛指点。
: static int my_sdio_probe(struct sdio_func *func,
: const struct sdio_device_id *id)

i**p
发帖数: 902
3
有.
insmod 能执行,/sys/bus/sdio/drivers/my_sdio 已被创建。

【在 h**i 的大作中提到】
: 这两个有没有?
: module_init(init);
: module_exit(exit);

S*A
发帖数: 7142
4
Did you see any dmesg output when you plug in the SD card?
You can add some printk into the sd bus module to figure out
what happen after you plug the SD card. Does it detect the
card at all. Then if it detects, why it does not call your
module.
i**p
发帖数: 902
5
是不是应该关掉其他读写micro sd 的driver? 如果需要的话,这些driver名字是什么?
google找不到这些信息。

【在 i**p 的大作中提到】
: 有.
: insmod 能执行,/sys/bus/sdio/drivers/my_sdio 已被创建。

n*****t
发帖数: 22014
6
Interrupt 对不对?是自己的板子?

【在 i**p 的大作中提到】
: 是不是应该关掉其他读写micro sd 的driver? 如果需要的话,这些driver名字是什么?
: google找不到这些信息。

h**i
发帖数: 712
7
你的bus确定可以工作?如果是公板,有没有其他card driver可以测试?我怀疑你的
device tree可能不正确,你得说说dmesg的信息。

【在 i**p 的大作中提到】
: 有.
: insmod 能执行,/sys/bus/sdio/drivers/my_sdio 已被创建。

i**p
发帖数: 902
8
这是一个root了的Android手机.
3 parts of dmesg here, insmod, remove sd card, insert sd card:
--------------------------------------
insmod mysdio.ko (sd card is in, trace is from my printk. no probe trace
though I add prink to my_sdio_probe)
<7>[ 263.716249] (pid:728, cmd:insmod) my_sdio_driver.drv.name:CRYPTRmicro_
sdio
<7>[ 263.716316] (pid:728, cmd:insmod) my_sdio_driver.drv.bus:0x8049be80
<7>[ 263.716373] (pid:728, cmd:insmod) my_sdio_driver.drv.bus->name:sdio
<7>[ 263.716429] (pid:728, cmd:insmod) my_sdio_driver.drv.mod_name:
<7>[ 263.716484] (pid:728, cmd:insmod) sdio_register_driver registered
----------------------------------------
Remove sd card, all trace is from kernel (not mine)
<7>[ 328.739769] msmsdcc_platform_status_irq: 81
<6>[ 328.739796] mmc0: Slot status change detected (1 -> 0)
<4>[ 328.739868] mmc_sd_detect(mmc0): err = -123
<4>[ 328.739889] mmc_sd_detect(mmc0): err = -123
<4>[ 328.739909] mmc_sd_detect(mmc0): err = -123
<4>[ 328.739929] mmc_sd_detect(mmc0): err = -123
<4>[ 328.739949] mmc_sd_detect(mmc0): err = -123
<3>[ 328.739968] mmc_sd_detect(mmc0): Unable to re-detect card (-123)
<6>[ 328.740029] mmc0: card aaaa removed
<6>[ 328.874043] [msm-audio:audio_out.c:audio_enable]
<6>[ 328.874081] [msm-audio:audmgr.c:audmgr_enable] session 0x804f6eb8
<6>[ 328.874836] [msm-audio:audmgr.c:process_audmgr_callback] rpc READY
handle=0x00000000
<6>[ 328.875154] [msm-audio:audmgr.c:audmgr_rpc_thread] rpc_reply status 0
<6>[ 328.928534] [msm-audio:audmgr.c:process_audmgr_callback] rpc CODEC_
CONFIG volume=0x00000000
<6>[ 329.032788] [adsp:adsp.c:msm_adsp_get] opening module AUDPPTASK
<6>[ 329.033444] [adsp:adsp.c:msm_adsp_get] module AUDPPTASK has been
registered
<6>[ 329.033469] [adsp:adsp.c:msm_adsp_enable] enable 'AUDPPTASK'state[0]
id[17227122]
<6>[ 329.034164] [adsp:adsp.c:handle_adsp_rtos_mtoa_app] rpc event=0, proc_
id=2, module=17227122, image=0
<6>[ 329.034534] [adsp:adsp.c:handle_adsp_rtos_mtoa_app] module AUDPPTASK:
READY
<6>[ 329.036751] [msm-audio:audpp.c:audpp_dsp_event] ENABLE
<6>[ 329.036776] [msm-audio:audio_out.c:audio_dsp_event] CFG_MSG ENABLE
<3>[ 329.036854] [adsp:adsp.c:__msm_adsp_write] failed to write queue 138,
retry
<3>[ 330.890969] binder: BC_ATTEMPT_ACQUIRE not supported
<6>[ 330.891041] binder: 54:113 ioctl c0186201 2adb7d68 returned -22
<3>[ 334.267883] init: untracked pid 370 exited
<3>[ 334.269566] init: untracked pid 384 exited
<3>[ 334.271284] init: untracked pid 386 exited
<6>[ 334.631018] [msm-audio:audio_out.c:audio_dsp_event] PCMDMAMISSED 32
<6>[ 336.570228] [msm-audio:audio_out.c:audio_disable]
<6>[ 336.570304] [msm-audio:audio_out.c:audio_dsp_event] CFG_MSG DISABLE
<6>[ 336.570354] [adsp:adsp.c:msm_adsp_disable] disable 'AUDPPTASK'
<6>[ 336.570408] [msm-audio:audpp.c:audpp_dsp_event] DISABLE
<6>[ 336.571456] [adsp:adsp.c:msm_adsp_disable_locked] disable interrupt
<6>[ 336.571498] [adsp:adsp.c:msm_adsp_put] closing module AUDPPTASK
<6>[ 336.571556] [msm-audio:audmgr.c:audmgr_disable] session 0x804f6eb8
<6>[ 336.572581] [msm-audio:audmgr.c:audmgr_rpc_thread] rpc_reply status 0
<3>[ 336.582713] [msm-audio:audmgr.c:process_audmgr_callback] DISABLED
-----------------------------
Insert sd card again. all trace is from kernel. My driver is not called.
<7>[ 450.961394] msmsdcc_platform_status_irq: 81
<6>[ 450.961443] mmc0: Slot status change detected (0 -> 1)
<4>[ 451.242756] mmc0: host does not support reading read-only switch.
assuming write-enable.
<6>[ 451.242861] mmc0: new high speed SDHC card at address aaaa
<6>[ 451.245893] mmcblk0: mmc0:aaaa SU04G 3.69 GiB
<6>[ 451.246449] mmcblk0: p1

【在 h**i 的大作中提到】
: 你的bus确定可以工作?如果是公板,有没有其他card driver可以测试?我怀疑你的
: device tree可能不正确,你得说说dmesg的信息。

n*****t
发帖数: 22014
9
CD 有,那就是 register 的问题了,看看其他 driver 怎么写的吧

CRYPTRmicro_

【在 i**p 的大作中提到】
: 这是一个root了的Android手机.
: 3 parts of dmesg here, insmod, remove sd card, insert sd card:
: --------------------------------------
: insmod mysdio.ko (sd card is in, trace is from my printk. no probe trace
: though I add prink to my_sdio_probe)
: <7>[ 263.716249] (pid:728, cmd:insmod) my_sdio_driver.drv.name:CRYPTRmicro_
: sdio
: <7>[ 263.716316] (pid:728, cmd:insmod) my_sdio_driver.drv.bus:0x8049be80
: <7>[ 263.716373] (pid:728, cmd:insmod) my_sdio_driver.drv.bus->name:sdio
: <7>[ 263.716429] (pid:728, cmd:insmod) my_sdio_driver.drv.mod_name:

i**p
发帖数: 902
10
现在是有两个driver注册了一个同样的设备,sdio core会同时调用这两个probe()吗?
还是依据注册的先后一个一个的调?我猜想是后者。所以我还是认为应该卸载原来的那
个driver, 但不知道怎么做。

【在 n*****t 的大作中提到】
: CD 有,那就是 register 的问题了,看看其他 driver 怎么写的吧
:
: CRYPTRmicro_

n*****t
发帖数: 22014
11
没看过这部分代码,一般第一个 driver probe found 就不会 probe 第二个了。你
make config 的时候不要加第一个不行吗?

?

【在 i**p 的大作中提到】
: 现在是有两个driver注册了一个同样的设备,sdio core会同时调用这两个probe()吗?
: 还是依据注册的先后一个一个的调?我猜想是后者。所以我还是认为应该卸载原来的那
: 个driver, 但不知道怎么做。

i**p
发帖数: 902
12
1.我的硬件是手机, 没有这个手机的核心代码.
2. 这个module可能是mmcblk.ko. 我试图卸载它,但说正在使用.

【在 n*****t 的大作中提到】
: 没看过这部分代码,一般第一个 driver probe found 就不会 probe 第二个了。你
: make config 的时候不要加第一个不行吗?
:
: ?

n*****t
发帖数: 22014
13
mmcblk 应该无关吧

【在 i**p 的大作中提到】
: 1.我的硬件是手机, 没有这个手机的核心代码.
: 2. 这个module可能是mmcblk.ko. 我试图卸载它,但说正在使用.

i**p
发帖数: 902
14
最好它无关, 反正我卸不掉它. 可是哪个module和这个有关呢?

【在 n*****t 的大作中提到】
: mmcblk 应该无关吧
1 (共1页)
进入Programming版参与讨论
相关主题
How to initialize object in constructor?不同compiler速度可以差很远吗?
Windows下的驱动程序开发After build,how to run the program on visual C# 2008
一个java class downcast 的问题问个超简单的C问题
两个继承问题C++现在写起来真舒服啊
VC++ release VS debugSQL debug step into a store procedure from another one (转载)
how to debug mpi?大家不觉得这篇文章很有道理么?未来语言的趋势?
能否给些讲debug经验的文章和书籍 (转载)g++ for Windows
一个debug的问题segfault
相关话题的讨论汇总
话题: sdio话题: adsp话题: audio话题: msm话题: sd