mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 12:39:22 -04:00
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>
This commit is contained in:
parent
33b1d5cae3
commit
e70bfa2986
@ -231,12 +231,18 @@ print:
|
|||||||
#ifdef CONFIG_CMD_NAND_LOCK_UNLOCK
|
#ifdef CONFIG_CMD_NAND_LOCK_UNLOCK
|
||||||
static void print_status(ulong start, ulong end, ulong erasesize, int status)
|
static void print_status(ulong start, ulong end, ulong erasesize, int status)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
printf("%08lx - %08lx: %08lx blocks %s%s%s\n",
|
printf("%08lx - %08lx: %08lx blocks %s%s%s\n",
|
||||||
start,
|
start,
|
||||||
end - 1,
|
end - 1,
|
||||||
(end - start) / erasesize,
|
(end - start) / erasesize,
|
||||||
((status & NAND_LOCK_STATUS_TIGHT) ? "TIGHT " : ""),
|
((status & NAND_LOCK_STATUS_TIGHT) ? "TIGHT " : ""),
|
||||||
((status & NAND_LOCK_STATUS_LOCK) ? "LOCK " : ""),
|
(!(status & NAND_LOCK_STATUS_UNLOCK) ? "LOCK " : ""),
|
||||||
((status & NAND_LOCK_STATUS_UNLOCK) ? "UNLOCK " : ""));
|
((status & NAND_LOCK_STATUS_UNLOCK) ? "UNLOCK " : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,6 @@ int nand_lock(struct mtd_info *mtd, int tight)
|
|||||||
* >0 lock status:
|
* >0 lock status:
|
||||||
* bitfield with the following combinations:
|
* bitfield with the following combinations:
|
||||||
* NAND_LOCK_STATUS_TIGHT: page in tight state
|
* NAND_LOCK_STATUS_TIGHT: page in tight state
|
||||||
* NAND_LOCK_STATUS_LOCK: page locked
|
|
||||||
* NAND_LOCK_STATUS_UNLOCK: page unlocked
|
* 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);
|
chip->cmdfunc(mtd, NAND_CMD_LOCK_STATUS, -1, page & chip->pagemask);
|
||||||
|
|
||||||
ret = chip->read_byte(mtd) & (NAND_LOCK_STATUS_TIGHT
|
ret = chip->read_byte(mtd) & (NAND_LOCK_STATUS_TIGHT
|
||||||
| NAND_LOCK_STATUS_LOCK
|
|
||||||
| NAND_LOCK_STATUS_UNLOCK);
|
| NAND_LOCK_STATUS_UNLOCK);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
@ -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);
|
int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts);
|
||||||
|
|
||||||
#define NAND_LOCK_STATUS_TIGHT 0x01
|
#define NAND_LOCK_STATUS_TIGHT 0x01
|
||||||
#define NAND_LOCK_STATUS_LOCK 0x02
|
|
||||||
#define NAND_LOCK_STATUS_UNLOCK 0x04
|
#define NAND_LOCK_STATUS_UNLOCK 0x04
|
||||||
|
|
||||||
int nand_lock(nand_info_t *meminfo, int tight);
|
int nand_lock(nand_info_t *meminfo, int tight);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user