Commit e70bfa2986f9c028e3c21e0995285047a9baec27
Committed by
Scott Wood
1 parent
33b1d5cae3
Exists in
master
and in
54 other branches
nand: Make NAND lock status compatible with Micron
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> Signed-off-by: Scott Wood <scottwood@freescale.com>
Showing 3 changed files with 7 additions and 4 deletions Side-by-side Diff
common/cmd_nand.c
... | ... | @@ -231,12 +231,18 @@ |
231 | 231 | #ifdef CONFIG_CMD_NAND_LOCK_UNLOCK |
232 | 232 | static void print_status(ulong start, ulong end, ulong erasesize, int status) |
233 | 233 | { |
234 | + /* | |
235 | + * Micron NAND flash (e.g. MT29F4G08ABADAH4) BLOCK LOCK READ STATUS is | |
236 | + * not the same as others. Instead of bit 1 being lock, it is | |
237 | + * #lock_tight. To make the driver support either format, ignore bit 1 | |
238 | + * and use only bit 0 and bit 2. | |
239 | + */ | |
234 | 240 | printf("%08lx - %08lx: %08lx blocks %s%s%s\n", |
235 | 241 | start, |
236 | 242 | end - 1, |
237 | 243 | (end - start) / erasesize, |
238 | 244 | ((status & NAND_LOCK_STATUS_TIGHT) ? "TIGHT " : ""), |
239 | - ((status & NAND_LOCK_STATUS_LOCK) ? "LOCK " : ""), | |
245 | + (!(status & NAND_LOCK_STATUS_UNLOCK) ? "LOCK " : ""), | |
240 | 246 | ((status & NAND_LOCK_STATUS_UNLOCK) ? "UNLOCK " : "")); |
241 | 247 | } |
242 | 248 |
drivers/mtd/nand/nand_util.c
... | ... | @@ -265,7 +265,6 @@ |
265 | 265 | * >0 lock status: |
266 | 266 | * bitfield with the following combinations: |
267 | 267 | * NAND_LOCK_STATUS_TIGHT: page in tight state |
268 | - * NAND_LOCK_STATUS_LOCK: page locked | |
269 | 268 | * NAND_LOCK_STATUS_UNLOCK: page unlocked |
270 | 269 | * |
271 | 270 | */ |
... | ... | @@ -294,7 +293,6 @@ |
294 | 293 | chip->cmdfunc(mtd, NAND_CMD_LOCK_STATUS, -1, page & chip->pagemask); |
295 | 294 | |
296 | 295 | ret = chip->read_byte(mtd) & (NAND_LOCK_STATUS_TIGHT |
297 | - | NAND_LOCK_STATUS_LOCK | |
298 | 296 | | NAND_LOCK_STATUS_UNLOCK); |
299 | 297 | |
300 | 298 | out: |
include/nand.h
... | ... | @@ -141,7 +141,6 @@ |
141 | 141 | int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts); |
142 | 142 | |
143 | 143 | #define NAND_LOCK_STATUS_TIGHT 0x01 |
144 | -#define NAND_LOCK_STATUS_LOCK 0x02 | |
145 | 144 | #define NAND_LOCK_STATUS_UNLOCK 0x04 |
146 | 145 | |
147 | 146 | int nand_lock(nand_info_t *meminfo, int tight); |