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

From: Masahiro Yamada
Date: Tue Mar 21 2017 - 05:15:13 EST


Hi Boris,


2017-03-15 16:55 GMT+09:00 Boris Brezillon <boris.brezillon@xxxxxxxxxxxxxxxxxx>:
> On Wed, 15 Mar 2017 09:55:13 +0900
> Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> wrote:
>
>> Hi Boris,
>>
>> Thanks for your review.
>>
>> 2017-03-15 5:58 GMT+09:00 Boris Brezillon <boris.brezillon@xxxxxxxxxxxxxxxxxx>:
>> > On Wed, 15 Mar 2017 02:45:48 +0900
>> > Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> 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