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 8/9] mtd: rawnand: ingenic: Add support for the JZ4725B
Date: Mon, 4 Mar 2019 11:35:19 +0100	[thread overview]
Message-ID: <20190304113519.2e102b25@xps13> (raw)
In-Reply-To: <20190209192305.4434-8-paul@crapouillou.net>

Hi Paul,

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

> The boot ROM of the JZ4725B SoC expects a specific OOB layout on the
> NAND, so we use it unconditionally in the ingenic-nand driver.
> 
> Also add the jz4725b-bch driver to support the JZ4725B-specific BCH
> hardware.
> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> 
> Changes:
> 
> v2: Instead of forcing the OOB layout, leave it to the board code or
>     devicetree to decide if the jz4725b-specific layout should be used
>     or not.
> 
> v3: - Revert the change in v2, as the previous behaviour was correct.
>     - Also add support for the hardware BCH of the JZ4725B in this
>       patch.
> 
> v4: - Add MODULE_* macros
>     - Add tweaks suggested by upstream feedback
> 
>  drivers/mtd/nand/raw/ingenic/Kconfig        |  10 +
>  drivers/mtd/nand/raw/ingenic/Makefile       |   1 +
>  drivers/mtd/nand/raw/ingenic/ingenic_nand.c |  48 ++++-
>  drivers/mtd/nand/raw/ingenic/jz4725b_bch.c  | 292 ++++++++++++++++++++++++++++
>  4 files changed, 350 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/mtd/nand/raw/ingenic/jz4725b_bch.c
> 

[...]

> +static int jz4725b_calculate(struct ingenic_ecc *bch,
> +			     struct ingenic_ecc_params *params,
> +			     const u8 *buf, u8 *ecc_code)
> +{
> +	int ret;
> +
> +	mutex_lock(&bch->lock);
> +	ret = jz4725b_bch_init(bch, params, true);

I really don't like this bch_init name. A BCH initialization is what is
supposed to be done only once (probably at boot time), can you find a
better name or a better organization of the correct/calculate path?

> +	if (ret) {
> +		dev_err(bch->dev, "Unable to init BCH with given parameters\n");
> +		goto out_disable;
> +	}
> +
> +	jz4725b_bch_write_data(bch, buf, params->size);
> +
> +	ret = jz4725b_bch_wait_complete(bch, BCH_BHINT_ENCF, NULL);
> +	if (ret) {
> +		dev_err(bch->dev, "timed out while calculating ECC\n");
> +		goto out_disable;
> +	}
> +
> +	jz4725b_bch_read_parity(bch, ecc_code, params->bytes);
> +
> +out_disable:
> +	jz4725b_bch_disable(bch);
> +	mutex_unlock(&bch->lock);
> +
> +	return ret;
> +}
> +

[...]

Thanks,
Miquèl

  reply	other threads:[~2019-03-04 10:35 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
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 [this message]
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=20190304113519.2e102b25@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).