Currently 4-byte adressing mode function is not exported, but since we plan
to use it outside of the SPI NOR core we need to export it.

While we are here, rename it to align the naming with the rest of exported
functions.

Signed-off-by: Robert Marko <robert.ma...@sartura.hr>
---
 drivers/mtd/spi/spi-nor-core.c |  7 +++----
 include/linux/mtd/spi-nor.h    | 10 ++++++++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 8882b045ce..8a64ee40c3 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -682,8 +682,7 @@ static void spi_nor_set_4byte_opcodes(struct spi_nor *nor,
 #endif /* !CONFIG_SPI_FLASH_BAR */
 
 /* Enable/disable 4-byte addressing mode. */
-static int set_4byte(struct spi_nor *nor, const struct flash_info *info,
-                    int enable)
+int spi_nor_set_4byte(struct spi_nor *nor, const struct flash_info *info, int 
enable)
 {
        int status;
        bool need_wren = false;
@@ -3481,7 +3480,7 @@ static int s25_s28_post_bfpt_fixup(struct spi_nor *nor,
         */
        if (params->size > SZ_128M) {
                if (bfpt->dwords[BFPT_DWORD(16)] & BFPT_DWORD16_EX4B_PWRCYC) {
-                       ret = set_4byte(nor, nor->info, 1);
+                       ret = spi_nor_set_4byte(nor, nor->info, 1);
                        if (ret)
                                return ret;
                }
@@ -3915,7 +3914,7 @@ static int spi_nor_init(struct spi_nor *nor)
                 */
                if (nor->flags & SNOR_F_BROKEN_RESET)
                        debug("enabling reset hack; may not recover from 
unexpected reboots\n");
-               set_4byte(nor, nor->info, 1);
+               spi_nor_set_4byte(nor, nor->info, 1);
        }
 
        return 0;
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 80e56cf308..94c0e5e98f 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -646,6 +646,16 @@ static inline int spi_nor_remove(struct spi_nor *nor)
  * Return: 0 for success, -errno for failure.
  */
 int spi_nor_remove(struct spi_nor *nor);
+
+/**
+ * spi_nor_set_4byte() - perform cleanup before booting to the next stage
+ * @nor:       the spi_nor structure
+ * @flash_info:        the flash_info structure
+ * @enable:    enable or disable 4byte mode
+ *
+ * Return: 0 for success, -errno for failure.
+ */
+int spi_nor_set_4byte(struct spi_nor *nor, const struct flash_info *info, int 
enable);
 #endif
 
 #endif
-- 
2.45.0

Reply via email to