All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v3 00/20] Refactor the architecture parts of mt7628
Date: Wed, 12 Feb 2020 14:46:26 +0100	[thread overview]
Message-ID: <302ab4e4-cc85-0fc2-3cb6-58adf70d7ff3@denx.de> (raw)
In-Reply-To: <CACUy__WX6gw8wzQCTFXUs3r6aMzX1dPF9w1aC2489A8r5=4m3Q@mail.gmail.com>

Hi Daniel,

On 12.02.20 13:48, Daniel Schwierzeck wrote:

<snip>

>>> Daniel, perhaps a dumb question, but is the MIPS U-Boot code position
>>> independant?
> 
> from your tests I can only conclude that RAM loading doesn't work at
> all. If you see it
> "working" than you simply junp to the old copy which the SPL created.
> A MIPS U-Boot
> is always built with position-dependant code. To make the U-Boot
> binary relocatable,
> we use the tools/mips-relocs.c which was ported from Linux. During
> linking we let gcc
> emit relocation entries which are post-processed by the mips-relocs
> tool. The output
> is then inserted into u-boot.bin in section ".data.reloc". Those reloc
> entries are then
> used by the MIPS relocation code to patch all symbols with the
> relative offset to the
> new text address.
> 
> If you build for example the Gardena Smart Gateway and disassemble the u-boot
> binary (which becomes the SPL payload), the very first instruction is this:
> 
> 80200000 <_start>:
> #endif
>          .endm
> 
> ENTRY(_start)
>          /* U-Boot entry point */
>          b       reset
> 80200000:       1000013f        b       80200500 <reset>
>           mtc0   zero, CP0_COUNT # clear cp0 count for most accurate boot timing
> 80200004:       40804800        mtc0    zero,c0_count
> 
> So if you load u-boot.bin to a different address than 0x80200000 and jump to it,
> the first instruction is a jump back to address 0x80200500. If the old SPL copy
> of u-boot.bin is still there, you'll see a "working" RAM boot.

Thanks for this analysis. This is exactly what happened in my test this
morning.

> Actually Mauro already did the right thing with erasing the load area
> at 0x80200000
> before downloading a new binary.
> 
> A stable approach to a RAM boot binary (which I use in my out-of-tree boards)
> would be to use a KSEG1 text address e.g. 0xa0200000 and explicitely switch
> the CPU to non-caching mode (this is normally skipped with
> CONFIG_SKIP_LOWLEVEL_INIT in the SPL payload). This approach always worked
> for me for booting via UART or EJTAG without getting messed up by
> cache effects.
> 
> So either we officially drop RAM boot support for mtmips platform (respectively
> don't use the u-boot.bin intended for SPL payload as RAM boot binary)
> or we keep the
> special RAM boot configs.

I assume that you are also okay with the cache flush approach? I'll send
v2 of this patch pretty soon if nobody objects.

Thanks,
Stefan

      reply	other threads:[~2020-02-12 13:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-21  8:17 [PATCH v3 00/20] Refactor the architecture parts of mt7628 Weijie Gao
2020-01-21  8:30 ` Weijie Gao
2020-02-10 17:20 ` Daniel Schwierzeck
2020-02-10 20:20   ` Mauro Condarelli
2020-02-10 21:28     ` Daniel Schwierzeck
2020-02-11 10:58       ` Mauro Condarelli
2020-02-11 11:16         ` Stefan
2020-02-11 12:34           ` Mauro Condarelli
2020-02-11 12:41             ` Stefan
2020-02-11 13:54         ` Daniel Schwierzeck
2020-02-11 14:27           ` Stefan
2020-02-11 16:11           ` Mauro Condarelli
2020-02-11 16:49             ` Daniel Schwierzeck
2020-02-11 18:05               ` Mauro Condarelli
2020-02-12  6:39                 ` Stefan
2020-02-12  9:23                   ` Mauro Condarelli
2020-02-12 12:25                     ` Stefan
2020-02-12 12:48                     ` Daniel Schwierzeck
2020-02-12 13:46                       ` Stefan [this message]

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=302ab4e4-cc85-0fc2-3cb6-58adf70d7ff3@denx.de \
    --to=sr@denx.de \
    --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.