diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2012-12-03 02:19:46 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2013-03-08 16:41:13 -0500 |
commit | d23d8d7e069c3aca071b7f68d9c15d11f8d4c84d (patch) | |
tree | 936923cdc7450422639747e99a83e5ce9843198a /common | |
parent | 5c1214de8c7b8b3e807ec09508e653580872e599 (diff) |
mmc: add support for write protection
Add generic mmc write protection functionality.
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Signed-off-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_mmc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c index 7dacd5114ce..8c53a10315e 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, |