summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi-nor/core.h
diff options
context:
space:
mode:
authorMichael Walle <mwalle@kernel.org>2023-09-08 13:16:24 +0300
committerTudor Ambarus <tudor.ambarus@linaro.org>2023-09-19 18:49:39 +0300
commitd0cfd228b34c125b76a9a7fd2d69ebf9ff7e5534 (patch)
treecf87ac733343dc0c534a04b37c096fa81e3737c6 /drivers/mtd/spi-nor/core.h
parent0554effe99f6e9383172b091a3c4c7fd1ed3ef58 (diff)
downloadlinux-d0cfd228b34c125b76a9a7fd2d69ebf9ff7e5534.tar.xz
mtd: spi-nor: default page_size to 256 bytes
The INFO() macro always set the page_size to 256 bytes. Make that an optional parameter. This default is a sane one for all older flashes, newer ones will set the page size by its SFDP tables anyway. Signed-off-by: Michael Walle <mwalle@kernel.org> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20230807-mtd-flash-info-db-rework-v3-6-e60548861b10@kernel.org Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
Diffstat (limited to 'drivers/mtd/spi-nor/core.h')
-rw-r--r--drivers/mtd/spi-nor/core.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 12c35409493b..25bc18197614 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -10,6 +10,11 @@
#include "sfdp.h"
#define SPI_NOR_MAX_ID_LEN 6
+/*
+ * 256 bytes is a sane default for most older flashes. Newer flashes will
+ * have the page size defined within their SFDP tables.
+ */
+#define SPI_NOR_DEFAULT_PAGE_SIZE 256
/* Standard SPI NOR flash operations. */
#define SPI_NOR_READID_OP(naddr, ndummy, buf, len) \
@@ -447,7 +452,7 @@ struct spi_nor_fixups {
* @sector_size: the size listed here is what works with SPINOR_OP_SE, which
* isn't necessarily called a "sector" by the vendor.
* @n_banks: the number of banks.
- * @page_size: the flash's page size.
+ * @page_size: (optional) the flash's page size. Defaults to 256.
* @addr_nbytes: number of address bytes to send.
*
* @parse_sfdp: true when flash supports SFDP tables. The false value has no
@@ -558,7 +563,6 @@ struct flash_info {
#define SPI_NOR_GEOMETRY(_sector_size, _n_sectors, _n_banks) \
.size = (_sector_size) * (_n_sectors), \
.sector_size = (_sector_size), \
- .page_size = 256, \
.n_banks = (_n_banks)
/* Used when the "_ext_id" is two bytes at most */