Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146684
b: refs/heads/master
c: 47c8a08
h: refs/heads/master
v: v3
  • Loading branch information
Paul Mundt committed Apr 27, 2009
1 parent 07c7307 commit a089655
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5be7c0a4d3dfe25091f2e4e524103e81d9e7e180
refs/heads/master: 47c8a08bbe77ad3c06f63919a14b0f0b0cd54390
1 change: 1 addition & 0 deletions trunk/arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ config SUPERH32
select HAVE_DYNAMIC_FTRACE
select HAVE_ARCH_KGDB
select ARCH_HIBERNATION_POSSIBLE if MMU
select RTC_LIB

config SUPERH64
def_bool ARCH = "sh64"
Expand Down
11 changes: 11 additions & 0 deletions trunk/arch/sh/include/asm/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ extern void (*board_time_init)(void);
extern void (*rtc_sh_get_time)(struct timespec *);
extern int (*rtc_sh_set_time)(const time_t);

/* some dummy definitions */
#define RTC_BATT_BAD 0x100 /* 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 */

struct rtc_time;
unsigned int get_rtc_time(struct rtc_time *);
int set_rtc_time(struct rtc_time *);

#define RTC_CAP_4_DIGIT_YEAR (1 << 0)

struct sh_rtc_platform_info {
Expand Down
23 changes: 23 additions & 0 deletions trunk/arch/sh/kernel/time_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/mc146818rtc.h> /* for rtc_lock */
#include <linux/platform_device.h>
#include <linux/smp.h>
#include <linux/rtc.h>
#include <asm/clock.h>
#include <asm/rtc.h>
#include <asm/timer.h>
Expand All @@ -45,6 +46,28 @@ static int null_rtc_set_time(const time_t secs)
void (*rtc_sh_get_time)(struct timespec *) = null_rtc_get_time;
int (*rtc_sh_set_time)(const time_t) = null_rtc_set_time;

unsigned int get_rtc_time(struct rtc_time *tm)
{
if (rtc_sh_get_time != null_rtc_get_time) {
struct timespec tv;

rtc_sh_get_time(&tv);
rtc_time_to_tm(tv.tv_sec, tm);
}

return RTC_24H;
}
EXPORT_SYMBOL(get_rtc_time);

int set_rtc_time(struct rtc_time *tm)
{
unsigned long secs;

rtc_tm_to_time(tm, &secs);
return rtc_sh_set_time(secs);
}
EXPORT_SYMBOL(set_rtc_time);

#ifndef CONFIG_GENERIC_TIME
void do_gettimeofday(struct timeval *tv)
{
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/rtc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ config RTC_DRV_GENERIC
tristate "Generic RTC support"
# Please consider writing a new RTC driver instead of using the generic
# RTC abstraction
depends on PARISC || M68K || PPC
depends on PARISC || M68K || PPC || SUPERH32
help
Say Y or M here to enable RTC support on systems using the generic
RTC abstraction. If you do not know what you are doing, you should
Expand Down

0 comments on commit a089655

Please sign in to comment.