diff mbox

[U-Boot] board: nios2: Check if flash is configured before calling early_flash_cmd_reset()

Message ID 1390904346-19294-1-git-send-email-ezequiel.garcia@free-electrons.com
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Ezequiel Garcia Jan. 28, 2014, 10:19 a.m. UTC
If CONFIG_CFI_FLASH_MTD is not defined, then we shouldn't perform the
flash early reset.

This commit fixes the following build error:

  nios2-generic.c: In function `__early_flash_cmd_reset':
  nios2-generic.c:23: error: `AMD_CMD_RESET' undeclared (first use in this function)
  nios2-generic.c:23: error: (Each undeclared identifier is reported only once
  nios2-generic.c:23: error: for each function it appears in.)
  nios2-generic.c:24: error: `FLASH_CMD_RESET' undeclared (first use in this function)

which was introduced by:

  commit a113fb39df43546c704aa8eba55720da9a9dfedd
  Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
  Date:   Fri Dec 20 18:34:53 2013 -0300

  board: nios2: Add CONFIG_CFI_FLASH_MTD guard to flash.h header include

  Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Cc: Thomas Chou <thomas@wytron.com.tw>
Reported-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
BTW, can't see why we are doing this "weak alias" trick. Looks bogus to me.

 board/altera/nios2-generic/nios2-generic.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tom Rini Jan. 29, 2014, 10:33 p.m. UTC | #1
On Tue, Jan 28, 2014 at 07:19:06AM -0300, Ezequiel Garcia wrote:

> If CONFIG_CFI_FLASH_MTD is not defined, then we shouldn't perform the
> flash early reset.
> 
> This commit fixes the following build error:
> 
>   nios2-generic.c: In function `__early_flash_cmd_reset':
>   nios2-generic.c:23: error: `AMD_CMD_RESET' undeclared (first use in this function)
>   nios2-generic.c:23: error: (Each undeclared identifier is reported only once
>   nios2-generic.c:23: error: for each function it appears in.)
>   nios2-generic.c:24: error: `FLASH_CMD_RESET' undeclared (first use in this function)
> 
> which was introduced by:
> 
>   commit a113fb39df43546c704aa8eba55720da9a9dfedd
>   Author: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
>   Date:   Fri Dec 20 18:34:53 2013 -0300
> 
>   board: nios2: Add CONFIG_CFI_FLASH_MTD guard to flash.h header include
> 
>   Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> 
> Cc: Thomas Chou <thomas@wytron.com.tw>
> Reported-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
index aa126d7..5ab9471 100644
--- a/board/altera/nios2-generic/nios2-generic.c
+++ b/board/altera/nios2-generic/nios2-generic.c
@@ -16,7 +16,8 @@ 
 
 void text_base_hook(void); /* nop hook for text_base.S */
 
-#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
+#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
+    defined(CONFIG_CFI_FLASH_MTD)
 static void __early_flash_cmd_reset(void)
 {
 	/* reset flash before we read env */
@@ -37,7 +38,8 @@  int board_early_init_f(void)
 			"led");
 #endif
 #endif
-#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
+#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
+    defined(CONFIG_CFI_FLASH_MTD)
 	early_flash_cmd_reset();
 #endif
 	return 0;