From: Patrick Delaunay <patrick.delaunay@foss.st.com>
To: <u-boot@lists.denx.de>
Cc: "Pali Rohár" <pali@kernel.org>, "Marek Vasut" <marex@denx.de>,
"Jagan Teki" <jagan@amarulasolutions.com>,
"Christophe KERELLO" <christophe.kerello@foss.st.com>,
"Miquel Raynal" <miquel.raynal@bootlin.com>,
"Priyanka Jain" <priyanka.jain@nxp.com>,
"Patrice Chotard" <patrice.chotard@foss.st.com>,
"Heiko Schocher" <hs@denx.de>,
"Patrick Delaunay" <patrick.delaunay@foss.st.com>,
"U-Boot STM32" <uboot-stm32@st-md-mailman.stormreply.com>
Subject: [PATCH v4 1/2] mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported
Date: Wed, 22 Sep 2021 18:29:07 +0200 [thread overview]
Message-ID: <20210922182841.v4.1.I81b4f1edfe925b001299e3b7ba0cf602d9268d59@changeid> (raw)
In-Reply-To: <20210922162909.1857566-1-patrick.delaunay@foss.st.com>
When CONFIG_SYS_MAX_FLASH_BANKS_DETECT is activated,
CONFIG_SYS_MAX_FLASH_BANKS is replaced by cfi_flash_num_flash_banks,
but this variable is defined in drivers/mtd/cfi_flash.c, which is
compiled only when CONFIG_FLASH_CFI_DRIVER is activated, in U-Boot
or in SPL when CONFIG_SPL_MTD_SUPPORT is activated.
This patch deactivates this feature CONFIG_SYS_MAX_FLASH_BANKS_DETECT
when flash cfi driver is not activated to avoid compilation issue in
the next patch, when CONFIG_SYS_MAX_FLASH_BANKS is used in spi_nor_scan().
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
see error in
https://source.denx.de/u-boot/custodians/u-boot-stm/-/pipelines/9138
drivers/mtd/spi/spi-nor-core.o: in function `spi_nor_scan':
drivers/mtd/spi/spi-nor-core.c:3672:
undefined reference to `cfi_flash_num_flash_banks'
compilation issue for the boards:
- j721e_hs_evm_r5
- j721e_evm_r5j
- j721e_hs_evm_a72
- j721e_evm_a72
- sagem_f@st1704_ram
(no changes since v3)
Changes in v3:
- NEW: solve compilation issue when CONFIG_SYS_MAX_FLASH_BANKS is used
include/mtd/cfi_flash.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h
index 4963c89642..a1af6fc200 100644
--- a/include/mtd/cfi_flash.h
+++ b/include/mtd/cfi_flash.h
@@ -157,11 +157,17 @@ struct cfi_pri_hdr {
* Use CONFIG_SYS_MAX_FLASH_BANKS_DETECT if defined
*/
#if defined(CONFIG_SYS_MAX_FLASH_BANKS_DETECT)
-#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks)
#define CFI_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+/* map to cfi_flash_num_flash_banks only when supported */
+#if IS_ENABLED(CONFIG_FLASH_CFI_DRIVER) && \
+ (!IS_ENABLED(CONFIG_SPL_BUILD) || IS_ENABLED(CONFIG_SPL_MTD_SUPPORT))
+#define CONFIG_SYS_MAX_FLASH_BANKS (cfi_flash_num_flash_banks)
/* board code can update this variable before CFI detection */
extern int cfi_flash_num_flash_banks;
#else
+#define CONFIG_SYS_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS_DETECT
+#endif
+#else
#define CFI_MAX_FLASH_BANKS CONFIG_SYS_MAX_FLASH_BANKS
#endif
--
2.25.1
next prev parent reply other threads:[~2021-09-22 16:29 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 16:29 [PATCH v4 0/2] mtd: spi: nor: force mtd name to "nor%d" Patrick Delaunay
2021-09-22 16:29 ` Patrick Delaunay [this message]
2021-09-28 18:45 ` [PATCH v4 1/2] mtd: cfi_flash: use cfi_flash_num_flash_banks only when supported Tom Rini
2021-09-22 16:29 ` [PATCH v4 2/2] mtd: spi: nor: force mtd name to "nor%d" Patrick Delaunay
2021-09-28 18:45 ` Tom Rini
2021-09-22 17:29 ` [PATCH v4 0/2] " Marek Behún
2021-09-22 18:24 ` Marek Vasut
2021-09-22 18:42 ` Tom Rini
2021-09-22 19:08 ` Marek Behún
2021-09-22 19:12 ` Marek Vasut
2021-09-22 19:05 ` Marek Behún
2021-09-22 19:23 ` Tom Rini
2021-09-22 19:39 ` Marek Vasut
2021-09-22 19:24 ` Marek Vasut
2021-09-22 19:41 ` Tom Rini
2021-09-22 19:42 ` Tom Rini
2021-09-22 19:46 ` Tom Rini
2021-09-22 19:56 ` Marek Vasut
2021-09-22 20:00 ` Tom Rini
2021-09-23 1:32 ` Marek Vasut
2021-09-23 9:04 ` Patrick DELAUNAY
2021-09-24 18:22 ` Tom Rini
2021-09-24 19:25 ` Marek Behún
2021-09-24 20:09 ` Marek Vasut
2021-09-25 0:12 ` Marek Behún
2021-09-25 3:06 ` Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210922182841.v4.1.I81b4f1edfe925b001299e3b7ba0cf602d9268d59@changeid \
--to=patrick.delaunay@foss.st.com \
--cc=christophe.kerello@foss.st.com \
--cc=hs@denx.de \
--cc=jagan@amarulasolutions.com \
--cc=marex@denx.de \
--cc=miquel.raynal@bootlin.com \
--cc=pali@kernel.org \
--cc=patrice.chotard@foss.st.com \
--cc=priyanka.jain@nxp.com \
--cc=u-boot@lists.denx.de \
--cc=uboot-stm32@st-md-mailman.stormreply.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).