mtd: spinand: Resolve GigaDevice/ESMT ID clash
Subsystems (2)
cover mtd: spinand: Resolve GigaDevice/ESMT ID clash
From: Ezra Buehler <[email protected]>
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(-)
Signature · 1 line
2.43.0
PATCH 1/2 mtd: spinand: Add support for 5-byte IDs
From: Ezra Buehler <[email protected]>
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).
--- include/linux/mtd/spinand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/mtd/spinand.h +1 -1
@@ -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
Signature · 1 line
2.43.0
Re: [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs
Quoted 11 lines · Ezra Buehler
From: Ezra Buehler <[email protected]>
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).
Quoted 1 line
Signed-off-by Ezra Buehler <[email protected]>
Tested for F50L1G41LB
Quoted 17 lines
--- include/linux/mtd/spinand.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/mtd/spinand.h +1
-1@@ -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
Signature · 2 lines
Best Regards, Martin Kurbanov
Re: [PATCH 1/2] mtd: spinand: Add support for 5-byte IDs
In reply to Ezra BuehlerQuoted 11 lines · Ezra Buehler
From: Ezra Buehler <[email protected]>
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).
Quoted 3 lines
Signed-off-by Ezra Buehler <[email protected]>Reviewed-by Martin Kurbanov <[email protected]>Tested-by Martin Kurbanov <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
PATCH 2/2 mtd: spinand: esmt: Extend IDs to 5 bytes
In reply to Ezra BuehlerFrom: Ezra Buehler <[email protected]>
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.
--- drivers/mtd/nand/spi/esmt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mtd/nand/spi/esmt.c +6 -3
@@ -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,
Signature · 1 line
2.43.0
Re: [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
Quoted 8 lines · Ezra Buehler
From: Ezra Buehler <[email protected]>
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.
Quoted 7 lines
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 <[email protected]>
Tested for F50L1G41LB
Quoted 38 lines
--- drivers/mtd/nand/spi/esmt.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/mtd/nand/spi/esmt.c +6
-3@@ -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,
Signature · 2 lines
Best Regards, Martin Kurbanov
Re: [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
Hi Martin,
Quoted 6 lines · Martin Kurbanov
Tested for F50L1G41LB
Reviewed-by Martin Kurbanov <[email protected]>Tested-by Martin Kurbanov <[email protected]>
Thank you very much for your valuable feedback!
Cheers,
Ezra.
Re: [PATCH 2/2] mtd: spinand: esmt: Extend IDs to 5 bytes
In reply to Ezra BuehlerQuoted 11 lines · Ezra Buehler
From: Ezra Buehler <[email protected]>
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.
Quoted 6 lines
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 <[email protected]>Reviewed-by Martin Kurbanov <[email protected]>Tested-by Martin Kurbanov <[email protected]>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
Hello Ezra!
Thank you for the patch series!
We will test it on the our side with ESMT flash and back to you soon.
Quoted 18 lines · Ezra Buehler
From: Ezra Buehler <[email protected]>
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 bytesdrivers/mtd/nand/spi/esmt.c | 9 ++++++--- include/linux/mtd/spinand.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-)
Signature · 2 lines
Thank you, Dmitry