All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <bbrezillon@kernel.org>
To: Paul Cercueil <paul@crapouillou.net>
Cc: David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Richard Weinberger <richard@nod.at>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Harvey Hunt <harveyhuntnexus@gmail.com>,
	Mathieu Malaterre <malat@debian.org>,
	linux-mtd@lists.infradead.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 6/9] mtd: rawnand: jz4780: Add ooblayout for the Qi Ben Nanonote
Date: Sun, 3 Feb 2019 08:30:04 +0100	[thread overview]
Message-ID: <20190203083004.390b96be@bbrezillon> (raw)
In-Reply-To: <20190202231926.2444-7-paul@crapouillou.net>

On Sat,  2 Feb 2019 20:19:23 -0300
Paul Cercueil <paul@crapouillou.net> wrote:

> The Ben Nanonote from Qi Hardware expects a specific OOB layout on its
> NAND. If the "ingenic,oob-layout" device property is set to "qi,lb60",
> this specific OOB layout is used.

I'm really not a big fan of this ingenic,oob-layout property, it
encourages people to use new custom layouts which is just a pain to
maintain. I understand that we don't have the choice for this board as
it's already upstream, but maybe we can avoid adding this prop and
check the root compat (which should contain the board name). 

> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> 
> Changes:
> 
> v2: New patch
> 
>  drivers/mtd/nand/raw/ingenic/jz4780_nand.c | 37 ++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/ingenic/jz4780_nand.c b/drivers/mtd/nand/raw/ingenic/jz4780_nand.c
> index baebb9a5c7c8..4b304eceae8d 100644
> --- a/drivers/mtd/nand/raw/ingenic/jz4780_nand.c
> +++ b/drivers/mtd/nand/raw/ingenic/jz4780_nand.c
> @@ -346,6 +346,41 @@ static int jz4780_nand_init_chips(struct jz4780_nand_controller *nfc,
>  	return 0;
>  }
>  
> +static int qi_lb60_ooblayout_ecc(struct mtd_info *mtd, int section,
> +				 struct mtd_oob_region *oobregion)
> +{
> +	struct nand_chip *chip = mtd_to_nand(mtd);
> +	struct nand_ecc_ctrl *ecc = &chip->ecc;
> +
> +	if (section || !ecc->total)
> +		return -ERANGE;
> +
> +	oobregion->length = ecc->total;
> +	oobregion->offset = 12;
> +
> +	return 0;
> +}
> +
> +static int qi_lb60_ooblayout_free(struct mtd_info *mtd, int section,
> +				  struct mtd_oob_region *oobregion)
> +{
> +	struct nand_chip *chip = mtd_to_nand(mtd);
> +	struct nand_ecc_ctrl *ecc = &chip->ecc;
> +
> +	if (section)
> +		return -ERANGE;
> +
> +	oobregion->length = mtd->oobsize - ecc->total - 12;
> +	oobregion->offset = 12 + ecc->total;
> +
> +	return 0;
> +}
> +
> +const struct mtd_ooblayout_ops qi_lb60_ooblayout_ops = {
> +	.ecc = qi_lb60_ooblayout_ecc,
> +	.free = qi_lb60_ooblayout_free,
> +};
> +
>  static int jz4725b_ooblayout_ecc(struct mtd_info *mtd, int section,
>  				 struct mtd_oob_region *oobregion)
>  {
> @@ -409,6 +444,8 @@ static int jz4780_nand_probe(struct platform_device *pdev)
>  	if (!ret) {
>  		if (!strcmp(layout, "ingenic,jz4725b")) {
>  			nfc->oob_layout  = &jz4725b_ooblayout_ops;
> +		} else if (!strcmp(layout, "qi,lb60")) {
> +			nfc->oob_layout = &qi_lb60_ooblayout_ops;
>  		} else {
>  			dev_err(dev, "Unrecognized OOB layout %s\n", layout);
>  			return -EINVAL;


WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <bbrezillon@kernel.org>
To: Paul Cercueil <paul@crapouillou.net>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org, Mathieu Malaterre <malat@debian.org>,
	Richard Weinberger <richard@nod.at>,
	linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
	Rob Herring <robh+dt@kernel.org>,
	linux-mtd@lists.infradead.org,
	Harvey Hunt <harveyhuntnexus@gmail.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v2 6/9] mtd: rawnand: jz4780: Add ooblayout for the Qi Ben Nanonote
Date: Sun, 3 Feb 2019 08:30:04 +0100	[thread overview]
Message-ID: <20190203083004.390b96be@bbrezillon> (raw)
In-Reply-To: <20190202231926.2444-7-paul@crapouillou.net>

On Sat,  2 Feb 2019 20:19:23 -0300
Paul Cercueil <paul@crapouillou.net> wrote:

> The Ben Nanonote from Qi Hardware expects a specific OOB layout on its
> NAND. If the "ingenic,oob-layout" device property is set to "qi,lb60",
> this specific OOB layout is used.

I'm really not a big fan of this ingenic,oob-layout property, it
encourages people to use new custom layouts which is just a pain to
maintain. I understand that we don't have the choice for this board as
it's already upstream, but maybe we can avoid adding this prop and
check the root compat (which should contain the board name). 

> 
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
> 
> Changes:
> 
> v2: New patch
> 
>  drivers/mtd/nand/raw/ingenic/jz4780_nand.c | 37 ++++++++++++++++++++++
>  1 file changed, 37 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/ingenic/jz4780_nand.c b/drivers/mtd/nand/raw/ingenic/jz4780_nand.c
> index baebb9a5c7c8..4b304eceae8d 100644
> --- a/drivers/mtd/nand/raw/ingenic/jz4780_nand.c
> +++ b/drivers/mtd/nand/raw/ingenic/jz4780_nand.c
> @@ -346,6 +346,41 @@ static int jz4780_nand_init_chips(struct jz4780_nand_controller *nfc,
>  	return 0;
>  }
>  
> +static int qi_lb60_ooblayout_ecc(struct mtd_info *mtd, int section,
> +				 struct mtd_oob_region *oobregion)
> +{
> +	struct nand_chip *chip = mtd_to_nand(mtd);
> +	struct nand_ecc_ctrl *ecc = &chip->ecc;
> +
> +	if (section || !ecc->total)
> +		return -ERANGE;
> +
> +	oobregion->length = ecc->total;
> +	oobregion->offset = 12;
> +
> +	return 0;
> +}
> +
> +static int qi_lb60_ooblayout_free(struct mtd_info *mtd, int section,
> +				  struct mtd_oob_region *oobregion)
> +{
> +	struct nand_chip *chip = mtd_to_nand(mtd);
> +	struct nand_ecc_ctrl *ecc = &chip->ecc;
> +
> +	if (section)
> +		return -ERANGE;
> +
> +	oobregion->length = mtd->oobsize - ecc->total - 12;
> +	oobregion->offset = 12 + ecc->total;
> +
> +	return 0;
> +}
> +
> +const struct mtd_ooblayout_ops qi_lb60_ooblayout_ops = {
> +	.ecc = qi_lb60_ooblayout_ecc,
> +	.free = qi_lb60_ooblayout_free,
> +};
> +
>  static int jz4725b_ooblayout_ecc(struct mtd_info *mtd, int section,
>  				 struct mtd_oob_region *oobregion)
>  {
> @@ -409,6 +444,8 @@ static int jz4780_nand_probe(struct platform_device *pdev)
>  	if (!ret) {
>  		if (!strcmp(layout, "ingenic,jz4725b")) {
>  			nfc->oob_layout  = &jz4725b_ooblayout_ops;
> +		} else if (!strcmp(layout, "qi,lb60")) {
> +			nfc->oob_layout = &qi_lb60_ooblayout_ops;
>  		} else {
>  			dev_err(dev, "Unrecognized OOB layout %s\n", layout);
>  			return -EINVAL;


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

  reply	other threads:[~2019-02-03  7:30 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-02 23:19 [PATCH v2 0/9] Ingenic JZ4780 NAND patchset v2 Paul Cercueil
2019-02-02 23:19 ` Paul Cercueil
2019-02-02 23:19 ` [PATCH v2 1/9] mtd: rawnand: Move drivers for Ingenic SoCs to subfolder Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-02 23:19 ` [PATCH v2 2/9] dt-bindings: mtd: ingenic: Add compatible strings for the JZ4740 Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-18 19:20   ` Rob Herring
2019-02-18 19:20     ` Rob Herring
2019-02-18 19:20     ` Rob Herring
2019-02-02 23:19 ` [PATCH v2 3/9] mtd: rawnand: jz4780: Use SPDX license notifiers Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-02 23:19 ` [PATCH v2 4/9] mtd: rawnand: jz4780: Add support for the JZ4740 Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-03  7:31   ` Boris Brezillon
2019-02-03  7:31     ` Boris Brezillon
2019-02-03 13:56     ` Paul Cercueil
2019-02-03 13:56       ` Paul Cercueil
2019-02-03 14:08       ` Boris Brezillon
2019-02-03 14:08         ` Boris Brezillon
2019-02-03 14:10         ` Paul Cercueil
2019-02-03 14:10           ` Paul Cercueil
2019-02-03 14:24           ` Boris Brezillon
2019-02-03 14:24             ` Boris Brezillon
2019-02-02 23:19 ` [PATCH v2 5/9] mtd: rawnand: jz4780: Add ooblayout for the JZ4725B Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-03  7:21   ` Boris Brezillon
2019-02-03  7:21     ` Boris Brezillon
2019-02-02 23:19 ` [PATCH v2 6/9] mtd: rawnand: jz4780: Add ooblayout for the Qi Ben Nanonote Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-03  7:30   ` Boris Brezillon [this message]
2019-02-03  7:30     ` Boris Brezillon
2019-02-02 23:19 ` [PATCH v2 7/9] mtd: rawnand: jz4780-bch: Separate top-level and SoC specific code Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-02 23:19 ` [PATCH v2 8/9] mtd: rawnand: jz4780-bch: Add support for the JZ4725B Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-02 23:19 ` [PATCH v2 9/9] mtd: rawnand: jz4780-bch: Add support for the JZ4740 Paul Cercueil
2019-02-02 23:19   ` Paul Cercueil
2019-02-03  7:35   ` Boris Brezillon
2019-02-03  7:35     ` Boris Brezillon
2019-02-03 13:58     ` Paul Cercueil
2019-02-03 13:58       ` Paul Cercueil
2019-02-03 14:16       ` Boris Brezillon
2019-02-03 14:16         ` Boris Brezillon
2019-02-03 14:56         ` Paul Cercueil
2019-02-03 14:56           ` Paul Cercueil
2019-02-03 15:07           ` Boris Brezillon
2019-02-03 15:07             ` Boris Brezillon
2019-02-03 15:41             ` Paul Cercueil
2019-02-03 15:41               ` Paul Cercueil
2019-02-04  9:26   ` kbuild test robot
2019-02-04  9:26     ` kbuild test robot
2019-02-04  9:26     ` kbuild test robot
2019-02-04 10:02   ` kbuild test robot
2019-02-04 10:02     ` kbuild test robot
2019-02-04 10:02     ` kbuild test robot
2019-02-03  7:20 ` [PATCH v2 0/9] Ingenic JZ4780 NAND patchset v2 Boris Brezillon
2019-02-03  7:20   ` Boris Brezillon
2019-02-03 13:01   ` Paul Cercueil
2019-02-03 13:01     ` Paul Cercueil
2019-02-03 14:04     ` Boris Brezillon
2019-02-03 14:04       ` 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=20190203083004.390b96be@bbrezillon \
    --to=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=malat@debian.org \
    --cc=marek.vasut@gmail.com \
    --cc=mark.rutland@arm.com \
    --cc=miquel.raynal@bootlin.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 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.