Skip to content

Commit 2d95d13

Browse files
mwallePratyush Yadav
authored andcommitted
mtd: spi-nor: get rid of SPI_NOR_NO_FR
The Everspin FRAM devices are the only user of the NO_FR flag. Drop the global flag and instead use a manufacturer fixup for the Everspin flashes to drop the fast read support. Signed-off-by: Michael Walle <[email protected]> Reviewed-by: Tudor Ambarus <[email protected]> Reviewed-by: Pratyush Yadav <[email protected]> [[email protected]: s/evervision/everspin/g in code and commit message] Signed-off-by: Pratyush Yadav <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent d323a41 commit 2d95d13

File tree

3 files changed

+17
-13
lines changed

3 files changed

+17
-13
lines changed

drivers/mtd/spi-nor/core.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,15 +2923,10 @@ static void spi_nor_init_default_params(struct spi_nor *nor)
29232923
params->page_size = info->page_size ?: SPI_NOR_DEFAULT_PAGE_SIZE;
29242924
params->n_banks = info->n_banks ?: SPI_NOR_DEFAULT_N_BANKS;
29252925

2926-
if (!(info->flags & SPI_NOR_NO_FR)) {
2927-
/* Default to Fast Read for DT and non-DT platform devices. */
2926+
/* Default to Fast Read for non-DT and enable it if requested by DT. */
2927+
if (!np || of_property_read_bool(np, "m25p,fast-read"))
29282928
params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST;
29292929

2930-
/* Mask out Fast Read if not requested at DT instantiation. */
2931-
if (np && !of_property_read_bool(np, "m25p,fast-read"))
2932-
params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST;
2933-
}
2934-
29352930
/* (Fast) Read settings. */
29362931
params->hwcaps.mask |= SNOR_HWCAPS_READ;
29372932
spi_nor_set_read_settings(&params->reads[SNOR_CMD_READ],

drivers/mtd/spi-nor/core.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,6 @@ struct spi_nor_id {
470470
* Usually these will power-up in a write-protected
471471
* state.
472472
* SPI_NOR_NO_ERASE: no erase command needed.
473-
* SPI_NOR_NO_FR: can't do fastread.
474473
* SPI_NOR_QUAD_PP: flash supports Quad Input Page Program.
475474
* SPI_NOR_RWW: flash supports reads while write.
476475
*
@@ -519,7 +518,6 @@ struct flash_info {
519518
#define SPI_NOR_BP3_SR_BIT6 BIT(4)
520519
#define SPI_NOR_SWP_IS_VOLATILE BIT(5)
521520
#define SPI_NOR_NO_ERASE BIT(6)
522-
#define SPI_NOR_NO_FR BIT(7)
523521
#define SPI_NOR_QUAD_PP BIT(8)
524522
#define SPI_NOR_RWW BIT(9)
525523

drivers/mtd/spi-nor/everspin.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,39 @@ static const struct flash_info everspin_nor_parts[] = {
1414
.size = SZ_16K,
1515
.sector_size = SZ_16K,
1616
.addr_nbytes = 2,
17-
.flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR,
17+
.flags = SPI_NOR_NO_ERASE,
1818
}, {
1919
.name = "mr25h256",
2020
.size = SZ_32K,
2121
.sector_size = SZ_32K,
2222
.addr_nbytes = 2,
23-
.flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR,
23+
.flags = SPI_NOR_NO_ERASE,
2424
}, {
2525
.name = "mr25h10",
2626
.size = SZ_128K,
2727
.sector_size = SZ_128K,
28-
.flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR,
28+
.flags = SPI_NOR_NO_ERASE,
2929
}, {
3030
.name = "mr25h40",
3131
.size = SZ_512K,
3232
.sector_size = SZ_512K,
33-
.flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR,
33+
.flags = SPI_NOR_NO_ERASE,
3434
}
3535
};
3636

37+
static void everspin_nor_default_init(struct spi_nor *nor)
38+
{
39+
/* Everspin FRAMs don't support the fast read opcode. */
40+
nor->params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST;
41+
}
42+
43+
static const struct spi_nor_fixups everspin_nor_fixups = {
44+
.default_init = everspin_nor_default_init,
45+
};
46+
3747
const struct spi_nor_manufacturer spi_nor_everspin = {
3848
.name = "everspin",
3949
.parts = everspin_nor_parts,
4050
.nparts = ARRAY_SIZE(everspin_nor_parts),
51+
.fixups = &everspin_nor_fixups,
4152
};

0 commit comments

Comments
 (0)