Commit 7d81a5e03ddbb44d05a32cad4a46a23577216497

Authored by Thomas Bogendoerfer
Committed by Ralf Baechle
1 parent 540799e32e

MIPS: IP22/28: Switch over to RTC class driver

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>

Showing 6 changed files with 15 additions and 89 deletions Side-by-side Diff

arch/mips/include/asm/mach-ip22/ds1286.h
1   -/*
2   - * This file is subject to the terms and conditions of the GNU General Public
3   - * License. See the file "COPYING" in the main directory of this archive
4   - * for more details.
5   - *
6   - * Copyright (C) 1998, 2001, 03 by Ralf Baechle
7   - *
8   - * RTC routines for PC style attached Dallas chip.
9   - */
10   -#ifndef __ASM_MACH_IP22_DS1286_H
11   -#define __ASM_MACH_IP22_DS1286_H
12   -
13   -#include <asm/sgi/hpc3.h>
14   -
15   -#define rtc_read(reg) (hpc3c0->rtcregs[(reg)] & 0xff)
16   -#define rtc_write(data, reg) do { hpc3c0->rtcregs[(reg)] = (data); } while(0)
17   -
18   -#endif /* __ASM_MACH_IP22_DS1286_H */
arch/mips/include/asm/mach-ip28/ds1286.h
1   -#ifndef __ASM_MACH_IP28_DS1286_H
2   -#define __ASM_MACH_IP28_DS1286_H
3   -#include <asm/mach-ip22/ds1286.h>
4   -#endif /* __ASM_MACH_IP28_DS1286_H */
arch/mips/sgi-ip22/ip22-platform.c
... ... @@ -192,4 +192,19 @@
192 192 }
193 193  
194 194 device_initcall(sgi_button_devinit);
  195 +
  196 +static int __init sgi_ds1286_devinit(void)
  197 +{
  198 + struct resource res;
  199 +
  200 + memset(&res, 0, sizeof(res));
  201 + res.start = HPC3_CHIP0_BASE + offsetof(struct hpc3_regs, rtcregs);
  202 + res.end = res.start + sizeof(hpc3c0->rtcregs) - 1;
  203 + res.flags = IORESOURCE_MEM;
  204 +
  205 + return IS_ERR(platform_device_register_simple("rtc-ds1286", -1,
  206 + &res, 1));
  207 +}
  208 +
  209 +device_initcall(sgi_ds1286_devinit);
arch/mips/sgi-ip22/ip22-setup.c
... ... @@ -4,7 +4,6 @@
4 4 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
5 5 * Copyright (C) 1997, 1998 Ralf Baechle (ralf@gnu.org)
6 6 */
7   -#include <linux/ds1286.h>
8 7 #include <linux/init.h>
9 8 #include <linux/kernel.h>
10 9 #include <linux/kdev_t.h>
arch/mips/sgi-ip22/ip22-time.c
... ... @@ -10,7 +10,6 @@
10 10 * Copyright (C) 2003, 06 Ralf Baechle (ralf@linux-mips.org)
11 11 */
12 12 #include <linux/bcd.h>
13   -#include <linux/ds1286.h>
14 13 #include <linux/init.h>
15 14 #include <linux/irq.h>
16 15 #include <linux/kernel.h>
... ... @@ -28,69 +27,6 @@
28 27 #include <asm/sgi/ioc.h>
29 28 #include <asm/sgi/hpc3.h>
30 29 #include <asm/sgi/ip22.h>
31   -
32   -/*
33   - * Note that mktime uses month from 1 to 12 while rtc_time_to_tm
34   - * uses 0 to 11.
35   - */
36   -unsigned long read_persistent_clock(void)
37   -{
38   - unsigned int yrs, mon, day, hrs, min, sec;
39   - unsigned int save_control;
40   - unsigned long flags;
41   -
42   - spin_lock_irqsave(&rtc_lock, flags);
43   - save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
44   - hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
45   -
46   - sec = BCD2BIN(hpc3c0->rtcregs[RTC_SECONDS] & 0xff);
47   - min = BCD2BIN(hpc3c0->rtcregs[RTC_MINUTES] & 0xff);
48   - hrs = BCD2BIN(hpc3c0->rtcregs[RTC_HOURS] & 0x3f);
49   - day = BCD2BIN(hpc3c0->rtcregs[RTC_DATE] & 0xff);
50   - mon = BCD2BIN(hpc3c0->rtcregs[RTC_MONTH] & 0x1f);
51   - yrs = BCD2BIN(hpc3c0->rtcregs[RTC_YEAR] & 0xff);
52   -
53   - hpc3c0->rtcregs[RTC_CMD] = save_control;
54   - spin_unlock_irqrestore(&rtc_lock, flags);
55   -
56   - if (yrs < 45)
57   - yrs += 30;
58   - if ((yrs += 40) < 70)
59   - yrs += 100;
60   -
61   - return mktime(yrs + 1900, mon, day, hrs, min, sec);
62   -}
63   -
64   -int rtc_mips_set_time(unsigned long tim)
65   -{
66   - struct rtc_time tm;
67   - unsigned int save_control;
68   - unsigned long flags;
69   -
70   - rtc_time_to_tm(tim, &tm);
71   -
72   - tm.tm_mon += 1; /* tm_mon starts at zero */
73   - tm.tm_year -= 40;
74   - if (tm.tm_year >= 100)
75   - tm.tm_year -= 100;
76   -
77   - spin_lock_irqsave(&rtc_lock, flags);
78   - save_control = hpc3c0->rtcregs[RTC_CMD] & 0xff;
79   - hpc3c0->rtcregs[RTC_CMD] = save_control | RTC_TE;
80   -
81   - hpc3c0->rtcregs[RTC_YEAR] = BIN2BCD(tm.tm_year);
82   - hpc3c0->rtcregs[RTC_MONTH] = BIN2BCD(tm.tm_mon);
83   - hpc3c0->rtcregs[RTC_DATE] = BIN2BCD(tm.tm_mday);
84   - hpc3c0->rtcregs[RTC_HOURS] = BIN2BCD(tm.tm_hour);
85   - hpc3c0->rtcregs[RTC_MINUTES] = BIN2BCD(tm.tm_min);
86   - hpc3c0->rtcregs[RTC_SECONDS] = BIN2BCD(tm.tm_sec);
87   - hpc3c0->rtcregs[RTC_HUNDREDTH_SECOND] = 0;
88   -
89   - hpc3c0->rtcregs[RTC_CMD] = save_control;
90   - spin_unlock_irqrestore(&rtc_lock, flags);
91   -
92   - return 0;
93   -}
94 30  
95 31 static unsigned long dosample(void)
96 32 {
include/linux/ds1286.h
... ... @@ -8,8 +8,6 @@
8 8 #ifndef __LINUX_DS1286_H
9 9 #define __LINUX_DS1286_H
10 10  
11   -#include <asm/ds1286.h>
12   -
13 11 /**********************************************************************
14 12 * register summary
15 13 **********************************************************************/