diff mbox

[U-Boot,3/3] nand: Make NAND lock status compatible with Micron

Message ID 1345235492-15043-3-git-send-email-joe.hershberger@ni.com
State Superseded
Delegated to: Scott Wood
Headers show

Commit Message

Joe Hershberger Aug. 17, 2012, 8:31 p.m. UTC
Micron NAND flash (e.g. MT29F4G08ABADAH4) BLOCK LOCK READ STATUS is not
the same as others.  Instead of bit 1 being lock, it is #lock_tight.
To make the driver support either format, ignore bit 1 and use only
bit 0 and bit 2.

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
---
 common/cmd_nand.c            | 2 +-
 drivers/mtd/nand/nand_util.c | 2 --
 include/nand.h               | 1 -
 3 files changed, 1 insertion(+), 4 deletions(-)

Comments

Scott Wood Aug. 17, 2012, 9 p.m. UTC | #1
On 08/17/2012 03:31 PM, Joe Hershberger wrote:
> Micron NAND flash (e.g. MT29F4G08ABADAH4) BLOCK LOCK READ STATUS is not
> the same as others.  Instead of bit 1 being lock, it is #lock_tight.
> To make the driver support either format, ignore bit 1 and use only
> bit 0 and bit 2.

Please put a comment in the code as to why we're doing this.

-Scott
diff mbox

Patch

diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index 9acac9f..cd5dba4 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -236,7 +236,7 @@  static void print_status(ulong start, ulong end, ulong erasesize, int status)
 		end - 1,
 		(end - start) / erasesize,
 		((status & NAND_LOCK_STATUS_TIGHT) ?  "TIGHT " : ""),
-		((status & NAND_LOCK_STATUS_LOCK) ?  "LOCK " : ""),
+		(!(status & NAND_LOCK_STATUS_UNLOCK) ?  "LOCK " : ""),
 		((status & NAND_LOCK_STATUS_UNLOCK) ?  "UNLOCK " : ""));
 }
 
diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 2c8ae98..d5b314a 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -265,7 +265,6 @@  int nand_lock(struct mtd_info *mtd, int tight)
  *			>0 lock status:
  *			  bitfield with the following combinations:
  *			  NAND_LOCK_STATUS_TIGHT: page in tight state
- *			  NAND_LOCK_STATUS_LOCK:  page locked
  *			  NAND_LOCK_STATUS_UNLOCK: page unlocked
  *
  */
@@ -294,7 +293,6 @@  int nand_get_lock_status(struct mtd_info *mtd, loff_t offset)
 	chip->cmdfunc(mtd, NAND_CMD_LOCK_STATUS, -1, page & chip->pagemask);
 
 	ret = chip->read_byte(mtd) & (NAND_LOCK_STATUS_TIGHT
-					  | NAND_LOCK_STATUS_LOCK
 					  | NAND_LOCK_STATUS_UNLOCK);
 
  out:
diff --git a/include/nand.h b/include/nand.h
index 2c2f588..ad2804d 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -141,7 +141,6 @@  int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts);
 
 #define NAND_LOCK_STATUS_TIGHT	0x01
-#define NAND_LOCK_STATUS_LOCK	0x02
 #define NAND_LOCK_STATUS_UNLOCK 0x04
 
 int nand_lock(nand_info_t *meminfo, int tight);