[U-Boot-Users] [PATCH 0/3] More cfi_flash refactoring

Haavard Skinnemoen hskinnemoen at atmel.com
Fri Dec 14 17:04:54 CET 2007

On Fri, 14 Dec 2007 15:36:15 +0100
Haavard Skinnemoen <hskinnemoen at atmel.com> wrote:

> I've tested it by programming a 7MB JFFS2 image into the on-board
> AT49BV642D flash. It went almost successfully -- I got two erase
> timeouts and one programming timeout. On the second try, it worked
> with no problems.
> It looks like I have a bug in my timing code, since "sleep 10"
> terminates early from time to time as well. So I feel pretty confident
> that the CFI driver is doing its job properly -- the timeouts are
> simply triggered too early every now and then.

Turns out that interrupts were never enabled, so the cycle counter lost
its upper 32 bits. After applying the patch below, I've successfully
erased and programmed the flash two times in a row.

So as far as I can tell, the CFI driver works. I'll send a merge
request with this and a couple of other avr32 fixes soon.


From: Haavard Skinnemoen <hskinnemoen at atmel.com>
Subject: [PATCH] AVR32: Enable interrupts at bootup

The timer code depends on the timer interrupt to keep track of the
upper 32 bits of the cycle counter. This obviously doesn't work when
interrupts are disabled the whole time.

Signed-off-by: Haavard Skinnemoen <hskinnemoen at atmel.com>
 lib_avr32/board.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib_avr32/board.c b/lib_avr32/board.c
index 4729e58..d6423d4 100644
--- a/lib_avr32/board.c
+++ b/lib_avr32/board.c
@@ -312,6 +312,8 @@ void board_init_r(gd_t *new_gd, ulong dest_addr)
+	enable_interrupts();
 	bd->bi_flashstart = 0;
 	bd->bi_flashsize = 0;
 	bd->bi_flashoffset = 0;

More information about the U-Boot mailing list