@@ -151,6 +151,15 @@ static ssize_t m25p80_read(struct spi_nor *nor, loff_t from, size_t len,
return len;
}
+/* Sending Flash size thourgh callback function to spi layer */
+size_t m25p80_get_flash_size(void *param)
+{
+ struct spi_mem *spimem = param;
+ struct m25p *flash = spi_mem_get_drvdata(spimem);
+
+ return (u32)(flash->spi_nor.mtd.size >> 10) * 1024;
+}
+
/*
* board specific setup should have ensured the SPI clock used here
* matches what the READ command supports, at least until this driver
@@ -188,6 +197,9 @@ static int m25p_probe(struct spi_mem *spimem)
spi_nor_set_flash_node(nor, spi->dev.of_node);
nor->priv = flash;
+ spimem->callback = m25p80_get_flash_size;
+ spimem->callback_param = spimem;
+
spi_mem_set_drvdata(spimem, flash);
flash->spimem = spimem;
Add get Flash size function support for passing Flash size through callback use to the spi layer. Add get Flash size function support Signed-off-by: Tomer Maimon <tmaimon77@gmail.com> --- drivers/mtd/devices/m25p80.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)