linux内核对e-MMC询问
软件版本kernel2.6.31;硬件平台:飞思卡尔MX28使用东芝的THGBM4G4D1HBAIR_24nm 2GB e-MMC作为存储器来用
在linux的内核中可以正确读取OCR,CID,CSD和Extended CSD寄存器,并成功做相应的highspeed,bus_width等设置。
通过以上的情况,可以确定cmd,clk,data(0-3)应该是没有问题的,其中Extended CSD寄存器的值是通过data线来返回的.
在mmc/core/core.c中的mmc_rescanf()函数识别为MMC卡接下来在识别分区信息时使用CMD18读取时,出现超时
[ 14.850000] ***mxs_mmc_start_cmd***
[ 14.850000] type: 0x20 opcode: 18, arg: 0x0(参数), flags 0xb5 retries: 0
[ 14.880000] hw_ssp_status:0xe0204020
[ 14.880000] response: 900-0-0-0(900为R1的response0) errors: 0xffffff92(表示超时)
根据MX的文档来看是接受response超时,但根据response来看,card_status是处于ready_for_data和tran传输状态
以上对内核mmc的代码没有作任何修改,根据东芝的文档,该e-MMC是符合JESD84-A441规范的.对于这个规范我对内核对MMC的访问流程做了一些修改,如在读取块前指定对user_data分区的读取,还是出现以上问题.请问各位对e-MMC有所了解的同仁,在内核中添加对e-MMC的支持,需要作哪些流程的改进?谢谢! 把这个超时错误注释掉,返回值设为TRUE试试
有时是因为卡不好也说不定 回复 1# invacx
很久没有看协议了
cmd 18 是多块读命令,我估计是你设置的response 时间有点短,设置的长一些试试。
还有一个迂回的办法: 用cmd17 命令完成你想做的。
回复 2# __SevenEleven
注释掉不能解决 回复 3# npuazm
尝试了时间设置为最大还是超时。是不是我在流程上不对,请问在内核源码的基础上该做哪些调整以适应e-mmc 回复 5# invacx
现在手上么有协议,等我回家看看协议,看看能不能给你什么建议
本帖最后由 npuazm 于 2012-09-05 16:34 编辑
回复 1# invacx
cmd 18 和emmc 有关系吗?貌似mmc 也可以多块读写
card_status是处于ready_for_data和tran传输状态,其中ready_for_data是什么状态,在mmc 状态流程图中没有这个说法呀?
ready_for_data和tran传输状态 同是一个状态吗?如果不是同一个,那么卡怎么会同时有两个状态呢?
回复 7# npuazm
根据card status来看是的
---
现在发现无论是cmd18还是cmd17来读取block,
只要arg=0都是可以读出来的(arg应该是block的地址),arg!=0读取都超时。
从第一次cmd18读取的数据来看,emmc只有一个分区且大小大概为2G,与实际大小相符。
困惑在与为什么读取的块地址如果不为0就会出现超时。
回复 8# invacx
这是你在一楼的log
在mmc/core/core.c中的mmc_rescanf()函数识别为MMC卡接下来在识别分区信息时使用CMD18读取时,出现超时
[ 14.850000] ***mxs_mmc_start_cmd***
[ 14.850000] type: 0x20 opcode: 18, arg: 0x0(参数), flags 0xb5 retries: 0
可以看出arg 也为0,但是当时也发生了超时。不知道你是改了什么,还是那次本来就没有超时。你前后的描述不完全一致。
从你现在的描述,我无法给出任何帮助。另外,你如何得出结论只要arg !=0就会超时的结论,如果有实验,给出实验的详细情况,如果有log给出详细的log。
我有一个猜测,是不是你无意中把卡设置成操作boot 区的模式了 回复 9# npuazm
//opcode: 为cmd
[ 14.050000] mmc_rescan
[ 14.100000]
[ 14.100000] MMC command:
[ 14.100000] type: 0x40 opcode: 0, arg: 0x0, flags 0xc0 retries: 0
[ 14.120000] register HW_SSP_STATUS:0xe0040020
[ 14.120000] response: 0x0-0x0-0x0-0x0 errors: 0(0x0)
[ 14.130000]
[ 14.130000] MMC command:
[ 14.130000] type: 0x60 opcode: 8, arg: 0x1aa, flags 0x2f5 retries: 0
[ 14.150000] register HW_SSP_STATUS:0xe0344020
[ 14.150000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.160000]
[ 14.160000] MMC command:
[ 14.160000] type: 0x60 opcode: 5, arg: 0x0, flags 0x2e1 retries: 3
[ 14.170000] register HW_SSP_STATUS:0xe0244020
[ 14.170000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.180000]
[ 14.180000] MMC command:
[ 14.180000] type: 0x60 opcode: 5, arg: 0x0, flags 0x2e1 retries: 2
[ 14.200000] register HW_SSP_STATUS:0xe0344020
[ 14.200000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.200000]
[ 14.200000] MMC command:
[ 14.200000] type: 0x60 opcode: 5, arg: 0x0, flags 0x2e1 retries: 1
[ 14.260000] register HW_SSP_STATUS:0xe0244020
[ 14.260000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.260000]
[ 14.260000] MMC command:
[ 14.260000] type: 0x60 opcode: 5, arg: 0x0, flags 0x2e1 retries: 0
[ 14.290000] register HW_SSP_STATUS:0xe0344020
[ 14.290000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.300000]
[ 14.300000] MMC command:
[ 14.300000] type: 0x60 opcode: 55, arg: 0x0, flags 0xf5 retries: 0
[ 14.330000] register HW_SSP_STATUS:0xe0244020
[ 14.330000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.330000]
[ 14.330000] MMC command:
[ 14.330000] type: 0x60 opcode: 55, arg: 0x0, flags 0xf5 retries: 0
[ 14.350000] register HW_SSP_STATUS:0xe0344020
[ 14.360000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.360000]
[ 14.360000] MMC command:
[ 14.360000] type: 0x60 opcode: 55, arg: 0x0, flags 0xf5 retries: 0
[ 14.370000] register HW_SSP_STATUS:0xe0244020
[ 14.380000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.390000]
[ 14.390000] MMC command:
[ 14.390000] type: 0x60 opcode: 55, arg: 0x0, flags 0xf5 retries: 0
[ 14.400000] register HW_SSP_STATUS:0xe0344020
[ 14.400000] response: 0x0-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 14.410000]
[ 14.410000] MMC command:
[ 14.410000] type: 0x60 opcode: 1, arg: 0x0, flags 0xe1 retries: 0
[ 14.430000] register HW_SSP_STATUS:0xe0100020
[ 14.430000] response: 0xff8080-0x0-0x0-0x0 errors: 0(0x0)
[ 14.440000]
[ 14.440000] MMC command:
[ 14.440000] type: 0x40 opcode: 0, arg: 0x0, flags 0xc0 retries: 0
[ 14.460000] register HW_SSP_STATUS:0xe0140020
[ 14.460000] response: 0x0-0x0-0x0-0x0 errors: 0(0x0)
[ 14.510000]
[ 14.510000] MMC command:
[ 14.510000] type: 0x60 opcode: 1, arg: 0x40300000, flags 0xe1 retries: 0
[ 14.520000] register HW_SSP_STATUS:0xe0100020
[ 14.530000] response: 0xff8080-0x0-0x0-0x0 errors: 0(0x0)
[ 14.550000]
[ 14.550000] MMC command:
[ 14.550000] type: 0x60 opcode: 1, arg: 0x40300000, flags 0xe1 retries: 0
[ 14.570000] register HW_SSP_STATUS:0xe0140020
[ 14.570000] response: 0x80ff8080-0x0-0x0-0x0 errors: 0(0x0)
[ 14.580000]
[ 14.580000] MMC command:
[ 14.580000] type: 0x60 opcode: 2, arg: 0x0, flags 0x67 retries: 3
[ 14.590000] register HW_SSP_STATUS:0xe0100020
[ 14.600000] response: 0x11010030-0x30324734-0x39000b16-0xc503bebb errors: 0(0x0)
[ 14.600000]
[ 14.600000] MMC command:
[ 14.600000] type: 0x0 opcode: 3, arg: 0x10000, flags 0x15 retries: 3
[ 14.620000] register HW_SSP_STATUS:0xe0140020
[ 14.620000] response: 0x500-0x0-0x0-0x0 errors: 0(0x0)
[ 14.630000]
[ 14.630000] MMC command:
[ 14.630000] type: 0x0 opcode: 9, arg: 0x10000, flags 0x7 retries: 3
[ 14.630000] register HW_SSP_STATUS:0xe0100020
[ 14.640000] response: 0xd00e0032-0xf5a03a7-0xffffffe1-0x964000dd errors: 0(0x0)
[ 14.650000]
[ 14.650000] MMC command:
[ 14.650000] type: 0x0 opcode: 7, arg: 0x10000, flags 0x15 retries: 3
[ 14.660000] register HW_SSP_STATUS:0xe0140020
[ 14.670000] response: 0x700-0x0-0x0-0x0 errors: 0(0x0)
[ 14.670000]
[ 14.670000] MMC command:
[ 14.670000] type: 0x20 opcode: 8, arg: 0x0, flags 0xb5 retries: 0
[ 14.680000] ADTC command:
[ 14.680000] response: 1, ignore crc: 0
[ 14.680000] data list: 1, blocksz: 512, blocks: 1, timeout: 10000000ns 0clks, flags: 0x200
[ 14.710000] register HW_SSP_STATUS:0xe0100020
[ 14.710000] 0x9d: 0xa8
[ 14.710000] 0x9e: 0x3
[ 14.710000] 0xa0: 0x3
[ 14.710000] 0xa6: 0x5
[ 14.720000] 0xa8: 0x1
[ 14.720000] 0xb5: 0x1
[ 14.720000] 0xc0: 0x5
[ 14.720000] 0xc2: 0x2
[ 14.730000] 0xc4: 0x7
[ 14.730000] 0xc6: 0x5
[ 14.730000] 0xc7: 0x1
[ 14.730000] 0xc8: 0x44
[ 14.730000] 0xc9: 0x44
[ 14.740000] 0xcd: 0x1e
[ 14.740000] 0xcf: 0x3c
[ 14.740000] 0xd1: 0x64
[ 14.750000] 0xd5: 0x80
[ 14.750000] 0xd6: 0x3a
[ 14.750000] 0xd9: 0x10
[ 14.750000] 0xdb: 0x9
[ 14.750000] 0xdc: 0x6
[ 14.760000] 0xdd: 0x1
[ 14.760000] 0xde: 0x10
[ 14.760000] 0xdf: 0x2
[ 14.760000] 0xe0: 0x2
[ 14.770000] 0xe1: 0x5
[ 14.770000] 0xe2: 0x8
[ 14.770000] 0xe4: 0x7
[ 14.770000] 0xe5: 0x42
[ 14.770000] 0xe6: 0x10
[ 14.780000] 0xe7: 0x15
[ 14.780000] 0xe8: 0x4
[ 14.780000] 0xea: 0x46
[ 14.790000] 0xee: 0x44
[ 14.790000] 0xf1: 0x1e
[ 14.790000] 0x1f6: 0x1
[ 14.790000] 0x1f7: 0x1
[ 14.790000] ---512
[ 14.800000] response: 0x900-0x0-0x0-0x0 errors: 0(0x0)
[ 14.800000]
[ 14.800000] MMC command:
[ 14.800000] type: 0x0 opcode: 6, arg: 0x3b90101, flags 0x49d retries: 3
[ 14.820000] register HW_SSP_STATUS:0xe0140020
[ 14.820000] response: 0x800-0x0-0x0-0x0 errors: 0(0x0)
[ 14.820000] ext_csd_bit:5, bus_width:10
[ 14.830000]
[ 14.830000] MMC command:
[ 14.830000] type: 0x0 opcode: 6, arg: 0x3b70501, flags 0x49d retries: 3
[ 14.840000] register HW_SSP_STATUS:0xe0100020
[ 14.840000] response: 0x800-0x0-0x0-0x0 errors: 0(0x0)
[ 14.850000] mmc0: new high speed MMC card at address 0001
[ 14.860000] mmcblk0: mmc0:0001 002G49 1.82 GiB
[ 14.860000]mmcblk0:mmc_blk_issue_rq max_blk_count:127
[ 14.870000]
//这里开始读取block
[ 14.870000] MMC command:
[ 14.870000] type: 0x20 opcode: 18, arg: 0x0, flags 0xb5 retries: 0
[ 14.880000] ADTC command:
[ 14.880000] response: 1, ignore crc: 0
[ 14.880000] data list: 1, blocksz: 512, blocks: 8, timeout: 10000000ns 0clks, flags: 0x200
[ 14.900000] register HW_SSP_STATUS:0xe0140020 //这里的返回,相对比如果是正常的SD卡是0xe0000020
//cmd18读取从block0开始的8个block. 0x1c0为物理地址 0x21为值,如果是0x0则没有打印出来
[ 14.900000] 0x1c0: 0x21
[ 14.900000] 0x1c2: 0x83
[ 14.900000] 0x1c3: 0x35
[ 14.900000] 0x1c4: 0xf6
[ 14.910000] 0x1c5: 0xb6
[ 14.910000] 0x1c6: 0x20
[ 14.910000] 0x1ca: 0xc0
[ 14.910000] 0x1cb: 0x7f
[ 14.920000] 0x1cc: 0x3a
[ 14.920000] 0x1fe: 0x55
[ 14.920000] 0x1ff: 0xaa
[ 14.920000] 0x200: 0xff
... ... //中间都是0xff
[ 23.740000] 0xfff: 0xff
[ 23.740000] ---4096
[ 23.750000] response: 0x900-0x0-0x0-0x0 errors: 0(0x0)//这里如果是SD卡是0x900-0x0-0x0-0x0
[ 23.750000] MMC command:
[ 23.750000] type: 0x0 opcode: 12, arg: 0x0, flags 0x49d retries: 0
[ 23.770000] register HW_SSP_STATUS:0xe0100020
[ 23.770000] response: 0xb00-0x0-0x0-0x0 errors: 0(0x0)
[ 23.770000]p1
[ 23.780000] mmc_rescan end
[ 30.240000] mmc_blk_issue_rq max_blk_count:127
[ 30.250000]
[ 30.250000] MMC command:
[ 30.250000] type: 0x20 opcode: 18, arg: 0x20, flags 0xb5 retries: 0
[ 30.270000] ADTC command:
[ 30.270000] response: 1, ignore crc: 0
[ 30.270000] data list: 4, blocksz: 512, blocks: 32, timeout: 10000000ns 0clks, flags: 0x200
[ 34.680000] register HW_SSP_STATUS:0xe0201020
[ 34.690000] response: 0x40000900-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 34.700000]
[ 34.700000] MMC command:
[ 34.700000] type: 0x0 opcode: 12, arg: 0x0, flags 0x49d retries: 0
[ 34.710000] register HW_SSP_STATUS:0xe0304020
[ 34.710000] response: 0x40000900-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 34.720000] mmcblk0: retrying using single block read
[ 34.720000] mmc_blk_issue_rq max_blk_count:127
[ 34.730000]
[ 34.730000] MMC command:
[ 34.730000] type: 0x20 opcode: 17, arg: 0x20, flags 0xb5 retries: 0
[ 34.740000] ADTC command:
[ 34.740000] response: 1, ignore crc: 0
[ 34.740000] data list: 1, blocksz: 512, blocks: 1, timeout: 10000000ns 0clks, flags: 0x200
[ 39.160000] register HW_SSP_STATUS:0xe0201020
[ 39.160000] response: 0x40400900-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 39.180000]
[ 39.180000] MMC command:
[ 39.180000] type: 0x0 opcode: 13, arg: 0x10000, flags 0x195 retries: 0
[ 39.180000] register HW_SSP_STATUS:0xe0040020
[ 39.190000] response: 0x900-0x0-0x0-0x0 errors: 0(0x0)
[ 39.190000] mmcblk0: error -110 sending read/write command, response 0x40400900, card status 0x900
[ 39.210000] end_request: I/O error, dev mmcblk0, sector 32
[ 39.210000] mmc_blk_issue_rq max_blk_count:127
[ 39.210000]
[ 39.210000] MMC command:
[ 39.210000] type: 0x20 opcode: 17, arg: 0x21, flags 0xb5 retries: 0
[ 39.230000] ADTC command:
[ 39.230000] response: 1, ignore crc: 0
[ 39.230000] data list: 1, blocksz: 512, blocks: 1, timeout: 10000000ns 0clks, flags: 0x200
[ 43.640000] register HW_SSP_STATUS:0xe0341020
[ 43.650000] response: 0x40000900-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 43.660000]
[ 43.660000] MMC command:
[ 43.660000] type: 0x0 opcode: 13, arg: 0x10000, flags 0x195 retries: 0
[ 43.670000] register HW_SSP_STATUS:0xe0100020
[ 43.670000] response: 0x900-0x0-0x0-0x0 errors: 0(0x0)
[ 43.680000] mmcblk0: error -110 sending read/write command, response 0x40000900, card status 0x900
[ 43.690000] end_request: I/O error, dev mmcblk0, sector 33
[ 43.690000] mmc_blk_issue_rq max_blk_count:127
[ 43.700000]
[ 43.700000] MMC command:
[ 43.700000] type: 0x20 opcode: 17, arg: 0x22, flags 0xb5 retries: 0
[ 43.710000] ADTC command:
[ 43.710000] response: 1, ignore crc: 0
[ 43.710000] data list: 1, blocksz: 512, blocks: 1, timeout: 10000000ns 0clks, flags: 0x200
[ 48.130000] register HW_SSP_STATUS:0xe0201020
[ 48.130000] response: 0x40000900-0x0-0x0-0x0 errors: 4294967186(0xffffff92)
[ 48.140000]
[ 48.140000] MMC command:
[ 48.140000] type: 0x0 opcode: 13, arg: 0x10000, flags 0x195 retries: 0
[ 48.160000] register HW_SSP_STATUS:0xe0040020
[ 48.160000] response: 0x900-0x0-0x0-0x0 errors: 0(0x0)
[ 48.160000] mmcblk0: error -110 sending read/write command, response 0x40000900, card status 0x900
[ 48.180000] end_request: I/O error, dev mmcblk0, sector 34
[ 48.180000] mmc_blk_issue_rq max_blk_count:127
[ 48.180000]
[ 48.180000] MMC command:
[ 48.180000] type: 0x20 opcode: 17, arg: 0x23, flags 0xb5 retries: 0
[ 48.200000] ADTC command:
[ 48.200000] response: 1, ignore crc: 0
[ 48.200000] data list: 1, blocksz: 512, blocks: 1, timeout: 10000000ns 0clks, flags: 0x200
这是开机后所有操作。
页:
[1]