All of lore.kernel.org
 help / color / mirror / Atom feed
From: wpa at fastmail.fm <wpa@fastmail.fm>
To: u-boot@lists.denx.de
Subject: [U-Boot] problem detecting CFI
Date: Fri, 02 Oct 2009 16:42:18 -0500	[thread overview]
Message-ID: <1254519738.8723.1337801725@webmail.messagingengine.com> (raw)
In-Reply-To: <1254439531.12740.1337643571@webmail.messagingengine.com>

I can fix this problem not but I really don't understand how the problem
happens in the first place. I found gp got changed in relocate_code in
file start.S. 

In relocate_code "function", the $gp is adjusted to point to the new
location, but somehow before program jumps to the relocated place, $gp
was changed. But I don't know where it is changed. So I used t8 register
to save the adjusted gp, and put it back before it jump to DRAM. But I
don't know why $gp was changed in the between. Can someone give me some
idea? I did not touch any thing else in this file.

        /*
         * Fix $gp:
         *
         * New $gp = (Old $gp - CONFIG_SYS_MONITOR_BASE) + Destination
         Address
         */
        move    t6, gp
        sub     gp, CONFIG_SYS_MONITOR_BASE
        add     gp, a2          /* gp now adjusted              */
        move    t8, gp          /*  add here <=== save gp               
        */

...

        /* Jump to where we've relocated ourselves.
         */
        move    gp, t8                        /* add here <=== copy gp
        back */
        addi    t0, s2, in_ram - _start
        jr      t0
        nop




On Thu, 01 Oct 2009 18:25 -0500, wpa@fastmail.fm wrote:
> I just found something interesting -
>
> In my previous email I thought the CFI detection was running from
> DRAM, but that assumption seems to be wrong. Previously I though it
> was running from DRAM because I traced the execution using BDI into
> mips/start">cpu/mips/start.S relocate_code, it runs to the place where
> it relocates itself. To be exact, here -
>
> addi t0, s2, in_ram - start jr t0 nop
>
> I checked and found the pc register changed to pointing to a SDRAM
> location, so relocation seems to be fine. I also load the symbol-file
> to the DRAM location at that point. But afterwards if I set breakpoint
> to board_init_r, the breakpoint is not triggered.
>
> Then I realized if I keep using the same symbol-file, the breakpoint
> at board_init_r can be triggered, and at that point, I can see the PC
> is still pointing to the flash.
>
> I don't understand how can the code, which has been relocated to SDRAM
> at one point, suddenly going back to run in the flash when it calls
> board_init_r. Can someone help me?
>
> Thanks.
>
>
> On Thu, 01 Oct 2009 16:47 -0500, wpa at fastmail.fm wrote:
> > I have a working u-boot 2008.10 on a mips 32 board and am trying to
> > port it over to u-boot 2009.06. So I used buildroot 2009.08 to build
> > the tool chain for my mips32 board as well as u-boot2009.06. I also
> > copied the previous u-boot initialization code to initialize timer,
> > serial port, ram and etc from u-boot 2008.10 to 2009.06.
> >
> > Right now the problem is the new u-boot 2009.06 does not detect cfi
> > of the flash. I am pretty sure u-boot is running from SDRAM when the
> > problem happens because the address is in the range of SDRAM. Please
> > let me know if you have any suggestion - I am running out of ideas.
> > I am attaching the printout from both the working u-boot 2008.10 and
> > u-boot 2009.06 below.
> >
> > Thanks a lot.
> >
> > U-Boot 2009.06 (Sep 30 2009 - 18:41:26)
> >
> > Reset Cause: Hardware Reset DRAM:  64 MB Top of RAM usable for U-
> > Boot at: 98000000 Reserving 139k for U-Boot at: 97fdc000 Reserving
> > 4352k for malloc() at: 97b9c000 Reserving 36 Bytes for Board Info
> > at: 97b9bfdc Reserving 36 Bytes for Global Data at: 97b9bfb8
> > Reserving 128k for boot params() at: 97b7bfb8 Stack Pointer at:
> > 97b7bf98 Now running in RAM - U-Boot at: 97fdc000 flash detect cfi
> > not found flash detect cfi not found
> >
> >
> > U-Boot 2008.10 (Sep 30 2009 - 11:37:03)
> >
> > Reset Cause: Hardware Reset DRAM:  64 MB Top of RAM usable for U-
> > Boot at: 98000000 Reserving 736k for U-Boot at: 97f44000 Reserving
> > 4352k for malloc() at: 97b04000 Reserving 44 Bytes for Board Info
> > at: 97b03fd4 Reserving 36 Bytes for Global Data at: 97b03fb0
> > Reserving 128k for boot params() at: 97ae3fb0 Stack Pointer at:
> > 97ae3f98 Now running in RAM - U-Boot at: 97f44000 flash detect cfi
> > fwc addr b0000000 cmd f0 f0 8bit x 8 bit fwc addr b0000000 cmd ff ff
> > 8bit x 8 bit fwc addr b0000055 cmd 98 98 8bit x 8 bit is= cmd 51(Q)
> > addr b0000010 is= 4f 51 fwc addr b0000555 cmd 98 98 8bit x 8 bit is=
> > cmd 51(Q) addr b0000010 is= 4f 51 fwc addr b0000000 cmd f0 f0f0
> > 16bit x 8 bit fwc addr b0000000 cmd ff ffff 16bit x 8 bit fwc addr
> > b00000aa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr b0000020 is=
> > 5151 5151 is= cmd 52(R) addr b0000022 is= 5252 5252 is= cmd 59(Y)
> > addr b0000024 is= 5959 5959 device interface is 2 found port 2 chip
> > 1 port 16 bits chip 8 bits
> > _______________________________________________
> > U-Boot mailing list U-Boot at lists.denx.de
> > http://lists.denx.de/mailman/listinfo/u-boot
> _______________________________________________
> U-Boot mailing list U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

  reply	other threads:[~2009-10-02 21:42 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 [this message]
2009-10-09 16:21 ` [U-Boot] MIPS cpu has " myuboot at fastmail.fm
     [not found]   ` <c166aa9f0910091016x6fe7bc77tc16222b6fb7c3c5d@mail.gmail.com>
     [not found]     ` <1255195660.1993.1339394551@webmail.messagingengine.com>
2009-10-10 20:47       ` 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=1254519738.8723.1337801725@webmail.messagingengine.com \
    --to=wpa@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.