根据
http://processors.wiki.ti.com/index.php/AM335x_MMC/SD_Driver%27s_Guide,你的驱动程序是
omap_hsmmc,也是
https://www.kernel.org/doc/Documentation/devicetree/bindings/mmc/ti-omap-hsmmc.txt的一些信息
在网上搜索SD卡中的SMART监控支持后,我得到了搜索查询mmc smartctl(因为smartctl是Linux中* ATA的SMART监控实用程序的名称,而mmc是实现MMC,SD,SDHC卡和控制器的内核子系统我发现Gwendal Grignou在某些移动PC OS https://code.google.com/p/chromium/issues/detail?id=315380上填充了这个bug
If the root device is a SATA device:
Add output of hdparm -I /dev/sda
Add output of smartctl -a /dev/sda
If the root device is a eMMC device:
When mmc-utils will be part of the image,add a similar command output.
我在这里看不到“SMART”,但是mmc-utils/mmc_cmds.c有代码通过使用ioctl(fd,MMC_IOC_CMD,(struct mmc_ioc_cmd *)& ioctl_data)向fd指向正确的mmcblkX设备向卡发送自定义命令(我希望这适用于大多数SD控制器).代码:Johan RUDHOLM(来自st-ericsson,2012,GPLv2):
int read_extcsd(int fd,__u8 *ext_csd)
{
struct mmc_ioc_cmd idata;
memset(&idata,sizeof(idata));
memset(ext_csd,sizeof(__u8) * 512);
idata.write_flag = 0;
idata.opcode = MMC_SEND_EXT_CSD;
idata.arg = 0;
idata.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_ADTC;
idata.blksz = 512;
idata.blocks = 1;
mmc_ioc_cmd_set_data(idata,ext_csd);
return ioctl(fd,&idata);
}
int write_extcsd_value(int fd,__u8 index,__u8 value)
{
struct mmc_ioc_cmd idata;
memset(&idata,sizeof(idata));
idata.write_flag = 1;
idata.opcode = MMC_SWITCH;
idata.arg = (MMC_SWITCH_MODE_WRITE_BYTE << 24) |
(index << 16) |
(value << 8) |
EXT_CSD_CMD_SET_NORMAL;
idata.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
return ioctl(fd,&idata);
}
struct mmc_ioc_cmd的官方userAPI(uapi)位于linux源代码树include/uapi/linux/mmc/ioctl.h中:
6 struct mmc_ioc_cmd {
...
10 /* Application-specific command. true = precede with CMD55 */
11 int is_acmd;
...
51 * Since this ioctl is only meant to enhance (and not replace) normal access
52 * to the mmc bus device...