From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] core ticks/timer code
Date: Tue, 31 Mar 2009 13:39:56 +0200 [thread overview]
Message-ID: <20090331113956.GD28787@game.jcrosoft.org> (raw)
In-Reply-To: <20090331102823.A2F9883797DC@gemini.denx.de>
On 12:28 Tue 31 Mar , Wolfgang Denk wrote:
> Dear Mike Frysinger,
>
> In message <200903310513.09082.vapier@gentoo.org> you wrote:
> >
> ...
> > > I've in mind to partially import the clocksource linux API or create a new
> > > U-Boot api devired from it's design
> >
> > the clocksource framework in linux sounds like extreme overkill for u-boot.
> > where do you see realistic usage of more than one timer ? u-boot is pretty
> > much a single threaded app that polls.
That's why I've tell to partially import it as have done Sascha in u-boot V2
>
> Correct. We definitely do not need the full capabilities of the Linux
> framework. Any new implementation will be checked against the current
> code, and memory foot print is something we will check carefully.
>
> OTOH, I think Sascha's u-boot-v2 uses code that was derived from the
> Linux code, but in a pretty lean way. It may be interesting to check
> there...
I've take a look on it and it's the idea I've in mind to do also
>
> > > I'll propose a new design with the following Requierement
> > >
> > > Generic delay function implementation
> > > - ndelay()
> > > - udelay()
> > > - mdelay()
> > >
> > > Generic helper
> > > - khz2cycles()
> > > - hz2cycles()
> > > - cs2ns()
> > >
> > > Timer API
> > > - timer_init() - setup the timer
> > > - timer_reset() - reset the timer (use in case of overflow)
> > > - get_ticks() - return the current ticks
> > > - get_cycles() - return the ticks frequency in ns
> >
> > do you have real use cases here ? i'd actually propose the opposite: kill off
> > the notion of "ticks", "cycles", and "hz". i dont think ndelay() is really
> > necessary, and mdelay() is a simple macro on top of udelay(). that leaves us
> > with really only the three functions we have today: timer_init(), get_timer(),
> > and reset_timer(). we clarify that the function operates in terms of
> > milliseconds and blam, it's all so simple now.
Yes I've real case where I do need ndelay to generate high speed clock with a
gpio and udelay is too slow.
we need get_cycles and get_ticks to calculate the udelay, mdelay and ndelay
otherwise how can you known the ticks frequency?
>
> Agreed (except that we probably cannot completely throw away the
> tick; IIRC there are cases in early startup when nothing else is
> available yet).
not necessarely you can activate the timer just after the cpu_init
so normally you do not need any get_ticks.
Best Regards,
J.
next prev parent reply other threads:[~2009-03-31 11:39 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-28 1:30 [U-Boot] core ticks/timer code Mike Frysinger
2009-03-28 7:07 ` Dirk Behme
2009-03-31 1:10 ` Mike Frysinger
2009-03-31 11:41 ` Scott McNutt
2009-03-31 15:48 ` Wolfgang Denk
2009-03-31 21:25 ` Scott Wood
2009-03-31 21:27 ` Wolfgang Denk
2009-04-02 12:38 ` Detlev Zundel
2009-04-02 13:09 ` Scott McNutt
2009-03-31 20:46 ` Wolfgang Denk
2009-03-31 8:17 ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-31 9:13 ` Mike Frysinger
2009-03-31 10:28 ` Wolfgang Denk
2009-03-31 11:25 ` Mike Frysinger
2009-03-31 11:41 ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-31 15:55 ` Dirk Behme
2009-04-02 19:16 ` Ladislav Michl
2009-04-02 21:18 ` Graeme Russ
2009-04-04 21:35 ` Wolfgang Denk
2009-03-31 15:46 ` Wolfgang Denk
2009-03-31 11:39 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2009-03-31 15:49 ` Wolfgang Denk
2009-03-31 21:32 ` Scott Wood
2009-04-04 21:14 ` Wolfgang Denk
2009-04-06 19:12 ` Scott Wood
2009-04-06 19:43 ` Wolfgang Denk
2009-03-31 20:43 ` Wolfgang Denk
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=20090331113956.GD28787@game.jcrosoft.org \
--to=plagnioj@jcrosoft.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.