From: myuboot at fastmail.fm <myuboot@fastmail.fm>
To: u-boot@lists.denx.de
Subject: [U-Boot] MIPS cpu has problem detecting CFI
Date: Fri, 09 Oct 2009 11:21:04 -0500 [thread overview]
Message-ID: <1255105264.3625.1339192705@webmail.messagingengine.com> (raw)
In-Reply-To: <1254433650.30149.1337631127@webmail.messagingengine.com>
I think I found a problem in cpu/mips/start.S.
gp register is used to point to the SDRAM. But after gp is adjusted to
proper location, a C function flush_cache is called. But this function
actually changes gp register before gp is used to jump to SDRAM. That
makes the u-boot run from flash and fails to detect CFI.
Here is the assembler code for flush_cache.c
(gdb) disassem 0xb0000798
Dump of assembler code for function flush_cache:
0xb000078c <flush_cache+0>: lui gp,0x3
0xb0000790 <flush_cache+4>: addiu gp,gp,-32300
0xb0000794 <flush_cache+8>: addu gp,gp,t9
And here is how I fixed the issue -
diff --git a/u-boot-2009.08/cpu/mips/start.S
b/u-boot-2009.08/cpu/mips/start.S
index 57db589..0e8f8ed 100644
--- a/u-boot-2009.08/cpu/mips/start.S
+++ b/u-boot-2009.08/cpu/mips/start.S
@@ -321,6 +321,7 @@ relocate_code:
move t6, gp
sub gp, CONFIG_SYS_MONITOR_BASE
add gp, a2 /* gp now adjusted */
+ move t8, gp
sub s1, gp, t6 /* s1 <-- relocation offset */
/*
@@ -358,6 +359,7 @@ relocate_code:
/* Jump to where we've relocated ourselves.
*/
+ move gp, t8
addi t0, s2, in_ram - _start
jr t0
nop
next prev parent reply other threads:[~2009-10-09 16:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 21:47 [U-Boot] problem detecting CFI wpa at fastmail.fm
2009-10-01 23:25 ` wpa at fastmail.fm
2009-10-02 21:42 ` wpa at fastmail.fm
2009-10-09 16:21 ` myuboot at fastmail.fm [this message]
[not found] ` <c166aa9f0910091016x6fe7bc77tc16222b6fb7c3c5d@mail.gmail.com>
[not found] ` <1255195660.1993.1339394551@webmail.messagingengine.com>
2009-10-10 20:47 ` [U-Boot] MIPS cpu has " Andrew Dyer
2009-10-12 15:10 ` myuboot at fastmail.fm
2009-10-12 22:11 ` Andrew Dyer
2009-10-12 22:28 ` Andrew Dyer
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=1255105264.3625.1339192705@webmail.messagingengine.com \
--to=myuboot@fastmail.fm \
--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.