Skip to contentSkip to conversation

New/Updated drivers: New generic RTC class PC-style 'CMOS' driver backported from Linux Kernel Ver. 2.6.29.2

PATCH New Daniel Kiper 1 participant 1 message Nov 24, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 New/Updated drivers: New generic RTC class PC-style 'CMOS' driver backported from Linux Kernel Ver. 2.6.29.2

# HG changeset patch
# User [email protected] # Date 1259016856 -3600
# Node ID 5ae764557edff344c59e88413d66c1e2f9a99eb0 # Parent 1db1bb63824b25f97d127449faeb3a56f1272c97 New generic RTC class PC-style 'CMOS' driver backported from Linux Kernel Ver. 2.6.29.2

arch/i386/Kconfig +1 -1
diff -r 1db1bb63824b -r 5ae764557edf arch/i386/Kconfig
@@ -237,7 +237,7 @@ config HPET_TIMER
 
 config HPET_EMULATE_RTC
 	bool
-	depends on HPET_TIMER && RTC=y
+	depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || RTC_DRV_CMOS=y)
 	default y
 
 config NR_CPUS
arch/i386/kernel/time_hpet.c +3 -1
diff -r 1db1bb63824b -r 5ae764557edf arch/i386/kernel/time_hpet.c
@@ -21,6 +21,8 @@
 
 #include <asm/hpet.h>
 #include <linux/hpet.h>
+
+#include <asm-generic/rtc.h>
 
 static unsigned long hpet_period;	/* fsecs / HPET clock */
 unsigned long hpet_tick;		/* hpet clks count per tick */
