Date: Wed, 25 Mar 1998 12:17:32 GMT
From: Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
To: linux-m68k@lists.linux-m68k.org
In-reply-to: <d3btuv9ejz.fsf@valhall.cern.ch> (message from Jes Sorensen on 25
	Mar 1998 12:48:32 +0100)
Subject: Re: L68K: Patch for 2.1.90
Sender: owner-linux-m68k@phil.uni-sb.de


Ok, here's a merge:

------------------------------------------------------------------------------
--- andreas/drivers/char/rtc.c	Wed Mar 25 13:11:05 1998
+++ my/drivers/char/rtc.c	Wed Mar 25 13:12:42 1998
@@ -621,13 +621,14 @@
 	}
 	if (guess)
 		printk("rtc: %s epoch (%lu) detected\n", guess, epoch);
-#endif
+#else
 	save_flags(flags);
 	cli();
 	/* Initialize periodic freq. to CMOS reset default, which is 1024Hz */
 	CMOS_WRITE(((CMOS_READ(RTC_FREQ_SELECT) & 0xF0) | 0x06), RTC_FREQ_SELECT);
 	restore_flags(flags);
 	rtc_freq = 1024;
+#endif
 	return 0;
 }
 
--- andreas/include/linux/mc146818rtc.h	Wed Mar 25 13:11:05 1998
+++ my/include/linux/mc146818rtc.h	Wed Mar 25 13:04:25 1998
@@ -44,9 +44,13 @@
 #define RTC_MINYEAR		epoch
 
 #else
-/* RTC in a PC */
+/* RTC in a PC or Alpha */
 
+#ifdef __alpha__
+#define RTC_HAS_IRQ 	0
+#else
 #define RTC_HAS_IRQ 	1
+#endif
 #define RTC_IRQ 	8	/* Can't see this changing soon.	*/
 #define RTC_IRQ_FLAGS	SA_INTERRUPT
 #define RTC_PORT(x)	(0x70 + (x))
@@ -66,9 +70,9 @@
  *   RTC_MINYEAR: minimum real year that can be stored in the RTC
  */
 
-/* standard values */
-#define RTC_CENTURY_SWITCH	69
-#define RTC_MINYEAR		1970
+/* If the epoch != 1900 (on some Alpha machines), there's no century switch */
+#define RTC_CENTURY_SWITCH	(epoch != 1900 ? 69 : -1)
+#define RTC_MINYEAR		(epoch != 1900 ? epoch : 1970)
 
 #endif
 
------------------------------------------------------------------------------

The patch to mc146818.h says that an Alpha doesn't have an RTC
interrupt, and turns off the century switch on Alpha if an epoch !=
1900 has been detected. (That's what I originally intended with my
patch to Jes.)

The patch in rtc.c isn't like that in 2.1.90, but AFAICS it doesn't
work on Alpha as it is, so I expect this patch in 2.1.91 :-) On Alpha,
the RTC is used for generating the system clock, so modifying the
frequency to 1024Hz will make the box get a heart attack :-)

To me it seems that the alpha patch by Nikita Schmid has more or less
been undone, maybe due to "too much #ifdefs" :-)

Roman
