From c9cadd074271be3812dfc501d98ae93df22d7bd0 Mon Sep 17 00:00:00 2001 From: Rod Whitby Date: Fri, 14 Apr 2006 06:39:54 +0000 Subject: ixp4xx-kernel: Removed obsolete patches, and refreshed patchset from the nslu2-linux kernel CVS repo. --- .../2.6.16/10-mtdpart-redboot-fis-byteswap.patch | 70 - .../linux/ixp4xx-kernel/2.6.16/40-rtc-class.patch | 3086 +++- .../2.6.16/45-eeprom-new-notifier.patch | 209 + .../ixp4xx-kernel/2.6.16/45-eeprom-notifier.patch | 184 - .../2.6.16/50-i2c-bus-ixp4xx-hwmon.patch | 14 - .../ixp4xx-kernel/2.6.16/70-artop-latency.patch | 27 - .../linux/ixp4xx-kernel/2.6.16/75-dsmg600.patch | 40 +- .../ixp4xx-kernel/2.6.16/82-nas100d-power.patch | 15 - .../ixp4xx-kernel/2.6.16/92-nas100d-mac.patch | 85 + .../linux/ixp4xx-kernel/2.6.16/92-nslu2-mac.patch | 88 + .../linux/ixp4xx-kernel/2.6.16/94-loft-setup.patch | 105 +- .../ixp4xx-kernel/2.6.16/94-nas100d-setup.patch | 73 - .../linux/ixp4xx-kernel/2.6.16/96-nslu2-leds.patch | 4 +- .../ixp4xx-kernel/2.6.16/linux-2.6.16-i2c.patch | 13671 ++++++++++++++ .../ixp4xx-kernel/2.6.16/patch-2.6.16-rc4-ide2 | 18474 ------------------- packages/linux/ixp4xx-kernel_2.6.16.bb | 16 +- 16 files changed, 16255 insertions(+), 19906 deletions(-) delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/10-mtdpart-redboot-fis-byteswap.patch create mode 100644 packages/linux/ixp4xx-kernel/2.6.16/45-eeprom-new-notifier.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/45-eeprom-notifier.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/50-i2c-bus-ixp4xx-hwmon.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/70-artop-latency.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/82-nas100d-power.patch create mode 100644 packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch create mode 100644 packages/linux/ixp4xx-kernel/2.6.16/92-nslu2-mac.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/94-nas100d-setup.patch create mode 100644 packages/linux/ixp4xx-kernel/2.6.16/linux-2.6.16-i2c.patch delete mode 100644 packages/linux/ixp4xx-kernel/2.6.16/patch-2.6.16-rc4-ide2 diff --git a/packages/linux/ixp4xx-kernel/2.6.16/10-mtdpart-redboot-fis-byteswap.patch b/packages/linux/ixp4xx-kernel/2.6.16/10-mtdpart-redboot-fis-byteswap.patch deleted file mode 100644 index 3fa0535abf..0000000000 --- a/packages/linux/ixp4xx-kernel/2.6.16/10-mtdpart-redboot-fis-byteswap.patch +++ /dev/null @@ -1,70 +0,0 @@ -drivers/mtd/redboot.c: recognise a foreign byte sex partition table - -The RedBoot boot loader writes flash partition tables containing native -byte sex 32 bit values. When booting an opposite byte sex kernel (e.g. an -LE kernel from BE RedBoot) the current MTD driver fails to handle the -partition table and therefore is unable to generate the correct partition -map for the flash. - -The patch recognises that the FIS directory (the partition table) is -byte-reversed by examining the partition table size, which is known to be -one erase block (this is an assumption made elsewhere in redboot.c). If -the size matches the erase block after byte swapping the value then -byte-reversal is assumed, if not no further action is taken. The patched -code is fail safe; should redboot.c be changed to support a partition table -with a modified size field the test will fail and the partition table will -be assumed to have the host byte sex. - -If byte-reversal is detected the patch byte swaps the remainder of the 32 -bit fields in the copy of the table; this copy is then used to set up the -MTD partition map. - -Signed-off-by: John Bowler -Signed-off-by: Andrew Morton -Modified slightly and -Signed-off-by: David Woodhouse - -Index: drivers/mtd/redboot.c -=================================================================== -RCS file: /home/cvs/mtd/drivers/mtd/redboot.c,v -retrieving revision 1.18 -retrieving revision 1.19 -diff -u -p -r1.18 -r1.19 ---- linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000 -+++ linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000 -@@ -89,8 +89,32 @@ static int parse_redboot_partitions(stru - i = numslots; - break; - } -- if (!memcmp(buf[i].name, "FIS directory", 14)) -+ if (!memcmp(buf[i].name, "FIS directory", 14)) { -+ /* This is apparently the FIS directory entry for the -+ * FIS directory itself. The FIS directory size is -+ * one erase block; if the buf[i].size field is -+ * swab32(erasesize) then we know we are looking at -+ * a byte swapped FIS directory - swap all the entries! -+ * (NOTE: this is 'size' not 'data_length'; size is -+ * the full size of the entry.) -+ */ -+ if (swab32(buf[i].size) == master->erasesize) { -+ int j; -+ for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) { -+ /* The unsigned long fields were written with the -+ * wrong byte sex, name and pad have no byte sex. -+ */ -+ swab32s(&buf[j].flash_base); -+ swab32s(&buf[j].mem_base); -+ swab32s(&buf[j].size); -+ swab32s(&buf[j].entry_point); -+ swab32s(&buf[j].data_length); -+ swab32s(&buf[j].desc_cksum); -+ swab32s(&buf[j].file_cksum); -+ } -+ } - break; -+ } - } - if (i == numslots) { - /* Didn't find it */ - - diff --git a/packages/linux/ixp4xx-kernel/2.6.16/40-rtc-class.patch b/packages/linux/ixp4xx-kernel/2.6.16/40-rtc-class.patch index 3cc84b2a9b..044bd3abc1 100644 --- a/packages/linux/ixp4xx-kernel/2.6.16/40-rtc-class.patch +++ b/packages/linux/ixp4xx-kernel/2.6.16/40-rtc-class.patch @@ -1,6 +1,365 @@ ---- linux-rtc.orig/include/linux/rtc.h 2006-02-19 23:33:10.000000000 +0100 -+++ linux-rtc/include/linux/rtc.h 2006-02-19 23:33:15.000000000 +0100 -@@ -93,8 +93,97 @@ struct rtc_pll_info { +--- + CREDITS | 5 + MAINTAINERS | 6 + arch/arm/Kconfig | 3 + arch/arm/common/rtctime.c | 108 -- + arch/arm/mach-integrator/time.c | 16 + arch/arm/mach-pxa/generic.c | 6 + arch/arm/mach-sa1100/generic.c | 6 + arch/mips/ddb5xxx/common/rtc_ds1386.c | 4 + arch/mips/dec/time.c | 4 + arch/mips/ite-boards/generic/time.c | 4 + arch/mips/jmr3927/common/rtc_ds1742.c | 4 + arch/mips/kernel/time.c | 22 + arch/mips/lasat/setup.c | 4 + arch/mips/mips-boards/atlas/atlas_setup.c | 2 + arch/mips/mips-boards/malta/malta_setup.c | 2 + arch/mips/momentum/jaguar_atx/setup.c | 4 + arch/mips/momentum/ocelot_3/setup.c | 4 + arch/mips/momentum/ocelot_c/setup.c | 4 + arch/mips/pmc-sierra/yosemite/setup.c | 4 + arch/mips/sgi-ip22/ip22-time.c | 4 + arch/mips/sgi-ip32/ip32-setup.c | 4 + arch/mips/sibyte/swarm/setup.c | 8 + arch/mips/sni/setup.c | 4 + arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | 4 + arch/mips/tx4938/common/rtc_rx5c348.c | 4 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/char/Kconfig | 2 + drivers/i2c/chips/Kconfig | 18 + drivers/i2c/chips/Makefile | 2 + drivers/i2c/chips/rtc8564.c | 385 ------- + drivers/i2c/chips/rtc8564.h | 78 - + drivers/i2c/chips/x1205.c | 698 ------------- + drivers/rtc/Kconfig | 156 ++ + drivers/rtc/Makefile | 20 + drivers/rtc/class.c | 145 ++ + drivers/rtc/hctosys.c | 69 + + drivers/rtc/interface.c | 277 +++++ + drivers/rtc/rtc-dev.c | 382 +++++++ + drivers/rtc/rtc-ds1672.c | 233 ++++ + drivers/rtc/rtc-ep93xx.c | 163 +++ + drivers/rtc/rtc-lib.c | 99 + + drivers/rtc/rtc-pcf8563.c | 355 ++++++ + drivers/rtc/rtc-proc.c | 162 +++ + drivers/rtc/rtc-rs5c372.c | 295 +++++ + drivers/rtc/rtc-sa1100.c | 392 +++++++ + drivers/rtc/rtc-sysfs.c | 124 ++ + drivers/rtc/rtc-test.c | 205 +++ + drivers/rtc/rtc-x1205.c | 619 +++++++++++ + include/asm-arm/rtc.h | 3 + include/asm-mips/time.h | 12 + include/linux/rtc.h | 92 + + include/linux/x1205.h | 31 + 53 files changed, 3888 insertions(+), 1372 deletions(-) + +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-ixp4xx/drivers/rtc/rtc-lib.c 2006-03-08 01:59:26.000000000 +0100 +@@ -0,0 +1,99 @@ ++/* ++ * rtc and date/time utility functions ++ * ++ * Copyright (C) 2005-06 Tower Technologies ++ * Author: Alessandro Zummo ++ * ++ * based on arch/arm/common/rtctime.c and other bits ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; version 2 of the License. ++*/ ++ ++#include ++#include ++ ++static const unsigned char rtc_days_in_month[] = { ++ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ++}; ++ ++#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400) ++#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400)) ++ ++int rtc_month_days(unsigned int month, unsigned int year) ++{ ++ return rtc_days_in_month[month] + (LEAP_YEAR(year) && month == 1); ++} ++EXPORT_SYMBOL(rtc_month_days); ++ ++/* ++ * Convert seconds since 01-01-1970 00:00:00 to Gregorian date. ++ */ ++void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) ++{ ++ register int days, month, year; ++ ++ days = time / 86400; ++ time -= days * 86400; ++ ++ /* day of the week, 1970-01-01 was a Thursday */ ++ tm->tm_wday = (days + 4) % 7; ++ ++ year = 1970 + days / 365; ++ days -= (year - 1970) * 365 ++ + LEAPS_THRU_END_OF(year - 1) ++ - LEAPS_THRU_END_OF(1970 - 1); ++ if (days < 0) { ++ year -= 1; ++ days += 365 + LEAP_YEAR(year); ++ } ++ tm->tm_year = year - 1900; ++ tm->tm_yday = days + 1; ++ ++ for (month = 0; month < 11; month++) { ++ int newdays; ++ ++ newdays = days - rtc_month_days(month, year); ++ if (newdays < 0) ++ break; ++ days = newdays; ++ } ++ tm->tm_mon = month; ++ tm->tm_mday = days + 1; ++ ++ tm->tm_hour = time / 3600; ++ time -= tm->tm_hour * 3600; ++ tm->tm_min = time / 60; ++ tm->tm_sec = time - tm->tm_min * 60; ++} ++EXPORT_SYMBOL(rtc_time_to_tm); ++ ++/* ++ * Does the rtc_time represent a valid date/time? ++ */ ++int rtc_valid_tm(struct rtc_time *tm) ++{ ++ if (tm->tm_year < 70 ++ || tm->tm_mon >= 12 ++ || tm->tm_mday < 1 ++ || tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900) ++ || tm->tm_hour >= 24 ++ || tm->tm_min >= 60 ++ || tm->tm_sec >= 60) ++ return -EINVAL; ++ ++ return 0; ++} ++EXPORT_SYMBOL(rtc_valid_tm); ++ ++/* ++ * Convert Gregorian date to seconds since 01-01-1970 00:00:00. ++ */ ++int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time) ++{ ++ *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, ++ tm->tm_hour, tm->tm_min, tm->tm_sec); ++ return 0; ++} ++EXPORT_SYMBOL(rtc_tm_to_time); +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-ixp4xx/drivers/rtc/Makefile 2006-03-08 01:59:26.000000000 +0100 +@@ -0,0 +1,20 @@ ++# ++# Makefile for RTC class/drivers. ++# ++ ++obj-$(CONFIG_RTC_LIB) += rtc-lib.o ++obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o ++obj-$(CONFIG_RTC_CLASS) += rtc-core.o ++rtc-core-y := class.o interface.o ++ ++obj-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o ++obj-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o ++obj-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o ++ ++obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o ++obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o ++obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o ++obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o ++obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o ++obj-$(CONFIG_RTC_DRV_EP93XX) += rtc-ep93xx.o ++obj-$(CONFIG_RTC_DRV_SA1100) += rtc-sa1100.o +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ linux-ixp4xx/drivers/rtc/Kconfig 2006-03-08 01:59:26.000000000 +0100 +@@ -0,0 +1,156 @@ ++\# ++# RTC class/drivers configuration ++# ++ ++menu "Real Time Clock" ++ ++config RTC_LIB ++ bool ++ ++config RTC_CLASS ++ tristate "RTC class" ++ depends on EXPERIMENTAL ++ default n ++ select RTC_LIB ++ help ++ Generic RTC class support. If you say yes here, you will ++ be allowed to plug one or more RTCs to your system. You will ++ probably want to enable one of more of the interfaces below. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-class. ++ ++config RTC_HCTOSYS ++ bool "Set system time from RTC on startup" ++ depends on RTC_CLASS = y ++ default y ++ help ++ If you say yes here, the system time will be set using ++ the value read from the specified RTC device. This is useful ++ in order to avoid unnecessary fschk runs. ++ ++config RTC_HCTOSYS_DEVICE ++ string "The RTC to read the time from" ++ depends on RTC_HCTOSYS = y ++ default "rtc0" ++ help ++ The RTC device that will be used as the source for ++ the system time, usually rtc0. ++ ++comment "RTC interfaces" ++ depends on RTC_CLASS ++ ++config RTC_INTF_SYSFS ++ tristate "sysfs" ++ depends on RTC_CLASS && SYSFS ++ default RTC_CLASS ++ help ++ Say yes here if you want to use your RTC using the sysfs ++ interface, /sys/class/rtc/rtcX . ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-sysfs. ++ ++config RTC_INTF_PROC ++ tristate "proc" ++ depends on RTC_CLASS && PROC_FS ++ default RTC_CLASS ++ help ++ Say yes here if you want to use your RTC using the proc ++ interface, /proc/driver/rtc . ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-proc. ++ ++config RTC_INTF_DEV ++ tristate "dev" ++ depends on RTC_CLASS ++ default RTC_CLASS ++ help ++ Say yes here if you want to use your RTC using the dev ++ interface, /dev/rtc . ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-dev. ++ ++comment "RTC drivers" ++ depends on RTC_CLASS ++ ++config RTC_DRV_X1205 ++ tristate "Xicor/Intersil X1205 RTC chip" ++ depends on RTC_CLASS && I2C ++ help ++ If you say yes here you get support for the ++ Xicor/Intersil X1205 RTC chip. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-x1205. ++ ++config RTC_DRV_DS1672 ++ tristate "Dallas/Maxim DS1672" ++ depends on RTC_CLASS && I2C ++ help ++ If you say yes here you get support for the ++ Dallas/Maxim DS1672 timekeeping chip. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-ds1672. ++ ++config RTC_DRV_PCF8563 ++ tristate "Philips PCF8563/Epson RTC8564" ++ depends on RTC_CLASS && I2C ++ help ++ If you say yes here you get support for the ++ Philips PCF8563 RTC chip. The Epson RTC8564 ++ should work as well. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-pcf8563. ++ ++config RTC_DRV_RS5C372 ++ tristate "Ricoh RS5C372A/B" ++ depends on RTC_CLASS && I2C ++ help ++ If you say yes here you get support for the ++ Ricoh RS5C372A and RS5C372B RTC chips. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-rs5c372. ++ ++config RTC_DRV_EP93XX ++ tristate "Cirrus Logic EP93XX" ++ depends on RTC_CLASS && ARCH_EP93XX ++ help ++ If you say yes here you get support for the ++ RTC embedded in the Cirrus Logic EP93XX processors. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-ep93xx. ++ ++ ++config RTC_DRV_SA1100 ++ bool "SA11x0/PXA2xx RTC support" ++ depends on ARCH_SA1100 || ARCH_PXA ++ help ++ If you say Y here you will get access to the real time clock ++ built into your SA11x0 or PXA2xx CPU. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called rtc-sa1100. ++ ++config RTC_DRV_TEST ++ tristate "Test driver/device" ++ depends on RTC_CLASS ++ help ++ If you say yes here you get support for the ++ RTC test driver. It's a software RTC which can be ++ used to test the RTC subsystem APIs. It gets ++ the time from the system clock. ++ You want this driver only if you are doing development ++ on the RTC subsystem. Please read the source code ++ for further details. ++ ++ This driver can also be built as a module. If so, the module ++ will be called rtc-test. ++ ++endmenu +--- linux-ixp4xx.orig/drivers/Kconfig 2006-03-08 01:59:18.000000000 +0100 ++++ linux-ixp4xx/drivers/Kconfig 2006-03-08 01:59:26.000000000 +0100 +@@ -72,4 +72,6 @@ source "drivers/sn/Kconfig" + + source "drivers/edac/Kconfig" + ++source "drivers/rtc/Kconfig" ++ + endmenu +--- linux-ixp4xx.orig/drivers/Makefile 2006-03-08 01:59:18.000000000 +0100 ++++ linux-ixp4xx/drivers/Makefile 2006-03-08 01:59:26.000000000 +0100 +@@ -56,6 +56,7 @@ obj-$(CONFIG_USB_GADGET) += usb/gadget/ + obj-$(CONFIG_GAMEPORT) += input/gameport/ + obj-$(CONFIG_INPUT) += input/ + obj-$(CONFIG_I2O) += message/ ++obj-$(CONFIG_RTC_LIB) += rtc/ + obj-$(CONFIG_I2C) += i2c/ + obj-$(CONFIG_W1) += w1/ + obj-$(CONFIG_HWMON) += hwmon/ +--- linux-ixp4xx.orig/include/linux/rtc.h 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/include/linux/rtc.h 2006-03-08 01:59:26.000000000 +0100 +@@ -93,8 +93,100 @@ struct rtc_pll_info { #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 */ @@ -12,12 +371,19 @@ + #ifdef __KERNEL__ ++extern int rtc_month_days(unsigned int month, unsigned int year); ++extern int rtc_valid_tm(struct rtc_time *tm); ++extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); ++extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); ++ +#include +#include +#include +#include +#include + ++extern struct class *rtc_class; ++ +struct rtc_class_ops { + int (*open)(struct device *); + void (*release)(struct device *); @@ -47,6 +413,7 @@ + struct rtc_class_ops *ops; + struct mutex ops_lock; + ++ struct class_device *rtc_dev; + struct cdev char_dev; + struct mutex char_lock; + @@ -68,11 +435,6 @@ +extern void rtc_device_unregister(struct rtc_device *rdev); +extern int rtc_interface_register(struct class_interface *intf); + -+extern int rtc_month_days(unsigned int month, unsigned int year); -+extern int rtc_valid_tm(struct rtc_time *tm); -+extern int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time); -+extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm); -+ +extern int rtc_read_time(struct class_device *class_dev, struct rtc_time *tm); +extern int rtc_set_time(struct class_device *class_dev, struct rtc_time *tm); +extern int rtc_set_mmss(struct class_device *class_dev, unsigned long secs); @@ -98,28 +460,609 @@ typedef struct rtc_task { void (*func)(void *private_data); void *private_data; ---- linux-rtc.orig/drivers/Kconfig 2006-02-19 23:33:10.000000000 +0100 -+++ linux-rtc/drivers/Kconfig 2006-02-19 23:33:15.000000000 +0100 -@@ -70,4 +70,6 @@ source "drivers/sn/Kconfig" +--- linux-ixp4xx.orig/arch/arm/common/rtctime.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/arm/common/rtctime.c 2006-03-08 01:59:26.000000000 +0100 +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -42,89 +43,6 @@ static struct rtc_ops *rtc_ops; + + #define rtc_epoch 1900UL + +-static const unsigned char days_in_month[] = { +- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +-}; +- +-#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400) +-#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400)) +- +-static int month_days(unsigned int month, unsigned int year) +-{ +- return days_in_month[month] + (LEAP_YEAR(year) && month == 1); +-} +- +-/* +- * Convert seconds since 01-01-1970 00:00:00 to Gregorian date. +- */ +-void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) +-{ +- int days, month, year; +- +- days = time / 86400; +- time -= days * 86400; +- +- tm->tm_wday = (days + 4) % 7; +- +- year = 1970 + days / 365; +- days -= (year - 1970) * 365 +- + LEAPS_THRU_END_OF(year - 1) +- - LEAPS_THRU_END_OF(1970 - 1); +- if (days < 0) { +- year -= 1; +- days += 365 + LEAP_YEAR(year); +- } +- tm->tm_year = year - 1900; +- tm->tm_yday = days + 1; +- +- for (month = 0; month < 11; month++) { +- int newdays; +- +- newdays = days - month_days(month, year); +- if (newdays < 0) +- break; +- days = newdays; +- } +- tm->tm_mon = month; +- tm->tm_mday = days + 1; +- +- tm->tm_hour = time / 3600; +- time -= tm->tm_hour * 3600; +- tm->tm_min = time / 60; +- tm->tm_sec = time - tm->tm_min * 60; +-} +-EXPORT_SYMBOL(rtc_time_to_tm); +- +-/* +- * Does the rtc_time represent a valid date/time? +- */ +-int rtc_valid_tm(struct rtc_time *tm) +-{ +- if (tm->tm_year < 70 || +- tm->tm_mon >= 12 || +- tm->tm_mday < 1 || +- tm->tm_mday > month_days(tm->tm_mon, tm->tm_year + 1900) || +- tm->tm_hour >= 24 || +- tm->tm_min >= 60 || +- tm->tm_sec >= 60) +- return -EINVAL; +- +- return 0; +-} +-EXPORT_SYMBOL(rtc_valid_tm); +- +-/* +- * Convert Gregorian date to seconds since 01-01-1970 00:00:00. +- */ +-int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time) +-{ +- *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, +- tm->tm_hour, tm->tm_min, tm->tm_sec); +- +- return 0; +-} +-EXPORT_SYMBOL(rtc_tm_to_time); +- + /* + * Calculate the next alarm time given the requested alarm time mask + * and the current time. +@@ -151,13 +69,13 @@ void rtc_next_alarm_time(struct rtc_time + } + } + +-static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) ++static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm) + { + memset(tm, 0, sizeof(struct rtc_time)); + return ops->read_time(tm); + } + +-static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm) ++static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm) + { + int ret; + +@@ -168,7 +86,7 @@ static inline int rtc_set_time(struct rt + return ret; + } + +-static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) ++static inline int rtc_arm_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) + { + int ret = -EINVAL; + if (ops->read_alarm) { +@@ -178,7 +96,7 @@ static inline int rtc_read_alarm(struct + return ret; + } + +-static inline int rtc_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) ++static inline int rtc_arm_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) + { + int ret = -EINVAL; + if (ops->set_alarm) +@@ -266,7 +184,7 @@ static int rtc_ioctl(struct inode *inode + + switch (cmd) { + case RTC_ALM_READ: +- ret = rtc_read_alarm(ops, &alrm); ++ ret = rtc_arm_read_alarm(ops, &alrm); + if (ret) + break; + ret = copy_to_user(uarg, &alrm.time, sizeof(tm)); +@@ -288,11 +206,11 @@ static int rtc_ioctl(struct inode *inode + alrm.time.tm_wday = -1; + alrm.time.tm_yday = -1; + alrm.time.tm_isdst = -1; +- ret = rtc_set_alarm(ops, &alrm); ++ ret = rtc_arm_set_alarm(ops, &alrm); + break; + + case RTC_RD_TIME: +- ret = rtc_read_time(ops, &tm); ++ ret = rtc_arm_read_time(ops, &tm); + if (ret) + break; + ret = copy_to_user(uarg, &tm, sizeof(tm)); +@@ -310,7 +228,7 @@ static int rtc_ioctl(struct inode *inode + ret = -EFAULT; + break; + } +- ret = rtc_set_time(ops, &tm); ++ ret = rtc_arm_set_time(ops, &tm); + break; + + case RTC_EPOCH_SET: +@@ -341,11 +259,11 @@ static int rtc_ioctl(struct inode *inode + ret = -EFAULT; + break; + } +- ret = rtc_set_alarm(ops, &alrm); ++ ret = rtc_arm_set_alarm(ops, &alrm); + break; + + case RTC_WKALM_RD: +- ret = rtc_read_alarm(ops, &alrm); ++ ret = rtc_arm_read_alarm(ops, &alrm); + if (ret) + break; + ret = copy_to_user(uarg, &alrm, sizeof(alrm)); +@@ -435,7 +353,7 @@ static int rtc_read_proc(char *page, cha + struct rtc_time tm; + char *p = page; + +- if (rtc_read_time(ops, &tm) == 0) { ++ if (rtc_arm_read_time(ops, &tm) == 0) { + p += sprintf(p, + "rtc_time\t: %02d:%02d:%02d\n" + "rtc_date\t: %04d-%02d-%02d\n" +@@ -445,7 +363,7 @@ static int rtc_read_proc(char *page, cha + rtc_epoch); + } - source "drivers/edac/Kconfig" +- if (rtc_read_alarm(ops, &alrm) == 0) { ++ if (rtc_arm_read_alarm(ops, &alrm) == 0) { + p += sprintf(p, "alrm_time\t: "); + if ((unsigned int)alrm.time.tm_hour <= 24) + p += sprintf(p, "%02d:", alrm.time.tm_hour); +--- linux-ixp4xx.orig/include/asm-arm/rtc.h 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/include/asm-arm/rtc.h 2006-03-08 01:59:26.000000000 +0100 +@@ -25,9 +25,6 @@ struct rtc_ops { + int (*proc)(char *buf); + }; + +-void rtc_time_to_tm(unsigned long, struct rtc_time *); +-int rtc_tm_to_time(struct rtc_time *, unsigned long *); +-int rtc_valid_tm(struct rtc_time *); + void rtc_next_alarm_time(struct rtc_time *, struct rtc_time *, struct rtc_time *); + void rtc_update(unsigned long, unsigned long); + int register_rtc(struct rtc_ops *); +--- linux-ixp4xx.orig/drivers/char/Kconfig 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/drivers/char/Kconfig 2006-03-08 01:59:26.000000000 +0100 +@@ -695,7 +695,7 @@ config NVRAM + + config RTC + tristate "Enhanced Real Time Clock Support" +- depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV ++ depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV && !ARM + ---help--- + 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 +--- linux-ixp4xx.orig/arch/arm/Kconfig 2006-03-08 01:59:18.000000000 +0100 ++++ linux-ixp4xx/arch/arm/Kconfig 2006-03-08 01:59:26.000000000 +0100 +@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration" + config ARM + bool + default y ++ select RTC_LIB + help + The ARM series is a line of low-power-consumption RISC chip designs + licensed by ARM Ltd and targeted at embedded applications and +@@ -819,6 +820,8 @@ source "drivers/usb/Kconfig" + + source "drivers/mmc/Kconfig" +source "drivers/rtc/Kconfig" + endmenu ---- linux-rtc.orig/drivers/Makefile 2006-02-19 23:33:10.000000000 +0100 -+++ linux-rtc/drivers/Makefile 2006-02-19 23:33:15.000000000 +0100 -@@ -56,6 +56,7 @@ obj-$(CONFIG_USB_GADGET) += usb/gadget/ - obj-$(CONFIG_GAMEPORT) += input/gameport/ - obj-$(CONFIG_INPUT) += input/ - obj-$(CONFIG_I2O) += message/ -+obj-y += rtc/ - obj-$(CONFIG_I2C) += i2c/ - obj-$(CONFIG_W1) += w1/ - obj-$(CONFIG_HWMON) += hwmon/ + + source "fs/Kconfig" +--- linux-ixp4xx.orig/arch/arm/mach-integrator/time.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/arm/mach-integrator/time.c 2006-03-08 01:59:26.000000000 +0100 +@@ -40,13 +40,13 @@ static int integrator_set_rtc(void) + return 1; + } + +-static int rtc_read_alarm(struct rtc_wkalrm *alrm) ++static int integrator_rtc_read_alarm(struct rtc_wkalrm *alrm) + { + rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time); + return 0; + } + +-static inline int rtc_set_alarm(struct rtc_wkalrm *alrm) ++static inline int integrator_rtc_set_alarm(struct rtc_wkalrm *alrm) + { + unsigned long time; + int ret; +@@ -62,7 +62,7 @@ static inline int rtc_set_alarm(struct r + return ret; + } + +-static int rtc_read_time(struct rtc_time *tm) ++static int integrator_rtc_read_time(struct rtc_time *tm) + { + rtc_time_to_tm(readl(rtc_base + RTC_DR), tm); + return 0; +@@ -76,7 +76,7 @@ static int rtc_read_time(struct rtc_time + * edge of the 1Hz clock, we must write the time one second + * in advance. + */ +-static inline int rtc_set_time(struct rtc_time *tm) ++static inline int integrator_rtc_set_time(struct rtc_time *tm) + { + unsigned long time; + int ret; +@@ -90,10 +90,10 @@ static inline int rtc_set_time(struct rt + + static struct rtc_ops rtc_ops = { + .owner = THIS_MODULE, +- .read_time = rtc_read_time, +- .set_time = rtc_set_time, +- .read_alarm = rtc_read_alarm, +- .set_alarm = rtc_set_alarm, ++ .read_time = integrator_rtc_read_time, ++ .set_time = integrator_rtc_set_time, ++ .read_alarm = integrator_rtc_read_alarm, ++ .set_alarm = integrator_rtc_set_alarm, + }; + + static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id, +--- linux-ixp4xx.orig/arch/mips/ddb5xxx/common/rtc_ds1386.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/ddb5xxx/common/rtc_ds1386.c 2006-03-08 01:59:26.000000000 +0100 +@@ -165,6 +165,6 @@ rtc_ds1386_init(unsigned long base) + WRITE_RTC(0xB, byte); + + /* set the function pointers */ +- rtc_get_time = rtc_ds1386_get_time; +- rtc_set_time = rtc_ds1386_set_time; ++ rtc_mips_get_time = rtc_ds1386_get_time; ++ rtc_mips_set_time = rtc_ds1386_set_time; + } +--- linux-ixp4xx.orig/arch/mips/dec/time.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/dec/time.c 2006-03-08 01:59:26.000000000 +0100 +@@ -193,8 +193,8 @@ static void dec_ioasic_hpt_init(unsigned + + void __init dec_time_init(void) + { +- rtc_get_time = dec_rtc_get_time; +- rtc_set_mmss = dec_rtc_set_mmss; ++ rtc_mips_get_time = dec_rtc_get_time; ++ rtc_mips_set_mmss = dec_rtc_set_mmss; + + mips_timer_state = dec_timer_state; + mips_timer_ack = dec_timer_ack; +--- linux-ixp4xx.orig/arch/mips/ite-boards/generic/time.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/ite-boards/generic/time.c 2006-03-08 01:59:26.000000000 +0100 +@@ -227,8 +227,8 @@ void __init it8172_time_init(void) + + local_irq_restore(flags); + +- rtc_get_time = it8172_rtc_get_time; +- rtc_set_time = it8172_rtc_set_time; ++ rtc_mips_get_time = it8172_rtc_get_time; ++ rtc_mips_set_time = it8172_rtc_set_time; + } + + #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) +--- linux-ixp4xx.orig/arch/mips/jmr3927/common/rtc_ds1742.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/jmr3927/common/rtc_ds1742.c 2006-03-08 01:59:26.000000000 +0100 +@@ -159,8 +159,8 @@ rtc_ds1742_init(unsigned long base) + db_assert((rtc_base & 0xe0000000) == KSEG1); + + /* set the function pointers */ +- rtc_get_time = rtc_ds1742_get_time; +- rtc_set_time = rtc_ds1742_set_time; ++ rtc_mips_get_time = rtc_ds1742_get_time; ++ rtc_mips_set_time = rtc_ds1742_set_time; + + /* clear oscillator stop bit */ + CMOS_WRITE(RTC_READ, RTC_CONTROL); +--- linux-ixp4xx.orig/arch/mips/kernel/time.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/kernel/time.c 2006-03-08 01:59:26.000000000 +0100 +@@ -65,9 +65,9 @@ static int null_rtc_set_time(unsigned lo + return 0; + } + +-unsigned long (*rtc_get_time)(void) = null_rtc_get_time; +-int (*rtc_set_time)(unsigned long) = null_rtc_set_time; +-int (*rtc_set_mmss)(unsigned long); ++unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time; ++int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time; ++int (*rtc_mips_set_mmss)(unsigned long); + + + /* usecs per counter cycle, shifted to left by 32 bits */ +@@ -438,7 +438,7 @@ irqreturn_t timer_interrupt(int irq, voi + + /* + * If we have an externally synchronized Linux clock, then update +- * CMOS clock accordingly every ~11 minutes. rtc_set_time() has to be ++ * CMOS clock accordingly every ~11 minutes. rtc_mips_set_time() has to be + * called as close as possible to 500 ms before the new second starts. + */ + write_seqlock(&xtime_lock); +@@ -446,7 +446,7 @@ irqreturn_t timer_interrupt(int irq, voi + xtime.tv_sec > last_rtc_update + 660 && + (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && + (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { +- if (rtc_set_mmss(xtime.tv_sec) == 0) { ++ if (rtc_mips_set_mmss(xtime.tv_sec) == 0) { + last_rtc_update = xtime.tv_sec; + } else { + /* do it again in 60 s */ +@@ -563,7 +563,7 @@ asmlinkage void ll_local_timer_interrupt + * b) (optional) calibrate and set the mips_hpt_frequency + * (only needed if you intended to use fixed_rate_gettimeoffset + * or use cpu counter as timer interrupt source) +- * 2) setup xtime based on rtc_get_time(). ++ * 2) setup xtime based on rtc_mips_get_time(). + * 3) choose a appropriate gettimeoffset routine. + * 4) calculate a couple of cached variables for later usage + * 5) board_timer_setup() - +@@ -631,10 +631,10 @@ void __init time_init(void) + if (board_time_init) + board_time_init(); + +- if (!rtc_set_mmss) +- rtc_set_mmss = rtc_set_time; ++ if (!rtc_mips_set_mmss) ++ rtc_mips_set_mmss = rtc_mips_set_time; + +- xtime.tv_sec = rtc_get_time(); ++ xtime.tv_sec = rtc_mips_get_time(); + xtime.tv_nsec = 0; + + set_normalized_timespec(&wall_to_monotonic, +@@ -770,8 +770,8 @@ void to_tm(unsigned long tim, struct rtc + + EXPORT_SYMBOL(rtc_lock); + EXPORT_SYMBOL(to_tm); +-EXPORT_SYMBOL(rtc_set_time); +-EXPORT_SYMBOL(rtc_get_time); ++EXPORT_SYMBOL(rtc_mips_set_time); ++EXPORT_SYMBOL(rtc_mips_get_time); + + unsigned long long sched_clock(void) + { +--- linux-ixp4xx.orig/arch/mips/lasat/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/lasat/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -174,8 +174,8 @@ void __init plat_setup(void) + + #ifdef CONFIG_DS1603 + ds1603 = &ds_defs[mips_machtype]; +- rtc_get_time = ds1603_read; +- rtc_set_time = ds1603_set; ++ rtc_mips_get_time = ds1603_read; ++ rtc_mips_set_time = ds1603_set; + #endif + + #ifdef DYNAMIC_SERIAL_INIT +--- linux-ixp4xx.orig/arch/mips/mips-boards/atlas/atlas_setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/mips-boards/atlas/atlas_setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -65,7 +65,7 @@ void __init plat_setup(void) + + board_time_init = mips_time_init; + board_timer_setup = mips_timer_setup; +- rtc_get_time = mips_rtc_get_time; ++ rtc_mips_get_time = mips_rtc_get_time; + } + + static void __init serial_init(void) +--- linux-ixp4xx.orig/arch/mips/mips-boards/malta/malta_setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/mips-boards/malta/malta_setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -225,5 +225,5 @@ void __init plat_setup(void) + + board_time_init = mips_time_init; + board_timer_setup = mips_timer_setup; +- rtc_get_time = mips_rtc_get_time; ++ rtc_mips_get_time = mips_rtc_get_time; + } +--- linux-ixp4xx.orig/arch/mips/momentum/jaguar_atx/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/momentum/jaguar_atx/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -228,8 +228,8 @@ void momenco_time_init(void) + mips_hpt_frequency = cpu_clock / 2; + board_timer_setup = momenco_timer_setup; + +- rtc_get_time = m48t37y_get_time; +- rtc_set_time = m48t37y_set_time; ++ rtc_mips_get_time = m48t37y_get_time; ++ rtc_mips_set_time = m48t37y_set_time; + } + + static struct resource mv_pci_io_mem0_resource = { +--- linux-ixp4xx.orig/arch/mips/momentum/ocelot_3/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/momentum/ocelot_3/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -215,8 +215,8 @@ void momenco_time_init(void) + mips_hpt_frequency = cpu_clock / 2; + board_timer_setup = momenco_timer_setup; + +- rtc_get_time = m48t37y_get_time; +- rtc_set_time = m48t37y_set_time; ++ rtc_mips_get_time = m48t37y_get_time; ++ rtc_mips_set_time = m48t37y_set_time; + } + + /* +--- linux-ixp4xx.orig/arch/mips/momentum/ocelot_c/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/momentum/ocelot_c/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -226,8 +226,8 @@ void momenco_time_init(void) + printk("momenco_time_init cpu_clock=%d\n", cpu_clock); + board_timer_setup = momenco_timer_setup; + +- rtc_get_time = m48t37y_get_time; +- rtc_set_time = m48t37y_set_time; ++ rtc_mips_get_time = m48t37y_get_time; ++ rtc_mips_set_time = m48t37y_set_time; + } + + void __init plat_setup(void) +--- linux-ixp4xx.orig/arch/mips/pmc-sierra/yosemite/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/pmc-sierra/yosemite/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -198,8 +198,8 @@ static void __init py_rtc_setup(void) + if (!m48t37_base) + printk(KERN_ERR "Mapping the RTC failed\n"); + +- rtc_get_time = m48t37y_get_time; +- rtc_set_time = m48t37y_set_time; ++ rtc_mips_get_time = m48t37y_get_time; ++ rtc_mips_set_time = m48t37y_set_time; + + write_seqlock(&xtime_lock); + xtime.tv_sec = m48t37y_get_time(); +--- linux-ixp4xx.orig/arch/mips/sgi-ip22/ip22-time.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/sgi-ip22/ip22-time.c 2006-03-08 01:59:26.000000000 +0100 +@@ -212,8 +212,8 @@ static void indy_timer_setup(struct irqa + void __init ip22_time_init(void) + { + /* setup hookup functions */ +- rtc_get_time = indy_rtc_get_time; +- rtc_set_time = indy_rtc_set_time; ++ rtc_mips_get_time = indy_rtc_get_time; ++ rtc_mips_set_time = indy_rtc_set_time; + + board_time_init = indy_time_init; + board_timer_setup = indy_timer_setup; +--- linux-ixp4xx.orig/arch/mips/sgi-ip32/ip32-setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/sgi-ip32/ip32-setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -91,8 +91,8 @@ void __init plat_setup(void) + { + board_be_init = ip32_be_init; + +- rtc_get_time = mc146818_get_cmos_time; +- rtc_set_mmss = mc146818_set_rtc_mmss; ++ rtc_mips_get_time = mc146818_get_cmos_time; ++ rtc_mips_set_mmss = mc146818_set_rtc_mmss; + + board_time_init = ip32_time_init; + board_timer_setup = ip32_timer_setup; +--- linux-ixp4xx.orig/arch/mips/sibyte/swarm/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/sibyte/swarm/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -114,14 +114,14 @@ void __init plat_setup(void) + + if (xicor_probe()) { + printk("swarm setup: Xicor 1241 RTC detected.\n"); +- rtc_get_time = xicor_get_time; +- rtc_set_time = xicor_set_time; ++ rtc_mips_get_time = xicor_get_time; ++ rtc_mips_set_time = xicor_set_time; + } + + if (m41t81_probe()) { + printk("swarm setup: M41T81 RTC detected.\n"); +- rtc_get_time = m41t81_get_time; +- rtc_set_time = m41t81_set_time; ++ rtc_mips_get_time = m41t81_get_time; ++ rtc_mips_set_time = m41t81_set_time; + } + + printk("This kernel optimized for " +--- linux-ixp4xx.orig/arch/mips/sni/setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/sni/setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -164,8 +164,8 @@ static struct pci_controller sni_control + + static inline void sni_pcimt_time_init(void) + { +- rtc_get_time = mc146818_get_cmos_time; +- rtc_set_time = mc146818_set_rtc_mmss; ++ rtc_mips_get_time = mc146818_get_cmos_time; ++ rtc_mips_set_time = mc146818_set_rtc_mmss; + } + + void __init plat_setup(void) +--- linux-ixp4xx.orig/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c 2006-03-08 01:59:26.000000000 +0100 +@@ -1036,8 +1036,8 @@ toshiba_rbtx4927_time_init(void) + + #ifdef CONFIG_RTC_DS1742 + +- rtc_get_time = rtc_ds1742_get_time; +- rtc_set_time = rtc_ds1742_set_time; ++ rtc_mips_get_time = rtc_ds1742_get_time; ++ rtc_mips_set_time = rtc_ds1742_set_time; + + TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, + ":rtc_ds1742_init()-\n"); +--- linux-ixp4xx.orig/arch/mips/tx4938/common/rtc_rx5c348.c 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/arch/mips/tx4938/common/rtc_rx5c348.c 2006-03-08 01:59:26.000000000 +0100 +@@ -197,6 +197,6 @@ rtc_rx5c348_init(int chipid) + srtc_24h = 1; + + /* set the function pointers */ +- rtc_get_time = rtc_rx5c348_get_time; +- rtc_set_time = rtc_rx5c348_set_time; ++ rtc_mips_get_time = rtc_rx5c348_get_time; ++ rtc_mips_set_time = rtc_rx5c348_set_time; + } +--- linux-ixp4xx.orig/include/asm-mips/time.h 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/include/asm-mips/time.h 2006-03-08 01:59:26.000000000 +0100 +@@ -26,14 +26,14 @@ extern spinlock_t rtc_lock; + + /* + * RTC ops. By default, they point to no-RTC functions. +- * rtc_get_time - mktime(year, mon, day, hour, min, sec) in seconds. +- * rtc_set_time - reverse the above translation and set time to RTC. +- * rtc_set_mmss - similar to rtc_set_time, but only min and sec need ++ * rtc_mips_get_time - mktime(year, mon, day, hour, min, sec) in seconds. ++ * rtc_mips_set_time - reverse the above translation and set time to RTC. ++ * rtc_mips_set_mmss - similar to rtc_set_time, but only min and sec need + * to be set. Used by RTC sync-up. + */ +-extern unsigned long (*rtc_get_time)(void); +-extern int (*rtc_set_time)(unsigned long); +-extern int (*rtc_set_mmss)(unsigned long); ++extern unsigned long (*rtc_mips_get_time)(void); ++extern int (*rtc_mips_set_time)(unsigned long); ++extern int (*rtc_mips_set_mmss)(unsigned long); + + /* + * Timer interrupt functions. --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-rtc/drivers/rtc/class.c 2006-02-19 23:33:15.000000000 +0100 -@@ -0,0 +1,143 @@ ++++ linux-ixp4xx/drivers/rtc/class.c 2006-03-08 01:59:26.000000000 +0100 +@@ -0,0 +1,145 @@ +/* + * RTC subsystem, base class + * @@ -175,252 +1118,99 @@ + + mutex_lock(&idr_lock); + err = idr_get_new(&rtc_idr, NULL, &id); -+ mutex_unlock(&idr_lock); -+ -+ if (err < 0) -+ goto exit; -+ -+ id = id & MAX_ID_MASK; -+ -+ if ((rtc = kzalloc(sizeof(struct rtc_device), GFP_KERNEL)) == NULL) { -+ err = -ENOMEM; -+ goto exit_idr; -+ } -+ -+ rtc->id = id; -+ rtc->ops = ops; -+ rtc->owner = owner; -+ rtc->class_dev.dev = dev; -+ rtc->class_dev.class = rtc_class; -+ rtc->class_dev.release = rtc_device_release; -+ -+ mutex_init(&rtc->ops_lock); -+ spin_lock_init(&rtc->irq_lock); -+ spin_lock_init(&rtc->irq_task_lock); -+ -+ strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); -+ snprintf(rtc->class_dev.class_id, BUS_ID_SIZE, "rtc%d", id); -+ -+ if ((err = class_device_register(&rtc->class_dev))) -+ goto exit_kfree; -+ -+ dev_info(dev, "rtc core: registered %s as %s\n", -+ rtc->name, rtc->class_dev.class_id); -+ -+ return rtc; -+ -+exit_kfree: -+ kfree(rtc); -+ -+exit_idr: -+ idr_remove(&rtc_idr, id); -+ -+exit: -+ return ERR_PTR(err); -+} -+EXPORT_SYMBOL_GPL(rtc_device_register); -+ -+ -+/** -+ * rtc_device_unregister - removes the previously registered RTC class device -+ * -+ * @rtc: the RTC class device to destroy -+ */ -+void rtc_device_unregister(struct rtc_device *rtc) -+{ -+ mutex_lock(&rtc->ops_lock); -+ rtc->ops = NULL; -+ mutex_unlock(&rtc->ops_lock); -+ class_device_unregister(&rtc->class_dev); -+} -+EXPORT_SYMBOL_GPL(rtc_device_unregister); -+ -+int rtc_interface_register(struct class_interface *intf) -+{ -+ intf->class = rtc_class; -+ return class_interface_register(intf); -+} -+EXPORT_SYMBOL_GPL(rtc_interface_register); -+ -+static int __init rtc_init(void) -+{ -+ rtc_class = class_create(THIS_MODULE, "rtc"); -+ if (IS_ERR(rtc_class)) { -+ printk(KERN_ERR "%s: couldn't create class\n", __FILE__); -+ return PTR_ERR(rtc_class); -+ } -+ return 0; -+} -+ -+static void __exit rtc_exit(void) -+{ -+ class_destroy(rtc_class); -+} -+ -+module_init(rtc_init); -+module_exit(rtc_exit); -+ -+MODULE_AUTHOR("Alessandro Zummo "); -+MODULE_DESCRIPTION("RTC class support"); -+MODULE_LICENSE("GPL"); ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-rtc/drivers/rtc/Kconfig 2006-02-21 00:36:43.000000000 +0100 -@@ -0,0 +1,131 @@ -+# -+# RTC class/drivers configuration -+# -+ -+menu "Real Time Clock" -+ -+config RTC_CLASS -+ tristate "RTC class" -+ depends on EXPERIMENTAL -+ default y -+ help -+ Generic RTC class support. If you say yes here, you will -+ be allowed to plug one or more RTCs to your system. You will -+ probably want to enable one of more of the interfaces below. -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-class. -+ -+config RTC_HCTOSYS -+ bool "Set system time from RTC on startup" -+ depends on RTC_CLASS = y -+ default y -+ help -+ If you say yes here, the system time will be set using -+ the value read from the specified RTC device. This is useful -+ in order to avoid unnecessary fschk runs. -+ -+config RTC_HCTOSYS_DEVICE -+ string "The RTC to read the time from" -+ depends on RTC_HCTOSYS = y -+ default "rtc0" -+ help -+ The RTC device that will be used as the source for -+ the system time, usually rtc0. -+ -+comment "RTC interfaces" -+ depends on RTC_CLASS -+ -+config RTC_INTF_SYSFS -+ tristate "sysfs" -+ depends on RTC_CLASS && SYSFS -+ default RTC_CLASS -+ help -+ Say yes here if you want to use your RTC using the sysfs -+ interface, /sys/class/rtc/rtcX . -+ -+ This driver can also be built as a module. If so, the module -+ will be called rtc-sysfs. ++ mutex_unlock(&idr_lock); + -+config RTC_INTF_PROC -+ tristate "proc" -+ depends on RTC_CLASS && PROC_FS -+ default RTC_CLASS -+ help -+ Say yes here if you want to use your RTC using the proc -+ interface, /proc/driver/rtc . ++ if (err < 0) ++ goto exit; + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-proc. ++ id = id & MAX_ID_MASK; + -+config RTC_INTF_DEV -+ tristate "dev" -+ depends on RTC_CLASS -+ default RTC_CLASS -+ help -+ Say yes here if you want to use your RTC using the dev -+ interface, /dev/rtc . ++ rtc = kzalloc(sizeof(struct rtc_device), GFP_KERNEL); ++ if (rtc == NULL) { ++ err = -ENOMEM; ++ goto exit_idr; ++ } + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-dev. ++ rtc->id = id; ++ rtc->ops = ops; ++ rtc->owner = owner; ++ rtc->class_dev.dev = dev; ++ rtc->class_dev.class = rtc_class; ++ rtc->class_dev.release = rtc_device_release; + -+comment "RTC drivers" -+ depends on RTC_CLASS ++ mutex_init(&rtc->ops_lock); ++ spin_lock_init(&rtc->irq_lock); ++ spin_lock_init(&rtc->irq_task_lock); + -+config RTC_DRV_X1205 -+ tristate "Xicor/Intersil X1205 RTC chip" -+ depends on RTC_CLASS && I2C -+ help -+ If you say yes here you get support for the -+ Xicor/Intersil X1205 RTC chip. ++ strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); ++ snprintf(rtc->class_dev.class_id, BUS_ID_SIZE, "rtc%d", id); + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-x1205. ++ err = class_device_register(&rtc->class_dev); ++ if (err) ++ goto exit_kfree; + -+config RTC_DRV_DS1672 -+ tristate "Dallas/Maxim DS1672" -+ depends on RTC_CLASS && I2C -+ help -+ If you say yes here you get support for the -+ Dallas/Maxim DS1672 timekeeping chip. ++ dev_info(dev, "rtc core: registered %s as %s\n", ++ rtc->name, rtc->class_dev.class_id); + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-ds1672. ++ return rtc; + -+config RTC_DRV_PCF8563 -+ tristate "Philips PCF8563/Epson RTC8564" -+ depends on RTC_CLASS && I2C -+ help -+ If you say yes here you get support for the -+ Philips PCF8563 RTC chip. The Epson RTC8564 -+ should work as well. ++exit_kfree: ++ kfree(rtc); + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-pcf8563. ++exit_idr: ++ idr_remove(&rtc_idr, id); + -+config RTC_DRV_RS5C372 -+ tristate "Ricoh RS5C372A/B" -+ depends on RTC_CLASS && I2C -+ help -+ If you say yes here you get support for the -+ Ricoh RS5C372A and RS5C372B RTC chips. ++exit: ++ return ERR_PTR(err); ++} ++EXPORT_SYMBOL_GPL(rtc_device_register); + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-rs5c372. + -+config RTC_DRV_TEST -+ tristate "Test driver/device" -+ depends on RTC_CLASS -+ help -+ If you say yes here you get support for the -+ RTC test driver. It's a software RTC which can be -+ used to test the RTC subsystem APIs. It gets -+ the time from the system clock. -+ You want this driver only if you are doing development -+ on the RTC subsystem. Please read the source code -+ for further details. ++/** ++ * rtc_device_unregister - removes the previously registered RTC class device ++ * ++ * @rtc: the RTC class device to destroy ++ */ ++void rtc_device_unregister(struct rtc_device *rtc) ++{ ++ mutex_lock(&rtc->ops_lock); ++ rtc->ops = NULL; ++ mutex_unlock(&rtc->ops_lock); ++ class_device_unregister(&rtc->class_dev); ++} ++EXPORT_SYMBOL_GPL(rtc_device_unregister); + -+ This driver can also be built as a module. If so, the module -+ will be called rtc-test. ++int rtc_interface_register(struct class_interface *intf) ++{ ++ intf->class = rtc_class; ++ return class_interface_register(intf); ++} ++EXPORT_SYMBOL_GPL(rtc_interface_register); + -+endmenu ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-rtc/drivers/rtc/Makefile 2006-02-21 00:36:43.000000000 +0100 -@@ -0,0 +1,18 @@ -+# -+# Makefile for RTC class/drivers. -+# ++static int __init rtc_init(void) ++{ ++ rtc_class = class_create(THIS_MODULE, "rtc"); ++ if (IS_ERR(rtc_class)) { ++ printk(KERN_ERR "%s: couldn't create class\n", __FILE__); ++ return PTR_ERR(rtc_class); ++ } ++ return 0; ++} + -+obj-y += utils.o -+obj-$(CONFIG_RTC_HCTOSYS) += hctosys.o -+obj-$(CONFIG_RTC_CLASS) += rtc-core.o -+rtc-core-y := class.o interface.o -+obj-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o -+obj-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o -+obj-$(CONFIG_RTC_INTF_DEV) += rtc-dev.o ++static void __exit rtc_exit(void) ++{ ++ class_destroy(rtc_class); ++} + -+obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o -+obj-$(CONFIG_RTC_DRV_TEST) += rtc-test.o -+obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o -+obj-$(CONFIG_RTC_DRV_PCF8563) += rtc-pcf8563.o -+obj-$(CONFIG_RTC_DRV_RS5C372) += rtc-rs5c372.o ++module_init(rtc_init); ++module_exit(rtc_exit); + ++MODULE_AUTHOR("Alessandro Zummo "); ++MODULE_DESCRIPTION("RTC class support"); ++MODULE_LICENSE("GPL"); --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-rtc/drivers/rtc/interface.c 2006-02-19 23:33:15.000000000 +0100 -@@ -0,0 +1,274 @@ ++++ linux-ixp4xx/drivers/rtc/interface.c 2006-03-08 01:59:26.000000000 +0100 +@@ -0,0 +1,277 @@ +/* + * RTC subsystem, interface functions + * @@ -436,15 +1226,14 @@ + +#include + -+extern struct class *rtc_class; -+ +int rtc_read_time(struct class_device *class_dev, struct rtc_time *tm) +{ + int err; + struct rtc_device *rtc = to_rtc_device(class_dev); + -+ if ((err = mutex_lock_interruptible(&rtc->ops_lock))) -+ return err; ++ err = mutex_lock_interruptible(&rtc->ops_lock); ++ if (err) ++ return -EBUSY; + + if (!rtc->ops) + err = -ENODEV; @@ -458,18 +1247,20 @@ + mutex_unlock(&rtc->ops_lock); + return err; +} -+EXPORT_SYMBOL(rtc_read_time); ++EXPORT_SYMBOL_GPL(rtc_read_time); + +int rtc_set_time(struct class_device *class_dev, struct rtc_time *tm) +{ + int err; + struct rtc_device *rtc = to_rtc_device(class_dev); + -+ if ((err = rtc_valid_tm(tm)) != 0) ++ err = rtc_valid_tm(tm); ++ if (err != 0) + return err; + -+ if ((err = mutex_lock_interruptible(&rtc->ops_lock))) -+ return err; ++ err = mutex_lock_interruptible(&rtc->ops_lock); ++ if (err) ++ return -EBUSY; + + if (!rtc->ops) + err = -ENODEV; @@ -481,57 +1272,56 @@ + mutex_unlock(&rtc->ops_lock); + return err; +} -+EXPORT_SYMBOL(rtc_set_time); ++EXPORT_SYMBOL_GPL(rtc_set_time); + +int rtc_set_mmss(struct class_device *class_dev, unsigned long secs) +{ + int err; + struct rtc_device *rtc = to_rtc_device(class_dev); + -+ if ((err = mutex_lock_interruptible(&rtc->ops_lock))) -+ return err; ++ err = mutex_lock_interruptible(&rtc->ops_lock); ++ if (err) ++ return -EBUSY; + + if (!rtc->ops) + err = -ENODEV; -+ else if (!rtc->ops->set_mmss) { -+ if (rtc->ops->read_time && rtc->ops->set_time) { -+ struct rtc_time new, old; -+ -+ new.tm_sec = secs % 60; -+ secs /= 60; -+ new.tm_min = secs % 60; -+ secs /= 60; -+ new.tm_hour = secs % 24; -+ -+ /* -+ * avoid writing when we're going to change the day -+ * of the month. We will retry in the next minute. -+ * This basically means that if the RTC must not drift -+ * by more than 1 minute in 11 minutes. -+ */ ++ else if (rtc->ops->set_mmss) ++ err = rtc->ops->set_mmss(class_dev->dev, secs); ++ else if (rtc->ops->read_time && rtc->ops->set_time) { ++ struct rtc_time new, old; ++ ++ err = rtc->ops->read_time(class_dev->dev, &old); ++ if (err == 0) { ++ rtc_time_to_tm(secs, &new); ++ ++ /* ++ * avoid writing when we're going to change the day of ++ * the month. We will retry in the next minute. This ++ * basically means that if the RTC must not drift ++ * by more than 1 minute in 11 minutes. ++ */ + if (!((old.tm_hour == 23 && old.tm_min == 59) || -+ (new.tm_hour == 23 && new.tm_min == 59))) ++ (new.tm_hour == 23 && new.tm_min == 59))) + err = rtc->ops->set_time(class_dev->dev, &new); + } -+ else -+ err = -EINVAL; + } + else -+ err = rtc->ops->set_mmss(class_dev->dev, secs); ++ err = -EINVAL; + + mutex_unlock(&rtc->ops_lock); + + return err; +} -+EXPORT_SYMBOL(rtc_set_mmss); ++EXPORT_SYMBOL_GPL(rtc_set_mmss); + +int rtc_read_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm) +{ + int err; + struct rtc_device *rtc = to_rtc_device(class_dev); + -+ if ((err = mutex_lock_interruptible(&rtc->ops_lock))) -+ return err; ++ err = mutex_lock_interruptible(&rtc->ops_lock); ++ if (err) ++ return -EBUSY; + + if (rtc->ops == NULL) + err = -ENODEV; @@ -545,15 +1335,16 @@ + mutex_unlock(&rtc->ops_lock); + return err; +} -+EXPORT_SYMBOL(rtc_read_alarm); ++EXPORT_SYMBOL_GPL(rtc_read_alarm); + +int rtc_set_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm) +{ + int err; + struct rtc_device *rtc = to_rtc_device(class_dev); + -+ if ((err = mutex_lock_interruptible(&rtc->ops_lock))) -+ return err; ++ err = mutex_lock_interruptible(&rtc->ops_lock); ++ if (err) ++ return -EBUSY; + + if (!rtc->ops) + err = -ENODEV; @@ -565,7 +1356,7 @@ + mutex_unlock(&rtc->ops_lock); + return err; +} -+EXPORT_SYMBOL(rtc_set_alarm); ++EXPORT_SYMBOL_GPL(rtc_set_alarm); + +void rtc_update_irq(struct class_device *class_dev, + unsigned long num, unsigned long events) @@ -584,7 +1375,7 @@ + wake_up_interruptible(&rtc->irq_queue); + kill_fasync(&rtc->async_queue, SIGIO, POLL_IN); +} -+EXPORT_SYMBOL(rtc_update_irq); ++EXPORT_SYMBOL_GPL(rtc_update_irq); + +struct class_device *rtc_class_open(char *name) +{ @@ -607,13 +1398,13 @@ + + return class_dev; +} -+EXPORT_SYMBOL(rtc_class_open); ++EXPORT_SYMBOL_GPL(rtc_class_open); + +void rtc_class_close(struct class_device *class_dev) +{ + module_put(to_rtc_device(class_dev)->owner); +} -+EXPORT_SYMBOL(rtc_class_close); ++EXPORT_SYMBOL_GPL(rtc_class_close); + +int rtc_irq_register(struct class_device *class_dev, struct rtc_task *task) +{ @@ -632,7 +1423,7 @@ + + return retval; +} -+EXPORT_SYMBOL(rtc_irq_register); ++EXPORT_SYMBOL_GPL(rtc_irq_register); + +void rtc_irq_unregister(struct class_device *class_dev, struct rtc_task *task) +{ @@ -643,7 +1434,7 @@ + rtc->irq_task = NULL; + spin_unlock(&rtc->irq_task_lock); +} -+EXPORT_SYMBOL(rtc_irq_unregister); ++EXPORT_SYMBOL_GPL(rtc_irq_unregister); + +int rtc_irq_set_state(struct class_device *class_dev, struct rtc_task *task, int enabled) +{ @@ -661,7 +1452,7 @@ + + return err; +} -+EXPORT_SYMBOL(rtc_irq_set_state); ++EXPORT_SYMBOL_GPL(rtc_irq_set_state); + +int rtc_irq_set_freq(struct class_device *class_dev, struct rtc_task *task, int freq) +{ @@ -672,8 +1463,10 @@ + /* allowed range is 2-8192 */ + if (freq < 2 || freq > 8192) + return -EINVAL; -+ -+/* if ((freq > rtc_max_user_freq) && (!capable(CAP_SYS_RESOURCE))) ++/* ++ FIXME: this does not belong here, will move where appropriate ++ at a later stage. It cannot hurt right now, trust me :) ++ if ((freq > rtc_max_user_freq) && (!capable(CAP_SYS_RESOURCE))) + return -EACCES; +*/ + /* check if freq is a power of 2 */ @@ -683,121 +1476,21 @@ + if (freq != (1 << tmp)) + return -EINVAL; + -+ spin_lock_irqsave(&rtc->irq_task_lock, flags); -+ if (rtc->irq_task != task) -+ err = -ENXIO; -+ spin_unlock_irqrestore(&rtc->irq_task_lock, flags); -+ -+ if (err == 0) { -+ if ((err = rtc->ops->irq_set_freq(class_dev->dev, freq)) == 0) -+ rtc->irq_freq = freq; -+ } -+ return err; -+ -+} ---- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-rtc/drivers/rtc/utils.c 2006-02-19 23:33:15.000000000 +0100 -@@ -0,0 +1,97 @@ -+/* -+ * RTC subsystem, utility functions -+ * -+ * Copyright (C) 2005 Tower Technologies -+ * Author: Alessandro Zummo -+ * -+ * based on arch/arm/common/rtctime.c -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; version 2 of the License. -+*/ -+ -+#include -+ -+static const unsigned char rtc_days_in_month[] = { -+ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -+}; -+ -+#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400) -+#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400)) -+ -+int rtc_month_days(unsigned int month, unsigned int year) -+{ -+ return rtc_days_in_month[month] + (LEAP_YEAR(year) && month == 1); -+} -+EXPORT_SYMBOL(rtc_month_days); -+ -+/* -+ * Convert seconds since 01-01-1970 00:00:00 to Gregorian date. -+ */ -+void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) -+{ -+ int days, month, year; -+ -+ days = time / 86400; -+ time -= days * 86400; -+ -+ tm->tm_wday = (days + 4) % 7; -+ -+ year = 1970 + days / 365; -+ days -= (year - 1970) * 365 -+ + LEAPS_THRU_END_OF(year - 1) -+ - LEAPS_THRU_END_OF(1970 - 1); -+ if (days < 0) { -+ year -= 1; -+ days += 365 + LEAP_YEAR(year); -+ } -+ tm->tm_year = year - 1900; -+ tm->tm_yday = days + 1; -+ -+ for (month = 0; month < 11; month++) { -+ int newdays; -+ -+ newdays = days - rtc_month_days(month, year); -+ if (newdays < 0) -+ break; -+ days = newdays; -+ } -+ tm->tm_mon = month; -+ tm->tm_mday = days + 1; -+ -+ tm->tm_hour = time / 3600; -+ time -= tm->tm_hour * 3600; -+ tm->tm_min = time / 60; -+ tm->tm_sec = time - tm->tm_min * 60; -+} -+EXPORT_SYMBOL(rtc_time_to_tm); -+ -+/* -+ * Does the rtc_time represent a valid date/time? -+ */ -+int rtc_valid_tm(struct rtc_time *tm) -+{ -+ if (tm->tm_year < 70 || -+ tm->tm_mon >= 12 || -+ tm->tm_mday < 1 || -+ tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900) || -+ tm->tm_hour >= 24 || -+ tm->tm_min >= 60 || -+ tm->tm_sec >= 60) -+ return -EINVAL; -+ -+ return 0; -+} -+EXPORT_SYMBOL(rtc_valid_tm); -+ -+/* -+ * Convert Gregorian date to seconds since 01-01-1970 00:00:00. -+ */ -+int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time) -+{ -+ *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, -+ tm->tm_hour, tm->tm_min, tm->tm_sec); -+ return 0; ++ spin_lock_irqsave(&rtc->irq_task_lock, flags); ++ if (rtc->irq_task != task) ++ err = -ENXIO; ++ spin_unlock_irqrestore(&rtc->irq_task_lock, flags); ++ ++ if (err == 0) { ++ err = rtc->ops->irq_set_freq(class_dev->dev, freq); ++ if (err == 0) ++ rtc->irq_freq = freq; ++ } ++ return err; +} -+EXPORT_SYMBOL(rtc_tm_to_time); --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-rtc/drivers/rtc/hctosys.c 2006-02-21 00:34:57.000000000 +0100 -@@ -0,0 +1,67 @@ ++++ linux-ixp4xx/drivers/rtc/hctosys.c 2006-03-08 01:59:26.000000000 +0100 +@@ -0,0 +1,69 @@ +/* + * RTC subsystem, initialize system time on startup + * @@ -834,8 +1527,10 @@ + return -ENODEV; + } + -+ if ((err = rtc_read_time(class_dev, &tm)) == 0) { -+ if (rtc_valid_tm(&tm) == 0) { ++ err = rtc_read_time(class_dev, &tm); ++ if (err == 0) { ++ err = rtc_valid_tm(&tm); ++ if (err == 0) { + struct timespec tv; + + tv.tv_nsec = NSEC_PER_SEC >> 1; @@ -865,231 +1560,38 @@ +} + +late_initcall(rtc_hctosys); ---- linux-rtc.orig/arch/arm/Kconfig 2006-02-21 00:34:27.000000000 +0100 -+++ linux-rtc/arch/arm/Kconfig 2006-02-21 00:36:42.000000000 +0100 -@@ -817,6 +817,8 @@ source "drivers/usb/Kconfig" - - source "drivers/mmc/Kconfig" - -+source "drivers/rtc/Kconfig" -+ - endmenu - - source "fs/Kconfig" ---- linux-rtc.orig/arch/arm/common/rtctime.c 2006-02-21 00:34:27.000000000 +0100 -+++ linux-rtc/arch/arm/common/rtctime.c 2006-02-21 00:36:42.000000000 +0100 -@@ -42,89 +42,6 @@ static struct rtc_ops *rtc_ops; - - #define rtc_epoch 1900UL - --static const unsigned char days_in_month[] = { -- 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 --}; -- --#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400) --#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400)) -- --static int month_days(unsigned int month, unsigned int year) --{ -- return days_in_month[month] + (LEAP_YEAR(year) && month == 1); --} -- --/* -- * Convert seconds since 01-01-1970 00:00:00 to Gregorian date. -- */ --void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) --{ -- int days, month, year; -- -- days = time / 86400; -- time -= days * 86400; -- -- tm->tm_wday = (days + 4) % 7; -- -- year = 1970 + days / 365; -- days -= (year - 1970) * 365 -- + LEAPS_THRU_END_OF(year - 1) -- - LEAPS_THRU_END_OF(1970 - 1); -- if (days < 0) { -- year -= 1; -- days += 365 + LEAP_YEAR(year); -- } -- tm->tm_year = year - 1900; -- tm->tm_yday = days + 1; -- -- for (month = 0; month < 11; month++) { -- int newdays; -- -- newdays = days - month_days(month, year); -- if (newdays < 0) -- break; -- days = newdays; -- } -- tm->tm_mon = month; -- tm->tm_mday = days + 1; -- -- tm->tm_hour = time / 3600; -- time -= tm->tm_hour * 3600; -- tm->tm_min = time / 60; -- tm->tm_sec = time - tm->tm_min * 60; --} --EXPORT_SYMBOL(rtc_time_to_tm); -- --/* -- * Does the rtc_time represent a valid date/time? -- */ --int rtc_valid_tm(struct rtc_time *tm) --{ -- if (tm->tm_year < 70 || -- tm->tm_mon >= 12 || -- tm->tm_mday < 1 || -- tm->tm_mday > month_days(tm->tm_mon, tm->tm_year + 1900) || -- tm->tm_hour >= 24 || -- tm->tm_min >= 60 || -- tm->tm_sec >= 60) -- return -EINVAL; -- -- return 0; --} --EXPORT_SYMBOL(rtc_valid_tm); -- --/* -- * Convert Gregorian date to seconds since 01-01-1970 00:00:00. -- */ --int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time) --{ -- *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, -- tm->tm_hour, tm->tm_min, tm->tm_sec); -- -- return 0; --} --EXPORT_SYMBOL(rtc_tm_to_time); -- - /* - * Calculate the next alarm time given the requested alarm time mask - * and the current time. -@@ -143,13 +60,13 @@ void rtc_next_alarm_time(struct rtc_time - next->tm_sec = alrm->tm_sec; - } - --static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) -+static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm) - { - memset(tm, 0, sizeof(struct rtc_time)); - return ops->read_time(tm); - } - --static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm) -+static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm) - { - int ret; +--- linux-ixp4xx.orig/CREDITS 2006-03-08 01:59:09.000000000 +0100 ++++ linux-ixp4xx/CREDITS 2006-03-08 01:59:26.000000000 +0100 +@@ -3741,10 +3741,11 @@ D: Mylex DAC960 PCI RAID driver + D: Miscellaneous kernel fixes -@@ -160,7 +77,7 @@ static inline int rtc_set_time(struct rt - return ret; - } - --static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) -+static inline int rtc_arm_read_alarm(struct rtc_ops *ops, s