public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Boris Brezillon <bbrezillon@kernel.org>
To: "Bean Huo (beanhuo)" <beanhuo@micron.com>
Cc: "boris.brezillon@bootlin.com" <boris.brezillon@bootlin.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"richard@nod.at" <richard@nod.at>,
	"miquel.raynal@bootlin.com" <miquel.raynal@bootlin.com>
Subject: Re: [RESEND PATCH V2 1/2] mtd: core: add erase preparation hook function pointer
Date: Fri, 18 Jan 2019 23:42:48 +0100	[thread overview]
Message-ID: <20190118234236.0d296130@bbrezillon> (raw)
In-Reply-To: <BYAPR08MB453384AEAB702223F460039EDB9C0@BYAPR08MB4533.namprd08.prod.outlook.com>

On Fri, 18 Jan 2019 22:11:34 +0000
"Bean Huo (beanhuo)" <beanhuo@micron.com> wrote:

> This patch is to add a callback function pointer
> for preparation routine of erase in nand_manufacturer_ops.
> 
> Signed-off-by: Bean Huo <beanhuo@micron.com>
> ---
>  drivers/mtd/nand/raw/internals.h | 2 ++
>  drivers/mtd/nand/raw/nand_base.c | 5 +++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
> index fbf6ca0..8382948 100644
> --- a/drivers/mtd/nand/raw/internals.h
> +++ b/drivers/mtd/nand/raw/internals.h
> @@ -42,6 +42,7 @@
>   *	     is here to let vendor specific code release those resources.
>   * @fixup_onfi_param_page: apply vendor specific fixups to the ONFI parameter
>   *			   page. This is called after the checksum is verified.
> + * @erase_pre: preparation before actually erase a physical block.
>   */
>  struct nand_manufacturer_ops {
>  	void (*detect)(struct nand_chip *chip);
> @@ -49,6 +50,7 @@ struct nand_manufacturer_ops {
>  	void (*cleanup)(struct nand_chip *chip);
>  	void (*fixup_onfi_param_page)(struct nand_chip *chip,
>  				      struct nand_onfi_params *p);
> +	int (*erase_pre)(struct nand_chip *chip, int page);

Let's move this hook to nand_chip and name it ->pre_erase() or
->erase_preparation().

>  };
>  
>  /**
> diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
> index cca4b24..d446d1c 100644
> --- a/drivers/mtd/nand/raw/nand_base.c
> +++ b/drivers/mtd/nand/raw/nand_base.c
> @@ -4246,6 +4246,11 @@ int nand_erase_nand(struct nand_chip *chip, struct erase_info *instr,
>  		    (page + pages_per_block))
>  			chip->pagebuf = -1;
>  
> +		if (chip->manufacturer.desc && chip->manufacturer.desc->ops &&
> +		    chip->manufacturer.desc->ops->erase_pre)
> +			chip->manufacturer.desc->ops->erase_pre(chip,
> +						page & chip->pagemask);
> +
>  		if (chip->legacy.erase)
>  			status = chip->legacy.erase(chip,
>  						    page & chip->pagemask);


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2019-01-18 22:43 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18 22:11 [RESEND PATCH V2 1/2] mtd: core: add erase preparation hook function pointer Bean Huo (beanhuo)
2019-01-18 22:42 ` Boris Brezillon [this message]
2019-01-20 15:25   ` Miquel Raynal
2019-01-21 10:33     ` [EXT] " Bean Huo (beanhuo)
2019-01-21  9:25   ` Bean Huo (beanhuo)
2019-01-21  9:32     ` Boris Brezillon
2019-01-24 15:52       ` Bean Huo (beanhuo)
2019-01-24 16:25         ` 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=20190118234236.0d296130@bbrezillon \
    --to=bbrezillon@kernel.org \
    --cc=beanhuo@micron.com \
    --cc=boris.brezillon@bootlin.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox