[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180721193840.05fa4e4f@bbrezillon>
Date: Sat, 21 Jul 2018 19:38:40 +0200
From: Boris Brezillon <boris.brezillon@...tlin.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>
Cc: Wenyou Yang <wenyou.yang@...rochip.com>,
Josh Wu <rainyfeeling@...look.com>,
Tudor Ambarus <Tudor.Ambarus@...rochip.com>,
Richard Weinberger <richard@....at>,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Marek Vasut <marek.vasut@...il.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Kamal Dasu <kdasu.kdev@...il.com>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
Han Xu <han.xu@....com>,
Harvey Hunt <harveyhuntnexus@...il.com>,
Vladimir Zapolskiy <vz@...ia.com>,
Sylvain Lemieux <slemieux.tyco@...il.com>,
Xiaolei Li <xiaolei.li@...iatek.com>,
Matthias Brugger <matthias.bgg@...il.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Chen-Yu Tsai <wens@...e.org>,
Marc Gonzalez <marc.w.gonzalez@...e.fr>,
Mans Rullgard <mans@...sr.com>, Stefan Agner <stefan@...er.ch>,
linux-mtd@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
bcm-kernel-feedback-list@...adcom.com,
linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH v4 18/35] mtd: rawnand: s3c2410: convert driver to
nand_scan()
On Fri, 20 Jul 2018 17:15:10 +0200
Miquel Raynal <miquel.raynal@...tlin.com> 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@...tlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@...tlin.com>
> ---
> drivers/mtd/nand/raw/s3c2410.c | 30 +++++++++++++-----------------
> 1 file changed, 13 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/s3c2410.c b/drivers/mtd/nand/raw/s3c2410.c
> index e8bf64832213..c21e8892394a 100644
> --- a/drivers/mtd/nand/raw/s3c2410.c
> +++ b/drivers/mtd/nand/raw/s3c2410.c
> @@ -915,20 +915,19 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
> }
>
> /**
> - * s3c2410_nand_update_chip - post probe update
> - * @info: The controller instance.
> - * @nmtd: The driver version of the MTD instance.
> + * s3c2410_nand_attach_chip - Init the ECC engine after NAND scan
> + * @chip: The NAND chip
> *
> - * This routine is called after the chip probe has successfully completed
> - * and the relevant per-chip information updated. This call ensure that
> + * This hook is called by the core after the identification of the NAND chip,
> + * once the relevant per-chip information is up to date.. This call ensure that
> * we update the internal state accordingly.
> *
> * The internal state is currently limited to the ECC state information.
> */
> -static int s3c2410_nand_update_chip(struct s3c2410_nand_info *info,
> - struct s3c2410_nand_mtd *nmtd)
> +static int s3c2410_nand_attach_chip(struct nand_chip *chip)
> {
> - struct nand_chip *chip = &nmtd->chip;
> + struct mtd_info *mtd = nand_to_mtd(chip);
> + struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
>
> switch (chip->ecc.mode) {
>
> @@ -998,6 +997,10 @@ static int s3c2410_nand_update_chip(struct s3c2410_nand_info *info,
> return 0;
> }
>
> +static const struct nand_controller_ops s3c24xx_nand_controller_ops = {
> + .attach_chip = s3c2410_nand_attach_chip,
> +};
> +
> static const struct of_device_id s3c24xx_nand_dt_ids[] = {
> {
> .compatible = "samsung,s3c2410-nand",
> @@ -1095,6 +1098,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, info);
>
> nand_controller_init(&info->controller);
> + info->controller.ops = &s3c24xx_nand_controller_ops;
>
> /* get the clock source and enable it */
>
> @@ -1166,15 +1170,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
> mtd->dev.parent = &pdev->dev;
> s3c2410_nand_init_chip(info, nmtd, sets);
>
> - err = nand_scan_ident(mtd, (sets) ? sets->nr_chips : 1, NULL);
> - if (err)
> - goto exit_error;
> -
> - err = s3c2410_nand_update_chip(info, nmtd);
> - if (err < 0)
> - goto exit_error;
> -
> - err = nand_scan_tail(mtd);
> + err = nand_scan(mtd, sets ? sets->nr_chips : 1);
> if (err)
> goto exit_error;
>
Powered by blists - more mailing lists