mtd: spi-nor: Delay the initialization of bank_size
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 31 Mar 2023 19:46:19 +0000 (21:46 +0200)
committerTudor Ambarus <tudor.ambarus@linaro.org>
Tue, 4 Apr 2023 06:40:38 +0000 (09:40 +0300)
commit79a4db50192c196757e1dffa7f590fc7080ad746
tree845fa823ee263e0bc0236a09661ea6a53cc17702
parent705c9ef831ce505f007d0af3fed2475764619533
mtd: spi-nor: Delay the initialization of bank_size

Bank size is derived from the chip's size, which in
spi_nor_init_default_params() can still be zero if the flash size is
not specified at flash declaration. Let the flash size be updated
by parsing SFDP and do the initialization of the bank size in
spi_nor_late_init_params(). Flashes that don't define the SFDP tables
must specify the flash size at declaration.

Fixes: 9d6c5d64f028 ("mtd: spi-nor: Introduce the concept of bank")
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/r/20230331194620.839899-1-miquel.raynal@bootlin.com
[ta: drop superfluous initialization in spi_nor_init_default_params(),
reword commit message, add Fixes tag.]
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
drivers/mtd/spi-nor/core.c