[U-Boot] [PATCH 10/19] x86: Re-enable PCAT timer 2 for beeping

Simon Glass sjg at chromium.org
Fri Apr 26 15:43:23 CEST 2013


Hi Graeme,

On Wed, Apr 17, 2013 at 7:53 PM, Graeme Russ <graeme.russ at gmail.com> wrote:
> Hi Simon,
>
>
> On Thu, Apr 18, 2013 at 12:13 PM, Simon Glass <sjg at chromium.org> wrote:
>>
>> While we don't want PCAT timers for timing, we want timer 2 so that we can
>> still make a beep. Re-purpose the PCAT driver for this, and enable it in
>> coreboot.
>>
>> Signed-off-by: Simon Glass <sjg at chromium.org>
>> ---
>>  arch/x86/include/asm/u-boot-x86.h |  1 +
>>  arch/x86/lib/Makefile             |  2 +-
>>  arch/x86/lib/pcat_timer.c         | 69
>> ++-------------------------------------
>>  arch/x86/lib/tsc_timer.c          |  6 +++-
>>  include/configs/coreboot.h        |  1 +
>>  5 files changed, 11 insertions(+), 68 deletions(-)
>
> [snip]
>
>> -/* this is not very exact */
>> -void __udelay(unsigned long usec)
>> -{
>> -       int counter;
>> -       int wraps;
>> -
>> -       if (timer_init_done) {
>> -               counter = read_pit();
>> -               wraps = usec / 1000;
>> -               usec = usec % 1000;
>> -
>> -               usec *= 1194;
>> -               usec /= 1000;
>> -               usec += counter;
>> -
>> -               while (usec > 1194) {
>> -                       usec -= 1194;
>> -                       wraps++;
>> -               }
>> -
>> -               while (1) {
>> -                       int new_count = read_pit();
>> -
>> -                       if (((new_count < usec) && !wraps) || wraps < 0)
>> -                               break;
>> -
>> -                       if (new_count > counter)
>> -                               wraps--;
>> -
>> -                       counter = new_count;
>> -               }
>> -       }
>> -
>> -}
>
> This does not seem related...

It really should be in a clean-up patch. But now that I am squashing
them, I will just add it to the squashed patch.

Regards,
Simon


More information about the U-Boot mailing list