public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/9] sunxi: Move SPL s_init() code to board_init_f()
Date: Fri, 30 Jan 2015 19:53:18 +0200	[thread overview]
Message-ID: <20150130195318.410e9dd6@i7> (raw)
In-Reply-To: <CAPnjgZ0sb9Rpk6+ySJNUnW-Ao67crKGBLRHiR4m8eAmLbigtXQ@mail.gmail.com>

On Mon, 29 Dec 2014 09:15:36 -0700
Simon Glass <sjg@chromium.org> wrote:

> Hi Ian,
> 
> On 28 December 2014 at 02:19, Ian Campbell <ijc@hellion.org.uk> wrote:
> > On Tue, 2014-12-23 at 12:04 -0700, Simon Glass wrote:
> >
> >> +void board_init_f(ulong dummy)
> >> +{
> > [...]
> >> +     /* Clear the BSS. */
> >> +     memset(__bss_start, 0, __bss_end - __bss_start);
> >> +
> >> +     board_init_r(NULL, 0);
> >
> > The previous (__weak) version of board_init_f also sets gd, which you've
> > also removed from s_init here and not added back anywhere (indeed, this
> > is the point...). But where is gd initialised now?
> 
> It's still in start.S, I've just removed this duplicate.
> 
> >
> > The patch generally looks good, two quick questions: has it been tested
> > in both FEL and regular mode, and has it been tested with a "legacy" as
> > well as a driver model system? (I might be able to find time in a day or
> > two to answer these myself, but for now I'll just ask).
> 
> I haven't tried FEL, I only just heard of it in your email. I'll see
> if I can figure out how to test that.

Just like Ian suspected, this patch has messed up the FEL boot mode
support.

In a nutshell, FEL is a special USB protocol (accessible on a USB OTG
connector), which is implemented by the boot ROM and activated by
holding a special hardware button pressed and rebooting the device.
FEL supports commands to read/write device RAM and execute code on
the device. It is designed for device unbricking and firmware recovery.

In particular, the FEL boot mode support is very useful for debugging
u-boot and kernel problems on tablets (the SD card slot can be used
for the UART console, while the system is booted over a micro-USB cable
with the help of FEL):
    http://linux-sunxi.org/File:MSI_Primo81_and_MicroSD_breakout.jpg

In u-boot it is used in the following way:
 1. The SPL code is uploaded from the linux PC to the device SRAM via
    a FEL command (using the 'fel' program from sunxi-tools).
 2. The SPL code is executed via a FEL command and expected to
    initialize the DRAM controller. The code is executed as a
    normal C or assembly function, which needs to return control
    back to the BROM code when it is done. Right now this
    function is s_init().
 3. As the DRAM is initialized and available now, the main u-boot
    binary is now uploaded to DRAM via FEL. Together with boot.scr,
    the kernel, the dtb file and optionally initramfs as needed.
 4. The main u-boot binary is executed via a FEL command, but never
    returns back to BROM anymore.

More details are available in the linux-sunxi wiki:
    http://linux-sunxi.org/FEL
    http://linux-sunxi.org/FEL/Protocol
    http://linux-sunxi.org/FEL/USBBoot

I have submitted a patch to fix this regression:
    https://patchwork.ozlabs.org/patch/434826/

If you encounter problems and/or need help when testing FEL, please
let me know.

-- 
Best regards,
Siarhei Siamashka

  reply	other threads:[~2015-01-30 17:53 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-23 19:04 [U-Boot] [PATCH 0/9] Remove use of gdata for global_data Simon Glass
2014-12-23 19:04 ` [U-Boot] [PATCH 1/9] arm: Add warnings about using gdata Simon Glass
2014-12-24  6:53   ` Igor Grinberg
2014-12-29 16:24     ` Simon Glass
2014-12-30  7:39       ` Igor Grinberg
2014-12-30 22:12         ` Simon Glass
2015-01-20 21:40   ` [U-Boot] [U-Boot,1/9] " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 2/9] sunxi: Move SPL s_init() code to board_init_f() Simon Glass
2014-12-28  9:19   ` Ian Campbell
2014-12-29 16:15     ` Simon Glass
2015-01-30 17:53       ` Siarhei Siamashka [this message]
2015-02-01 16:29         ` Simon Glass
2015-02-01 16:45           ` Siarhei Siamashka
2015-02-01 17:00             ` Simon Glass
2015-02-01 18:37               ` Siarhei Siamashka
2015-02-01 20:59                 ` Simon Glass
2015-02-02  8:07                   ` Hans de Goede
2015-02-03  5:29                     ` Simon Glass
2015-02-04  0:55                       ` Simon Glass
2015-02-04  1:58                         ` Siarhei Siamashka
2015-02-04  3:23                           ` Simon Glass
2015-02-04  4:14                             ` Simon Glass
2015-01-20 21:40   ` [U-Boot] [U-Boot, " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 3/9] sunxi: Drop use of lowlevel_init() Simon Glass
2014-12-28  9:10   ` Ian Campbell
2015-01-20 21:40   ` [U-Boot] [U-Boot,3/9] " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 4/9] arm: Reduce the scope " Simon Glass
2014-12-23 19:04 ` [U-Boot] [PATCH 5/9] zynq: Remove reference to gdata Simon Glass
2015-01-20 21:40   ` [U-Boot] [U-Boot,5/9] " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 6/9] imx: cm_fx6: " Simon Glass
2014-12-24  6:50   ` Igor Grinberg
2014-12-31 12:25   ` Nikita Kiryanov
2015-01-20 21:40   ` [U-Boot] [U-Boot,6/9] " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 7/9] imx: woodburn: " Simon Glass
2014-12-30 12:10   ` Stefano Babic
2015-01-20 21:40   ` [U-Boot] [U-Boot,7/9] " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 8/9] imx: ls102xa: " Simon Glass
2015-01-20 21:40   ` [U-Boot] [U-Boot,8/9] " Tom Rini
2014-12-23 19:04 ` [U-Boot] [PATCH 9/9] arm: Drop gdata global_data variable in SPL Simon Glass
2014-12-28  9:09 ` [U-Boot] [PATCH 0/9] Remove use of gdata for global_data Ian Campbell
2015-01-19  6:48 ` Albert ARIBAUD

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=20150130195318.410e9dd6@i7 \
    --to=siarhei.siamashka@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox