summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoe Hershberger <[email protected]>2017-11-06 18:16:10 -0800
committerMichal Simek <[email protected]>2017-11-29 08:02:40 +0100
commit6d3fa0dfdd3cc0e5067785fcb9ca6267b1501fa4 (patch)
tree0c5d300ce1b057aab6b375641f7f2da59fe1c3bb /drivers
parent310995d9f91ae56082b49be06fe8c3d01424f8f6 (diff)
mtd: nand: zynq: Add support for the NAND lock/unlock operation
Zynq NAND driver is not support for NAND lock or unlock operation. Hence, accidentally write into the critical NAND region might cause data corruption to occur. This commit is to add NAND lock/unlock command into NAND SMC register set for NAND lock/unlock operaion. Signed-off-by: Joe Hershberger <[email protected]> Signed-off-by: Keng Soon Cheah <[email protected]> Cc: Chen Yee Chew <[email protected]> Cc: Siva Durga Prasad Paladugu <[email protected]> Cc: Michal Simek <[email protected]> Cc: Scott Wood <[email protected]> Signed-off-by: Michal Simek <[email protected]>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/nand/zynq_nand.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mtd/nand/zynq_nand.c b/drivers/mtd/nand/zynq_nand.c
index e6c80b5b5c1..076b8782443 100644
--- a/drivers/mtd/nand/zynq_nand.c
+++ b/drivers/mtd/nand/zynq_nand.c
@@ -84,6 +84,13 @@
#define ZYNQ_NAND_ECC_BUSY (1 << 6) /* ECC block is busy */
#define ZYNQ_NAND_ECC_MASK 0x00FFFFFF /* ECC value mask */
+#ifndef NAND_CMD_LOCK_TIGHT
+#define NAND_CMD_LOCK_TIGHT 0x2c
+#endif
+
+#ifndef NAND_CMD_LOCK_STATUS
+#define NAND_CMD_LOCK_STATUS 0x7a
+#endif
/* SMC register set */
struct zynq_nand_smc_regs {
@@ -144,6 +151,11 @@ static const struct zynq_nand_command_format zynq_nand_commands[] = {
{NAND_CMD_PARAM, NAND_CMD_NONE, 1, 0},
{NAND_CMD_GET_FEATURES, NAND_CMD_NONE, 1, 0},
{NAND_CMD_SET_FEATURES, NAND_CMD_NONE, 1, 0},
+ {NAND_CMD_LOCK, NAND_CMD_NONE, 0, 0},
+ {NAND_CMD_LOCK_TIGHT, NAND_CMD_NONE, 0, 0},
+ {NAND_CMD_UNLOCK1, NAND_CMD_NONE, 3, 0},
+ {NAND_CMD_UNLOCK2, NAND_CMD_NONE, 3, 0},
+ {NAND_CMD_LOCK_STATUS, NAND_CMD_NONE, 3, 0},
{NAND_CMD_NONE, NAND_CMD_NONE, 0, 0},
/* Add all the flash commands supported by the flash device */
};