Skip to content

Commit

Permalink
sh: Kill off the rest of the legacy rtc mess.
Browse files Browse the repository at this point in the history
With the new RTC class driver, we can get rid of most of the
old left over cruft.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed Sep 27, 2006
1 parent 51e22e7 commit 91550f7
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 381 deletions.
13 changes: 0 additions & 13 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,6 @@ config CPU_LITTLE_ENDIAN
endian byte order. These modes require different kernels. Say Y if
your machine is little endian, N if it's a big endian machine.

# The SH7750 RTC module is disabled in the Dreamcast
config SH_RTC
bool
depends on !SH_DREAMCAST && !SH_SATURN && !SH_7300_SOLUTION_ENGINE && \
!SH_73180_SOLUTION_ENGINE && !SH_LANDISK && \
!SH_R7780RP && !SH_SHMIN
default y
help
Selecting this option will allow the Linux kernel to emulate
PC's RTC.

If unsure, say N.

config SH_FPU
bool "FPU support"
depends on !CPU_SH3
Expand Down
27 changes: 3 additions & 24 deletions arch/sh/boards/snapgear/rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
#include <linux/mc146818rtc.h>
#include <asm/io.h>

/****************************************************************************/

static int use_ds1302 = 0;
static int use_ds1302;

/****************************************************************************/
/*
Expand Down Expand Up @@ -79,10 +77,6 @@ static unsigned int ds1302_readbyte(unsigned int addr)
unsigned int val;
unsigned long flags;

#if 0
printk("SnapGear RTC: ds1302_readbyte(addr=%x)\n", addr);
#endif

local_irq_save(flags);
set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
Expand All @@ -101,10 +95,6 @@ static void ds1302_writebyte(unsigned int addr, unsigned int val)
{
unsigned long flags;

#if 0
printk("SnapGear RTC: ds1302_writebyte(addr=%x)\n", addr);
#endif

local_irq_save(flags);
set_dirp(get_dirp() | RTC_RESET | RTC_IODATA | RTC_SCLK);
set_dp(get_dp() & ~(RTC_RESET | RTC_IODATA | RTC_SCLK));
Expand Down Expand Up @@ -167,9 +157,6 @@ void __init secureedge5410_rtc_init(void)
if (use_ds1302) {
rtc_sh_get_time = snapgear_rtc_gettimeofday;
rtc_sh_set_time = snapgear_rtc_settimeofday;
} else {
rtc_sh_get_time = sh_rtc_gettimeofday;
rtc_sh_set_time = sh_rtc_settimeofday;
}

printk("SnapGear RTC: using %s rtc.\n", use_ds1302 ? "ds1302" : "internal");
Expand All @@ -184,10 +171,8 @@ void snapgear_rtc_gettimeofday(struct timespec *ts)
{
unsigned int sec, min, hr, day, mon, yr;

if (!use_ds1302) {
sh_rtc_gettimeofday(ts);
if (!use_ds1302)
return;
}

sec = bcd2int(ds1302_readbyte(RTC_ADDR_SEC));
min = bcd2int(ds1302_readbyte(RTC_ADDR_MIN));
Expand Down Expand Up @@ -228,7 +213,7 @@ int snapgear_rtc_settimeofday(const time_t secs)
unsigned long nowtime;

if (!use_ds1302)
return sh_rtc_settimeofday(secs);
return 0;

/*
* This is called direct from the kernel timer handling code.
Expand All @@ -237,10 +222,6 @@ int snapgear_rtc_settimeofday(const time_t secs)

nowtime = secs;

#if 1
printk("SnapGear RTC: snapgear_rtc_settimeofday(nowtime=%ld)\n", nowtime);
#endif

/* STOP RTC */
ds1302_writebyte(RTC_ADDR_SEC, ds1302_readbyte(RTC_ADDR_SEC) | 0x80);

Expand Down Expand Up @@ -326,5 +307,3 @@ void secureedge5410_cmos_write(unsigned char val, int addr)
default: break;
}
}

/****************************************************************************/
1 change: 0 additions & 1 deletion arch/sh/kernel/cpu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ obj-$(CONFIG_CPU_SH2) += sh2/
obj-$(CONFIG_CPU_SH3) += sh3/
obj-$(CONFIG_CPU_SH4) += sh4/

