mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-11 15:49:56 +00:00
mtd: nand: differentiate 1- vs. 2-byte writes when marking bad blocks
It seems that we have developed a bad-block-marking "feature" out of pure laziness: "We write two bytes per location, so we dont have to mess with 16 bit access." It's relatively simple to write a 1 byte at a time on x8 devices and 2 bytes at a time on x16 devices, so let's do it. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
cdbec05086
commit
8544331998
@ -430,13 +430,17 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
||||
/*
|
||||
* Write to first two pages if necessary. If we write to more
|
||||
* than one location, the first error encountered quits the
|
||||
* procedure. We write two bytes per location, so we dont have
|
||||
* to mess with 16 bit access.
|
||||
* procedure.
|
||||
*/
|
||||
ops.len = ops.ooblen = 2;
|
||||
ops.datbuf = NULL;
|
||||
ops.oobbuf = buf;
|
||||
ops.ooboffs = chip->badblockpos & ~0x01;
|
||||
ops.ooboffs = chip->badblockpos;
|
||||
if (chip->options & NAND_BUSWIDTH_16) {
|
||||
ops.ooboffs &= ~0x01;
|
||||
ops.len = ops.ooblen = 2;
|
||||
} else {
|
||||
ops.len = ops.ooblen = 1;
|
||||
}
|
||||
ops.mode = MTD_OPS_PLACE_OOB;
|
||||
do {
|
||||
ret = nand_do_write_oob(mtd, ofs, &ops);
|
||||
|
Loading…
x
Reference in New Issue
Block a user