Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
ba8990f2
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ba8990f2
编写于
4月 03, 2006
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MIPS] JMR3927 build fixes for the RTC code.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
67cbeb33
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
45 addition
and
32 deletion
+45
-32
arch/mips/jmr3927/common/rtc_ds1742.c
arch/mips/jmr3927/common/rtc_ds1742.c
+30
-30
include/asm-mips/ds1742.h
include/asm-mips/ds1742.h
+13
-0
include/asm-mips/mach-jmr3927/ds1742.h
include/asm-mips/mach-jmr3927/ds1742.h
+2
-2
未找到文件。
arch/mips/jmr3927/common/rtc_ds1742.c
浏览文件 @
ba8990f2
...
...
@@ -60,15 +60,15 @@ rtc_ds1742_get_time(void)
unsigned
long
flags
;
spin_lock_irqsave
(
&
rtc_lock
,
flags
);
CMOS_WRITE
(
RTC_READ
,
RTC_CONTROL
);
second
=
BCD2BIN
(
CMOS_READ
(
RTC_SECONDS
)
&
RTC_SECONDS_MASK
);
minute
=
BCD2BIN
(
CMOS_READ
(
RTC_MINUTES
));
hour
=
BCD2BIN
(
CMOS_READ
(
RTC_HOURS
));
day
=
BCD2BIN
(
CMOS_READ
(
RTC_DATE
));
month
=
BCD2BIN
(
CMOS_READ
(
RTC_MONTH
));
year
=
BCD2BIN
(
CMOS_READ
(
RTC_YEAR
));
century
=
BCD2BIN
(
CMOS_READ
(
RTC_CENTURY
)
&
RTC_CENTURY_MASK
);
CMOS_WRITE
(
0
,
RTC_CONTROL
);
rtc_write
(
RTC_READ
,
RTC_CONTROL
);
second
=
BCD2BIN
(
rtc_read
(
RTC_SECONDS
)
&
RTC_SECONDS_MASK
);
minute
=
BCD2BIN
(
rtc_read
(
RTC_MINUTES
));
hour
=
BCD2BIN
(
rtc_read
(
RTC_HOURS
));
day
=
BCD2BIN
(
rtc_read
(
RTC_DATE
));
month
=
BCD2BIN
(
rtc_read
(
RTC_MONTH
));
year
=
BCD2BIN
(
rtc_read
(
RTC_YEAR
));
century
=
BCD2BIN
(
rtc_read
(
RTC_CENTURY
)
&
RTC_CENTURY_MASK
);
rtc_write
(
0
,
RTC_CONTROL
);
spin_unlock_irqrestore
(
&
rtc_lock
,
flags
);
year
+=
century
*
100
;
...
...
@@ -87,16 +87,16 @@ rtc_ds1742_set_time(unsigned long t)
unsigned
long
flags
;
spin_lock_irqsave
(
&
rtc_lock
,
flags
);
CMOS_WRITE
(
RTC_READ
,
RTC_CONTROL
);
cmos_second
=
(
u8
)(
CMOS_READ
(
RTC_SECONDS
)
&
RTC_SECONDS_MASK
);
cmos_minute
=
(
u8
)
CMOS_READ
(
RTC_MINUTES
);
cmos_hour
=
(
u8
)
CMOS_READ
(
RTC_HOURS
);
cmos_day
=
(
u8
)
CMOS_READ
(
RTC_DATE
);
cmos_month
=
(
u8
)
CMOS_READ
(
RTC_MONTH
);
cmos_year
=
(
u8
)
CMOS_READ
(
RTC_YEAR
);
cmos_century
=
CMOS_READ
(
RTC_CENTURY
)
&
RTC_CENTURY_MASK
;
rtc_write
(
RTC_READ
,
RTC_CONTROL
);
cmos_second
=
(
u8
)(
rtc_read
(
RTC_SECONDS
)
&
RTC_SECONDS_MASK
);
cmos_minute
=
(
u8
)
rtc_read
(
RTC_MINUTES
);
cmos_hour
=
(
u8
)
rtc_read
(
RTC_HOURS
);
cmos_day
=
(
u8
)
rtc_read
(
RTC_DATE
);
cmos_month
=
(
u8
)
rtc_read
(
RTC_MONTH
);
cmos_year
=
(
u8
)
rtc_read
(
RTC_YEAR
);
cmos_century
=
rtc_read
(
RTC_CENTURY
)
&
RTC_CENTURY_MASK
;
CMOS_WRITE
(
RTC_WRITE
,
RTC_CONTROL
);
rtc_write
(
RTC_WRITE
,
RTC_CONTROL
);
/* convert */
to_tm
(
t
,
&
tm
);
...
...
@@ -104,18 +104,18 @@ rtc_ds1742_set_time(unsigned long t)
/* check each field one by one */
year
=
BIN2BCD
(
tm
.
tm_year
-
EPOCH
);
if
(
year
!=
cmos_year
)
{
CMOS_WRITE
(
year
,
RTC_YEAR
);
rtc_write
(
year
,
RTC_YEAR
);
}
month
=
BIN2BCD
(
tm
.
tm_mon
);
if
(
month
!=
(
cmos_month
&
0x1f
))
{
CMOS_WRITE
((
month
&
0x1f
)
|
(
cmos_month
&
~
0x1f
),
RTC_MONTH
);
rtc_write
((
month
&
0x1f
)
|
(
cmos_month
&
~
0x1f
),
RTC_MONTH
);
}
day
=
BIN2BCD
(
tm
.
tm_mday
);
if
(
day
!=
cmos_day
)
{
CMOS_WRITE
(
day
,
RTC_DATE
);
rtc_write
(
day
,
RTC_DATE
);
}
if
(
cmos_hour
&
0x40
)
{
...
...
@@ -130,20 +130,20 @@ rtc_ds1742_set_time(unsigned long t)
/* 24 hour format */
hour
=
BIN2BCD
(
tm
.
tm_hour
)
&
0x3f
;
}
if
(
hour
!=
cmos_hour
)
CMOS_WRITE
(
hour
,
RTC_HOURS
);
if
(
hour
!=
cmos_hour
)
rtc_write
(
hour
,
RTC_HOURS
);
minute
=
BIN2BCD
(
tm
.
tm_min
);
if
(
minute
!=
cmos_minute
)
{
CMOS_WRITE
(
minute
,
RTC_MINUTES
);
rtc_write
(
minute
,
RTC_MINUTES
);
}
second
=
BIN2BCD
(
tm
.
tm_sec
);
if
(
second
!=
cmos_second
)
{
CMOS_WRITE
(
second
&
RTC_SECONDS_MASK
,
RTC_SECONDS
);
rtc_write
(
second
&
RTC_SECONDS_MASK
,
RTC_SECONDS
);
}
/* RTC_CENTURY and RTC_CONTROL share same address... */
CMOS_WRITE
(
cmos_century
,
RTC_CONTROL
);
rtc_write
(
cmos_century
,
RTC_CONTROL
);
spin_unlock_irqrestore
(
&
rtc_lock
,
flags
);
return
0
;
...
...
@@ -163,9 +163,9 @@ rtc_ds1742_init(unsigned long base)
rtc_mips_set_time
=
rtc_ds1742_set_time
;
/* clear oscillator stop bit */
CMOS_WRITE
(
RTC_READ
,
RTC_CONTROL
);
cmos_second
=
(
u8
)(
CMOS_READ
(
RTC_SECONDS
)
&
RTC_SECONDS_MASK
);
CMOS_WRITE
(
RTC_WRITE
,
RTC_CONTROL
);
CMOS_WRITE
(
cmos_second
,
RTC_SECONDS
);
/* clear msb */
CMOS_WRITE
(
0
,
RTC_CONTROL
);
rtc_write
(
RTC_READ
,
RTC_CONTROL
);
cmos_second
=
(
u8
)(
rtc_read
(
RTC_SECONDS
)
&
RTC_SECONDS_MASK
);
rtc_write
(
RTC_WRITE
,
RTC_CONTROL
);
rtc_write
(
cmos_second
,
RTC_SECONDS
);
/* clear msb */
rtc_write
(
0
,
RTC_CONTROL
);
}
include/asm-mips/ds1742.h
0 → 100644
浏览文件 @
ba8990f2
/*
* 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) 2006 by Ralf Baechle (ralf@linux-mips.org)
*/
#ifndef _ASM_DS1742_H
#define _ASM_DS1742_H
#include <ds1742.h>
#endif
/* _ASM_DS1742_H */
include/asm-mips/mach-jmr3927/ds1742.h
浏览文件 @
ba8990f2
...
...
@@ -3,14 +3,14 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2003 by Ralf Baechle
* Copyright (C) 2003
, 06
by Ralf Baechle
*/
#ifndef __ASM_MACH_JMR3927_DS1742_H
#define __ASM_MACH_JMR3927_DS1742_H
#include <asm/jmr3927/jmr3927.h>
#define rtc_read(reg) (jmr3927_nvram_in(
addr
))
#define rtc_read(reg) (jmr3927_nvram_in(
reg
))
#define rtc_write(data, reg) (jmr3927_nvram_out((data),(reg)))
#endif
/* __ASM_MACH_JMR3927_DS1742_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录