Re: mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> ------- Original Message -------
> Sender : Jongman Heo<jongman.heo@xxxxxxxxxxx> S5/Senior Engineer/STB S/W R&D Lab./Samsung Electronics
> Date : 2012-03-20 11:07 (GMT+09:00)
> Title : mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area
> 
> 
> Hi, all,
> 
> I'm seeing weird issue with MMC ioctl.
> 
> I've modified mmc-util package a bit, to set write-protection to user data area, using following argument.
> 
>     idata.write_flag = 1;
>     idata.opcode = 28; // MMC_SET_WRITE_PROT
>     idata.arg = ...  // 512B sector address
>     ...
>     idata.flags = MMC_RSP_R1B | MMC_CMD_AC;   
>     // As I remember, "MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC" shows no difference.
> 
> If I execute the program, it returns "ioctl: Connection timed out" error, and dmesg shows following.
> 
>     [   67.252710] sdhci-pci 0000:01:1b.0: mmc_blk_ioctl_cmd: cmd error -110
> 
> 
> But if I run "fdisk -l /dev/mmcblk0" command before the execution, it works... no error occurs and write protection works..
> 
> Have you seen similar issue like this? fdisk command affects MMC flash status?
> FYI, I'm using 2.6.35 kernel (MMC ioctl command support and some features are backported).
> 
> 

Today, I've tried to solve this issue again, and I found the root cause.

My eMMC flash has two boot partitions by default. 
Partition table probing did access the eMMC boot partitions at the end, which leads to change EXT_CSD_PART_CONFIG value to 0x1 (boot partition 0), not 0x0 (User Area).

If I ever access any user area of eMMC (/dev/mmcblk0p1 ~ /dev/mmcblk0/12), PARTITION_ACCESS value of PARTITION_CONFIG changes to 0x0, and my write-protection ioctl for user area works. (Previously, fdisk command did the job..)

FYI, I've used NFS boot environment, and there was no access operation on eMMC user area before my ioctl command.

Obviously, commit 41e2a489 ("mmc: Ensure linux starts in eMMC user partition") does not help to solve my issue.
But I think my issue can be solved at user space level, Thanks.

Result from extcsd read command of mmc-util, right after boot :
./mmc-util extcsd read /dev/mmcblk0
[snip]
Boot configuration bytes [PARTITION_CONFIG: 0x01]
 Not boot enable
 R/W Boot Partition 1
[snip]

dmesg shows that eMMC boot partitions are accessed at the end of partition probing.
===============================================================
[    1.729148] mmc0: new MMC card at address 0001
[    1.733924] mmcblk0: mmc0:0001 M4G1FB 3.64 GiB
[    1.738554] mmcblk0boot0: mmc0:0001 M4G1FB partition 1 1.00 MiB
[    1.744569] mmcblk0boot1: mmc0:0001 M4G1FB partition 2 1.00 MiB
[    1.750815]  mmcblk0:
[    1.754503]  p1 p2 p3 p4 <
[    1.758547]  p5
[    1.761614]  p6
[    1.764698]  p7
[    1.767497]  p8
[    1.770297]  p9
[    1.773377]  p10
[    1.776544]  p11
[    1.779713]  p12 >
[    1.784224]  mmcblk0boot1:
[    1.788196]  unknown partition table
[    1.792278]  mmcblk0boot0:
[    1.796321]  unknown partition table
��.n��������+%������w��{.n�����{��i��)��jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux