Re: Exporting calibrate_delay()

From: Rogier Wolff (
Date: Fri Aug 25 2000 - 02:16:28 EST

Alan Cox wrote:
> > The idea is to have a different value for loops_per_sec for all
> > (read: 12) clock speeds. I want to calculate the values when the
> So you could compute all twelve in the driver init functions before the
> kernel loads the root fs, then the initfunc is still there
> > driver loads so I can just plug in a new value for loops_per_sec
> > at a clock speed change. If I disable all interrupts while
> > recalibrating it shouldn't hurt udelay, right?
> That sounds right
> > How correct is that? More specifically: how sensitive are the other
> > drivers for slightly incorrect values of loops_per_sec?
> Generally pretty slack.

But in general, remember that it is used for "udelay" and that this is
usually used for when the datasheet says: "You need to wait 12 us
after reset before you can access the device again". If you follow the
datasheet, you'd put a udelay(12); in there. How much margin that
datasheet has is of course unknown. But the device has the option of
stopping to work at 11us, but 13us should be ok.

In practise, people have wondered how linux copes with PCs that switch
speeds. The answer: Linux doesn't cope, people are just lucky that it
keeps working. That's what Alan means with "pretty slack".

(So switching from high to low clocks generally should work, whereas
switching to a higher clock after booting may fail. However, it depends
on wether hte hardware happened to have some slack in the specs.)


** ** ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:15 EST