mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash
@ 2024-01-25 20:01 Ezra Buehler
  2024-01-25 20:01 ` [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs Ezra Buehler
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Ezra Buehler @ 2024-01-25 20:01 UTC (permalink / raw)
  To: linux-mtd
  Cc: Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov, Md Sadre Alam,
	Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>

Since commit aa08bf187f32 ("mtd: spinand: esmt: add support for
F50D2G41KA") the MT7688-based GARDENA smart Gateway no longer boots.
This is due to an ID clash resulting in the ESMT driver being used
together with our GigaDevice GD5F1GQ5UEYIG.

The following patches resolve the issue for our board. However, I do not
have any ESMT NAND flash chips to further test my changes with.

Ezra Buehler (2):
  mtd: spinand: Add support for 5-byte IDs
  mtd: spinand: esmt: Extend IDs to 5 bytes

 drivers/mtd/nand/spi/esmt.c | 9 ++++++---
 include/linux/mtd/spinand.h | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

-- 
2.43.0


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

* [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs
  2024-01-25 20:01 [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Ezra Buehler
@ 2024-01-25 20:01 ` Ezra Buehler
  2024-01-26 18:46   ` Martin Kurbanov
  2024-02-05 14:28   ` Miquel Raynal
  2024-01-25 20:01 ` [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes Ezra Buehler
  2024-01-26 11:09 ` [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Dmitry Rokosov
  2 siblings, 2 replies; 9+ messages in thread
From: Ezra Buehler @ 2024-01-25 20:01 UTC (permalink / raw)
  To: linux-mtd
  Cc: Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov, Md Sadre Alam,
	Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>

E.g. ESMT chips will return an identification code with a length of 5
bytes. In order to prevent ambiguity, flash chips would actually need to
return IDs that are up to 17 or more bytes long due to JEDEC's
continuation scheme. I understand that if a manufacturer ID is located
in bank N of JEDEC's database (there are currently 16 banks), N - 1
continuation codes (7Fh) need to be added to the identification code
(comprising of manufacturer ID and device ID). However, most flash chip
manufacturers don't seem to implement this (correctly).

Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
---
 include/linux/mtd/spinand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index badb4c1ac079..5c19ead60499 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -169,7 +169,7 @@
 struct spinand_op;
 struct spinand_device;
 
-#define SPINAND_MAX_ID_LEN	4
+#define SPINAND_MAX_ID_LEN	5
 /*
  * For erase, write and read operation, we got the following timings :
  * tBERS (erase) 1ms to 4ms
-- 
2.43.0


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

* [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
  2024-01-25 20:01 [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Ezra Buehler
  2024-01-25 20:01 ` [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs Ezra Buehler
@ 2024-01-25 20:01 ` Ezra Buehler
  2024-01-26 18:48   ` Martin Kurbanov
  2024-02-05 14:28   ` Miquel Raynal
  2024-01-26 11:09 ` [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Dmitry Rokosov
  2 siblings, 2 replies; 9+ messages in thread
From: Ezra Buehler @ 2024-01-25 20:01 UTC (permalink / raw)
  To: linux-mtd
  Cc: Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov, Md Sadre Alam,
	Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>

According to the datasheets, the ESMT chips in question will return a 5
byte long identification code where the last 3 bytes are the JEDEC
continuation codes (7Fh). Although, I would have expected 4 continuation
codes as Powerchip Semiconductor (C8h, corresponding to the parameter
page data) is located in bank 5 of the JEDEC database.

By matching the full 5 bytes we can avoid clashes with GigaDevice NAND
flashes.

This fix allows the MT7688-based GARDENA smart Gateway to boot again.

Fixes: aa08bf187f32 ("mtd: spinand: esmt: add support for F50D2G41KA")
Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
---
 drivers/mtd/nand/spi/esmt.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/nand/spi/esmt.c b/drivers/mtd/nand/spi/esmt.c
index 31c439a557b1..4597a82de23a 100644
--- a/drivers/mtd/nand/spi/esmt.c
+++ b/drivers/mtd/nand/spi/esmt.c
@@ -104,7 +104,8 @@ static const struct mtd_ooblayout_ops f50l1g41lb_ooblayout = {
 
 static const struct spinand_info esmt_c8_spinand_table[] = {
 	SPINAND_INFO("F50L1G41LB",
-		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01, 0x7f,
+				0x7f, 0x7f),
 		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -113,7 +114,8 @@ static const struct spinand_info esmt_c8_spinand_table[] = {
 		     0,
 		     SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)),
 	SPINAND_INFO("F50D1G41LB",
-		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11),
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11, 0x7f,
+				0x7f, 0x7f),
 		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -122,7 +124,8 @@ static const struct spinand_info esmt_c8_spinand_table[] = {
 		     0,
 		     SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)),
 	SPINAND_INFO("F50D2G41KA",
-		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51),
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51, 0x7f,
+				0x7f, 0x7f),
 		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
-- 
2.43.0


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

* Re: [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash
  2024-01-25 20:01 [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Ezra Buehler
  2024-01-25 20:01 ` [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs Ezra Buehler
  2024-01-25 20:01 ` [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes Ezra Buehler
@ 2024-01-26 11:09 ` Dmitry Rokosov
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Rokosov @ 2024-01-26 11:09 UTC (permalink / raw)
  To: Ezra Buehler
  Cc: linux-mtd, Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov,
	Md Sadre Alam, Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

Hello Ezra!

Thank you for the patch series!

We will test it on the our side with ESMT flash and back to you soon.

On Thu, Jan 25, 2024 at 10:01:06PM +0200, Ezra Buehler wrote:
> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> Since commit aa08bf187f32 ("mtd: spinand: esmt: add support for
> F50D2G41KA") the MT7688-based GARDENA smart Gateway no longer boots.
> This is due to an ID clash resulting in the ESMT driver being used
> together with our GigaDevice GD5F1GQ5UEYIG.
> 
> The following patches resolve the issue for our board. However, I do not
> have any ESMT NAND flash chips to further test my changes with.
> 
> Ezra Buehler (2):
>   mtd: spinand: Add support for 5-byte IDs
>   mtd: spinand: esmt: Extend IDs to 5 bytes
> 
>  drivers/mtd/nand/spi/esmt.c | 9 ++++++---
>  include/linux/mtd/spinand.h | 2 +-
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 

-- 
Thank you,
Dmitry

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

* Re: [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs
  2024-01-25 20:01 ` [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs Ezra Buehler
@ 2024-01-26 18:46   ` Martin Kurbanov
  2024-02-05 14:28   ` Miquel Raynal
  1 sibling, 0 replies; 9+ messages in thread
From: Martin Kurbanov @ 2024-01-26 18:46 UTC (permalink / raw)
  To: Ezra Buehler, linux-mtd
  Cc: Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov, Md Sadre Alam,
	Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel



On 25.01.2024 23:01, Ezra Buehler wrote:
> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> E.g. ESMT chips will return an identification code with a length of 5
> bytes. In order to prevent ambiguity, flash chips would actually need to
> return IDs that are up to 17 or more bytes long due to JEDEC's
> continuation scheme. I understand that if a manufacturer ID is located
> in bank N of JEDEC's database (there are currently 16 banks), N - 1
> continuation codes (7Fh) need to be added to the identification code
> (comprising of manufacturer ID and device ID). However, most flash chip
> manufacturers don't seem to implement this (correctly).
> 
> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>

Tested for F50L1G41LB

Reviewed-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Tested-by: Martin Kurbanov <mmkurbanov@salutedevices.com>

> ---
>  include/linux/mtd/spinand.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
> index badb4c1ac079..5c19ead60499 100644
> --- a/include/linux/mtd/spinand.h
> +++ b/include/linux/mtd/spinand.h
> @@ -169,7 +169,7 @@
>  struct spinand_op;
>  struct spinand_device;
>  
> -#define SPINAND_MAX_ID_LEN	4
> +#define SPINAND_MAX_ID_LEN	5
>  /*
>   * For erase, write and read operation, we got the following timings :
>   * tBERS (erase) 1ms to 4ms

-- 
Best Regards,
Martin Kurbanov

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

* Re: [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
  2024-01-25 20:01 ` [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes Ezra Buehler
@ 2024-01-26 18:48   ` Martin Kurbanov
  2024-01-27  8:26     ` Ezra Buehler
  2024-02-05 14:28   ` Miquel Raynal
  1 sibling, 1 reply; 9+ messages in thread
From: Martin Kurbanov @ 2024-01-26 18:48 UTC (permalink / raw)
  To: Ezra Buehler, linux-mtd
  Cc: Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov, Md Sadre Alam,
	Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel



On 25.01.2024 23:01, Ezra Buehler wrote:
> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> According to the datasheets, the ESMT chips in question will return a 5
> byte long identification code where the last 3 bytes are the JEDEC
> continuation codes (7Fh). Although, I would have expected 4 continuation
> codes as Powerchip Semiconductor (C8h, corresponding to the parameter
> page data) is located in bank 5 of the JEDEC database.
> 
> By matching the full 5 bytes we can avoid clashes with GigaDevice NAND
> flashes.
> 
> This fix allows the MT7688-based GARDENA smart Gateway to boot again.
> 
> Fixes: aa08bf187f32 ("mtd: spinand: esmt: add support for F50D2G41KA")
> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>


Tested for F50L1G41LB

Reviewed-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Tested-by: Martin Kurbanov <mmkurbanov@salutedevices.com>

> ---
>  drivers/mtd/nand/spi/esmt.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mtd/nand/spi/esmt.c b/drivers/mtd/nand/spi/esmt.c
> index 31c439a557b1..4597a82de23a 100644
> --- a/drivers/mtd/nand/spi/esmt.c
> +++ b/drivers/mtd/nand/spi/esmt.c
> @@ -104,7 +104,8 @@ static const struct mtd_ooblayout_ops f50l1g41lb_ooblayout = {
>  
>  static const struct spinand_info esmt_c8_spinand_table[] = {
>  	SPINAND_INFO("F50L1G41LB",
> -		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01),
> +		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x01, 0x7f,
> +				0x7f, 0x7f),
>  		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
>  		     NAND_ECCREQ(1, 512),
>  		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
> @@ -113,7 +114,8 @@ static const struct spinand_info esmt_c8_spinand_table[] = {
>  		     0,
>  		     SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)),
>  	SPINAND_INFO("F50D1G41LB",
> -		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11),
> +		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x11, 0x7f,
> +				0x7f, 0x7f),
>  		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
>  		     NAND_ECCREQ(1, 512),
>  		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
> @@ -122,7 +124,8 @@ static const struct spinand_info esmt_c8_spinand_table[] = {
>  		     0,
>  		     SPINAND_ECCINFO(&f50l1g41lb_ooblayout, NULL)),
>  	SPINAND_INFO("F50D2G41KA",
> -		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51),
> +		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0x51, 0x7f,
> +				0x7f, 0x7f),
>  		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
>  		     NAND_ECCREQ(8, 512),
>  		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,

-- 
Best Regards,
Martin Kurbanov

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

* Re: [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
  2024-01-26 18:48   ` Martin Kurbanov
@ 2024-01-27  8:26     ` Ezra Buehler
  0 siblings, 0 replies; 9+ messages in thread
From: Ezra Buehler @ 2024-01-27  8:26 UTC (permalink / raw)
  To: Martin Kurbanov
  Cc: linux-mtd, Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov,
	Md Sadre Alam, Miquel Raynal, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

Hi Martin,

> On 26 Jan 2024, at 20:49, Martin Kurbanov <mmkurbanov@salutedevices.com> wrote:
> 
> Tested for F50L1G41LB
> 
> Reviewed-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
> Tested-by: Martin Kurbanov <mmkurbanov@salutedevices.com>

Thank you very much for your valuable feedback!

Cheers,
Ezra.

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

* Re: [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
  2024-01-25 20:01 ` [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes Ezra Buehler
  2024-01-26 18:48   ` Martin Kurbanov
@ 2024-02-05 14:28   ` Miquel Raynal
  1 sibling, 0 replies; 9+ messages in thread
From: Miquel Raynal @ 2024-02-05 14:28 UTC (permalink / raw)
  To: Ezra Buehler, linux-mtd
  Cc: Miquel Raynal, Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov,
	Md Sadre Alam, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

On Thu, 2024-01-25 at 20:01:08 UTC, Ezra Buehler wrote:
> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> According to the datasheets, the ESMT chips in question will return a 5
> byte long identification code where the last 3 bytes are the JEDEC
> continuation codes (7Fh). Although, I would have expected 4 continuation
> codes as Powerchip Semiconductor (C8h, corresponding to the parameter
> page data) is located in bank 5 of the JEDEC database.
> 
> By matching the full 5 bytes we can avoid clashes with GigaDevice NAND
> flashes.
> 
> This fix allows the MT7688-based GARDENA smart Gateway to boot again.
> 
> Fixes: aa08bf187f32 ("mtd: spinand: esmt: add support for F50D2G41KA")
> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> Reviewed-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
> Tested-by: Martin Kurbanov <mmkurbanov@salutedevices.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

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

* Re: [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs
  2024-01-25 20:01 ` [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs Ezra Buehler
  2024-01-26 18:46   ` Martin Kurbanov
@ 2024-02-05 14:28   ` Miquel Raynal
  1 sibling, 0 replies; 9+ messages in thread
From: Miquel Raynal @ 2024-02-05 14:28 UTC (permalink / raw)
  To: Ezra Buehler, linux-mtd
  Cc: Miquel Raynal, Chuanhong Guo, Dmitry Rokosov, Martin Kurbanov,
	Md Sadre Alam, Richard Weinberger, Sridharan S N,
	Vignesh Raghavendra, linux-kernel

On Thu, 2024-01-25 at 20:01:07 UTC, Ezra Buehler wrote:
> From: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> 
> E.g. ESMT chips will return an identification code with a length of 5
> bytes. In order to prevent ambiguity, flash chips would actually need to
> return IDs that are up to 17 or more bytes long due to JEDEC's
> continuation scheme. I understand that if a manufacturer ID is located
> in bank N of JEDEC's database (there are currently 16 banks), N - 1
> continuation codes (7Fh) need to be added to the identification code
> (comprising of manufacturer ID and device ID). However, most flash chip
> manufacturers don't seem to implement this (correctly).
> 
> Signed-off-by: Ezra Buehler <ezra.buehler@husqvarnagroup.com>
> Reviewed-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
> Tested-by: Martin Kurbanov <mmkurbanov@salutedevices.com>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.

Miquel

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

end of thread, other threads:[~2024-02-05 14:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 20:01 [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Ezra Buehler
2024-01-25 20:01 ` [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs Ezra Buehler
2024-01-26 18:46   ` Martin Kurbanov
2024-02-05 14:28   ` Miquel Raynal
2024-01-25 20:01 ` [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes Ezra Buehler
2024-01-26 18:48   ` Martin Kurbanov
2024-01-27  8:26     ` Ezra Buehler
2024-02-05 14:28   ` Miquel Raynal
2024-01-26 11:09 ` [PATCH 0/2] mtd: spinand: Resolve GigaDevice/ESMT ID clash Dmitry Rokosov

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

all inboxes | Powered by JetHome®