[v4,2/3] mtd: spi-nor: Add additional octal-mode page program flags to be checked during SFDP 4BAIT parsing

Message ID 20221202135539.271936-3-nathan.morrison@timesys.com
State New
Headers
Series mtd: spi-nor: Extend SFDP to support additional octal modes as per latest JEDEC standard |

Commit Message

Nathan Barrett-Morrison Dec. 2, 2022, 1:55 p.m. UTC
  This adds some support for automatically searching a chip's SFDP table for:

program commands: 1S-1S-8S, 1S-8S-8S

Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
---
 drivers/mtd/spi-nor/sfdp.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Michael Walle Dec. 2, 2022, 3:16 p.m. UTC | #1
Am 2022-12-02 14:55, schrieb Nathan Barrett-Morrison:
> This adds some support for automatically searching a chip's SFDP table 
> for:
> 
> program commands: 1S-1S-8S, 1S-8S-8S
> 
> Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>

Maybe a bit shorter subject and more text in the commit
message. But I don't care too much.

Reviewed-by: Michael Walle <michael@walle.cc>
  
Tudor Ambarus Dec. 26, 2022, 8:14 a.m. UTC | #2
On 02.12.2022 15:55, Nathan Barrett-Morrison wrote:
> This adds some support for automatically searching a chip's SFDP table for:
you can drop ":"
> 
and this new line
> program commands: 1S-1S-8S, 1S-8S-8S
> 
> Signed-off-by: Nathan Barrett-Morrison <nathan.morrison@timesys.com>
> ---
>   drivers/mtd/spi-nor/sfdp.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
> index e4e87815ba94..e1b7547bf81e 100644
> --- a/drivers/mtd/spi-nor/sfdp.c
> +++ b/drivers/mtd/spi-nor/sfdp.c
> @@ -1089,6 +1089,14 @@ static int spi_nor_parse_4bait(struct spi_nor *nor,
>   		spi_nor_set_pp_settings(&params_pp[SNOR_CMD_PP_1_4_4],
>   					SPINOR_OP_PP_1_4_4_4B,
>   					SNOR_PROTO_1_4_4);
> +	if (pp_hwcaps & SNOR_HWCAPS_PP_1_1_8)
> +		spi_nor_set_pp_settings(&params_pp[SNOR_CMD_PP_1_1_8],
> +					SPINOR_OP_PP_1_1_8_4B,
> +					SNOR_PROTO_1_1_8);
> +	if (pp_hwcaps & SNOR_HWCAPS_PP_1_8_8)
> +		spi_nor_set_pp_settings(&params_pp[SNOR_CMD_PP_1_8_8],
> +					SPINOR_OP_PP_1_8_8_4B,
> +					SNOR_PROTO_1_8_8);

Why did you choose to not add support for reads as well?

>   
>   	for (i = 0; i < SNOR_ERASE_TYPE_MAX; i++) {
>   		if (erase_mask & BIT(i))
  

Patch

diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index e4e87815ba94..e1b7547bf81e 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -1089,6 +1089,14 @@  static int spi_nor_parse_4bait(struct spi_nor *nor,
 		spi_nor_set_pp_settings(&params_pp[SNOR_CMD_PP_1_4_4],
 					SPINOR_OP_PP_1_4_4_4B,
 					SNOR_PROTO_1_4_4);
+	if (pp_hwcaps & SNOR_HWCAPS_PP_1_1_8)
+		spi_nor_set_pp_settings(&params_pp[SNOR_CMD_PP_1_1_8],
+					SPINOR_OP_PP_1_1_8_4B,
+					SNOR_PROTO_1_1_8);
+	if (pp_hwcaps & SNOR_HWCAPS_PP_1_8_8)
+		spi_nor_set_pp_settings(&params_pp[SNOR_CMD_PP_1_8_8],
+					SPINOR_OP_PP_1_8_8_4B,
+					SNOR_PROTO_1_8_8);
 
 	for (i = 0; i < SNOR_ERASE_TYPE_MAX; i++) {
 		if (erase_mask & BIT(i))