From: harveyhuntnexus@gmail.com (Harvey Hunt)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 21/52] mtd: rawnand: jz4780: convert driver to nand_scan()
Date: Fri, 16 Mar 2018 15:33:05 +0000 [thread overview]
Message-ID: <c3df8f9f-7d3f-4fa5-dad3-a9f6697aa67d@gmail.com> (raw)
In-Reply-To: <20180316143824.568be773@xps13>
Hi Miqu?l,
On 03/16/2018 01:38 PM, Miquel Raynal wrote:
> Hi Harvey,
>
> On Thu, 15 Mar 2018 15:40:25 +0000, Harvey Hunt
> <harveyhuntnexus@gmail.com> wrote:
>
>> Hi Miquel,
>>
>> Sorry it's taken me a little while to review your changes, a few
>> comments below:
>>
>> On 03/02/2018 05:03 PM, Miquel Raynal wrote:
>>> Two helpers have been added to the core to make ECC-related
>>> configuration between the detection phase and the final NAND scan. Use
>>> these hooks and convert the driver to just use nand_scan() instead of
>>> both nand_scan_ident() and nand_scan_tail().
>>>
>>> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>> ---
>>> drivers/mtd/nand/raw/jz4780_nand.c | 30 ++++++++++++------------------
>>> 1 file changed, 12 insertions(+), 18 deletions(-)
>>>
>>> diff --git a/drivers/mtd/nand/raw/jz4780_nand.c b/drivers/mtd/nand/raw/jz4780_nand.c
>>> index e69f6ae4c539..fd5dc9d9b0c6 100644
>>> --- a/drivers/mtd/nand/raw/jz4780_nand.c
>>> +++ b/drivers/mtd/nand/raw/jz4780_nand.c
>>> @@ -157,9 +157,8 @@ static int jz4780_nand_ecc_correct(struct mtd_info *mtd, u8 *dat,
>>> return jz4780_bch_correct(nfc->bch, ¶ms, dat, read_ecc);
>>> }
>>>
>>> -static int jz4780_nand_init_ecc(struct jz4780_nand_chip *nand, struct device *dev)
>>> +static int jz4780_nand_attach_chip(struct nand_chip *chip)
>>> {
>>> - struct nand_chip *chip = &nand->chip;
>>> struct mtd_info *mtd = nand_to_mtd(chip);
>>> struct jz4780_nand_controller *nfc = to_jz4780_nand_controller(chip->controller);
>>> int eccbytes;
>>> @@ -170,7 +169,8 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip *nand, struct device *de
>>> switch (chip->ecc.mode) {
>>> case NAND_ECC_HW:
>>> if (!nfc->bch) {
>>> - dev_err(dev, "HW BCH selected, but BCH controller not found\n");
>>> + dev_err(nfc->dev,
>>> + "HW BCH selected, but BCH controller not found\n");
>>> return -ENODEV;
>>> }
>>>
>>> @@ -179,15 +179,16 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip *nand, struct device *de
>>> chip->ecc.correct = jz4780_nand_ecc_correct;
>>> /* fall through */
>>> case NAND_ECC_SOFT:
>>> - dev_info(dev, "using %s (strength %d, size %d, bytes %d)\n",
>>> - (nfc->bch) ? "hardware BCH" : "software ECC",
>>> - chip->ecc.strength, chip->ecc.size, chip->ecc.bytes);
>>> + dev_info(nfc->dev, "using %s (strength %d, size %d, bytes %d)\n",
>>> + (nfc->bch) ? "hardware BCH" : "software ECC",
>>> + chip->ecc.strength, chip->ecc.size, chip->ecc.bytes)> break;
>>> case NAND_ECC_NONE:
>>> - dev_info(dev, "not using ECC\n");
>>> + dev_info(nfc->dev, "not using ECC\n");
>>> break;
>>> default:
>>> - dev_err(dev, "ECC mode %d not supported\n", chip->ecc.mode);
>>> + dev_err(nfc->dev, "ECC mode %d not supported\n",
>>> + chip->ecc.mode);
>>> return -EINVAL;
>>> }
>> These changes seem redundant as dev is passed into the function,
>> although you could remove it from the function defintion.
>
> That is right, I should have also removed the 'dev' parameter.
>
That'd be great
>>
>>>
>>> @@ -199,7 +200,7 @@ static int jz4780_nand_init_ecc(struct jz4780_nand_chip *nand, struct device *de
>>> eccbytes = mtd->writesize / chip->ecc.size * chip->ecc.bytes;
>>>
>>> if (eccbytes > mtd->oobsize - 2) {
>>> - dev_err(dev,
>>> + dev_err(nfc->dev,
>>> "invalid ECC config: required %d ECC bytes, but only %d are available",
>>> eccbytes, mtd->oobsize - 2);
>>> return -EINVAL;
>>> @@ -279,15 +280,8 @@ static int jz4780_nand_init_chip(struct platform_device *pdev,
>>> chip->controller = &nfc->controller;
>>> nand_set_flash_node(chip, np);
>>>
>>> - ret = nand_scan_ident(mtd, 1, NULL);
>>> - if (ret)
>>> - return ret;
>>> -
>>> - ret = jz4780_nand_init_ecc(nand, dev)
>>
>> You've removed this call, but without it the ECC won't be initialised...
>
> Actually it is not removed but just renamed to match the core's hook
> name. The purpose of this function is to perform any chip-related
> tuning after the identification, and the name should not limit
> ourselves to do something not related to ECC configuration.
>
Sorry for the noise, seems I've forgotten how to read patches...
>>
>>> - if (ret)
>>> - return ret;
>>> -
>>> - ret = nand_scan_tail(mtd);
>>> + chip->ecc.attach_chip = jz4780_nand_attach_chip;
>>
>> This function doesn't exist.
>
> See above, the *nand_init_ecc() function has been renamed in
> *nand_attach_chip().
>
> This hook: chip->ecc.attach_chip() will be called between
> nand_scan_ident() and nand_scan_tail() from within nand_scan().
>
Same as above :-)
Once you remove the redundant dev param:
Acked-By: Harvey Hunt <harveyhuntnexus@gmail.com>
>>
>>> + ret = nand_scan(mtd, 1);
>>> if (ret)
>>> return ret;
>>>
>>>
>>
>> Thanks,
>>
>> Harvey
>
> Thanks for reviewing,
> Miqu?l
>
Thanks,
Harvey
next prev parent reply other threads:[~2018-03-16 15:33 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-02 17:03 [PATCH 00/52] Allow dynamic allocations during NAND chip identification phase Miquel Raynal
2018-03-02 17:03 ` [PATCH 01/52] mtd: rawnand: add hooks that may be called during nand_scan() Miquel Raynal
2018-03-15 15:24 ` Boris Brezillon
2018-03-02 17:03 ` [PATCH 02/52] mtd: rawnand: bf5xx: fix probe function error path Miquel Raynal
2018-03-15 15:23 ` Boris Brezillon
2018-03-02 17:03 ` [PATCH 03/52] mtd: rawnand: bf5xx: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 04/52] mtd: rawnand: brcmnand: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 05/52] mtd: rawnand: brcmnand: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 06/52] mtd: rawnand: cafe: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 07/52] mtd: rawnand: cafe: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 08/52] mtd: rawnand: davinci: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 09/52] mtd: rawnand: davinci: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 10/52] mtd: rawnand: denali: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 11/52] mtd: rawnand: denali: convert to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 12/52] mtd: rawnand: fsl_elbc: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 13/52] mtd: rawnand: fsl_elbc: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 14/52] mtd: rawnand: fsl_ifc: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 15/52] mtd: rawnand: fsl_ifc: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 16/52] mtd: rawnand: fsmc: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 17/52] mtd: rawnand: fsmc: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 18/52] mtd: rawnand: gpmi: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 19/52] mtd: rawnand: hisi504: enhance the probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 20/52] mtd: rawnand: hisi504: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 21/52] mtd: rawnand: jz4780: " Miquel Raynal
2018-03-15 15:40 ` Harvey Hunt
2018-03-16 13:38 ` Miquel Raynal
2018-03-16 15:33 ` Harvey Hunt [this message]
2018-03-20 7:24 ` Miquel Raynal
2018-03-02 17:03 ` [PATCH 22/52] mtd: rawnand: lpc32xx_mlc: enhance the probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 23/52] mtd: rawnand: lpc32xx_mlc: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 24/52] mtd: rawnand: lpc32xx_slc: enhance the probe function error Miquel Raynal
2018-03-02 17:03 ` [PATCH 25/52] mtd: rawnand: lpc32xx_slc: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 26/52] mtd: rawnand: marvell: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 27/52] mtd: rawnand: mtk: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 28/52] mtd: rawnand: mxc: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 29/52] mtd: rawnand: mxc: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 30/52] mtd: rawnand: nandsim: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 31/52] mtd: rawnand: omap2: fix the probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 32/52] mtd: rawnand: omap2: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 33/52] mtd: rawnand: s3c2410: enhance the probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 34/52] mtd: rawnand: s3c2410: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 35/52] mtd: rawnand: sh_flctl: move all NAND chip related setup in one function Miquel Raynal
2018-03-02 17:03 ` [PATCH 36/52] mtd: rawnand: sh_flctl: fix the probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 37/52] mtd: rawnand: sh_flctl: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 38/52] mtd: rawnand: sunxi: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 39/52] mtd: rawnand: tango: fix probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 40/52] mtd: rawnand: tango: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 41/52] mtd: rawnand: txx9ndfmc: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 42/52] mtd: rawnand: vf610: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 43/52] mtd: rawnand: atmel: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 44/52] mtd: rawnand: add a field in nand_chip to fill an array of IDs Miquel Raynal
2018-03-02 17:03 ` [PATCH 45/52] mtd: rawnand: sm_common: make use of the new flash_ids table entry Miquel Raynal
2018-03-02 17:03 ` [PATCH 46/52] mtd: rawnand: sm_common: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 47/52] mtd: rawnand: docg4: fix the probe function error path Miquel Raynal
2018-03-02 17:03 ` [PATCH 48/52] mtd: rawnand: docg4: convert driver to nand_scan() Miquel Raynal
2018-03-02 17:03 ` [PATCH 49/52] mtd: rawnand: qcom: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 50/52] mtd: rawnand: jz4740: " Miquel Raynal
2018-03-02 17:03 ` [PATCH 51/52] mtd: rawnand: do not export nand_scan_[ident|tail]() anymore Miquel Raynal
2018-03-02 17:04 ` [PATCH 52/52] mtd: rawnand: allocate dynamically ONFI parameters during detection Miquel Raynal
2018-03-15 15:19 ` [PATCH 00/52] Allow dynamic allocations during NAND chip identification phase 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=c3df8f9f-7d3f-4fa5-dad3-a9f6697aa67d@gmail.com \
--to=harveyhuntnexus@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).