Commit a7734ead authored by Tom Rini's avatar Tom Rini Committed by Linus Torvalds

[PATCH] A generic RTC driver [1/3]

This is the current version of the genrtc driver from the m68k
community.  This is slightly different than the version I have sent
previously in that it has been switched to C99-style initializers,
which was done in the current m68k CVS tree by Geert Uytterhoeven, and
the needed changes to select/compile it in general.  I had previously
asked the m68k community if anyone objected to this being submitted by me,
and I got Richard Zidlicky's (who's at the top of the file) approval, as
well as Geert Uytterhoeven's approval.
parent 67fbc2cd
...@@ -969,6 +969,31 @@ CONFIG_RTC ...@@ -969,6 +969,31 @@ CONFIG_RTC
The module is called rtc.o. If you want to compile it as a module, The module is called rtc.o. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>. say M here and read <file:Documentation/modules.txt>.
Generic Real Time Clock Support
CONFIG_GEN_RTC
If you say Y here and create a character special file /dev/rtc with
major number 10 and minor number 135 using mknod ("man mknod"), you
will get access to the real time clock (or hardware clock) built
into your computer.
It reports status information via the file /proc/driver/rtc and its
behaviour is set by various ioctls on /dev/rtc. If you enable the
"extended RTC operation" below it will also provide an emulation
for RTC_UIE which is required by some programs and may improve
precision in some cases.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
The module is called genrtc.o. If you want to compile it as a module,
say M here and read <file:Documentation/modules.txt>. To load the
module automaticaly add 'alias char-major-10-135 genrtc' to your
/etc/modules.conf
Extended RTC operation
CONFIG_GEN_RTC_X
Provides an emulation for RTC_UIE which is required by some programs
and may improve precision of the generic RTC support in some cases.
CONFIG_H8 CONFIG_H8
The Hitachi H8/337 is a microcontroller used to deal with the power The Hitachi H8/337 is a microcontroller used to deal with the power
and thermal environment. If you say Y here, you will be able to and thermal environment. If you say Y here, you will be able to
......
...@@ -151,6 +151,12 @@ if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" ]; then ...@@ -151,6 +151,12 @@ if [ "$CONFIG_X86" = "y" -o "$CONFIG_IA64" = "y" ]; then
fi fi
tristate '/dev/nvram support' CONFIG_NVRAM tristate '/dev/nvram support' CONFIG_NVRAM
tristate 'Enhanced Real Time Clock Support' CONFIG_RTC tristate 'Enhanced Real Time Clock Support' CONFIG_RTC
if [ "$CONFIG_RTC" != "y" ]; then
tristate 'Generic /dev/rtc emulation' CONFIG_GEN_RTC
if [ "$CONFIG_GEN_RTC" != "n" ]; then
bool ' Extended RTC operation' CONFIG_GEN_RTC_X
fi
fi
if [ "$CONFIG_IA64" = "y" ]; then if [ "$CONFIG_IA64" = "y" ]; then
bool 'EFI Real Time Clock Services' CONFIG_EFI_RTC bool 'EFI Real Time Clock Services' CONFIG_EFI_RTC
fi fi
......
...@@ -167,6 +167,7 @@ obj-$(CONFIG_APPLICOM) += applicom.o ...@@ -167,6 +167,7 @@ obj-$(CONFIG_APPLICOM) += applicom.o
obj-$(CONFIG_SONYPI) += sonypi.o obj-$(CONFIG_SONYPI) += sonypi.o
obj-$(CONFIG_ATARIMOUSE) += atarimouse.o obj-$(CONFIG_ATARIMOUSE) += atarimouse.o
obj-$(CONFIG_RTC) += rtc.o obj-$(CONFIG_RTC) += rtc.o
obj-$(CONFIG_GEN_RTC) += genrtc.o
obj-$(CONFIG_EFI_RTC) += efirtc.o obj-$(CONFIG_EFI_RTC) += efirtc.o
ifeq ($(CONFIG_PPC),) ifeq ($(CONFIG_PPC),)
obj-$(CONFIG_NVRAM) += nvram.o obj-$(CONFIG_NVRAM) += nvram.o
......
This diff is collapsed.
...@@ -39,10 +39,32 @@ struct rtc_wkalrm { ...@@ -39,10 +39,32 @@ struct rtc_wkalrm {
struct rtc_time time; /* time the alarm is set to */ struct rtc_time time; /* time the alarm is set to */
}; };
/*
* Data structure to control PLL correction some better RTC feature
* pll_value is used to get or set current value of correction,
* the rest of the struct is used to query HW capabilities.
* This is modeled after the RTC used in Q40/Q60 computers but
* should be sufficiently flexible for other devices
*
* +ve pll_value means clock will run faster by
* pll_value*pll_posmult/pll_clock
* -ve pll_value means clock will run slower by
* pll_value*pll_negmult/pll_clock
*/
struct rtc_pll_info {
int pll_ctrl; /* placeholder for fancier control */
int pll_value; /* get/set correction value */
int pll_max; /* max +ve (faster) adjustment value */
int pll_min; /* max -ve (slower) adjustment value */
int pll_posmult; /* factor for +ve corection */
int pll_negmult; /* factor for -ve corection */
long pll_clock; /* base PLL frequency */
};
/* /*
* ioctl calls that are permitted to the /dev/rtc interface, if * ioctl calls that are permitted to the /dev/rtc interface, if
* CONFIG_RTC/CONFIG_EFI_RTC was enabled. * any of the RTC drivers are enabled.
*/ */
#define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */ #define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */
...@@ -65,6 +87,8 @@ struct rtc_wkalrm { ...@@ -65,6 +87,8 @@ struct rtc_wkalrm {
#define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/ #define RTC_WKALM_SET _IOW('p', 0x0f, struct rtc_wkalrm)/* Set wakeup alarm*/
#define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/ #define RTC_WKALM_RD _IOR('p', 0x10, struct rtc_wkalrm)/* Get wakeup alarm*/
#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
#ifdef __KERNEL__ #ifdef __KERNEL__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment