From: Ruiqiang Hao <ruiqiang....@windriver.com>

commit 4e35f5591b43 (mtd: spi-nor: Use CLSR command for FL-L chips) and
commit c9d6aaec411f (mtd/spi-nor: enable USE_CLSR capability for Cypress
FL-L product family) are based on kernel v5.15, after commit 51c55506a7b1
(mtd: spi-nor: spansion: convert USE_CLSR to a manufacturer flag), there
will be build issue below. According to this commit to fix it.

drivers/mtd/spi-nor/spansion.c: In function 'spi_nor_s25fl_l_sr_ready':
drivers/mtd/spi-nor/spansion.c:554:26: error: 'SNOR_F_USE_CLSR' undeclared 
(first use in this function)
  554 |         if (nor->flags & SNOR_F_USE_CLSR && sr[1] & (SR_E_ERR | 
SR_P_ERR)) {
      |                          ^~~~~~~~~~~~~~~
drivers/mtd/spi-nor/spansion.c:554:26: note: each undeclared identifier is 
reported only once for each function it appears in
drivers/mtd/spi-nor/spansion.c:560:17: error: implicit declaration of function 
'spi_nor_clear_sr'; did you mean 'spi_nor_read_sr'? 
[-Werror=implicit-function-declaration]
  560 |                 spi_nor_clear_sr(nor);
      |                 ^~~~~~~~~~~~~~~~
      |                 spi_nor_read_sr
drivers/mtd/spi-nor/spansion.c: In function 'spansion_nor_sr_ready_and_clear':
drivers/mtd/spi-nor/spansion.c:588:68: error: too few arguments to function 
'spi_nor_read_id'
  588 |         const struct flash_info *tmpinfo = nor->info ? nor->info : 
spi_nor_read_id(nor);
      |                                                                    
^~~~~~~~~~~~~~~
In file included from drivers/mtd/spi-nor/spansion.c:9:
drivers/mtd/spi-nor/core.h:652:5: note: declared here
  652 | int spi_nor_read_id(struct spi_nor *nor, u8 naddr, u8 ndummy, u8 *id,
      |     ^~~~~~~~~~~~~~~

Signed-off-by: Ruiqiang Hao <ruiqiang....@windriver.com>
---
 drivers/mtd/spi-nor/core.c     |  2 +-
 drivers/mtd/spi-nor/core.h     |  1 +
 drivers/mtd/spi-nor/spansion.c | 15 +++++++++------
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index bde32d0e8e38..dccf4169e301 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -1655,7 +1655,7 @@ static const struct flash_info *spi_nor_match_id(struct 
spi_nor *nor,
        return NULL;
 }
 
-static const struct flash_info *spi_nor_detect(struct spi_nor *nor)
+const struct flash_info *spi_nor_detect(struct spi_nor *nor)
 {
        const struct flash_info *info;
        u8 *id = nor->bouncebuf;
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 290613fd63ae..2f9871751544 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -651,6 +651,7 @@ int spi_nor_sr2_bit1_quad_enable(struct spi_nor *nor);
 int spi_nor_sr2_bit7_quad_enable(struct spi_nor *nor);
 int spi_nor_read_id(struct spi_nor *nor, u8 naddr, u8 ndummy, u8 *id,
                    enum spi_nor_protocol reg_proto);
+const struct flash_info *spi_nor_detect(struct spi_nor *nor);
 int spi_nor_read_sr(struct spi_nor *nor, u8 *sr);
 int spi_nor_sr_ready(struct spi_nor *nor);
 int spi_nor_read_cr(struct spi_nor *nor, u8 *cr);
diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
index b2e220e6b111..18b8f9a564b8 100644
--- a/drivers/mtd/spi-nor/spansion.c
+++ b/drivers/mtd/spi-nor/spansion.c
@@ -441,13 +441,16 @@ static const struct flash_info spansion_nor_parts[] = {
                NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) },
        { "s25fl064l",  INFO(0x016017,      0,  64 * 1024, 128)
                NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
-               FIXUP_FLAGS(SPI_NOR_4B_OPCODES | USE_CLSR) },
+               FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
+               MFR_FLAGS(USE_CLSR) },
        { "s25fl128l",  INFO(0x016018,      0,  64 * 1024, 256)
                NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
-               FIXUP_FLAGS(SPI_NOR_4B_OPCODES | USE_CLSR) },
+               FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
+               MFR_FLAGS(USE_CLSR) },
        { "s25fl256l",  INFO(0x016019,      0,  64 * 1024, 512)
                NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
-               FIXUP_FLAGS(SPI_NOR_4B_OPCODES | USE_CLSR) },
+               FIXUP_FLAGS(SPI_NOR_4B_OPCODES)
+               MFR_FLAGS(USE_CLSR) },
        { "s25hl512t",  INFO6(0x342a1a, 0x0f0390, 256 * 1024, 256)
                PARSE_SFDP
                MFR_FLAGS(USE_CLSR)
@@ -551,13 +554,13 @@ static int spi_nor_s25fl_l_sr_ready(struct spi_nor *nor)
        if (ret)
                return ret;
 
-       if (nor->flags & SNOR_F_USE_CLSR && sr[1] & (SR_E_ERR | SR_P_ERR)) {
+       if (nor->info->mfr_flags & USE_CLSR && sr[1] & (SR_E_ERR | SR_P_ERR)) {
                if (sr[1] & SR_E_ERR)
                        dev_err(nor->dev, "Erase Error occurred\n");
                else
                        dev_err(nor->dev, "Programming Error occurred\n");
 
-               spi_nor_clear_sr(nor);
+               spansion_nor_clear_sr(nor);
 
                /*
                 * WEL bit remains set to one when an erase or page program
@@ -585,7 +588,7 @@ static int spi_nor_s25fl_l_sr_ready(struct spi_nor *nor)
 static int spansion_nor_sr_ready_and_clear(struct spi_nor *nor)
 {
        int ret;
-       const struct flash_info *tmpinfo = nor->info ? nor->info : 
spi_nor_read_id(nor);
+       const struct flash_info *tmpinfo = nor->info ? nor->info : 
spi_nor_detect(nor);
 
        if (IS_ERR_OR_NULL(tmpinfo))
                return -ENOENT;
-- 
2.35.5

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12883): 
https://lists.yoctoproject.org/g/linux-yocto/message/12883
Mute This Topic: https://lists.yoctoproject.org/mt/100271681/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to