From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Richard Weinberger <richard@nod.at>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Cyrille Pitchen <cyrille.pitchen@atmel.com>,
linux-mtd@lists.infradead.org,
Linus Walleij <linus.walleij@linaro.org>,
Stefan Roese <sr@denx.de>,
stable@vger.kernel.org
Subject: Re: [PATCH 01/13] mtd: nand: fsmc: fix NAND width handling
Date: Wed, 22 Mar 2017 22:42:37 +0100 [thread overview]
Message-ID: <20170322224237.3cc00c7f@bbrezillon> (raw)
In-Reply-To: <1490090645-8576-2-git-send-email-thomas.petazzoni@free-electrons.com>
+Greg for the backport to stable question.
On Tue, 21 Mar 2017 11:03:53 +0100
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
> In commit eea628199d5b ("mtd: Add device-tree support to fsmc_nand"),
> Device Tree support was added to the fmsc_nand driver. However, this
> code has a bug in how it handles the bank-width DT property to set the
> bus width.
>
> Indeed, in the function fsmc_nand_probe_config_dt() that parses the
> Device Tree, it sets pdata->width to either 8 or 16 depending on the
> value of the bank-width DT property.
>
> Then, the ->probe() function will test if pdata->width is equal to
> FSMC_NAND_BW16 (which is 2) to set NAND_BUSWIDTH_16 in
> nand->options. Therefore, with the DT probing, this condition will never
> match.
>
> This commit fixes that by removing the "width" field from
> fsmc_nand_platform_data and instead have the fsmc_nand_probe_config_dt()
> function directly set the appropriate nand->options value.
>
> It is worth mentioning that if this commit gets backported to older
> kernels, prior to the drop of non-DT probing, then non-DT probing will
> be broken because nand->options will no longer be set to
> NAND_BUSWIDTH_16.
Then maybe we should the drop the Cc-stable tag, or put # vX.Y+ to
prevent this patch from being applied to versions where it could break
things.
Note that no-one complained about this bug so far, so I guess no-one
cares about this fix (probably because 16-bits NANDs are not widely
used) ;-).
>
> Fixes: eea628199d5b ("mtd: Add device-tree support to fsmc_nand")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> drivers/mtd/nand/fsmc_nand.c | 13 +++++--------
> 1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
> index bda1e46..66aece9 100644
> --- a/drivers/mtd/nand/fsmc_nand.c
> +++ b/drivers/mtd/nand/fsmc_nand.c
> @@ -150,7 +150,6 @@ struct fsmc_nand_platform_data {
> struct mtd_partition *partitions;
> unsigned int nr_partitions;
> unsigned int options;
> - unsigned int width;
> unsigned int bank;
>
> enum access_mode mode;
> @@ -844,18 +843,19 @@ static int fsmc_nand_probe_config_dt(struct platform_device *pdev,
> u32 val;
> int ret;
>
> - /* Set default NAND width to 8 bits */
> - pdata->width = 8;
> + pdata->options = 0;
> +
> if (!of_property_read_u32(np, "bank-width", &val)) {
> if (val == 2) {
> - pdata->width = 16;
> + pdata->options |= NAND_BUSWIDTH_16;
> } else if (val != 1) {
> dev_err(&pdev->dev, "invalid bank-width %u\n", val);
> return -EINVAL;
> }
> }
> +
> if (of_get_property(np, "nand-skip-bbtscan", NULL))
> - pdata->options = NAND_SKIP_BBTSCAN;
> + pdata->options |= NAND_SKIP_BBTSCAN;
>
> pdata->nand_timings = devm_kzalloc(&pdev->dev,
> sizeof(*pdata->nand_timings), GFP_KERNEL);
> @@ -992,9 +992,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
> nand->badblockbits = 7;
> nand_set_flash_node(nand, np);
>
> - if (pdata->width == FSMC_NAND_BW16)
> - nand->options |= NAND_BUSWIDTH_16;
> -
> switch (host->mode) {
> case USE_DMA_ACCESS:
> dma_cap_zero(mask);
next prev parent reply other threads:[~2017-03-22 21:43 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-21 10:03 [PATCH 00/13] mtd: nand: fsmc: fixes, improvements and cleanups Thomas Petazzoni
2017-03-21 10:03 ` [PATCH 01/13] mtd: nand: fsmc: fix NAND width handling Thomas Petazzoni
2017-03-22 21:42 ` Boris Brezillon [this message]
2017-03-22 22:06 ` Thomas Petazzoni
2017-03-23 9:53 ` Linus Walleij
2017-03-21 10:03 ` [PATCH 02/13] mtd: nand: fsmc: rework fsmc_nand_setup() to use ->setup_data_interface() Thomas Petazzoni
2017-03-22 21:56 ` Boris Brezillon
2017-03-22 22:05 ` Thomas Petazzoni
2017-03-22 22:23 ` Boris Brezillon
2017-03-22 22:39 ` Thomas Petazzoni
2017-03-22 22:53 ` Boris Brezillon
2017-03-23 9:57 ` Linus Walleij
2017-03-21 10:03 ` [PATCH 03/13] mtd: nand: fsmc: add support to use NAND timings Thomas Petazzoni
2017-03-23 9:59 ` Linus Walleij
2017-03-21 10:03 ` [PATCH 04/13] mtd: nand: fsmc: move fsmc_nand_data definition Thomas Petazzoni
2017-03-23 10:00 ` Linus Walleij
2017-03-21 10:03 ` [PATCH 05/13] mtd: nand: fsmc: remove ->select_bank() from fsmc_nand_platform_data Thomas Petazzoni
2017-03-23 10:00 ` Linus Walleij
2017-03-21 10:03 ` [PATCH 06/13] mtd: nand: fsmc: remove fsmc_select_chip() Thomas Petazzoni
2017-03-23 10:01 ` Linus Walleij
2017-03-21 10:03 ` [PATCH 07/13] mtd: nand: fmsc: kill {read, write}_dma_priv from fsmc_nand_platform_data Thomas Petazzoni
2017-03-23 10:02 ` Linus Walleij
2017-03-21 10:04 ` [PATCH 08/13] mtd: nand: fsmc: kill {nr_, }partitions structure fields Thomas Petazzoni
2017-03-23 10:03 ` Linus Walleij
2017-03-21 10:04 ` [PATCH 09/13] mtd: nand: fsmc: remove duplicate nand_set_flash_node() Thomas Petazzoni
2017-03-23 10:04 ` Linus Walleij
2017-03-21 10:04 ` [PATCH 10/13] mtd: nand: fsmc: finally remove fsmc_nand_platform_data Thomas Petazzoni
2017-03-23 10:05 ` Linus Walleij
2017-03-21 10:04 ` [PATCH 11/13] mtd: nand: fsmc: use devm_clk_get() Thomas Petazzoni
2017-03-23 10:05 ` Linus Walleij
2017-03-21 10:04 ` [PATCH 12/13] mtd: nand: fsmc: remove unused definitions Thomas Petazzoni
2017-03-23 10:06 ` Linus Walleij
2017-03-21 10:04 ` [PATCH 13/13] mtd: nand: fsmc: remove CONFIG_OF conditional Thomas Petazzoni
2017-03-22 22:01 ` Boris Brezillon
2017-03-23 10:07 ` Linus Walleij
2017-03-23 9:50 ` [PATCH 00/13] mtd: nand: fsmc: fixes, improvements and cleanups Linus Walleij
2017-03-23 9:52 ` Thomas Petazzoni
2017-03-24 8:26 ` 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=20170322224237.3cc00c7f@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@atmel.com \
--cc=dwmw2@infradead.org \
--cc=gregkh@linuxfoundation.org \
--cc=linus.walleij@linaro.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
--cc=sr@denx.de \
--cc=stable@vger.kernel.org \
--cc=thomas.petazzoni@free-electrons.com \
/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.