linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Paul Cercueil <paul@crapouillou.net>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Harvey Hunt <harveyhuntnexus@gmail.com>,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 6/9] mtd: rawnand: ingenic: Separate top-level and SoC specific code
Date: Mon, 4 Mar 2019 11:20:58 +0100	[thread overview]
Message-ID: <20190304112058.67cd5194@xps13> (raw)
In-Reply-To: <20190209192305.4434-6-paul@crapouillou.net>

Hi Paul,

Paul Cercueil <paul@crapouillou.net> wrote on Sat,  9 Feb 2019 16:23:02
-0300:

> The ingenic-nand driver uses an API provided by the jz4780-bch driver.
> This makes it difficult to support other SoCs in the jz4780-bch driver.
> To work around this, we separate the API functions from the SoC-specific
> code, so that these API functions are SoC-agnostic.
> 

I like the idea, actually I am working on this separation (see
[1]) and I would really appreciate that you try to implement the
interface when it will be available (v2 is coming this week, I think v3
will be the one to test when raw NAND devices will be properly
supported). I will add you in Cc: if you want to follow/review.

[1] http://lists.infradead.org/pipermail/linux-mtd/2019-February/087815.html

> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> 
> v2: Add an optional .probe() callback. It is used for instance to set
>     the clock rate in the JZ4780 backend.
> 
> v3: The common code is now inside the ingenic-ecc module. Each
>     SoC-specific ECC code is now in its own module, which leaves to the
>     user the choice of which (if any) ECC code should be supported.
> 
> v4: No change
> 
>  drivers/mtd/nand/raw/ingenic/Kconfig        |  17 +++
>  drivers/mtd/nand/raw/ingenic/Makefile       |   5 +-
>  drivers/mtd/nand/raw/ingenic/ingenic_ecc.c  | 157 +++++++++++++++++++++++++
>  drivers/mtd/nand/raw/ingenic/ingenic_ecc.h  |  84 ++++++++++++++
>  drivers/mtd/nand/raw/ingenic/ingenic_nand.c |  38 +++----
>  drivers/mtd/nand/raw/ingenic/jz4780_bch.c   | 170 +++++-----------------------
>  drivers/mtd/nand/raw/ingenic/jz4780_bch.h   |  40 -------
>  7 files changed, 308 insertions(+), 203 deletions(-)
>  create mode 100644 drivers/mtd/nand/raw/ingenic/ingenic_ecc.c
>  create mode 100644 drivers/mtd/nand/raw/ingenic/ingenic_ecc.h
>  delete mode 100644 drivers/mtd/nand/raw/ingenic/jz4780_bch.h
> 

[...]

