Starting the real time clock on virgin systems

Eric W. Biederman ebiederman at lnxi.com
Tue Dec 10 21:02:00 CET 2002


Kevin Hester <kevinh at ispiri.com> writes:

> Hi all,
> 
> First I'd like to describe a problem I've encountered:
> 
> I have a virgin motherboard that has never been powered up before.  i.e. this 
> board was not manufactured elsewhere and a 'standard' BIOS has never been 
> used on it.
> 
> When booting this board I discovered an interesting problem: the boot would 
> hang when the "hwclock" tool was invoked by /etc/rcS.d/<some script that 
> reads the rtc>.  
> 
> The underlying problem is that this common linux utility is reading the RTC 
> via the standard IO ports 70-71.  Within this RTC window all of the dallas 
> semiconductor RTC clones use a few bits in register 0x0a to enable the clock 
> when power is down.  The default values of these bits do not enable the clock 
> - presumably to avoid draining the battery until the boards are first placed 
> into production.
> 
> I've modified my version of linuxbios to ensure that these bits are set to 
> enable the RTC updates.  My question is, where is the best place to make this 
> change?

Assuming your RTC hardware is in your southbridge:
src/southbridge/<manufacturer>/<chipset>/rtc.c or something like that.

It is my experience that only for reading the real time clock is
a real time clock a real time clock.  The control functions which are
handled rarely tend to be specific to an individual implementation.  Though
there are generally similarities within a family of implementations.

> 1) In some non linuxbios component (i.e. some little app run at boot time)
> 
> 2) In linuxbios, but restricted to my mainboard.
> 
> 3) In linuxbios, but in 'common' code that applies to all intel boards.

In linuxbios common code that applies to your southbridge.
For now it will probably work best to have that code called from your mainboard,
and others who need it can call that code as well.\
 
> I'm in favor of option 3, but I thought I'd ask first.  I think this problem 
> would apply to any board.  The reason we haven't seen it before is that most 
> folks are running linux bios on boards that once had a standard bios.  The 
> standard bios has already 'activated' the RTC updates.

I suspect being the second BIOS on the boards has certainly had something to
do with it.   But given how much chips vary this may simply be an oddity of
your particular variation of the board.

> What do you think?

Until I see proof that this feature was in the original motorola mc146818 
real time clock, and has been in all implementations there after, I
don't want the code to apply all boards indescrimanently.

Eric




More information about the coreboot mailing list