[U-Boot] [PATCH] nios2: reset cfi flash before reading env
Wolfgang Denk
wd at denx.de
Wed Jan 5 09:15:29 CET 2011
Dear Thomas Chou,
In message <1294211855-18584-1-git-send-email-thomas at wytron.com.tw> you wrote:
> Flash might be in unknown state when u-boot is started with jtag.
> And got wrong env data. So reset it in board early init.
>
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> ---
> board/altera/nios2-generic/nios2-generic.c | 6 ++++++
> 1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/board/altera/nios2-generic/nios2-generic.c b/board/altera/nios2-generic/nios2-generic.c
> index 89848cf..b76e479 100644
> --- a/board/altera/nios2-generic/nios2-generic.c
> +++ b/board/altera/nios2-generic/nios2-generic.c
> @@ -24,12 +24,18 @@
>
> #include <common.h>
> #include <netdev.h>
> +#include <mtd/cfi_flash.h>
> +#include <asm/io.h>
>
> void text_base_hook(void); /* nop hook for text_base.S */
>
> int board_early_init_f(void)
> {
> text_base_hook();
> +#if defined(CONFIG_ENV_IS_IN_FLASH) && defined(CONFIG_SYS_FLASH_BASE)
> + writeb(AMD_CMD_RESET, CONFIG_SYS_FLASH_BASE);
> + writeb(FLASH_CMD_RESET, CONFIG_SYS_FLASH_BASE);
> +#endif
Instead of making fixed assumptions about flash type and it's
properties here you should use generic routines from the CFI driver to
do the reset.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
How many seconds are there in a year? If I tell you there are 3.155 x
10^7, you won't even try to remember it. On the other hand, who could
forget that, to within half a percent, pi seconds is a nanocentury.
-- Tom Duff, Bell Labs
More information about the U-Boot
mailing list