> diff --git a/drivers/mtd/nand/raw/ingenic/ingenic_nand.c b/drivers/mtd/nand/raw/ingenic/ingenic_nand.c
> index 8c73f7c5be9a..0f51fd15fe79 100644
> --- a/drivers/mtd/nand/raw/ingenic/ingenic_nand.c
> +++ b/drivers/mtd/nand/raw/ingenic/ingenic_nand.c
> @@ -22,7 +22,7 @@
>  
>  #include <linux/jz4780-nemc.h>
>  
> -#include "jz4780_bch.h"
> +#include "ingenic_ecc.h"
>  
>  #define DRV_NAME	"ingenic-nand"
>  
> @@ -40,7 +40,7 @@ struct ingenic_nand_cs {
>  
>  struct ingenic_nfc {
>  	struct device *dev;
> -	struct jz4780_bch *bch;
> +	struct ingenic_ecc *ecc;
>  	struct nand_controller controller;
>  	unsigned int num_banks;
>  	struct list_head chips;
> @@ -124,10 +124,10 @@ static int ingenic_nand_ecc_calculate(struct nand_chip *chip, const u8 *dat,
>  {
>  	struct ingenic_nand *nand = to_ingenic_nand(nand_to_mtd(chip));
>  	struct ingenic_nfc *nfc = to_ingenic_nfc(nand->chip.controller);
> -	struct jz4780_bch_params params;
> +	struct ingenic_ecc_params params;
>  
>  	/*
> -	 * Don't need to generate the ECC when reading, BCH does it for us as
> +	 * Don't need to generate the ECC when reading, ECC does it for us as

"the ECC engine does it for us" would be more meaningful.

>  	 * part of decoding/correction.
>  	 */
>  	if (nand->reading)
> @@ -137,7 +137,7 @@ static int ingenic_nand_ecc_calculate(struct nand_chip *chip, const u8 *dat,
>  	params.bytes = nand->chip.ecc.bytes;
>  	params.strength = nand->chip.ecc.strength;
>  
> -	return jz4780_bch_calculate(nfc->bch, &params, dat, ecc_code);
> +	return ingenic_ecc_calculate(nfc->ecc, &params, dat, ecc_code);
>  }
>  

Thanks,
Miquèl

  reply	other threads:[~2019-03-04 10:21 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09 19:22 [PATCH v4 1/9] dt-bindings: mtd: ingenic: Add compatible strings for JZ4740 and JZ4725B Paul Cercueil
2019-02-09 19:22 ` [PATCH v4 2/9] dt-bindings: mtd: ingenic: Change 'BCH' to 'ECC' in documentation Paul Cercueil
2019-02-13 21:46   ` Rob Herring
2019-03-04  9:50   ` Miquel Raynal
2019-03-04 18:23     ` Paul Cercueil
2019-03-04 18:58       ` Miquel Raynal
2019-03-13 12:59         ` Paul Cercueil
2019-03-13 13:12           ` Miquel Raynal
2019-02-09 19:22 ` [PATCH v4 3/9] mtd: rawnand: Move drivers for Ingenic SoCs to subfolder Paul Cercueil
2019-02-09 19:23 ` [PATCH v4 4/9] mtd: rawnand: ingenic: Use SPDX license notifiers Paul Cercueil
2019-02-09 19:23 ` [PATCH v4 5/9] mtd: rawnand: ingenic: Rename jz4780_nand driver to ingenic_nand Paul Cercueil
2019-02-09 19:23 ` [PATCH v4 6/9] mtd: rawnand: ingenic: Separate top-level and SoC specific code Paul Cercueil
2019-03-04 10:20   ` Miquel Raynal [this message]
2019-03-04 18:26     ` Paul Cercueil
2019-03-04 19:04       ` Miquel Raynal
2019-02-09 19:23 ` [PATCH v4 7/9] mtd: rawnand: ingenic: Add support for the JZ4740 Paul Cercueil
2019-03-04 10:34   ` Miquel Raynal
2019-03-04 18:28     ` Paul Cercueil
2019-03-04 19:07       ` Miquel Raynal
2019-02-09 19:23 ` [PATCH v4 8/9] mtd: rawnand: ingenic: Add support for the JZ4725B Paul Cercueil
2019-03-04 10:35   ` Miquel Raynal
2019-03-04 18:30     ` Paul Cercueil
2019-03-04 19:09       ` Miquel Raynal
2019-03-13 12:46         ` Paul Cercueil
2019-02-09 19:23 ` [PATCH v4 9/9] mtd: rawnand: ingenic: Add ooblayout for the Qi Ben Nanonote Paul Cercueil
2019-02-13 21:45 ` [PATCH v4 1/9] dt-bindings: mtd: ingenic: Add compatible strings for JZ4740 and JZ4725B Rob Herring
2019-03-04  9:45 ` Miquel Raynal
2019-03-04 18:22   ` Paul Cercueil
2019-03-04 18:51     ` Miquel Raynal
2019-03-13 12:55       ` Paul Cercueil
2019-03-13 13:09         ` 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=20190304112058.67cd5194@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dwmw2@infradead.org \
    --cc=harveyhuntnexus@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=paul@crapouillou.net \
    --cc=richard@nod.at \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).