]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
MIPS: IP22/28: Switch over to RTC class driver
authorThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 14 Oct 2008 15:16:55 +0000 (17:16 +0200)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 15 Oct 2008 11:46:51 +0000 (12:46 +0100)
This patchset removes some dead code and creates a platform device
for the RTC class driver.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
arch/mips/include/asm/mach-ip22/ds1286.h [deleted file]
arch/mips/include/asm/mach-ip28/ds1286.h [deleted file]
arch/mips/sgi-ip22/ip22-platform.c
arch/mips/sgi-ip22/ip22-setup.c
arch/mips/sgi-ip22/ip22-time.c
include/linux/ds1286.h

diff --git a/arch/mips/include/asm/mach-ip22/ds1286.h b/arch/mips/include/asm/mach-ip22/ds1286.h
deleted file mode 100644 (file)
index f19f1ea..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 1998, 2001, 03 by Ralf Baechle
- *
- * RTC routines for PC style attached Dallas chip.
- */
-#ifndef __ASM_MACH_IP22_DS1286_H
-#define __ASM_MACH_IP22_DS1286_H
-
-#include <asm/sgi/hpc3.h>
-
-#define rtc_read(reg)          (hpc3c0->rtcregs[(reg)] & 0xff)
-#define rtc_write(data, reg)   do { hpc3c0->rtcregs[(reg)] = (data); } while(0)
-
-#endif /* __ASM_MACH_IP22_DS1286_H */
diff --git a/arch/mips/include/asm/mach-ip28/ds1286.h b/arch/mips/include/asm/mach-ip28/ds1286.h
deleted file mode 100644 (file)
index 471bb9a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __ASM_MACH_IP28_DS1286_H
-#define __ASM_MACH_IP28_DS1286_H
-#include <asm/mach-ip22/ds1286.h>
-#endif /* __ASM_MACH_IP28_DS1286_H */
index 52486c4d2b019739be2db360e3cbc8b7dd1fd847..deddbf0ebe5c839175353b3f7f8cce68a594106c 100644 (file)
@@ -192,3 +192,18 @@ static int __init sgi_button_devinit(void)
 }
 
 device_initcall(sgi_button_devinit);
+
+static int __init sgi_ds1286_devinit(void)
+{
+       struct resource res;
+
+       memset(&res, 0, sizeof(res));
+       res.start = HPC3_CHIP0_BASE + offsetof(struct hpc3_regs, rtcregs);
+       res.end = res.start + sizeof(hpc3c0->rtcregs) - 1;
+       res.flags = IORESOURCE_MEM;
+
+       return IS_ERR(platform_device_register_simple("rtc-ds1286", -1,
+                                                     &res, 1));
+}
+
+device_initcall(sgi_ds1286_devinit);
index 896a1ef8482962e5376a37487693f5b87183f053..b9a931358e2391801aa0e2704ecbb8f83b991be4 100644 (file)
@@ -4,7 +4,6 @@
  * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
  * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
  */
-#include <linux/ds1286.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/kdev_t.h>
index 10e50549165588b13cfc5a63e17a57539f7812ba..3dcb27ec0c530b7aa4238bc4eb2cd568cd9fc794 100644 (file)
@@ -10,7 +10,6 @@
  * Copyright (C) 2003, 06 Ralf Baechle (ralf@linux-mips.org)
  */
 #include <linux/bcd.h>
-#include <linux/ds1286.h>
 #include <linux/init.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <asm/sgi/hpc3.h>
 #include <asm/sgi/ip22.h>
 
-/*
- * Note that mktime uses month from 1 to 12 while rtc_time_to_tm
- * uses 0 to 11.
- */
-unsigned long read_persistent_clock(void)
-{
-       unsigned int yrs, mon, day, hrs, min, sec;
-       unsigned int save_control;
-       unsigned long flags;
-
-       spin_lock_irqsave(&rtc_lock, flags);
-       save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
-       hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
-
-       sec = BCD2BIN(hpc3c0->rtcregs[RTC_SECONDS] & 0xff);
-       min = BCD2BIN(hpc3c0->rtcregs[RTC_MINUTES] & 0xff);
-       hrs = BCD2BIN(hpc3c0->rtcregs[RTC_HOURS] & 0x3f);
-       day = BCD2BIN(hpc3c0->rtcregs[RTC_DATE] & 0xff);
-       mon = BCD2BIN(hpc3c0->rtcregs[RTC_MONTH] & 0x1f);
-       yrs = BCD2BIN(hpc3c0->rtcregs[RTC_YEAR] & 0xff);
-
-       hpc3c0->rtcregs[RTC_CMD] = save_control;
-       spin_unlock_irqrestore(&rtc_lock, flags);
-
-       if (yrs < 45)
-               yrs += 30;
-       if ((yrs += 40) < 70)
-               yrs += 100;
-
-       return mktime(yrs + 1900, mon, day, hrs, min, sec);
-}
-
-int rtc_mips_set_time(unsigned long tim)
-{
-       struct rtc_time tm;
-       unsigned int save_control;
-       unsigned long flags;
-
-       rtc_time_to_tm(tim, &tm);
-
-       tm.tm_mon += 1;         /* tm_mon starts at zero */
-       tm.tm_year -= 40;
-       if (tm.tm_year >= 100)
-               tm.tm_year -= 100;
-
-       spin_lock_irqsave(&rtc_lock, flags);
-       save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
-       hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
-
-       hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_year);
-       hpc3c0->rtcregs[RTC_MONTH] = BIN2BCD(tm.tm_mon);
-       hpc3c0->rtcregs[RTC_DATE] = BIN2BCD(tm.tm_mday);
-       hpc3c0->rtcregs[RTC_HOURS] = BIN2BCD(tm.tm_hour);
-       hpc3c0->rtcregs[RTC_MINUTES] = BIN2BCD(tm.tm_min);
-       hpc3c0->rtcregs[RTC_SECONDS] = BIN2BCD(tm.tm_sec);
-       hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0;
-
-       hpc3c0->rtcregs[RTC_CMD] = save_control;
-       spin_unlock_irqrestore(&rtc_lock, flags);
-
-       return 0;
-}
-
 static unsigned long dosample(void)
 {
        u32 ct0, ct1;
index d8989860e4cefba476e8e31566690e4f687e88de..45ea0aa0aeb9e8ca8f48a8d628e60fd32a58a8e7 100644 (file)
@@ -8,8 +8,6 @@
 #ifndef __LINUX_DS1286_H
 #define __LINUX_DS1286_H
 
-#include <asm/ds1286.h>
-
 /**********************************************************************
  * register summary
  **********************************************************************/