From d23d8d7e069c3aca071b7f68d9c15d11f8d4c84d Mon Sep 17 00:00:00 2001 From: Nikita Kiryanov Date: Mon, 3 Dec 2012 02:19:46 +0000 Subject: mmc: add support for write protection Add generic mmc write protection functionality. Signed-off-by: Nikita Kiryanov Signed-off-by: Igor Grinberg --- common/cmd_mmc.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'common/cmd_mmc.c') diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 7dacd5114c..8c53a10315 100644 --- a/common/cmd_mmc.c +++ b/common/cmd_mmc.c @@ -282,6 +282,13 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) mmc_init(mmc); + if ((state == MMC_WRITE || state == MMC_ERASE)) { + if (mmc_getwp(mmc) == 1) { + printf("Error: card is write protected!\n"); + return 1; + } + } + switch (state) { case MMC_READ: n = mmc->block_dev.block_read(curr_device, blk, -- cgit