Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
84953b39
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
84953b39
编写于
10月 26, 2007
作者:
R
Ralf Baechle
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[MIPS] SNI: Convert a20r timer to clockevent device.
Signed-off-by:
N
Ralf Baechle
<
ralf@linux-mips.org
>
上级
e0511f75
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
64 addition
and
16 deletion
+64
-16
arch/mips/sni/time.c
arch/mips/sni/time.c
+64
-16
未找到文件。
arch/mips/sni/time.c
浏览文件 @
84953b39
...
...
@@ -11,27 +11,78 @@
#define SNI_COUNTER2_DIV 64
#define SNI_COUNTER0_DIV ((SNI_CLOCK_TICK_RATE / SNI_COUNTER2_DIV) / HZ)
static
void
sni_a20r_timer_ack
(
void
)
static
void
a20r_set_mode
(
enum
clock_event_mode
mode
,
struct
clock_event_device
*
evt
)
{
*
(
volatile
u8
*
)
A20R_PT_TIM0_ACK
=
0x0
;
wmb
();
switch
(
mode
)
{
case
CLOCK_EVT_MODE_PERIODIC
:
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
12
)
=
0x34
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
0
)
=
SNI_COUNTER0_DIV
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
0
)
=
SNI_COUNTER0_DIV
>>
8
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
12
)
=
0xb4
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
8
)
=
SNI_COUNTER2_DIV
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
8
)
=
SNI_COUNTER2_DIV
>>
8
;
wmb
();
break
;
case
CLOCK_EVT_MODE_ONESHOT
:
case
CLOCK_EVT_MODE_UNUSED
:
case
CLOCK_EVT_MODE_SHUTDOWN
:
break
;
case
CLOCK_EVT_MODE_RESUME
:
break
;
}
}
static
struct
clock_event_device
a20r_clockevent_device
=
{
.
name
=
"a20r-timer"
,
.
features
=
CLOCK_EVT_FEAT_PERIODIC
,
/* .mult, .shift, .max_delta_ns and .min_delta_ns left uninitialized */
.
rating
=
300
,
.
irq
=
SNI_A20R_IRQ_TIMER
,
.
set_mode
=
a20r_set_mode
,
};
static
irqreturn_t
a20r_interrupt
(
int
irq
,
void
*
dev_id
)
{
struct
clock_event_device
*
cd
=
dev_id
;
*
(
volatile
u8
*
)
A20R_PT_TIM0_ACK
=
0
;
wmb
();
cd
->
event_handler
(
cd
);
return
IRQ_HANDLED
;
}
static
struct
irqaction
a20r_irqaction
=
{
.
handler
=
a20r_interrupt
,
.
flags
=
IRQF_DISABLED
|
IRQF_PERCPU
,
.
name
=
"a20r-timer"
,
};
/*
* a20r platform uses 2 counters to divide the input frequency.
* Counter 2 output is connected to Counter 0 & 1 input.
*/
static
void
__init
sni_a20r_timer_setup
(
struct
irqaction
*
irq
)
static
void
__init
sni_a20r_timer_setup
(
void
)
{
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
12
)
=
0x34
;
wmb
()
;
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
0
)
=
(
SNI_COUNTER0_DIV
)
&
0xff
;
wmb
()
;
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
0
)
=
(
SNI_COUNTER0_DIV
>>
8
)
&
0xff
;
wmb
();
struct
clock_event_device
*
cd
=
&
a20r_clockevent_device
;
struct
irqaction
*
action
=
&
a20r_irqaction
;
unsigned
int
cpu
=
smp_processor_id
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
12
)
=
0xb4
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
8
)
=
(
SNI_COUNTER2_DIV
)
&
0xff
;
wmb
();
*
(
volatile
u8
*
)(
A20R_PT_CLOCK_BASE
+
8
)
=
(
SNI_COUNTER2_DIV
>>
8
)
&
0xff
;
wmb
();
cd
->
cpumask
=
cpumask_of_cpu
(
cpu
);
setup_irq
(
SNI_A20R_IRQ_TIMER
,
irq
)
;
mips_timer_ack
=
sni_a20r_timer_ack
;
action
->
dev_id
=
cd
;
setup_irq
(
SNI_A20R_IRQ_TIMER
,
&
a20r_irqaction
)
;
}
#define SNI_8254_TICK_RATE 1193182UL
...
...
@@ -119,17 +170,14 @@ void __init plat_time_init(void)
mips_hpt_frequency
=
r4k_tick
*
HZ
;
setup_pit_timer
();
}
void
__init
plat_timer_setup
(
struct
irqaction
*
irq
)
{
switch
(
sni_brd_type
)
{
case
SNI_BRD_10
:
case
SNI_BRD_10NEW
:
case
SNI_BRD_TOWER_OASIC
:
case
SNI_BRD_MINITOWER
:
sni_a20r_timer_setup
(
irq
);
break
;
sni_a20r_timer_setup
(
);
break
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录