Okay, it's been a while since I last did this, so bear with me if I make any
mistakes.
Following this are two parts of a patch to add an RTC class driver for the
Dallas/Maxim DS1685/1687 RTC chip. I'm routing it through this ML because A) I
don't know any better and B) only the SGI O2 currently makes use of it. Plus
people here have a really keen eye for things and can tell me if I need to do
something better.
The first patch is derived from an older version of the DS1685 driver I found on
Google. That patch apparently made it up to akpm's -mm branch, but never made it
into a -mm release and as far as I can tell, died at some undetermined point. I
haven't tried contacting the original author, either. I just used the DS1685
data sheet, O2's original CMOS RTC driver, and the old code for the IP30
(Octane) RTC driver (which is the same chip) to get this working.
The second patch adds in the IP32-specific bits. I can't think of a sane way to
avoid mixing arch-specific code with generic code, but the register padding that
IP32 needs is, as far as I can tell, unavoidable. The second patch also adds in
minor differences for the DS17285/17287 RTC, which is extremely similar to the 1685.
IRIX suggests IP32 is supposed to have the 17287 chips by default, but I
examined four separate O2 boards and all of them have DS1687-5 chips. Even two
of my Octane system boards had DS1687-5 chips. But the differences were minor
enough, that they can be enabled by flipping a menuconfig item. You can even
run them w/ a 1687-5 chip with no ill effects.
Also, the second patch removes the old RTC access code from IP32, but it does
NOT touch the power down code. That can be modified to include the ds1685.h
file and allow for the deletion of 17287rtc.h down the road. The current RTC
framework doesn't appear to support the extended registers used for power down
anyways, so there's no way to build this into the driver itself. Though it
wouldn't be very hard to add it once the base RTC class code picks up the support.
Thoughts?
--
Joshua Kinard
Gentoo/MIPS
kumba@xxxxxxxxxx
"The past tempts us, the present confuses us, the future frightens us. And our
lives slip away, moment by moment, lost in that vast, terrible in-between."
--Emperor Turhan, Centauri Republic