Skip to contentSkip to conversation

Add MMC password protection (lock/unlock) support

PATCH New Anderson Briglia 1 participant 1 message Dec 13, 2005 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH 5/5 Add MMC password protection (lock/unlock) support

The MMC_LOCK_UNLOCK command requires the block length to be exactly the password length + 2 bytes, but hardware-specific drivers force a "power of 2" block size.

This patch sends the exact block size (password + 2 bytes) to the host. OMAP specific.

drivers/mmc/omap.c +6 -2
Index: linux-2.6.14-omap2/drivers/mmc/omap.c
===================================================================
@@ -891,8 +891,12 @@ mmc_omap_prepare_data(struct mmc_omap_ho
 		return;
 	}
 
-
-	block_size = 1 << data->blksz_bits;
+	/*  password protection: we need to send the exact block size to the
+	 *  card (password + 2), not a 2-exponent. */
+	if (req->cmd->opcode == MMC_LOCK_UNLOCK)
+		block_size = data->sg[0].length;
+	else
+		block_size = 1 << data->blksz_bits;
 
 	OMAP_MMC_WRITE(host->base, NBLK, data->blocks - 1);
 	OMAP_MMC_WRITE(host->base, BLEN, block_size - 1);

--
Anderson Briglia,
Anderson Lizardo,
Carlos Eduardo Aguiar

Embedded Linux Lab - 10LE
Nokia Institute of Technology - INdT
Manaus - Brazil