linux-mmc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@de.bosch.com>
To: Chris Ball <cjb@laptop.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: MMC_SWITCH command doesn't update the ext_csd data structure
Date: Tue, 3 Sep 2013 13:04:43 +0200	[thread overview]
Message-ID: <5225C24B.9020705@de.bosch.com> (raw)

Hi,

using the MMC_SWITCH command via the ioctl to write registers of the 
EXT_CSD, it looks to us that in this case the internal ext_csd data 
structure isn't updated. Resulting in a mismatch of what the ext_csd 
data structure contains and what's written to the real hardware.

We are using the mmc utils [1] to e.g. enable the bootpart

mmc bootpart enable 1 0 /dev/mmcblk1

This correctly writes to the EXT_CSD structure of the device, but 
doesn't update

card->ext_csd.part_config

Issuing additional MMC_SWITCH commands afterwards use the then (wrong) 
card->ext_csd.part_config. Resulting in a undo of the mmc bootpart enable.

What we think might be necessary here is anything like

--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -542,11 +544,17 @@ static int mmc_blk_ioctl_cmd(struct block_device 
*bdev,
                                         __func__, status, err);
         }

+       if ((cmd.opcode == MMC_SWITCH) && ((cmd.arg >> 24) & 0x3)) {
+               /* In case the IOCTL has modified the EXT_CSD, update 
it, i.e. re-read the EXT_CSD */
+		mmc_update_ext_csd(card->ext_csd);
+       }
+
  cmd_rel_host:
         mmc_release_host(card->host);

?

Opinions?

Best regards

Dirk

[1] https://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git/


             reply	other threads:[~2013-09-03 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-03 11:04 Dirk Behme [this message]
2013-09-03 11:26 ` MMC_SWITCH command doesn't update the ext_csd data structure Chris Ball
2013-09-03 11:34   ` Dirk Behme

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=5225C24B.9020705@de.bosch.com \
    --to=dirk.behme@de.bosch.com \
    --cc=cjb@laptop.org \
    --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;
as well as URLs for NNTP newsgroup(s).