[i2c] Question on ds1339's oscillator

David Brownell david-b at pacbell.net
Fri Jun 15 18:24:33 CEST 2007


On Friday 15 June 2007, Rodolfo Giometti wrote:
> On Fri, Jun 15, 2007 at 08:19:50AM -0700, David Brownell wrote:
> 
> Yes, I already applied such patches.

Good.


> > Say what --- an RTC can function with its oscillator off??
> > 
> > Or are you saying that check is incorrect?  I could imagine
> > that OSFt should maybe be ignored, other than for purposes
> > of issuing a warning (before clearing it).
> 
> My board has a micro controller that, at boot, disables such
> oscillator in order to avoid the square wave form at the output pin. When
> the driver starts up it recognizes that the oscillator is off and exits... but since
> old version worked well I simplyremoved the
> 
> 	goto exit_free;
> 
> line and the RTC continue to work properly.

In which case I guess the issue is that the OSF flag should
not be treated that way.


> To be honest I still doesn't well understand what the oscillator is
> used for... :-/ In the past I supposed that it was needed turned on
> but in reality this is not true. Now I suppose it is useful only to
> generate the square wave form.

Erm, not at all.  The oscillator is what drives the RTC
clock ... you know, the tick/tock/tick/tock/... part.
RTCs just count oscillator cycles.  If no oscillator is
running, the reported time will never change.

The square wave output is a different thing entirely.
Oscillator output may optionally be sent out on one pin
of many RTCs (probably divided down) ... maybe the board
needs a 32 kiHz signal to drive another circuit.

 
> > Yes, certainly.  The general policy should be, I think, that the
> > RTC init sequence won't change configuration ... so that for example
> > if you're given system with the square wave output already set up,
> > the assumption should be that the board is wired to require that.
> 
> Mmm... that is true if you have an external micro controller that
> configures the RTC for your otherwise how can the CPU setup the
> initial configuration if the driver is not yet renning? :-o

The boot loader can do it, but more likely that was done as part
of manufacturing the board ... along with initializing the clock
used by the RTC.


> I think that we should force IRQ output if the board configuration
> define an irq line otherwise we can the square wave form as outout.

And when the Linux configuration was a mistake, and then the
circuit which needed that clock stops working correctly ...?

If the board setup provides an IRQ and the chip is configured
to generate square wave output, that's clearly a bug somewhere.

Issuing a warning is clearly appropriate.  Reconfiguring the
hardware, on the assumption that the Linux config is right,
seems dangerous to me.  That's not a good way to fix bugs in
the production line (including the bootloader).

- Dave




More information about the i2c mailing list