summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi-nor/core.h
diff options
context:
space:
mode:
authorMichael Walle <mwalle@kernel.org>2023-09-08 12:16:26 +0200
committerTudor Ambarus <tudor.ambarus@linaro.org>2023-09-19 18:49:54 +0300
commite255a79162b6fbf3c62f2883ef9ecd66feb10fb6 (patch)
tree88fd7e69d9f7e7f939652f68f3c5f775bbac792b /drivers/mtd/spi-nor/core.h
parent9983e6da917d7a8e367be05be167b1eeb6c8f120 (diff)
mtd: spi-nor: default .n_banks to 1
If .n_banks is not set in the flash_info database, the default value should be 1. This way, we don't have to always set the .n_banks parameter in flash_info. 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-8-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, 4 insertions, 4 deletions
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 2fc999f2787c..8627d0b95be6 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -15,6 +15,7 @@
* have the page size defined within their SFDP tables.
*/
#define SPI_NOR_DEFAULT_PAGE_SIZE 256
+#define SPI_NOR_DEFAULT_N_BANKS 1
/* Standard SPI NOR flash operations. */
#define SPI_NOR_READID_OP(naddr, ndummy, buf, len) \
@@ -453,7 +454,7 @@ struct spi_nor_fixups {
* @size: the size of the flash in bytes.
* @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.
+ * @n_banks: (optional) the number of banks. Defaults to 1.
* @page_size: (optional) the flash's page size. Defaults to 256.
* @addr_nbytes: number of address bytes to send.
*
@@ -570,7 +571,7 @@ struct flash_info {
/* Used when the "_ext_id" is two bytes at most */
#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors) \
SPI_NOR_ID((_jedec_id), (_ext_id)), \
- SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), 1),
+ SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), 0),
#define INFOB(_jedec_id, _ext_id, _sector_size, _n_sectors, _n_banks) \
SPI_NOR_ID((_jedec_id), (_ext_id)), \
@@ -578,13 +579,12 @@ struct flash_info {
#define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors) \
SPI_NOR_ID6((_jedec_id), (_ext_id)), \
- SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), 1),
+ SPI_NOR_GEOMETRY((_sector_size), (_n_sectors), 0),
#define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_nbytes) \
.size = (_sector_size) * (_n_sectors), \
.sector_size = (_sector_size), \
.page_size = (_page_size), \
- .n_banks = 1, \
.addr_nbytes = (_addr_nbytes), \
.flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, \