public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES
@ 2017-07-31  8:29 Boris Brezillon
  2017-07-31 11:52 ` Alexander Dahl
  2017-07-31 16:28 ` Boris Brezillon
  0 siblings, 2 replies; 3+ messages in thread
From: Boris Brezillon @ 2017-07-31  8:29 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Cyrille Pitchen,
	Alexander Dahl, Miquel Raynal, stable

Some ONFI NANDs do not support the SET/GET FEATURES commands, which,
according to the spec, is perfectly valid.

On these NANDs we can't set a specific timing mode using the "timing
mode" feature, and we should assume the NAND does not require any setup
to enter a specific timing mode.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
Reported-by: Alexander Dahl <ada@thorsis.com>
Cc: <stable@vger.kernel.org>
---
 drivers/mtd/nand/nand_base.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 7b3826b42447..f2bd2c00a8a1 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1131,7 +1131,9 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
 	 * Ensure the timing mode has been changed on the chip side
 	 * before changing timings on the controller side.
 	 */
-	if (chip->onfi_version) {
+	if (chip->onfi_version &&
+	    (le16_to_cpu(chip->onfi_params.opt_cmd) &
+	     ONFI_OPT_CMD_SET_GET_FEATURES)) {
 		u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
 			chip->onfi_timing_mode_default,
 		};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES
  2017-07-31  8:29 [PATCH] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES Boris Brezillon
@ 2017-07-31 11:52 ` Alexander Dahl
  2017-07-31 16:28 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Dahl @ 2017-07-31 11:52 UTC (permalink / raw)
  To: linux-mtd
  Cc: Boris Brezillon, Richard Weinberger, Cyrille Pitchen, stable,
	Marek Vasut, Miquel Raynal, Brian Norris, David Woodhouse

Hello,

Tested-by: Alexander Dahl <ada@thorsis.com>

Greets
Alex

Am Montag, 31. Juli 2017, 10:29:56 schrieb Boris Brezillon:
> Some ONFI NANDs do not support the SET/GET FEATURES commands, which,
> according to the spec, is perfectly valid.
> 
> On these NANDs we can't set a specific timing mode using the "timing
> mode" feature, and we should assume the NAND does not require any
> setup to enter a specific timing mode.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
> Reported-by: Alexander Dahl <ada@thorsis.com>
> Cc: <stable@vger.kernel.org>
> ---
>  drivers/mtd/nand/nand_base.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c
> b/drivers/mtd/nand/nand_base.c index 7b3826b42447..f2bd2c00a8a1
> 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -1131,7 +1131,9 @@ static int nand_setup_data_interface(struct
> nand_chip *chip, int chipnr) * Ensure the timing mode has been
> changed on the chip side * before changing timings on the controller
> side.
>  	 */
> -	if (chip->onfi_version) {
> +	if (chip->onfi_version &&
> +	    (le16_to_cpu(chip->onfi_params.opt_cmd) &
> +	     ONFI_OPT_CMD_SET_GET_FEATURES)) {
>  		u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
>  			chip->onfi_timing_mode_default,
>  		};

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES
  2017-07-31  8:29 [PATCH] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES Boris Brezillon
  2017-07-31 11:52 ` Alexander Dahl
@ 2017-07-31 16:28 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2017-07-31 16:28 UTC (permalink / raw)
  To: Boris Brezillon, Richard Weinberger, linux-mtd
  Cc: David Woodhouse, Brian Norris, Marek Vasut, Cyrille Pitchen,
	Alexander Dahl, Miquel Raynal, stable

On Mon, 31 Jul 2017 10:29:56 +0200
Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> Some ONFI NANDs do not support the SET/GET FEATURES commands, which,
> according to the spec, is perfectly valid.
> 
> On these NANDs we can't set a specific timing mode using the "timing
> mode" feature, and we should assume the NAND does not require any setup
> to enter a specific timing mode.

Applied to nand/fixes.

> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
> Reported-by: Alexander Dahl <ada@thorsis.com>
> Cc: <stable@vger.kernel.org>
> ---
>  drivers/mtd/nand/nand_base.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index 7b3826b42447..f2bd2c00a8a1 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c
> @@ -1131,7 +1131,9 @@ static int nand_setup_data_interface(struct nand_chip *chip, int chipnr)
>  	 * Ensure the timing mode has been changed on the chip side
>  	 * before changing timings on the controller side.
>  	 */
> -	if (chip->onfi_version) {
> +	if (chip->onfi_version &&
> +	    (le16_to_cpu(chip->onfi_params.opt_cmd) &
> +	     ONFI_OPT_CMD_SET_GET_FEATURES)) {
>  		u8 tmode_param[ONFI_SUBFEATURE_PARAM_LEN] = {
>  			chip->onfi_timing_mode_default,
>  		};

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-31 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-31  8:29 [PATCH] mtd: nand: Fix timing setup for NANDs that do not support SET FEATURES Boris Brezillon
2017-07-31 11:52 ` Alexander Dahl
2017-07-31 16:28 ` Boris Brezillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox