From: Jongman Heo <jongman.heo@samsung.com>
To: "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Cc: Jongman Heo <jongman.heo@samsung.com>
Subject: Re: mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area
Date: Wed, 28 Mar 2012 04:07:31 +0000 (GMT) [thread overview]
Message-ID: <31643330.133551332907651626.JavaMail.weblogic@epml07> (raw)
> ------- Original Message -------
> Sender : Jongman Heo<jongman.heo@samsung.com> 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
next reply other threads:[~2012-03-28 4:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-28 4:07 Jongman Heo [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-03-20 2:07 mmc_blk_ioctl_cmd: cmd error -110, when I try set writeprotect to user data area Jongman Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31643330.133551332907651626.JavaMail.weblogic@epml07 \
--to=jongman.heo@samsung.com \
--cc=linux-mmc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox