mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon SEMPER flash
Subsystems (3)
v3 cover mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon SEMPER flash
From: Takahiro Kuwano <[email protected]>
Infineon(Cypress) SEMPER NOR flash family has on-die ECC and its program granularity is 16-byte ECC data unit size. JFFS2 supports write buffer mode for ECC'd NOR flash. To activate it, MTD_BIT_WRITEABLE needs to be unset in mtd->flags. In this series, a new SNOR_F_ECC flag is introduced and fixups for SEMPER flash pats set it.
Changes in v3
- Split to three patches
Changes in v2
- Introduce SNOR_F_ECC flag
- Add fixes tag and Cc stable
Takahiro Kuwano (3):
mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s28hx
SEMPER flash
mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s25hx
SEMPER flash
mtd: spi-nor: spansion: Enable JFFS2 write buffer for S25FS256T
drivers/mtd/spi-nor/core.c | 3 +++ drivers/mtd/spi-nor/core.h | 1 + drivers/mtd/spi-nor/debugfs.c | 1 + drivers/mtd/spi-nor/spansion.c | 28 +++++++++++++++------------- 4 files changed, 20 insertions(+), 13 deletions(-)
Signature · 6 lines
2.34.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
PATCH v3 1/3 mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s28hx SEMPER flash
From: Takahiro Kuwano <[email protected]>
Infineon(Cypress) SEMPER NOR flash family has on-die ECC and its program granularity is 16-byte ECC data unit size. JFFS2 supports write buffer mode for ECC'd NOR flash. Provide a way to clear the MTD_BIT_WRITEABLE flag in order to enable JFFS2 write buffer mode support.
A new SNOR_F_ECC flag is introduced to determine if the part has on-die ECC and if it has, MTD_BIT_WRITEABLE is unset.
In vendor specific driver, a common cypress_nor_ecc_init() helper is added. This helper takes care for ECC related initialization for SEMPER flash family by setting up params->writesize and SNOR_F_ECC.
--- drivers/mtd/spi-nor/core.c | 3 +++ drivers/mtd/spi-nor/core.h | 1 + drivers/mtd/spi-nor/debugfs.c | 1 + drivers/mtd/spi-nor/spansion.c | 13 ++++++++++++- 4 files changed, 17 insertions(+), 1 deletion(-)
drivers/mtd/spi-nor/core.c +3 -0
@@ -3407,6 +3407,9 @@ static void spi_nor_set_mtd_info(struct spi_nor *nor) mtd->name =dev_name (dev); mtd->type =MTD_NORFLASH ; mtd->flags =MTD_CAP_NORFLASH ; +/* Unset BIT_WRITEABLE to enable JFFS2 write buffer for ECC'd NOR */ +if (nor->flags &SNOR_F_ECC ) + mtd->flags &= ~MTD_BIT_WRITEABLE ;if (nor->info->flags &SPI_NOR_NO_ERASE ) mtd->flags |=MTD_NO_ERASE ;else
drivers/mtd/spi-nor/core.h +1 -0
@@ -131,6 +131,7 @@ enum spi_nor_option_flags {SNOR_F_SOFT_RESET =BIT (12 ),SNOR_F_SWP_IS_VOLATILE =BIT (13 ),SNOR_F_RWW =BIT (14 ), + SNOR_F_ECC = BIT(15), }; struct spi_nor_read_command {
drivers/mtd/spi-nor/debugfs.c +1 -0
@@ -26,6 +26,7 @@ static const char *const snor_f_names[] = {SNOR_F_NAME (SOFT_RESET ),SNOR_F_NAME (SWP_IS_VOLATILE ),SNOR_F_NAME (RWW ), + SNOR_F_NAME(ECC), };#undef SNOR_F_NAME
drivers/mtd/spi-nor/spansion.c +12 -1
@@ -332,6 +332,17 @@ static int cypress_nor_set_page_size(struct spi_nor *nor)return 0 ; } +static void cypress_nor_ecc_init (struct spi_nor *nor) +{ +/* +* Programming is supported only in 16-byte ECC data unit granularity. +* Byte-programming, bit-walking, or multiple program operations to the +* same ECC data unit without an erase are not allowed. +*/ + nor->params->writesize =16 ; + nor->flags |=SNOR_F_ECC ; +} + static int s25fs256t_post_bfpt_fixup(struct spi_nor *nor, const struct sfdp_parameter_header *bfpt_header,
@@ -506,7 +517,7 @@ static int s28hx_t_post_bfpt_fixup(struct spi_nor *nor,static void s28hx_t_late_init (struct spi_nor *nor) { nor->params->octal_dtr_enable = cypress_nor_octal_dtr_enable; - nor->params->writesize =16 ; +cypress_nor_ecc_init (nor); }static const struct spi_nor_fixups s28hx_t_fixups = {
Signature · 1 line
2.34.1
PATCH v3 2/3 mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s25hx SEMPER flash
In reply to [email protected]From: Takahiro Kuwano <[email protected]>
Infineon(Cypress) SEMPER NOR flash family has on-die ECC and its program granularity is 16-byte ECC data unit size. JFFS2 supports write buffer mode for ECC'd NOR flash. Provide a way to clear the MTD_BIT_WRITEABLE flag in order to enable JFFS2 write buffer mode support.
--- drivers/mtd/spi-nor/spansion.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mtd/spi-nor/spansion.c +2 -5
@@ -442,13 +442,10 @@ static void s25hx_t_post_sfdp_fixup(struct spi_nor *nor)static void s25hx_t_late_init (struct spi_nor *nor) { -struct spi_nor_flash_parameter *params = nor->params; -/* Fast Read 4B requires mode cycles */ - params->reads[SNOR_CMD_READ_FAST ].num_mode_clocks =8 ; + nor->params->reads[SNOR_CMD_READ_FAST ].num_mode_clocks =8 ; -/* The writesize should be ECC data unit size */ - params->writesize =16 ; +cypress_nor_ecc_init (nor); }static struct spi_nor_fixups s25hx_t_fixups = {
Signature · 1 line
2.34.1
PATCH v3 3/3 mtd: spi-nor: spansion: Enable JFFS2 write buffer for S25FS256T
In reply to [email protected]From: Takahiro Kuwano <[email protected]>
Infineon(Cypress) SEMPER NOR flash family has on-die ECC and its program granularity is 16-byte ECC data unit size. JFFS2 supports write buffer mode for ECC'd NOR flash. Provide a way to clear the MTD_BIT_WRITEABLE flag in order to enable JFFS2 write buffer mode support. Drop the comment as the same info is now specified in cypress_nor_ecc_init().
--- drivers/mtd/spi-nor/spansion.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/mtd/spi-nor/spansion.c +1 -7
@@ -384,13 +384,7 @@ static void s25fs256t_post_sfdp_fixup(struct spi_nor *nor)static void s25fs256t_late_init (struct spi_nor *nor) { -/* -* Programming is supported only in 16-byte ECC data unit granularity. -* Byte-programming, bit-walking, or multiple program operations to the -* same ECC data unit without an erase are not allowed. See chapter -* 5.3.1 and 5.6 in the datasheet. -*/ - nor->params->writesize =16 ; +cypress_nor_ecc_init (nor); }static struct spi_nor_fixups s25fs256t_fixups = {
Signature · 1 line
2.34.1
Tudor Ambarus
AppliedQuoted 10 lines · On Thu, 06 Apr 2023 15:17:43 +0900, [email protected] wrote:
Infineon(Cypress) SEMPER NOR flash family has on-die ECC and its program granularity is 16-byte ECC data unit size. JFFS2 supports write buffer mode for ECC'd NOR flash. To activate it,
MTD_BIT_WRITEABLEneeds to be unset inmtd->flags. In this series, a newSNOR_F_ECCflag is introduced and fixups for SEMPER flash pats set it.Changes in v3
- Split to three patches[...]
Applied to git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git,
spi-nor/next branch. Thanks!
[1/3] mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s28hx SEMPER flash
https://git.kernel.org/mtd/c/9fd0945fe6fa [2/3] mtd: spi-nor: spansion: Enable JFFS2 write buffer for Infineon s25hx SEMPER flash https://git.kernel.org/mtd/c/4199c1719e24 [3/3] mtd: spi-nor: spansion: Enable JFFS2 write buffer for S25FS256T https://git.kernel.org/mtd/c/a9180c298d35
Cheers,
Signature · 5 lines
Tudor Ambarus <[email protected]> ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/