[PATCH v4 2/2] mtd: nand: write BBM to OOB even with flash-based BBT

Shmulik Ladkani shmulik.ladkani at gmail.com
Sat Jan 21 05:10:49 EST 2012


On Fri, 20 Jan 2012 20:38:04 -0800 Brian Norris <computersforpeace at gmail.com> wrote:
>  static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
>  {
>  	struct nand_chip *chip = mtd->priv;
>  	uint8_t buf[2] = { 0, 0 };
> -	int block, ret, i = 0;
> +	int block, res, ret = 0, i = 0;
> +	int write_oob = !(chip->bbt_options & NAND_BBT_NO_OOB_BBM);
>  
> -	if (!(chip->bbt_options & NAND_BBT_USE_FLASH)) {
> +	BUG_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
> +			!(chip->bbt_options & NAND_BBT_USE_FLASH));
> +
> +	if (write_oob) {
>  		struct erase_info einfo;
>  
>  		/* Attempt erase before marking OOB */

About to erase the block, but it could have been OOB BBM marked (due
to former power cut between BBM marking and BBT update).
Should we test if the OOB BBM is already set, as Artem suggested?
(at least when NAND_BBT_USE_FLASH && !NAND_BBT_NO_OOB_BBM)

>  
> -	/* Do we have a flash based bad block table? */
> -	if (chip->bbt_options & NAND_BBT_USE_FLASH)
> -		ret = nand_update_bbt(mtd, ofs);
> -	else {
> +	/* Write bad block marker to OOB */
> +	if (write_oob) {

Same question as above.

Regards,
Shmulik



More information about the linux-mtd mailing list