lkml.org 
[lkml]   [2019]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC v1 3/3] mtd: m25p80: add get Flash size callback support
Date
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(+)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index c50888670250..fd14c8c6d8d8 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -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;

--
2.18.0
\
 
 \ /
  Last update: 2019-07-29 16:28    [W:0.042 / U:0.360 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site