Skip to content

Commit f151876

Browse files
ambarusvarshini-rajendran
authored andcommitted
mtd: spi-nor: core: Introduce SPI_NOR_DTR_BSWAP16 no_sfdp_flag
Introduce SPI_NOR_DTR_BSWAP16 flag for flashes that don't define the mandatory BFPT table. When set it indicates that the byte order of 16-bit words is swapped when read in 8D-8D-8D mode compared to 1-1-1 mode. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
1 parent b740cb6 commit f151876

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/mtd/spi-nor/core.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2776,7 +2776,7 @@ static void spi_nor_no_sfdp_init_params(struct spi_nor *nor)
27762776
{
27772777
struct spi_nor_flash_parameter *params = nor->params;
27782778
struct spi_nor_erase_map *map = &params->erase_map;
2779-
const u8 no_sfdp_flags = nor->info->no_sfdp_flags;
2779+
const u16 no_sfdp_flags = nor->info->no_sfdp_flags;
27802780
u8 i, erase_mask;
27812781

27822782
if (no_sfdp_flags & SPI_NOR_DUAL_READ) {
@@ -2817,6 +2817,9 @@ static void spi_nor_no_sfdp_init_params(struct spi_nor *nor)
28172817
SPINOR_OP_PP, SNOR_PROTO_8_8_8_DTR);
28182818
}
28192819

2820+
if (no_sfdp_flags & SPI_NOR_DTR_BSWAP16)
2821+
nor->flags |= SNOR_F_DTR_BSWAP16;
2822+
28202823
/*
28212824
* Sector Erase settings. Sort Erase Types in ascending order, with the
28222825
* smallest erase size starting at BIT(0).

drivers/mtd/spi-nor/core.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,8 @@ struct spi_nor_fixups {
484484
* SPI_NOR_OCTAL_READ: flash supports Octal Read.
485485
* SPI_NOR_OCTAL_DTR_READ: flash supports octal DTR Read.
486486
* SPI_NOR_OCTAL_DTR_PP: flash supports Octal DTR Page Program.
487+
* SPI_NOR_DTR_BSWAP16: the byte order of 16-bit words is swapped when
488+
* read or written in DTR mode compared to STR mode.
487489
*
488490
* @fixup_flags: flags that indicate support that can be discovered via SFDP
489491
* ideally, but can not be discovered for this particular flash
@@ -528,14 +530,15 @@ struct flash_info {
528530
#define SPI_NOR_QUAD_PP BIT(9)
529531
#define SPI_NOR_RWW BIT(10)
530532

531-
u8 no_sfdp_flags;
533+
u16 no_sfdp_flags;
532534
#define SPI_NOR_SKIP_SFDP BIT(0)
533535
#define SECT_4K BIT(1)
534536
#define SPI_NOR_DUAL_READ BIT(3)
535537
#define SPI_NOR_QUAD_READ BIT(4)
536538
#define SPI_NOR_OCTAL_READ BIT(5)
537539
#define SPI_NOR_OCTAL_DTR_READ BIT(6)
538540
#define SPI_NOR_OCTAL_DTR_PP BIT(7)
541+
#define SPI_NOR_DTR_BSWAP16 BIT(8)
539542

540543
u8 fixup_flags;
541544
#define SPI_NOR_4B_OPCODES BIT(0)

0 commit comments

Comments
 (0)