diff mbox series

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

Message ID 1547640475-26939-2-git-send-email-horatiu.vultur@microchip.com
State Deferred
Delegated to: Daniel Schwierzeck
Headers show
Series mtd: spi: Add MSCC SPI flash driver | expand

Commit Message

Horatiu Vultur Jan. 16, 2019, 12:07 p.m. UTC
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@amarulasolutions.com>
Signed-off-by: Horatiu Vultur <horatiu.vultur@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(-)

Comments

Daniel Schwierzeck Jan. 16, 2019, 2:07 p.m. UTC | #1
Am 16.01.19 um 13:07 schrieb Horatiu Vultur:
> 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@amarulasolutions.com>
> Signed-off-by: Horatiu Vultur <horatiu.vultur@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(-)
> 

maybe you should wait with this series as there is on-going work to
import spi-nor from Linux [1]

[1] https://lists.denx.de/pipermail/u-boot/2018-December/350565.html
Horatiu Vultur Jan. 17, 2019, 12:13 p.m. UTC | #2
Hi Daniel,

The 01/16/2019 15:07, Daniel Schwierzeck wrote:
> 
> 
> Am 16.01.19 um 13:07 schrieb Horatiu Vultur:
> > 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@amarulasolutions.com>
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@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(-)
> > 
> 
> maybe you should wait with this series as there is on-going work to
> import spi-nor from Linux [1]
> 
> [1] https://lists.denx.de/pipermail/u-boot/2018-December/350565.html
> 

That is perfectly fine for me, I will submit another patch after the
spi-nor series is accepted. Thank you.

> -- 
> - Daniel
diff mbox series

Patch

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;