All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] non-blocking flash functions - is this possible/acceptable?
Date: Tue, 27 Oct 2009 09:21:25 -0400	[thread overview]
Message-ID: <4AE6F3D5.5060403@ge.com> (raw)
In-Reply-To: <20091027125146.GA3216@leila.ping.de>

Wolfgang Wegner wrote:
> Hi,
> 
> we have an update protocol that normally relies on data being
> received while the previous block is written to flash.
> 
> We hacked our U-Boot to provide non-blocking variants for flash
> access for the relevant functions, which are:
> 
> flash_status_check_nb()
> flash_full_status_check_nb()
> flash_erase_nb() (single-sector only)
> flash_write_cfibuffer_nb()
> write_buff_nb()
> 
> Apart from flash_status_check_nb() and flash_erase_nb() (the latter
> being reduced to handle only one sector at a time), these are mainly
> the same functions as the originals, but use
> flash_[full_]status_check_nb()
> instead, so there is much duplicate code.
> 
> Is such a use case generally acceptable in U-Boot, and if so,

I'll defer to Wolfgang Denk, Stefan Roese, (Scott Wood?), and others for 
this half.

My 2c: Overlapping data transfer with flash erase/write operations can 
be beneficial as it can reduce the programming time substantially. 
(Erase is less beneficial than write since erases don't happen as often 
and take a relatively long time, so the overlap optimization savings is 
a smaller percentage of the total erase time - Amdahl's Law.)

> anybody have an idea how to implement those without all this duplicate
> code?

Move the code to the non-blocking functions (which you have already 
done), and then implement the blocking versions as wrappers that simply 
call the non-blocking write followed by a loop calling 
flash_status_check_nb() until the write is complete.  For erase, you 
would need a loop to do the multi-sector erase as multiple non-blocking 
+ wait operations.

> Of course I can also implement this stuff in our board code, but it
> seems a bit unlogical to break the flash handling apart and the bloat
> would remain, just in a different place.

Yes, that would be horrible.

> [I am bringing this topic up because I am trying to prepare patches for
> sending to the list, and this one seems to me as a real show-stopper
> right now.]
> 
> Regards,
> Wolfgang

Best regards,
gvb

  reply	other threads:[~2009-10-27 13:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-27 12:51 [U-Boot] non-blocking flash functions - is this possible/acceptable? Wolfgang Wegner
2009-10-27 13:21 ` Jerry Van Baren [this message]
2009-10-27 14:03   ` Jerry Van Baren
2009-10-27 15:22     ` Wolfgang Wegner
2009-10-27 15:57       ` Jerry Van Baren
2009-10-27 15:24   ` Wolfgang Wegner
2009-10-27 18:58 ` Wolfgang Denk
2009-10-30 14:48   ` [U-Boot] [RFC PATCH] Implementation of non-blocking flash write/erase/status check functions Wolfgang Wegner
2009-10-30 15:02     ` Wolfgang Wegner
2009-10-30 18:22     ` Wolfgang Denk
2009-11-02 16:26       ` [U-Boot] [PATCH] " Wolfgang Wegner
2009-11-02 16:33       ` [U-Boot] [RFC PATCH] Implementation of " Wolfgang Wegner
2009-12-09 16:00       ` [U-Boot] [PATCH RFC v2] " Wolfgang Wegner
2010-01-22 10:03         ` Wolfgang Wegner
2010-01-22 12:03           ` Wolfgang Denk
2010-01-25  8:35             ` Stefan Roese

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=4AE6F3D5.5060403@ge.com \
    --to=gerald.vanbaren@ge.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 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.