linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Create add_rtc() function to enable the RTC CMOS driver
@ 2007-06-06 16:37 Wade Farnsworth
  2007-06-06 22:44 ` Arnd Bergmann
  2007-06-11  7:06 ` Milton Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Wade Farnsworth @ 2007-06-06 16:37 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

Signed-off-by: Wade Farnsworth <wfarnsworth@mvista.com>

---

 arch/powerpc/kernel/setup-common.c |   31 +++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

Index: linux-2.6-powerpc-8641/arch/powerpc/kernel/setup-common.c
===================================================================
--- linux-2.6-powerpc-8641.orig/arch/powerpc/kernel/setup-common.c
+++ linux-2.6-powerpc-8641/arch/powerpc/kernel/setup-common.c
@@ -32,6 +32,7 @@
 #include <linux/unistd.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/mc146818rtc.h>
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <asm/processor.h>
@@ -447,6 +448,36 @@ static __init int add_pcspkr(void)
 }
 device_initcall(add_pcspkr);
 
+#ifdef CONFIG_RTC_DRV_CMOS
+static int  __init add_rtc(void)
+{
+	struct device_node *np;
+	struct platform_device *pd;
+	struct resource res;
+
+	np = of_find_compatible_node(NULL, NULL, "pnpPNP,b00");
+	if (!np)
+		return -ENODEV;
+
+	if (of_address_to_resource(np, 0, &res)) {
+		of_node_put(np);
+		return -ENODEV;
+	}
+
+	pd = platform_device_register_simple("rtc_cmos", -1,
+					     &res, 1);
+	of_node_put(np);
+	if (IS_ERR(pd))
+		return PTR_ERR(pd);
+
+	/* rtc-cmos only supports 24-hr mode */
+	CMOS_WRITE(CMOS_READ(RTC_CONTROL) | RTC_24H, RTC_CONTROL);
+
+	return 0;
+}
+device_initcall(add_rtc);
+#endif /* CONFIG_RTC_DRV_CMOS */
+
 void probe_machine(void)
 {
 	extern struct machdep_calls __machine_desc_start;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-11 22:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06 16:37 [PATCH] Create add_rtc() function to enable the RTC CMOS driver Wade Farnsworth
2007-06-06 22:44 ` Arnd Bergmann
2007-06-07 13:11   ` Segher Boessenkool
2007-06-11  7:06 ` Milton Miller
2007-06-11 22:51   ` Wade Farnsworth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).