[parisc-linux-cvs] linux deller
Helge Deller
deller@gmx.de
Sat, 11 Jan 2003 21:08:57 +0100
--Boundary-00=_ZnHI+40Z4vdqQj7
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
On Saturday 11 January 2003 21:10, Helge Deller wrote:
> CVSROOT: /var/cvs
> Module name: linux
> Changes by: deller 03/01/11 13:10:46
>
> Modified files:
> . : Makefile
> Documentation : Configure.help
> arch/parisc/kernel: parisc_ksyms.c
> drivers/char : genrtc.c
> include/linux : rtc.h
> Added files:
> include/asm-parisc: rtc.h
>
> Log message:
> 2.4.20-pa19:
> update to combined driver for m68k & hppa by Geert Uytterhoeven
> <geert@linux-m68k.org>
--Boundary-00=_ZnHI+40Z4vdqQj7
Content-Type: text/plain;
charset="iso-8859-1";
name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="diff"
Index: Makefile
===================================================================
RCS file: /var/cvs/linux/Makefile,v
retrieving revision 1.378
diff -u -p -r1.378 Makefile
--- Makefile 27 Dec 2002 08:06:09 -0000 1.378
+++ Makefile 11 Jan 2003 20:05:34 -0000
@@ -1,7 +1,7 @@
VERSION = 2
PATCHLEVEL = 4
SUBLEVEL = 20
-EXTRAVERSION = -pa18
+EXTRAVERSION = -pa19
KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
Index: Documentation/Configure.help
===================================================================
RCS file: /var/cvs/linux/Documentation/Configure.help,v
retrieving revision 1.29
diff -u -p -r1.29 Configure.help
--- Documentation/Configure.help 14 Nov 2002 15:10:09 -0000 1.29
+++ Documentation/Configure.help 11 Jan 2003 20:06:55 -0000
@@ -19000,6 +19000,34 @@ CONFIG_RTC
The module is called rtc.o. If you want to compile it as a module,
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.
+
+ In 2.4 and later kernels this is the only way to set and get rtc
+ time on m68k systems so it is highly recommended.
+
+ 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 automatically 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.
+
Tadpole ANA H8 Support
CONFIG_H8
The Hitachi H8/337 is a microcontroller used to deal with the power
Index: arch/parisc/kernel/parisc_ksyms.c
===================================================================
RCS file: /var/cvs/linux/arch/parisc/kernel/parisc_ksyms.c,v
retrieving revision 1.43
diff -u -p -r1.43 parisc_ksyms.c
--- arch/parisc/kernel/parisc_ksyms.c 17 Nov 2002 09:45:59 -0000 1.43
+++ arch/parisc/kernel/parisc_ksyms.c 11 Jan 2003 20:06:55 -0000
@@ -150,6 +150,8 @@ EXPORT_SYMBOL(csum_partial_copy);
#include <asm/pdc.h>
EXPORT_SYMBOL(pdc_add_valid);
+EXPORT_SYMBOL(pdc_tod_read);
+EXPORT_SYMBOL(pdc_tod_set);
EXPORT_SYMBOL(pdc_lan_station_id);
EXPORT_SYMBOL(pdc_get_initiator);
Index: drivers/char/genrtc.c
===================================================================
RCS file: /var/cvs/linux/drivers/char/genrtc.c,v
retrieving revision 1.7
diff -u -p -r1.7 genrtc.c
--- drivers/char/genrtc.c 29 Nov 2001 19:29:38 -0000 1.7
+++ drivers/char/genrtc.c 11 Jan 2003 20:06:55 -0000
<skipped>
Index: include/linux/rtc.h
===================================================================
RCS file: /var/cvs/linux/include/linux/rtc.h,v
retrieving revision 1.8
diff -u -p -r1.8 rtc.h
--- include/linux/rtc.h 5 Jul 2001 21:39:34 -0000 1.8
+++ include/linux/rtc.h 11 Jan 2003 20:06:55 -0000
@@ -39,10 +39,32 @@ struct rtc_wkalrm {
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
- * CONFIG_RTC/CONFIG_EFI_RTC was enabled.
+ * ioctl calls that are permitted to the /dev/rtc interface, if
+ * any of the RTC drivers are enabled.
*/
#define RTC_AIE_ON _IO('p', 0x01) /* Alarm int. enable on */
@@ -66,4 +88,6 @@ struct rtc_wkalrm {
#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_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 */
#endif /* _LINUX_RTC_H_ */
Index: include/asm-parisc/rtc.h
===================================================================
RCS file: include/asm-parisc/rtc.h
diff -N include/asm-parisc/rtc.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ include/asm-parisc/rtc.h 11 Jan 2003 20:06:55 -0000
@@ -0,0 +1,131 @@
+/* include/asm-parisc/rtc.h */
+
+#ifndef _ASM_RTC_H
+#define _ASM_RTC_H
+
+#ifdef __KERNEL__
+
+#include <linux/rtc.h>
+#include <asm/errno.h>
+
+#define RTC_PIE 0x40 /* periodic interrupt enable */
+#define RTC_AIE 0x20 /* alarm interrupt enable */
+#define RTC_UIE 0x10 /* update-finished interrupt enable */
+
+/* some dummy definitions */
+#define RTC_BATT_BAD 0x10 /* battery bad */
+#define RTC_SQWE 0x08 /* enable square-wave output */
+#define RTC_DM_BINARY 0x04 /* all time/date values are BCD if clear */
+#define RTC_24H 0x02 /* 24 hour mode - else hours bit 7 means pm */
+#define RTC_DST_EN 0x01 /* auto switch DST - works f. USA only */
+
+
+/* constants for calculation */
+#define SECS_PER_HOUR (60 * 60)
+#define SECS_PER_DAY (SECS_PER_HOUR * 24)
+
+#define __isleap(year) \
+ ((year) % 4 == 0 && ((year) % 100 != 0 || (year) % 400 == 0))
+
+
+/* How many days come before each month (0-12). */
+static const unsigned short int __mon_yday[2][13] =
+{
+ /* Normal years. */
+ { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 },
+ /* Leap years. */
+ { 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366 }
+};
+
+static inline unsigned get_rtc_time(struct rtc_time *wtime)
+{
+ /*
+ * Only the values that we read from the RTC are set. We leave
+ * tm_wday, tm_yday and tm_isdst untouched. Even though the
+ * RTC has RTC_DAY_OF_WEEK, we ignore it, as it is only updated
+ * by the RTC when initially set to a non-zero value.
+ */
+
+ struct pdc_tod tod_data;
+ long int days, rem, y;
+ const unsigned short int *ip;
+
+ if (pdc_tod_read(&tod_data) < 0)
+ return (RTC_24H | RTC_BATT_BAD);
+
+
+ // most of the remainder of this function is:
+ // Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc.
+ // This was originally a part of the GNU C Library.
+ // It is distributed under the GPL, and was swiped from offtime.c
+
+
+ days = tod_data.tod_sec / SECS_PER_DAY;
+ rem = tod_data.tod_sec % SECS_PER_DAY;
+
+ wtime->tm_hour = rem / SECS_PER_HOUR;
+ rem %= SECS_PER_HOUR;
+ wtime->tm_min = rem / 60;
+ wtime->tm_sec = rem % 60;
+
+ y = 1970;
+
+#define DIV(a, b) ((a) / (b) - ((a) % (b) < 0))
+#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))
+
+ while (days < 0 || days >= (__isleap (y) ? 366 : 365))
+ {
+ /* Guess a corrected year, assuming 365 days per year. */
+ long int yg = y + days / 365 - (days % 365 < 0);
+
+ /* Adjust DAYS and Y to match the guessed year. */
+ days -= ((yg - y) * 365
+ + LEAPS_THRU_END_OF (yg - 1)
+ - LEAPS_THRU_END_OF (y - 1));
+ y = yg;
+ }
+ wtime->tm_year = y - 1900;
+#undef DIV
+#undef LEAPS_THRU_END_OF
+
+ ip = __mon_yday[__isleap(y)];
+ for (y = 11; days < (long int) ip[y]; --y)
+ continue;
+ days -= ip[y];
+ wtime->tm_mon = y;
+ wtime->tm_mday = days + 1;
+
+ return (RTC_24H);
+}
+
+static inline int set_rtc_time(struct rtc_time *wtime)
+{
+ u_int32_t secs;
+
+ secs = mktime(wtime->tm_year + 1900, wtime->tm_mon + 1, wtime->tm_mday,
+ wtime->tm_hour, wtime->tm_min, wtime->tm_sec);
+
+ if (pdc_tod_set(secs, 0) < 0)
+ return -EINVAL;
+ else
+ return 0;
+}
+
+static inline unsigned int get_rtc_ss(void)
+{
+ return -EINVAL;
+}
+
+static inline int get_rtc_pll(struct rtc_pll_info *pll)
+{
+ return -EINVAL;
+}
+static inline int set_rtc_pll(struct rtc_pll_info *pll)
+{
+ return -EINVAL;
+}
+
+#endif /* __KERNEL__ */
+
+#endif /* _ASM__RTC_H */
+
--Boundary-00=_ZnHI+40Z4vdqQj7--