From: Ulf Samuelsson <arago@emagii.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] U-Boot: AM335x Booting with environment in NAND: ECC cause failures...
Date: Fri, 02 Nov 2012 10:42:03 +0100 [thread overview]
Message-ID: <5093956B.1000300@emagii.com> (raw)
Trying to boot from NAND on an AM335x-EVM with environment in NAND
Have cloned "git://arago-project.org/git/projects/u-boot-am33x.git"
and done some minor changes (see below)
All documentation I've read tell me to use "nandecc hw 2" before
programming the NAND.
If I program the kernel and rootfs into the nand by
nandecc hw 2
nand.write ...
and then save the environment, it looks like the environment is saved
with the same ECC algorithm.
This is no good, since U-Boot will always read the environment at boot,
using the incompatible Hamming Mode, so the next reboot will fail.
This looks like a bug to me.
Methinks there should be a configuration item telling which ECC algorithm
to use for the environment, and this is used when reading the
environment at boot,
and when using "saveenv".
Any other read/writes should use the user defined algorithm
Right now, you need to remember to set the ECC to Hamming before every
saveenv
BR
Ulf Samuelsson
-----------------------------------------------------------------
diff --git a/boards.cfg b/boards.cfg
index 55af69f..ec5480c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -168,10 +168,11 @@ omap3_pandora arm armv7
pandora -
igep0020 arm armv7 igep0020
isee omap3
igep0030 arm armv7 igep0030
isee omap3
am335x_evm arm armv7 am335x
ti ti81xx
-am335x_evm_restore_flash arm armv7 am335x
ti ti81xx am335x_evm:RESTORE_FLASH
-am335x_evm_spiboot arm armv7 am335x
ti ti81xx am335x_evm:SPI_BOOT
-am335x_evm_uart_usbspl arm armv7 am335x
ti ti81xx am335x_evm:UART_THEN_USB_SPL
-am335x_evm_restore_flash_usbspl arm armv7 am335x
ti ti81xx am335x_evm:RESTORE_FLASH,UART_THEN_USB_SPL
+am335x_evm_nandflash arm armv7 am335x
ti ti81xx am335x_evm:NAND_BOOT
+am335x_evm_restore_flash arm armv7 am335x
ti ti81xx am335x_evm:RESTORE_FLASH
+am335x_evm_spiboot arm armv7 am335x
ti ti81xx am335x_evm:SPI_BOOT
+am335x_evm_uart_usbspl arm armv7 am335x
ti ti81xx am335x_evm:UART_THEN_USB_SPL
+am335x_evm_restore_flash_usbspl arm armv7 am335x
ti ti81xx am335x_evm:RESTORE_FLASH,UART_THEN_USB_SPL
am3517_crane arm armv7 am3517crane
ti omap3
am3517_evm arm armv7 am3517evm
logicpd omap3
am3517_evm_norflash arm armv7 am3517evm
logicpd omap3 am3517_evm:SYS_HAS_NORFLASH
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 3ae23b2..4cc5e43 100755
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -16,7 +16,12 @@
#define CONFIG_AM335X
#define CONFIG_TI81XX
#define CONFIG_SYS_NO_FLASH
-#ifndef CONFIG_SPI_BOOT
+#define kB << 10
+#if defined(CONFIG_NAND_BOOT)
+#define CONFIG_NAND_ENV
+#elif defined(CONFIG_SPI_BOOT)
+#define CONFIG_NAND_ENV
+#else
#define CONFIG_NAND_ENV
#endif
@@ -131,29 +136,44 @@
"tftp ${kloadaddr} ${bootfile}; " \
"run net_args; " \
"bootm ${kloadaddr}\0" \
+ "reflash=mmc rescan ; " \
+ "nand erase 0x0 0x280000 ; " \
+ "saveenv ; " \
+ "nandecc hw 2 ; " \
+ "fatload mmc 0 0x81000000 MLO ; " \
+ "nand write 0x81000000 0x0 0x20000 ; " \
+ "nand write 0x81000000 0x20000 0x20000 ; " \
+ "nand write 0x81000000 0x40000 0x20000 ; " \
+ "nand write 0x81000000 0x60000 0x20000 ; " \
+ "fatload mmc 0 0x81000000 u-boot.img ; " \
+ "nand write 0x81000000 0x80000 0x1E0000\0" \
+ "update=mmc rescan ; " \
+ "fatload mmc ${mmc_dev} ${loadaddr} update.env ; " \
+ "env import -t $loadaddr $filesize ; " \
+ "run update\0" \
+ "tiboot=if mmc rescan; then " \
+ "echo SD/MMC found on device ${mmc_dev};" \
+ "if run loadbootenv; then " \
+ "echo Loaded environment from ${bootenv};" \
+ "run importbootenv;" \
+ "fi;" \
+ "if test -n $uenvcmd; then " \
+ "echo Running uenvcmd ...;" \
+ "run uenvcmd;" \
+ "fi;" \
+ "if run mmc_load_uimage; then " \
+ "run mmc_args;" \
+ "bootm ${kloadaddr};" \
+ "fi;" \
+ "fi;" \
+ "run nand_boot;\0" \
+
#ifndef CONFIG_RESTORE_FLASH
/* set to negative value for no autoboot */
#define CONFIG_BOOTDELAY 3
-#define CONFIG_BOOTCOMMAND \
- "if mmc rescan; then " \
- "echo SD/MMC found on device ${mmc_dev};" \
- "if run loadbootenv; then " \
- "echo Loaded environment from ${bootenv};" \
- "run importbootenv;" \
- "fi;" \
- "if test -n $uenvcmd; then " \
- "echo Running uenvcmd ...;" \
- "run uenvcmd;" \
- "fi;" \
- "if run mmc_load_uimage; then " \
- "run mmc_args;" \
- "bootm ${kloadaddr};" \
- "fi;" \
- "fi;" \
- "run nand_boot;" \
-
+#define CONFIG_BOOTCOMMAND "run nand_boot"
#else
#define CONFIG_BOOTDELAY 0
@@ -236,7 +256,7 @@
#define CONFIG_SPL_LDSCRIPT "$(CPUDIR)/omap-common/u-boot-spl.lds"
/* NAND boot config */
-#ifndef CONFIG_SPI_BOOT
+#ifdef CONFIG_NAND_BOOT
#define CONFIG_SPL_NAND_SIMPLE
#define CONFIG_SPL_NAND_SUPPORT
#define CONFIG_SYS_NAND_5_ADDR_CYCLE
@@ -267,6 +287,7 @@
#endif
/* SPI boot config */
+#ifdef CONFIG_SPI_BOOT
#define CONFIG_SPL_SPI_SUPPORT
#define CONFIG_SPL_SPI_FLASH_SUPPORT
#define CONFIG_SPL_SPI_LOAD
@@ -274,6 +295,7 @@
#define CONFIG_SPL_SPI_CS 0
#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000
#define CONFIG_SYS_SPI_U_BOOT_SIZE 0x40000
+#endif
/*
* 1MB into the SDRAM to allow for SPL's bss@the beginning of SDRAM.
@@ -361,6 +383,9 @@
#if defined(CONFIG_NAND_ENV)
#undef CONFIG_ENV_IS_NOWHERE
#define CONFIG_ENV_IS_IN_NAND
+#undef CONFIG_ENV_SIZE
+#define CONFIG_ENV_SIZE 0x20000
+
#define CONFIG_SYS_MAX_FLASH_SECT 520 /* max no of sectors in a chip */
#define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max no of flash banks */
#define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */
next reply other threads:[~2012-11-02 9:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 9:42 Ulf Samuelsson [this message]
2012-11-02 15:51 ` [U-Boot] U-Boot: AM335x Booting with environment in NAND: ECC cause failures Tom Rini
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=5093956B.1000300@emagii.com \
--to=arago@emagii.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.