mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-10 07:50:04 +00:00
mtd: nand: remove NAND_BBT_SCANEMPTY
NAND_BBT_SCANEMPTY is a strange, badly-supported option with omap as its single remaining user. NAND_BBT_SCANEMPTY was likely used by accident in omap2[1]. And anyway, omap2 doesn't scan the chip for bad blocks (courtesy of NAND_SKIP_BBTSCAN), and so its use of this option is irrelevant. This patch drops the NAND_BBT_SCANEMPTY option. [1] http://lists.infradead.org/pipermail/linux-mtd/2012-July/042902.html Signed-off-by: Brian Norris <computersforpeace@gmail.com> Cc: Ivan Djelic <ivan.djelic@parrot.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
b32843b772
commit
dad2256269
@ -1224,8 +1224,6 @@ in this page</entry>
|
|||||||
#define NAND_BBT_CREATE 0x00000200
|
#define NAND_BBT_CREATE 0x00000200
|
||||||
/* Search good / bad pattern through all pages of a block */
|
/* Search good / bad pattern through all pages of a block */
|
||||||
#define NAND_BBT_SCANALLPAGES 0x00000400
|
#define NAND_BBT_SCANALLPAGES 0x00000400
|
||||||
/* Scan block empty during good / bad block scan */
|
|
||||||
#define NAND_BBT_SCANEMPTY 0x00000800
|
|
||||||
/* Write bbt if neccecary */
|
/* Write bbt if neccecary */
|
||||||
#define NAND_BBT_WRITE 0x00001000
|
#define NAND_BBT_WRITE 0x00001000
|
||||||
/* Read and write back block contents when writing bbt */
|
/* Read and write back block contents when writing bbt */
|
||||||
|
@ -110,33 +110,17 @@ static int check_pattern_no_oob(uint8_t *buf, struct nand_bbt_descr *td)
|
|||||||
* @td: search pattern descriptor
|
* @td: search pattern descriptor
|
||||||
*
|
*
|
||||||
* Check for a pattern at the given place. Used to search bad block tables and
|
* Check for a pattern at the given place. Used to search bad block tables and
|
||||||
* good / bad block identifiers. If the SCAN_EMPTY option is set then check, if
|
* good / bad block identifiers.
|
||||||
* all bytes except the pattern area contain 0xff.
|
|
||||||
*/
|
*/
|
||||||
static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
|
static int check_pattern(uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td)
|
||||||
{
|
{
|
||||||
int end = 0;
|
|
||||||
uint8_t *p = buf;
|
|
||||||
|
|
||||||
if (td->options & NAND_BBT_NO_OOB)
|
if (td->options & NAND_BBT_NO_OOB)
|
||||||
return check_pattern_no_oob(buf, td);
|
return check_pattern_no_oob(buf, td);
|
||||||
|
|
||||||
end = paglen + td->offs;
|
|
||||||
if (td->options & NAND_BBT_SCANEMPTY)
|
|
||||||
if (memchr_inv(p, 0xff, end))
|
|
||||||
return -1;
|
|
||||||
p += end;
|
|
||||||
|
|
||||||
/* Compare the pattern */
|
/* Compare the pattern */
|
||||||
if (memcmp(p, td->pattern, td->len))
|
if (memcmp(buf + paglen + td->offs, td->pattern, td->len))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (td->options & NAND_BBT_SCANEMPTY) {
|
|
||||||
p += td->len;
|
|
||||||
end += td->len;
|
|
||||||
if (memchr_inv(p, 0xff, len - end))
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,15 +491,9 @@ static int create_bbt(struct mtd_info *mtd, uint8_t *buf,
|
|||||||
else
|
else
|
||||||
numpages = 1;
|
numpages = 1;
|
||||||
|
|
||||||
if (!(bd->options & NAND_BBT_SCANEMPTY)) {
|
|
||||||
/* We need only read few bytes from the OOB area */
|
/* We need only read few bytes from the OOB area */
|
||||||
scanlen = 0;
|
scanlen = 0;
|
||||||
readlen = bd->len;
|
readlen = bd->len;
|
||||||
} else {
|
|
||||||
/* Full page content should be read */
|
|
||||||
scanlen = mtd->writesize + mtd->oobsize;
|
|
||||||
readlen = numpages * mtd->writesize;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chip == -1) {
|
if (chip == -1) {
|
||||||
numblocks = mtd->size >> this->bbt_erase_shift;
|
numblocks = mtd->size >> this->bbt_erase_shift;
|
||||||
@ -882,7 +860,6 @@ static inline int nand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *b
|
|||||||
{
|
{
|
||||||
struct nand_chip *this = mtd->priv;
|
struct nand_chip *this = mtd->priv;
|
||||||
|
|
||||||
bd->options &= ~NAND_BBT_SCANEMPTY;
|
|
||||||
return create_bbt(mtd, this->buffers->databuf, bd, -1);
|
return create_bbt(mtd, this->buffers->databuf, bd, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ static struct nand_ecclayout omap_oobinfo;
|
|||||||
*/
|
*/
|
||||||
static uint8_t scan_ff_pattern[] = { 0xff };
|
static uint8_t scan_ff_pattern[] = { 0xff };
|
||||||
static struct nand_bbt_descr bb_descrip_flashbased = {
|
static struct nand_bbt_descr bb_descrip_flashbased = {
|
||||||
.options = NAND_BBT_SCANEMPTY | NAND_BBT_SCANALLPAGES,
|
.options = NAND_BBT_SCANALLPAGES,
|
||||||
.offs = 0,
|
.offs = 0,
|
||||||
.len = 1,
|
.len = 1,
|
||||||
.pattern = scan_ff_pattern,
|
.pattern = scan_ff_pattern,
|
||||||
|
@ -133,7 +133,6 @@ static inline int onenand_memory_bbt (struct mtd_info *mtd, struct nand_bbt_desc
|
|||||||
{
|
{
|
||||||
struct onenand_chip *this = mtd->priv;
|
struct onenand_chip *this = mtd->priv;
|
||||||
|
|
||||||
bd->options &= ~NAND_BBT_SCANEMPTY;
|
|
||||||
return create_bbt(mtd, this->page_buf, bd, -1);
|
return create_bbt(mtd, this->page_buf, bd, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,8 +93,6 @@ struct nand_bbt_descr {
|
|||||||
#define NAND_BBT_CREATE_EMPTY 0x00000400
|
#define NAND_BBT_CREATE_EMPTY 0x00000400
|
||||||
/* Search good / bad pattern through all pages of a block */
|
/* Search good / bad pattern through all pages of a block */
|
||||||
#define NAND_BBT_SCANALLPAGES 0x00000800
|
#define NAND_BBT_SCANALLPAGES 0x00000800
|
||||||
/* Scan block empty during good / bad block scan */
|
|
||||||
#define NAND_BBT_SCANEMPTY 0x00001000
|
|
||||||
/* Write bbt if neccecary */
|
/* Write bbt if neccecary */
|
||||||
#define NAND_BBT_WRITE 0x00002000
|
#define NAND_BBT_WRITE 0x00002000
|
||||||
/* Read and write back block contents when writing bbt */
|
/* Read and write back block contents when writing bbt */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user