[PATCH 2/2] mmc: lock: don't perform lock/unlock commands when in DDR mode

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

 



From: Abbas Raza <Abbas_Raza@xxxxxxxxxx>

According to JEDEC Standard No. 84-A441:
The card lock/unlock command (CMD42) can only be performed when the
card operates in single data rate mode. CMD42 is an illegal command in
dual data rate mode.

So if the card is in DDR mode, don't perform lock/unlock commands.
Otherwise following errors will be seen:

echo setpw > /sys/class/mmc_host/mmc2/mmc2\:0001/lock
-sh: echo: write error: Connection timed out

Timeout occurs because SET_BLOCK_LEN (CMD16) fails in dual data rate mode as
mentioned in JEDEC Standard No. 84-A441:

The following commands: bus testing (CMD19, CMD14), lock-unlock (CMD42),
set block-length (CMD16) and stream transfer (CMD11,CMD20) are not allowed
once the card is configured to operate in dual data rate mode and shall not
be executed but regarded as illegal commands.

Cc: Al Cooper <alcooperx@xxxxxxxxx>
Cc: Chris Ball <cjb@xxxxxxxxxx>
Signed-off-by: Abbas Raza <Abbas_Raza@xxxxxxxxxx>
---
 drivers/mmc/core/mmc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 24d2010..f34d237 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -664,6 +664,12 @@ ssize_t mmc_lock_store(struct device *dev, struct device_attribute *att,
 	struct mmc_password password;
 
 	mmc_claim_host(card->host);
+
+	if (mmc_card_ddr_mode(card)) {
+		dev_warn(dev, "Illegal operation in DDR mode\n");
+		goto out;
+	}
+
 	if (!mmc_card_lockable(card))
 		goto out;
 	for (x = 0; x < ARRAY_SIZE(lock_cmds); x++) {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux