mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
mtd: spi-nor: core: Introduce flash_info mfr_flags
Used in the manufacturer fixup hooks to differentiate support between flashes of the same manufacturer. Not used in the SPI NOR core. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Michael Walle <michael@walle.cc> Reviewed-by: Pratyush Yadav <p.yadav@ti.com> Link: https://lore.kernel.org/r/20211207140254.87681-6-tudor.ambarus@microchip.com
This commit is contained in:
parent
5273cc6df9
commit
7683b39d60
@ -336,7 +336,6 @@ struct flash_info {
|
||||
u32 flags;
|
||||
#define SECT_4K BIT(0) /* SPINOR_OP_BE_4K works uniformly */
|
||||
#define SPI_NOR_NO_ERASE BIT(1) /* No erase command needed */
|
||||
#define SST_WRITE BIT(2) /* use SST byte programming */
|
||||
#define SPI_NOR_NO_FR BIT(3) /* Can't do fastread */
|
||||
#define SECT_4K_PMC BIT(4) /* SPINOR_OP_BE_4K_PMC works uniformly */
|
||||
#define SPI_NOR_DUAL_READ BIT(5) /* Flash supports Dual Read */
|
||||
@ -385,6 +384,12 @@ struct flash_info {
|
||||
* protection bits. Usually these will
|
||||
* power-up in a write-protected state.
|
||||
*/
|
||||
u8 mfr_flags; /*
|
||||
* Manufacturer private flags. Used in
|
||||
* the manufacturer fixup hooks to
|
||||
* differentiate support between flashes
|
||||
* of the same manufacturer.
|
||||
*/
|
||||
|
||||
const struct spi_nor_otp_organization otp_org;
|
||||
|
||||
@ -450,6 +455,9 @@ struct flash_info {
|
||||
.n_regions = (_n_regions), \
|
||||
},
|
||||
|
||||
#define MFR_FLAGS(_mfr_flags) \
|
||||
.mfr_flags = (_mfr_flags), \
|
||||
|
||||
/**
|
||||
* struct spi_nor_manufacturer - SPI NOR manufacturer object
|
||||
* @name: manufacturer name
|
||||
|
@ -8,6 +8,9 @@
|
||||
|
||||
#include "core.h"
|
||||
|
||||
/* SST flash_info mfr_flag. Used to specify SST byte programming. */
|
||||
#define SST_WRITE BIT(0)
|
||||
|
||||
#define SST26VF_CR_BPNV BIT(3)
|
||||
|
||||
static int sst26vf_lock(struct spi_nor *nor, loff_t ofs, uint64_t len)
|
||||
@ -58,28 +61,46 @@ static const struct spi_nor_fixups sst26vf_fixups = {
|
||||
static const struct flash_info sst_parts[] = {
|
||||
/* SST -- large erase sizes are "overlays", "sectors" are 4K */
|
||||
{ "sst25vf040b", INFO(0xbf258d, 0, 64 * 1024, 8,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25vf080b", INFO(0xbf258e, 0, 64 * 1024, 16,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25vf016b", INFO(0xbf2541, 0, 64 * 1024, 32,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25vf032b", INFO(0xbf254a, 0, 64 * 1024, 64,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25vf064c", INFO(0xbf254b, 0, 64 * 1024, 128,
|
||||
SECT_4K | SPI_NOR_4BIT_BP | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE) },
|
||||
{ "sst25wf512", INFO(0xbf2501, 0, 64 * 1024, 1,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25wf010", INFO(0xbf2502, 0, 64 * 1024, 2,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25wf020", INFO(0xbf2503, 0, 64 * 1024, 4,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25wf020a", INFO(0x621612, 0, 64 * 1024, 4, SECT_4K | SPI_NOR_HAS_LOCK) },
|
||||
{ "sst25wf040b", INFO(0x621613, 0, 64 * 1024, 8, SECT_4K | SPI_NOR_HAS_LOCK) },
|
||||
{ "sst25wf040", INFO(0xbf2504, 0, 64 * 1024, 8,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst25wf080", INFO(0xbf2505, 0, 64 * 1024, 16,
|
||||
SECT_4K | SST_WRITE | SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE) },
|
||||
SECT_4K | SPI_NOR_HAS_LOCK |
|
||||
SPI_NOR_SWP_IS_VOLATILE)
|
||||
MFR_FLAGS(SST_WRITE) },
|
||||
{ "sst26wf016b", INFO(0xbf2651, 0, 64 * 1024, 32,
|
||||
SECT_4K | SPI_NOR_DUAL_READ |
|
||||
SPI_NOR_QUAD_READ) },
|
||||
@ -179,7 +200,7 @@ out:
|
||||
|
||||
static void sst_late_init(struct spi_nor *nor)
|
||||
{
|
||||
if (nor->info->flags & SST_WRITE)
|
||||
if (nor->info->mfr_flags & SST_WRITE)
|
||||
nor->mtd._write = sst_write;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user