所在包:mmc命令在mmc-utils包中。
使用方法:可以通过mmc不带参数来查看用法
Usage:
mmc extcsd read <device>
Print extcsd data from <device>.
mmc writeprotect get <device>
Determine the eMMC writeprotect status of <device>.
mmc writeprotect set <device>
Set the eMMC writeprotect status of <device>.
This sets the eMMC to be write-protected until next boot.
mmc disable 512B emulation <device>
Set the eMMC data sector size to 4KB by disabling emulation on
<device>.
mmc enh_area set <-y|-n> <start KiB> <length KiB> <device>
Enable the enhanced user area for the <device>.
Dry-run only unless -y is passed.
NOTE! This is a one-time programmable (unreversible) change.
mmc write_reliability set <-y|-n> <partition> <device>
Enable write reliability per partition for the <device>.
Dry-run only unless -y is passed.
NOTE! This is a one-time programmable (unreversible) change.
mmc status get <device>
Print the response to STATUS_SEND (CMD13).
mmc bootpart enable <boot_partition> <send_ack> <device>
Enable the boot partition for the <device>.
To receive acknowledgment of boot from the card set <send_ack>
to 1, else set it to 0.
mmc bkops enable <device>
Enable the eMMC BKOPS feature on <device>.
NOTE! This is a one-time programmable (unreversible) change.
mmc hwreset enable <device>
Permanently enable the eMMC H/W Reset feature on <device>.
NOTE! This is a one-time programmable (unreversible) change.
mmc hwreset disable <device>
Permanently disable the eMMC H/W Reset feature on <device>.
NOTE! This is a one-time programmable (unreversible) change.
mmc sanitize <device>
Send Sanitize command to the <device>.
This will delete the unmapped memory region of the device.
mmc help|--help|-h
Show the help.
mmc <cmd> --help
Show detailed help for a command or subset of commands.
0.1
用法示例
mmc extcsd read /dev/mmc0
参考网址:Linux kernel mmc 框架说明,包括mmc_test使用方法_运维_kivy_xian的博客-CSDN博客
1.CONFIG_MMC_BLOCK=n,CONFIG_MMC_TEST=y。
或者CONFIG_MMC_BLOCK=y, CONFIG_MMC_TEST=y。如果选用后一种配置,需要再系统起来后,在总线driver中手动bind和unbind,见最后。。
2.CONFIG_DEBUG_FS=y,CONFIG_DEBUG_KERNEL=y,这两项在defconfig中已经配置,所以不需要进行改动;
3.mount -t debugfs none /sys/kernel/debug,这个我们的project中已经挂载了,不需要进行改动;
4.测试
etau:/ # ls /sys/kernel/debug/mmc0/
mmc0:aaaa
etau:/ # cd /sys/kernel/debug/mmc0/mmc0:aaaa
etau:/sys/kernel/debug/mmc0/mmc0:aaaa# cat testlist
1: Basic write (no data verification)
2: Basic read (no data verification)
3: Basic write (with data verification)
4: Basic read (with data verification)
5: Multi-block write
6: Multi-block read
7: Power of two block writes
8: Power of two block reads
9: Weird sized block writes
10: Weird sized block reads
11: Badly aligned write
12: Badly aligned read
13: Badly aligned multi-block write
14: Badly aligned multi-block read
15: Correct xfer_size at write (start failure)
16: Correct xfer_size at read (start failure)
17: Correct xfer_size at write (midway failure)
18: Correct xfer_size at read (midway failure)
19: Highmem write
20: Highmem read
21: Multi-block highmem write
22: Multi-block highmem read
23: Best-case read performance
24: Best-case write performance
25: Best-case read performance into scattered pages
26: Best-case write performance from scatteredpages
27: Single read performance by transfer size
28: Single write performance by transfer size
29: Single trim performance by transfer size
30: Consecutive read performance by transfer size
31: Consecutive write performance by transfer size
32: Consecutive trim performance by transfer size
33: Random read performance by transfer size
34: Random write performance by transfer size
35: Large sequential read into scattered pages
36: Large sequential write from scattered pages
37: Write performance with blocking req 4k to 4MB
38: Write performance with non-blocking req 4k to 4MB
39: Read performance with blocking req 4k to 4MB
40: Read performance with non-blocking req 4k to 4MB
41: Write performance blocking req 1 to 512 sg elems
42: Write performance non-blocking req 1 to 512 sg elems
43: Read performance blocking req 1 to 512 sg elems
44: Read performance non-blocking req 1 to 512 sg elems
45: Reset test
然后执行etau:/sys/kernel/debug/mmc0/mmc0:aaaa# echo 1 > test可以看到测试结果:
[314034.644348] mmc0: Starting tests of cardmmc0:aaaa...
[314034.645080] mmc0: Test case 1. Basicwrite (no data verification)...
[314034.647583] mmc0: Result: OK
[314034.647827] mmc0: Tests completed.
如果在步骤1中CONFIG_MMC_BLOCK=y,那么需要先执行执行如下操作:
etau:/ # ls sys/bus/mmc/devices/
mmc0:aaaa
etau:/sys/bus/mmc/drivers # ls
mmc_test/ mmcblk/
etau:/sys/bus/mmc/drivers # cd mmcblk/
etau:/sys/bus/mmc/drivers/mmcblk # ls -al
total 0
drwxr-xr-x 2 root root 0 2000-01-01 01:27 .
drwxr-xr-x 4 root root 0 2000-01-01 01:27 ..
--w------- 1 root root 4096 2000-01-01 01:28bind
lrwxrwxrwx 1 root root 0 2000-01-01 01:28 mmc0:aaaa ->../../../../devices/soc0/20a50000.rda-mmc0/mmc_host/mmc0/mmc0:aaaa
--w------- 1 root root 4096 2000-01-01 01:28uevent
--w------- 1 root root 4096 2000-01-01 01:28unbind
etau:/sys/bus/mmc/drivers/mmcblk #echo –n mmc0:aaaa> unbind
etau:/sys/bus/mmc/drivers # cd mmc_test/
etau:/sys/bus/mmc/drivers/mmc_test # ls
bind uevent unbind
etau:/sys/bus/mmc/drivers/mmc_test #echo –n mmc0:aaaa> bind
完成上述操作后,完成了mmc0:aaaa和mmc_test driver的绑定。