From rvinson@mvista.com Fri Jun  3 14:39:48 2005
Message-ID: <42A0CF1C.6000900@mvista.com>
Date: Fri, 03 Jun 2005 14:43:56 -0700
From: Randy Vinson <rvinson@mvista.com>
Cc: Kumar Gala <kumar.gala@freescale.com>
To: Greg KH <greg@kroah.com>
Subject: I2C: Add support for Maxim/Dallas DS1374 Real-Time Clock Chip (2/2)

This change provides support for the DS1374 Real-Time Clock chip present
on the MPC8349ADS board. It depends on a previous patch which adds I2C
support for the DS1374.

Signed-off-by: Randy Vinson <rvinson@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/ppc/platforms/83xx/mpc834x_sys.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+)

--- gregkh-2.6.orig/arch/ppc/platforms/83xx/mpc834x_sys.c	2005-06-06 12:08:33.000000000 -0700
+++ gregkh-2.6/arch/ppc/platforms/83xx/mpc834x_sys.c	2005-06-09 22:04:17.000000000 -0700
@@ -186,6 +186,26 @@
 	ipic_set_default_priority();
 }
 
+#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
+extern ulong	ds1374_get_rtc_time(void);
+extern int	ds1374_set_rtc_time(ulong);
+
+static int __init
+mpc834x_rtc_hookup(void)
+{
+	struct timespec	tv;
+
+	ppc_md.get_rtc_time = ds1374_get_rtc_time;
+	ppc_md.set_rtc_time = ds1374_set_rtc_time;
+
+	tv.tv_nsec = 0;
+	tv.tv_sec = (ppc_md.get_rtc_time)();
+	do_settimeofday(&tv);
+
+	return 0;
+}
+late_initcall(mpc834x_rtc_hookup);
+#endif
 static __inline__ void
 mpc834x_sys_set_bat(void)
 {
