From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RESEND PATCH v2 2/5] Tegra2: Add microsecond timer functions
Date: Sun, 10 Jul 2011 16:54:03 +1000 [thread overview]
Message-ID: <4E194C8B.2030303@gmail.com> (raw)
In-Reply-To: <CAPnjgZ2tjr5ivuJaJSYCTZM-bMuZi2+SFJxB=3ERidMa6QMjXA@mail.gmail.com>
Hi Simon,
On 10/07/11 16:14, Simon Glass wrote:
> Hi Graeme,
[snip]
>
> timer_get_us needs to be u64 (unsigned long long). Also, the new timer API
> will define this as time_now_us, would be great if you could use this
> naming convention now to save me doing a mass of replaces later
>
>
> Yes will do.
Thanks
> > +
> > +unsigned long timer_get_future_us(u32 delay)
> > +{
> > + return timer_get_us() + delay;
> > +}
>
> C'mon - We've been here before - This is timer API stuff. Where are you
> going to use this? Why can't the proposed API be used instead?
>
> I know you don't like the 'time since' implementation, but this has been
> discussed to death and it appears to me that the majority decision was to
> go that route rather than the 'future time' route. It is a completely
> pointless exercise and a complete waste of my time to re-write the timer
> API just to have someone that doesn't like a particular aspect go off and
> write a one-off function.
>
>
> Well this code pre-dates this and I haven't revised it. I will take another
> look and sort this out. In fact from memory the return value isn't even used!
Ah, OK then - Sorry for the tone, I didn't realise the history of this patch
[snip]
>
> 'likely' meaning it may or may not - no guarantee though. The new timer API
> is designed specifically designed to resolve this - 'At least x ms/us have
> passed' or 'at most x ms/us have passed'. No more 'x ms/us _might_ have
> passed'
>
>
> Yes, watch this space.
Maybe you could grab the timer functions for the new API from the patch
series I posted recently and create the micro-second equivalents in Tegra2.
I can the move them into common code later with no other code changes necessary
>
> BTW I have come across another problem where initialization must be done
> which has long delays in it (LCD display power-up sequence). It's starting
> to feel like we should have a central place for registering a timer which
> calls back when a time has expired. That way we can continue with other
> tings while we wait for the time to elapse. Something like:
>
>
> /* Move to the next state */
> static int next_state(void *my_data)
> {
> /* do some things, and then if you want to be called again... */
> timer_register(timer_now_ms() + 40, next_state, my_data)
> }
>
> void start_lcd_init()
> {
> // do first thing
> ...
> // set a timer to do the next thing later
> timer_register(timer_now_ms() + 200, next_state, my_data)
> }
>
> ...
>
> Every now and then code (or a timer wait function) can call
>
> timer_check()
>
> which will call any expired timers on the list and remove them. This allows
> LCD init to continue while downloading the kernel, for example.
>
>
> I haven't thought too hard about this, but apart from LCD I know that USB
> has some big delays. Obviously we can't make U-Boot multi-threaded but we
> can perhaps do something simple like the above. What do you think?
Well, this is a little beyond the scope of a simple boot loader ;) And
unless we start getting real fancy with task schedulers etc, the callback
will most likely be done in the context of an IRQ handler.
I do agree, however, that in some circumstances, it would be useful to be
able to 'background' some tasks such as doing a flash erase in the
background while calculating the environment CRC or letting a device
initialising itself while U-Boot moves on through the boot sequence. But
this can be done without callbacks anyway in the board init sequence:
...low level init stuff...,
start_lcd_init,
...other stuff...,
wait_lcd_init_complete,
...more stuff needing LCD output...,
> Also given that your timer API stuff seems to have a good reception and
> people are very happy, is there any impediment to getting this in sooner
> rather than later?
>
I hope so, but I'm really wanting feedback from Wolfgang and I fear the
merge window will close before it's ready :(
Regards,
Graeme
next prev parent reply other threads:[~2011-07-10 6:54 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-05 16:49 [U-Boot] [RESEND PATCH v2 0/5] Add basic clock and pinmux functions to the Tegra2 Simon Glass
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 1/5] Tegra2: Add macros to calculate bitfield shifts and masks Simon Glass
2011-07-09 13:56 ` Albert ARIBAUD
2011-07-11 4:34 ` Simon Glass
2011-07-11 6:16 ` Wolfgang Denk
2011-07-11 16:19 ` Anton Staaf
2011-07-12 15:29 ` Albert ARIBAUD
2011-07-12 16:48 ` Anton Staaf
2011-07-12 19:30 ` Wolfgang Denk
2011-07-12 20:59 ` Anton Staaf
2011-07-12 21:18 ` Wolfgang Denk
2011-07-12 23:11 ` Anton Staaf
2011-07-13 11:28 ` Detlev Zundel
2011-07-13 16:47 ` Anton Staaf
2011-07-14 16:00 ` Albert ARIBAUD
2011-07-14 17:29 ` Anton Staaf
2011-07-14 18:26 ` Albert ARIBAUD
2011-07-14 18:30 ` Wolfgang Denk
2011-07-14 18:42 ` Anton Staaf
2011-07-14 18:44 ` Wolfgang Denk
2011-07-14 20:06 ` Anton Staaf
2011-07-11 6:13 ` Wolfgang Denk
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 2/5] Tegra2: Add microsecond timer functions Simon Glass
2011-07-09 13:58 ` Albert ARIBAUD
2011-07-10 5:24 ` Graeme Russ
2011-07-10 6:14 ` Simon Glass
2011-07-10 6:54 ` Graeme Russ [this message]
2011-07-11 6:17 ` Wolfgang Denk
2011-07-11 6:20 ` Wolfgang Denk
2011-07-11 6:43 ` Graeme Russ
2011-07-11 19:58 ` Wolfgang Denk
2011-07-11 22:52 ` Graeme Russ
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 3/5] Tegra2: Add more clock support Simon Glass
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 4/5] Tegra2: add additional pin multiplexing features Simon Glass
2011-07-05 16:49 ` [U-Boot] [RESEND PATCH v2 5/5] Tegra2: Use clock and pinmux functions to simplify code Simon Glass
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=4E194C8B.2030303@gmail.com \
--to=graeme.russ@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 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.