[U-Boot] [U-Boot, 1/2] spi: Add progress percentage and write speed to `sf update`

Simon Glass sjg at chromium.org
Fri Dec 21 19:21:35 CET 2012


Hi Jagan,

On Fri, Dec 21, 2012 at 12:46 AM, Jagan Teki <jagannadh.teki at gmail.com>wrote:

> Hi Simon,
>
> On Thu, Dec 20, 2012 at 6:48 AM, Simon Glass <sjg at chromium.org> wrote:
> > Hi Tom,
> >
> > On Wed, Dec 19, 2012 at 5:03 PM, Tom Rini <trini at ti.com> wrote:
> >> On Thu, Dec 20, 2012 at 12:14:00AM +0100, Wolfgang Denk wrote:
> >>> Dear Tom Rini,
> >>>
> >>> In message <20121219225945.GF14589 at bill-the-cat> you wrote:
> >>> >
> >>> ...
> >>> > With this change, applied to u-boot/master.
> >>>
> >>> Argh.... :-(
> >>>
> >>> Can we please undo this somehow?  This does not fit at all
> >>> conceptually.  U-Boot is supposed to use the good ols UNIX philosophy
> >>> of being terse by default, and special casing one specific storage
> >>> device makes no sense at all to me.
> >>
> >> We need to fix some of the underlying problems so that we're consistent
> >> here.  Sometimes we have output (network #), sometimes we don't.
> >> Sometimes we have a speed (network, filesystem load), sometimes we
> >> don't.  I'd be quite happy to have a uniform output and a uniform ON/OFF
> >> switch.
> >
> > I'm happy to do something like this. Obviously we want a config, but
> > do we also want an env variable to control it? Could be useful.
> >
> > And at the risk of killing it with feature creep, perhaps we could
> > have two levels of verbosity: progress (which repeatedly updates on
> > the same line) and notice (which does not). That might take care of
> > Jagannadha's use case also.
> >
>
> Any plan to add config for verbose messages on cmd_sf.c?
> seems like you plan for something, because I have some couple of patches
> which has verbose messages for sf read/erase/write commands.
> http://article.gmane.org/gmane.comp.boot-loaders.u-boot/149753


Yes there seems to be a plan. Perhaps I will sketch out a few ideas so that
people can comment:

Add two environment variables:

verbose=0|1    - if this is 0, then commands complete silently as now. If
>=1 then messages like the ones you propose ('flash successfully erased')
appear
progress=0|1    - if this is 0, then commands show no progress when
working. If >=1 then some commands will show progress as they work (all on
a single line like 'sf update')

We also need a CONFIG for each to enable it, like perhaps
CONFIG_SYS_VERBOSE and CONFIG_SYS_PROGRESS.

Then I suppose we need a few functions like:

struct progress_info {
   uint count;   /* Number of things we are going to count through */
   uint upto;    /* Current thing we are up to */
   int flags;
   /* flags like whether to convert to KB/MB/etc., and whether to show
bytes per second */
   /* may need to record column position of last message so we can clear it
at the end */
};

void progress_setup(struct progress_info *progress, uint count, int flags);
void progress_update(struct progress_info *progress, uint upto);
void progress_done(struct progress_info *progress)
void verbose_printf()

which compile to nothing if the CONFIG options are not enabled. Will need
to look at each current instance of this sort of code though and make sure
that this covers everything that is needed.

I haven't done anything on this and won't get to it for several weeks,
which is why I am posting ideas here for comment.

Regards,
Simon


>
>
> Thanks,
> Jagan.
>
> > Regards,
> > Simon
> >
> >>
> >> --
> >> Tom
> >>
> >> _______________________________________________
> >> 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
>


More information about the U-Boot mailing list