@@ -425,7 +427,7 @@ irqreturn_t hpet_rtc_interrupt(int irq, 
 	hpet_rtc_timer_reinit();
 
 	if (UIE_on | AIE_on) {
-		rtc_get_rtc_time(&curr_time);
+		get_rtc_time(&curr_time);
 	}
 	if (UIE_on) {
 		if (curr_time.tm_sec != prev_update_sec) {
arch/x86_64/Kconfig +1 -1
diff -r 1db1bb63824b -r 5ae764557edf arch/x86_64/Kconfig
@@ -426,7 +426,7 @@ config HPET_TIMER
 
 config HPET_EMULATE_RTC
 	bool "Provide RTC interrupt"
-	depends on HPET_TIMER && RTC=y
+	depends on HPET_TIMER && (RTC=y || RTC=m || RTC_DRV_CMOS=m || RTC_DRV_CMOS=y)
 
 # Mark as embedded because too many people got it wrong.
 # The code disables itself when not needed.
arch/x86_64/kernel/time.c +2 -1
diff -r 1db1bb63824b -r 5ae764557edf arch/x86_64/kernel/time.c
@@ -39,6 +39,7 @@
 #include <asm/sections.h>
 #include <linux/cpufreq.h>
 #include <linux/hpet.h>
+#include <asm-generic/rtc.h>
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/apic.h>
 #endif
@@ -1272,7 +1273,7 @@ irqreturn_t hpet_rtc_interrupt(int irq, 
 	hpet_rtc_timer_reinit();
 
 	if (UIE_on | AIE_on) {
-		rtc_get_rtc_time(&curr_time);
+		get_rtc_time(&curr_time);
 	}
 	if (UIE_on) {
 		if (curr_time.tm_sec != prev_update_sec) {
drivers/acpi/utilities/utglobal.c +1 -0
diff -r 1db1bb63824b -r 5ae764557edf drivers/acpi/utilities/utglobal.c
@@ -840,5 +840,6 @@ void acpi_ut_init_globals(void)
 	return_VOID;
 }
 
+ACPI_EXPORT_SYMBOL(acpi_gbl_FADT)
 ACPI_EXPORT_SYMBOL(acpi_dbg_level)
 ACPI_EXPORT_SYMBOL(acpi_dbg_layer)
drivers/char/Kconfig +9 -1
diff -r 1db1bb63824b -r 5ae764557edf drivers/char/Kconfig
@@ -715,6 +715,12 @@ config NVRAM
 	  To compile this driver as a module, choose M here: the
 	  module will be called nvram.
 
+#
+# These legacy RTC drivers just cause too many conflicts with the generic
+# RTC framework ... let's not even try to coexist any more.
+#
+if RTC_LIB=n
+
 config RTC
 	tristate "Enhanced Real Time Clock Support"
 	depends on !PPC && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV && !ARM
@@ -808,6 +814,8 @@ config S3C2410_RTC
 	  RTC (Realtime Clock) driver for the clock inbuilt into the
 	  Samsung S3C2410. This can provide periodic interrupt rates
 	  from 1Hz to 64Hz for user programs, and wakeup from Alarm.
+
+endif # RTC_LIB
 
 config COBALT_LCD
 	bool "Support for Cobalt LCD"
@@ -1012,7 +1020,7 @@ config HPET
 	  non-periodioc and/or periodic.
 
 config HPET_RTC_IRQ
-	bool "HPET Control RTC IRQ" if !HPET_EMULATE_RTC
+	bool "HPET Control RTC IRQ" if RTC_LIB=n && !HPET_EMULATE_RTC
 	default n
 	depends on HPET
 	help
drivers/rtc/Kconfig +23 -0
diff -r 1db1bb63824b -r 5ae764557edf drivers/rtc/Kconfig
@@ -82,6 +82,29 @@ config RTC_INTF_DEV_UIE_EMUL
 
 comment "RTC drivers"
 	depends on RTC_CLASS
+
+# this 'CMOS' RTC driver is arch dependent because <asm-generic/rtc.h>
+# requires <asm/mc146818rtc.h> defining CMOS_READ/CMOS_WRITE, and a
+# global rtc_lock ... it's not yet just another platform_device.
+
+config RTC_DRV_CMOS
+	tristate "PC-style 'CMOS'"
+	depends on RTC_CLASS && (X86 || ALPHA || ARM || M32R || ATARI || PPC || MIPS || SPARC64)
+	default y if X86
+	help
+	  Say "yes" here to get direct support for the real time clock
+	  found in every PC or ACPI-based system, and some other boards.
+	  Specifically the original MC146818, compatibles like those in
+	  PC south bridges, the DS12887 or M48T86, some multifunction
+	  or LPC bus chips, and so on.
+
+	  Your system will need to define the platform device used by
+	  this driver, otherwise it won't be accessible. This means
+	  you can safely enable this driver if you don't know whether
+	  or not your board has this kind of hardware.
+
+	  This driver can also be built as a module. If so, the module
+	  will be called rtc-cmos.
 
 config RTC_DRV_X1205
 	tristate "Xicor/Intersil X1205"
drivers/rtc/Makefile +1 -0
diff -r 1db1bb63824b -r 5ae764557edf drivers/rtc/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_RTC_DRV_X1205)	+= rtc-x1205
 obj-$(CONFIG_RTC_DRV_X1205)	+= rtc-x1205.o
 obj-$(CONFIG_RTC_DRV_ISL1208)	+= rtc-isl1208.o
 obj-$(CONFIG_RTC_DRV_TEST)	+= rtc-test.o
+obj-$(CONFIG_RTC_DRV_CMOS)	+= rtc-cmos.o
 obj-$(CONFIG_RTC_DRV_DS1307)	+= rtc-ds1307.o
 obj-$(CONFIG_RTC_DRV_DS1672)	+= rtc-ds1672.o
 obj-$(CONFIG_RTC_DRV_DS1742)	+= rtc-ds1742.o
include/linux/mc146818rtc.h +17 -0
diff -r 1db1bb63824b -r 5ae764557edf include/linux/mc146818rtc.h
@@ -18,6 +18,23 @@
 #ifdef __KERNEL__
 #include <linux/spinlock.h>		/* spinlock_t */
 extern spinlock_t rtc_lock;		/* serialize CMOS RAM access */
+
+/* Some RTCs extend the mc146818 register set to support alarms of more
+ * than 24 hours in the future; or dates that include a century code.
+ * This platform_data structure can pass this information to the driver.
+ *
+ * Also, some platforms need suspend()/resume() hooks to kick in special
+ * handling of wake alarms, e.g. activating ACPI BIOS hooks or setting up
+ * a separate wakeup alarm used by some almost-clone chips.
+ */
+struct cmos_rtc_board_info {
+	void	(*wake_on)(struct device *dev);
+	void	(*wake_off)(struct device *dev);
+
+	u8	rtc_day_alarm;		/* zero, or register index */
+	u8	rtc_mon_alarm;		/* zero, or register index */
+	u8	rtc_century;		/* zero, or register index */
+};
 #endif
 
 /**********************************************************************
drivers/rtc/rtc-cmos.c new file +1150 -0

1,150 lines not on this page · raw message

include/linux/log2.h new file +209 -0

209 lines not on this page · raw message