obj-$(CONFIG_SH_RTC) += rtc.o
obj-$(CONFIG_UBC_WAKEUP) += ubc.o
obj-$(CONFIG_SH_ADC) += adc.o
2 changes: 1 addition & 1 deletion arch/sh/kernel/cpu/irq/ipr.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void __init init_IRQ(void)
#ifndef CONFIG_CPU_SUBTYPE_SH7780
make_ipr_irq(TIMER_IRQ, TIMER_IPR_ADDR, TIMER_IPR_POS, TIMER_PRIORITY);
make_ipr_irq(TIMER1_IRQ, TIMER1_IPR_ADDR, TIMER1_IPR_POS, TIMER1_PRIORITY);
#if defined(CONFIG_SH_RTC)
#ifdef RTC_IRQ
make_ipr_irq(RTC_IRQ, RTC_IPR_ADDR, RTC_IPR_POS, RTC_PRIORITY);
#endif

Expand Down
128 changes: 0 additions & 128 deletions arch/sh/kernel/cpu/rtc.c

This file was deleted.

41 changes: 18 additions & 23 deletions arch/sh/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
*
* Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
* Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
* Copyright (C) 2002, 2003, 2004, 2005 Paul Mundt
* Copyright (C) 2002 - 2006 Paul Mundt
* Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
*
* Some code taken from i386 version.
* Copyright (C) 1991, 1992, 1995 Linus Torvalds
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
Expand All @@ -26,15 +25,20 @@ struct sys_timer *sys_timer;
DEFINE_SPINLOCK(rtc_lock);
EXPORT_SYMBOL(rtc_lock);

/* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want
* these routines anywhere... */
#ifdef CONFIG_SH_RTC
void (*rtc_sh_get_time)(struct timespec *) = sh_rtc_gettimeofday;
int (*rtc_sh_set_time)(const time_t) = sh_rtc_settimeofday;
#else
void (*rtc_sh_get_time)(struct timespec *);
int (*rtc_sh_set_time)(const time_t);
#endif
/* Dummy RTC ops */
static void null_rtc_get_time(struct timespec *tv)
{
tv->tv_sec = mktime(2000, 1, 1, 0, 0, 0);
tv->tv_nsec = 0;
}

static int null_rtc_set_time(const time_t secs)
{
return 0;
}

void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;

/*
* Scheduler clock - returns current time in nanosec units.
Expand Down Expand Up @@ -70,7 +74,6 @@ void do_gettimeofday(struct timeval *tv)
tv->tv_sec = sec;
tv->tv_usec = usec;
}

EXPORT_SYMBOL(do_gettimeofday);

int do_settimeofday(struct timespec *tv)
Expand Down Expand Up @@ -103,7 +106,6 @@ int do_settimeofday(struct timespec *tv)

return 0;
}

EXPORT_SYMBOL(do_settimeofday);

/* last time the RTC clock got updated */
Expand Down Expand Up @@ -181,7 +183,6 @@ static int __init timer_init_sysfs(void)
sys_timer->dev.cls = &timer_sysclass;
return sysdev_register(&sys_timer->dev);
}

device_initcall(timer_init_sysfs);

void (*board_time_init)(void);
Expand All @@ -193,15 +194,9 @@ void __init time_init(void)

clk_init();

if (rtc_sh_get_time) {
rtc_sh_get_time(&xtime);
} else {
xtime.tv_sec = mktime(2000, 1, 1, 0, 0, 0);
xtime.tv_nsec = 0;
}

set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);
rtc_sh_get_time(&xtime);
set_normalized_timespec(&wall_to_monotonic,
-xtime.tv_sec, -xtime.tv_nsec);

/*
* Find the timer to use as the system timer, it will be
Expand Down
2 changes: 1 addition & 1 deletion drivers/char/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ config NVRAM

config RTC
tristate "Enhanced Real Time Clock Support"
depends on !PPC && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV && !ARM
depends on !PPC && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV && !ARM && !SUPERH
---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
Expand Down
Loading

0 comments on commit 91550f7

Please sign in to comment.