2022-02-18 15:50:56

by Tudor Ambarus

[permalink] [raw]
Subject: [PATCH 3/4] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT

Parse BFPT in order to retrieve the byte order in 8D-8D-8D mode.

Signed-off-by: Tudor Ambarus <[email protected]>
---
drivers/mtd/spi-nor/sfdp.c | 3 +++
drivers/mtd/spi-nor/sfdp.h | 1 +
2 files changed, 4 insertions(+)

diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
index a5211543d30d..551edbb039f0 100644
--- a/drivers/mtd/spi-nor/sfdp.c
+++ b/drivers/mtd/spi-nor/sfdp.c
@@ -633,6 +633,9 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
return -EOPNOTSUPP;
}

+ if (bfpt.dwords[BFPT_DWORD(18)] & BFPT_DWORD18_BYTE_ORDER_SWAPPED)
+ nor->flags |= SNOR_F_DTR_BSWAP16;
+
return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt);
}

diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h
index bbf80d2990ab..9a834ea31c16 100644
--- a/drivers/mtd/spi-nor/sfdp.h
+++ b/drivers/mtd/spi-nor/sfdp.h
@@ -97,6 +97,7 @@ struct sfdp_bfpt {
#define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */
#define BFPT_DWORD18_CMD_EXT_RES (0x2UL << 29) /* Reserved */
#define BFPT_DWORD18_CMD_EXT_16B (0x3UL << 29) /* 16-bit opcode */
+#define BFPT_DWORD18_BYTE_ORDER_SWAPPED BIT(31)

struct sfdp_parameter_header {
u8 id_lsb;
--
2.25.1


2022-02-21 08:54:36

by Michael Walle

[permalink] [raw]
Subject: Re: [PATCH 3/4] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT

Am 2022-02-18 15:58, schrieb Tudor Ambarus:
> Parse BFPT in order to retrieve the byte order in 8D-8D-8D mode.
>
> Signed-off-by: Tudor Ambarus <[email protected]>
> ---
> drivers/mtd/spi-nor/sfdp.c | 3 +++
> drivers/mtd/spi-nor/sfdp.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
> index a5211543d30d..551edbb039f0 100644
> --- a/drivers/mtd/spi-nor/sfdp.c
> +++ b/drivers/mtd/spi-nor/sfdp.c
> @@ -633,6 +633,9 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
> return -EOPNOTSUPP;
> }
>
> + if (bfpt.dwords[BFPT_DWORD(18)] & BFPT_DWORD18_BYTE_ORDER_SWAPPED)
> + nor->flags |= SNOR_F_DTR_BSWAP16;
> +
> return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt);
> }
>
> diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h
> index bbf80d2990ab..9a834ea31c16 100644
> --- a/drivers/mtd/spi-nor/sfdp.h
> +++ b/drivers/mtd/spi-nor/sfdp.h
> @@ -97,6 +97,7 @@ struct sfdp_bfpt {
> #define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */
> #define BFPT_DWORD18_CMD_EXT_RES (0x2UL << 29) /* Reserved */
> #define BFPT_DWORD18_CMD_EXT_16B (0x3UL << 29) /* 16-bit opcode */
> +#define BFPT_DWORD18_BYTE_ORDER_SWAPPED BIT(31)
>
> struct sfdp_parameter_header {
> u8 id_lsb;

Reviewed-by: Michael Walle <[email protected]>

-michael

2022-03-02 20:35:09

by Pratyush Yadav

[permalink] [raw]
Subject: Re: [PATCH 3/4] mtd: spi-nor: sfdp: Get the 8D-8D-8D byte order from BFPT

On 18/02/22 04:58PM, Tudor Ambarus wrote:
> Parse BFPT in order to retrieve the byte order in 8D-8D-8D mode.
>
> Signed-off-by: Tudor Ambarus <[email protected]>

Reviewed-by: Pratyush Yadav <[email protected]>

> ---
> drivers/mtd/spi-nor/sfdp.c | 3 +++
> drivers/mtd/spi-nor/sfdp.h | 1 +
> 2 files changed, 4 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c
> index a5211543d30d..551edbb039f0 100644
> --- a/drivers/mtd/spi-nor/sfdp.c
> +++ b/drivers/mtd/spi-nor/sfdp.c
> @@ -633,6 +633,9 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor,
> return -EOPNOTSUPP;
> }
>
> + if (bfpt.dwords[BFPT_DWORD(18)] & BFPT_DWORD18_BYTE_ORDER_SWAPPED)
> + nor->flags |= SNOR_F_DTR_BSWAP16;
> +
> return spi_nor_post_bfpt_fixups(nor, bfpt_header, &bfpt);
> }
>
> diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h
> index bbf80d2990ab..9a834ea31c16 100644
> --- a/drivers/mtd/spi-nor/sfdp.h
> +++ b/drivers/mtd/spi-nor/sfdp.h
> @@ -97,6 +97,7 @@ struct sfdp_bfpt {
> #define BFPT_DWORD18_CMD_EXT_INV (0x1UL << 29) /* Invert */
> #define BFPT_DWORD18_CMD_EXT_RES (0x2UL << 29) /* Reserved */
> #define BFPT_DWORD18_CMD_EXT_16B (0x3UL << 29) /* 16-bit opcode */
> +#define BFPT_DWORD18_BYTE_ORDER_SWAPPED BIT(31)
>
> struct sfdp_parameter_header {
> u8 id_lsb;
> --
> 2.25.1
>

--
Regards,
Pratyush Yadav
Texas Instruments Inc.