[PATCH] mtd: nand: use .read_oob() instead of .cmdfunc() for bad block check

Masahiro Yamada yamada.masahiro at socionext.com
Tue Mar 21 02:07:45 PDT 2017


Hi Boris,


2017-03-15 16:55 GMT+09:00 Boris Brezillon <boris.brezillon at free-electrons.com>:
> On Wed, 15 Mar 2017 09:55:13 +0900
> Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
>
>> Hi Boris,
>>
>> Thanks for your review.
>>
>> 2017-03-15 5:58 GMT+09:00 Boris Brezillon <boris.brezillon at free-electrons.com>:
>> > On Wed, 15 Mar 2017 02:45:48 +0900
>> > Masahiro Yamada <yamada.masahiro at socionext.com> wrote:
>> >
>> >> The nand_default_block_markbad() is the default implementation of
>> >> chip->block_markbad().  This is called for marking a block as bad.
>> >> It invokes nand_do_write_oob(), then calls a higher level accessor
>> >> ecc->write_oob().
>> >>
>> >> On the other hand, when reading BBM from the OOB, chip->block_bad()
>> >> is called, and nand_block_bad() is the default implementation.  This
>> >> function calls a lower level chip->cmdfunc().  If a driver wants to
>> >> re-use nand_block_bad(), it is required to support NAND_CMD_READOOB
>> >> in its cmdfunc().


I just noticed duplicated efforts for reading BBM.

When creating BBT at initialization, functions are called as follows:

check_create()
  create_bbt()
    scan_block_fast()


scan_block_fast() calls high-level API mtd_read_oob() to check BBM.


On the other hand, we have nand_block_bad() implemented with lower API.


Perhaps, we can merge them.


So, do you want to align to the scan_block_fast approach
(high level API)?



-- 
Best Regards
Masahiro Yamada



More information about the linux-mtd mailing list