405LP RTC warning patch

Hollis Blanchard hollis at austin.ibm.com
Fri Dec 20 04:31:14 EST 2002


As David suggested, this patch warns the user if the RTC frequency is
altered by Linux (at least a little time will have been lost during
firmware boot).

Please apply to _2_4_devel.

-Hollis
--
PowerPC Linux
IBM Linux Technology Center
-------------- next part --------------
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux 2.4 for PowerPC development tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.1179  -> 1.1180 
#	arch/ppc/platforms/ibm405lp.c	1.5     -> 1.6    
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/12/19	hollis at granite.austin.ibm.com	1.1180
# print a warning message if RTC frequency is altered
# --------------------------------------------
#
diff -Nru a/arch/ppc/platforms/ibm405lp.c b/arch/ppc/platforms/ibm405lp.c
--- a/arch/ppc/platforms/ibm405lp.c	Thu Dec 19 11:27:45 2002
+++ b/arch/ppc/platforms/ibm405lp.c	Thu Dec 19 11:27:45 2002
@@ -288,7 +288,14 @@
 		mtdcr(DCRN_RTC0_CR1, 0x80);		/* Disable update cycles/interrupts*/
 		mtdcr(DCRN_RTC0_WRAP, 0);       /* toggle NRST & NMR */
 		mtdcr(DCRN_RTC0_WRAP, 3);
-		mtdcr(DCRN_RTC0_CR0, (RTC_DVBITS & 0x7) << 4);		/* input clock */
+
+		/* if necessary, set the input clock frequency */
+		if ((mfdcr(DCRN_RTC0_CR0) >> 4) != RTC_DVBITS) {
+			printk(KERN_WARNING "Warning: RTC frequency was incorrect\n");
+			mtdcr(DCRN_RTC0_CR0,
+					 ((RTC_DVBITS & 0x7) << 4) | (mfdcr(DCRN_RTC0_CR0) & 0xf));
+		}
+
 		mtdcr(DCRN_RTC0_CR1, mfdcr(DCRN_RTC0_CR1) & 0x7f);	/* allow updates */
 
 		not_initialized = 0;


More information about the Linuxppc-embedded mailing list