[U-Boot] [PATCH 1/3] mtd: spi: export functions to sf_internal.h

Horatiu Vultur horatiu.vultur at microchip.com
Wed Jan 16 12:07:53 UTC 2019


Expose the following functions: clean_bar, write_bar, spi_flash_std_write,
spi_flash_std_erase and spi_flash_std_probe to sf_internal.h to be able to
reuse them.

Cc: Jagan Teki <jagan at amarulasolutions.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur at microchip.com>
---
 drivers/mtd/spi/sf_internal.h | 8 ++++++++
 drivers/mtd/spi/sf_probe.c    | 8 ++++----
 drivers/mtd/spi/spi_flash.c   | 4 ++--
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 46a5044..69968c5 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -224,6 +224,14 @@ int spi_flash_read_common(struct spi_flash *flash, const u8 *cmd,
 int spi_flash_cmd_read_ops(struct spi_flash *flash, u32 offset,
 		size_t len, void *data);
 
+int clean_bar(struct spi_flash *flash);
+int write_bar(struct spi_flash *flash, u32 offset);
+
+int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
+			const void *buf);
+int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len);
+int spi_flash_std_probe(struct udevice *dev);
+
 #ifdef CONFIG_SPI_FLASH_MTD
 int spi_flash_mtd_register(struct spi_flash *flash);
 void spi_flash_mtd_unregister(void);
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 00f8558..4ddb3ce 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -100,8 +100,8 @@ static int spi_flash_std_read(struct udevice *dev, u32 offset, size_t len,
 	return log_ret(spi_flash_cmd_read_ops(flash, offset, len, buf));
 }
 
-static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
-			       const void *buf)
+int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
+			const void *buf)
 {
 	struct spi_flash *flash = dev_get_uclass_priv(dev);
 
@@ -117,7 +117,7 @@ static int spi_flash_std_write(struct udevice *dev, u32 offset, size_t len,
 	return spi_flash_cmd_write_ops(flash, offset, len, buf);
 }
 
-static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
+int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len)
 {
 	struct spi_flash *flash = dev_get_uclass_priv(dev);
 
@@ -131,7 +131,7 @@ static int spi_flash_std_get_sw_write_prot(struct udevice *dev)
 	return spi_flash_cmd_get_sw_write_prot(flash);
 }
 
-static int spi_flash_std_probe(struct udevice *dev)
+int spi_flash_std_probe(struct udevice *dev)
 {
 	struct spi_slave *slave = dev_get_parent_priv(dev);
 	struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev);
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 0c2392f..536f0a1 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -133,7 +133,7 @@ int spi_flash_cmd_get_sw_write_prot(struct spi_flash *flash)
  * Otherwise, the BA24 bit may be left set and then after reset, the
  * ROM would read/write/erase SPL from 16 MiB * bank_sel address.
  */
-static int clean_bar(struct spi_flash *flash)
+int clean_bar(struct spi_flash *flash)
 {
 	u8 cmd, bank_sel = 0;
 
@@ -145,7 +145,7 @@ static int clean_bar(struct spi_flash *flash)
 	return spi_flash_write_common(flash, &cmd, 1, &bank_sel, 1);
 }
 
-static int write_bar(struct spi_flash *flash, u32 offset)
+int write_bar(struct spi_flash *flash, u32 offset)
 {
 	u8 cmd, bank_sel;
 	int ret;
-- 
2.7.4



More information about the U-Boot mailing list