All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Pan <peterpansjtu@gmail.com>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Peter Pan <peterpandong@micron.com>,
	Richard Weinberger <richard@nod.at>,
	Brian Norris <computersforpeace@gmail.com>,
	linux-mtd@lists.infradead.org,
	"linshunquan (A)" <linshunquan1@hisilicon.com>
Subject: Re: [PATCH v2 4/6] nand: spi: Add BBT support
Date: Thu, 9 Mar 2017 09:58:51 +0800	[thread overview]
Message-ID: <CAAyFORJUevwLgDq5K1QG42cidKV+2ZisH03WeGAJ0=_OJwCQOQ@mail.gmail.com> (raw)
In-Reply-To: <20170308093135.2fa02e72@bbrezillon>

Hi Boris,

On Wed, Mar 8, 2017 at 4:31 PM, Boris Brezillon
<boris.brezillon@free-electrons.com> wrote:
> On Wed, 1 Mar 2017 16:52:08 +0800
> Peter Pan <peterpandong@micron.com> wrote:
>
>>  /**
>> - * spinand_erase - [MTD Interface] erase block(s)
>> + * __spinand_erase - erase block(s)
>>   * @mtd: MTD device structure
>>   * @einfo: erase instruction
>> + * @allowbbt: allow to access bbt
>>   *
>>   * Erase one ore more blocks
>>   */
>> -static int spinand_erase(struct mtd_info *mtd, struct erase_info *einfo)
>> +static int __spinand_erase(struct mtd_info *mtd, struct erase_info *einfo,
>> +                     int allowbbt)
>
> Please no __ prefixes. Not sure you need the wrappers you define below
> BTW.

mtd->_erase needs a function to treat BBT block as bad block while
nand_ops->erase not. What's your suggestion if we don't use the wrappers?

>
>>  {
>>       struct spinand_device *chip = mtd_to_spinand(mtd);
>>       struct nand_device *nand = mtd_to_nand(mtd);
>> @@ -1152,7 +1185,7 @@ static int spinand_erase(struct mtd_info *mtd, struct erase_info *einfo)
>>
>>       while (len) {
>>               /* Check if we have a bad block, we do not erase bad blocks! */
>> -             if (spinand_block_bad(mtd, offs, 0)) {
>> +             if (spinand_block_checkbad(mtd, offs, 0, allowbbt)) {
>>                       pr_warn("%s: attempt to erase a bad block at 0x%012llx\n",
>>                       __func__, offs);
>>                       einfo->state = MTD_ERASE_FAILED;
>> @@ -1193,6 +1226,55 @@ static int spinand_erase(struct mtd_info *mtd, struct erase_info *einfo)
>>       /* Return more or less happy */
>>       return ret;
>>  }
>> +
>> +/**
>> + * spinand_erase - [MTD Interface] erase block(s)
>> + * @mtd: MTD device structure
>> + * @einfo: erase instruction
>> + *
>> + * Erase one ore more blocks
>> + */
>> +static int spinand_erase(struct mtd_info *mtd, struct erase_info *einfo)
>> +{
>> +     return __spinand_erase(mtd, einfo, 0);
>> +}
>> +
>> +
>> +static int spinand_erase_bbt(struct nand_device *nand, struct erase_info *einfo)
>> +{
>> +     return __spinand_erase(nand_to_mtd(nand), einfo, 1);
>> +}
>> +
>
> [...]
>
>
>> +static void spinand_fill_nandd(struct spinand_device *chip)
>> +{
>> +     struct nand_device *nand = &chip->base;
>> +
>> +     nand->ops = &spinand_ops;
>> +}
>
> This is not needed. I did that in the raw NAND framework to ease the
> transition to the generic NAND layer, but here, you're
> natively supporting it. Just assign nand->ops in spinand_scan_ident().

Noted/ Fix this in v3.

Thanks
Peter Pan

  reply	other threads:[~2017-03-09  1:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01  8:52 [PATCH v2 0/6] Introduction to SPI NAND framework Peter Pan
2017-03-01  8:52 ` [PATCH v2 1/6] nand: spi: Add init/release function Peter Pan
2017-03-01  9:58   ` Boris Brezillon
2017-03-03  8:37     ` Peter Pan
2017-03-03  9:28       ` Boris Brezillon
2017-03-03  9:37         ` Arnaud Mouiche
2017-03-03 10:00           ` Boris Brezillon
2017-03-03 10:12             ` Arnaud Mouiche
2017-03-03 10:17               ` Boris Brezillon
2017-03-10  7:50     ` Peter Pan
2017-03-10  9:13       ` Arnaud Mouiche
2017-03-01 13:21   ` Thomas Petazzoni
2017-03-03  8:40     ` Peter Pan
2017-03-01  8:52 ` [PATCH v2 2/6] nand: spi: add basic operations support Peter Pan
2017-03-07 17:57   ` Boris Brezillon
2017-03-09  1:43     ` Peter Pan
2017-03-09  6:02       ` Boris Brezillon
2017-03-09 17:09         ` Arnaud Mouiche
2017-03-10  1:58           ` Peter Pan
2017-03-10  7:50             ` Arnaud Mouiche
2017-03-01  8:52 ` [PATCH v2 3/6] nand: spi: Add bad block support Peter Pan
2017-03-08  7:23   ` Boris Brezillon
2017-03-08  7:59     ` Peter Pan
2017-03-01  8:52 ` [PATCH v2 4/6] nand: spi: Add BBT support Peter Pan
2017-03-08  8:31   ` Boris Brezillon
2017-03-09  1:58     ` Peter Pan [this message]
2017-03-09  6:12       ` Boris Brezillon
2017-03-01  8:52 ` [PATCH v2 5/6] nand: spi: add Micron spi nand support Peter Pan
2017-03-08  8:32   ` Boris Brezillon
2017-03-09  1:59     ` Peter Pan
2017-03-01  8:52 ` [PATCH v2 6/6] nand: spi: Add generic SPI controller support Peter Pan
2017-03-08  8:44   ` Boris Brezillon
2017-03-09  2:02     ` Peter Pan
2017-03-09  6:06       ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAyFORJUevwLgDq5K1QG42cidKV+2ZisH03WeGAJ0=_OJwCQOQ@mail.gmail.com' \
    --to=peterpansjtu@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=linshunquan1@hisilicon.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=peterpandong@micron.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.