Commit 07e2822d158940a0e8ba45b6ab0344ffa1011a07

Authored by Ezequiel Garcia
Committed by Tom Rini
1 parent 3d83efbce9

board: nios2: Check if flash is configured before calling early_flash_cmd_reset()

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>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

board/altera/nios2-generic/nios2-generic.c
... ... @@ -16,7 +16,8 @@
16 16  
17 17 void text_base_hook(void); /* nop hook for text_base.S */
18 18  
19   -#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
  19 +#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
  20 + defined(CONFIG_CFI_FLASH_MTD)
20 21 static void __early_flash_cmd_reset(void)
21 22 {
22 23 /* reset flash before we read env */
... ... @@ -37,7 +38,8 @@
37 38 "led");
38 39 #endif
39 40 #endif
40   -#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR)
  41 +#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_ENV_ADDR) && \
  42 + defined(CONFIG_CFI_FLASH_MTD)
41 43 early_flash_cmd_reset();
42 44 #endif
43 45 return 0;