diff mbox series

[v7,1/5] mtd: nand: Pass mode information to nand_page_io_req

Message ID 20180515150825.19835-2-boris.brezillon@bootlin.com
State Accepted
Delegated to: Boris Brezillon
Headers show
Series mtd: Add a SPI NAND driver | expand

Commit Message

Boris Brezillon May 15, 2018, 3:08 p.m. UTC
The NAND sub-layers are likely to need the MTD_OPS_XXX mode information
in order to decide if they should enable/disable ECC or how they should
place the OOB bytes in the provided OOB buffer.

Add a field to nand_page_io_req to pass this information.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 include/linux/mtd/nand.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Miquel Raynal June 1, 2018, 10:11 a.m. UTC | #1
Hi Boris,

On Tue, 15 May 2018 17:08:21 +0200, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:

> The NAND sub-layers are likely to need the MTD_OPS_XXX mode information
> in order to decide if they should enable/disable ECC or how they should
> place the OOB bytes in the provided OOB buffer.
> 
> Add a field to nand_page_io_req to pass this information.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---

Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Frieder Schrempf June 1, 2018, 10:17 a.m. UTC | #2
Hi Boris,

On 15.05.2018 17:08, Boris Brezillon wrote:
> The NAND sub-layers are likely to need the MTD_OPS_XXX mode information
> in order to decide if they should enable/disable ECC or how they should
> place the OOB bytes in the provided OOB buffer.
> 
> Add a field to nand_page_io_req to pass this information.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---

Tested-by: Frieder Schrempf <frieder.schrempf@exceet.de>
Reviewed-by: Frieder Schrempf <frieder.schrempf@exceet.de>
Boris Brezillon June 1, 2018, 12:55 p.m. UTC | #3
On Tue, 15 May 2018 17:08:21 +0200
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> The NAND sub-layers are likely to need the MTD_OPS_XXX mode information
> in order to decide if they should enable/disable ECC or how they should
> place the OOB bytes in the provided OOB buffer.
> 
> Add a field to nand_page_io_req to pass this information.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>

Applied this one to nand/next. Will send a v8 fixing the issues
in other patches.

> ---
>  include/linux/mtd/nand.h | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> index 792ea5c26329..abe975c87b90 100644
> --- a/include/linux/mtd/nand.h
> +++ b/include/linux/mtd/nand.h
> @@ -86,6 +86,7 @@ struct nand_pos {
>   * @ooboffs: the OOB offset within the page
>   * @ooblen: the number of OOB bytes to read from/write to this page
>   * @oobbuf: buffer to store OOB data in or get OOB data from
> + * @mode: one of the %MTD_OPS_XXX mode
>   *
>   * This object is used to pass per-page I/O requests to NAND sub-layers. This
>   * way all useful information are already formatted in a useful way and
> @@ -106,6 +107,7 @@ struct nand_page_io_req {
>  		const void *out;
>  		void *in;
>  	} oobbuf;
> +	int mode;
>  };
>  
>  /**
> @@ -599,6 +601,7 @@ static inline void nanddev_io_iter_init(struct nand_device *nand,
>  {
>  	struct mtd_info *mtd = nanddev_to_mtd(nand);
>  
> +	iter->req.mode = req->mode;
>  	iter->req.dataoffs = nanddev_offs_to_pos(nand, offs, &iter->req.pos);
>  	iter->req.ooboffs = req->ooboffs;
>  	iter->oobbytes_per_page = mtd_oobavail(mtd, req);
diff mbox series

Patch

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 792ea5c26329..abe975c87b90 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -86,6 +86,7 @@  struct nand_pos {
  * @ooboffs: the OOB offset within the page
  * @ooblen: the number of OOB bytes to read from/write to this page
  * @oobbuf: buffer to store OOB data in or get OOB data from
+ * @mode: one of the %MTD_OPS_XXX mode
  *
  * This object is used to pass per-page I/O requests to NAND sub-layers. This
  * way all useful information are already formatted in a useful way and
@@ -106,6 +107,7 @@  struct nand_page_io_req {
 		const void *out;
 		void *in;
 	} oobbuf;
+	int mode;
 };
 
 /**
@@ -599,6 +601,7 @@  static inline void nanddev_io_iter_init(struct nand_device *nand,
 {
 	struct mtd_info *mtd = nanddev_to_mtd(nand);
 
+	iter->req.mode = req->mode;
 	iter->req.dataoffs = nanddev_offs_to_pos(nand, offs, &iter->req.pos);
 	iter->req.ooboffs = req->ooboffs;
 	iter->oobbytes_per_page = mtd_oobavail(mtd, req);