Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
a6ad57fb
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看板
提交
a6ad57fb
编写于
4月 29, 2005
作者:
L
Linus Torvalds
浏览文件
操作
浏览文件
下载
差异文件
Merge of master.kernel.org:/home/rmk/linux-2.6-serial.git
上级
dd96a8e0
587897f5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
60 addition
and
8 deletion
+60
-8
drivers/serial/imx.c
drivers/serial/imx.c
+60
-8
未找到文件。
drivers/serial/imx.c
浏览文件 @
a6ad57fb
...
...
@@ -321,18 +321,39 @@ static void imx_break_ctl(struct uart_port *port, int break_state)
#define TXTL 2
/* reset default */
#define RXTL 1
/* reset default */
static
int
imx_setup_ufcr
(
struct
imx_port
*
sport
,
unsigned
int
mode
)
{
unsigned
int
val
;
unsigned
int
ufcr_rfdiv
;
/* set receiver / transmitter trigger level.
* RFDIV is set such way to satisfy requested uartclk value
*/
val
=
TXTL
<<
10
|
RXTL
;
ufcr_rfdiv
=
(
imx_get_perclk1
()
+
sport
->
port
.
uartclk
/
2
)
/
sport
->
port
.
uartclk
;
if
(
!
ufcr_rfdiv
)
ufcr_rfdiv
=
1
;
if
(
ufcr_rfdiv
>=
7
)
ufcr_rfdiv
=
6
;
else
ufcr_rfdiv
=
6
-
ufcr_rfdiv
;
val
|=
UFCR_RFDIV
&
(
ufcr_rfdiv
<<
7
);
UFCR
((
u32
)
sport
->
port
.
membase
)
=
val
;
return
0
;
}
static
int
imx_startup
(
struct
uart_port
*
port
)
{
struct
imx_port
*
sport
=
(
struct
imx_port
*
)
port
;
int
retval
;
unsigned
int
val
;
unsigned
long
flags
;
/* set receiver / transmitter trigger level. We assume
* that RFDIV has been set by the arch setup or by the bootloader.
*/
val
=
(
UFCR
((
u32
)
sport
->
port
.
membase
)
&
UFCR_RFDIV
)
|
TXTL
<<
10
|
RXTL
;
UFCR
((
u32
)
sport
->
port
.
membase
)
=
val
;
imx_setup_ufcr
(
sport
,
0
);
/* disable the DREN bit (Data Ready interrupt enable) before
* requesting IRQs
...
...
@@ -737,9 +758,12 @@ static void __init
imx_console_get_options
(
struct
imx_port
*
sport
,
int
*
baud
,
int
*
parity
,
int
*
bits
)
{
if
(
UCR1
((
u32
)
sport
->
port
.
membase
)
|
UCR1_UARTEN
)
{
/* ok, the port was enabled */
unsigned
int
ucr2
,
ubir
,
ubmr
,
uartclk
;
unsigned
int
baud_raw
;
unsigned
int
ucfr_rfdiv
;
ucr2
=
UCR2
((
u32
)
sport
->
port
.
membase
);
...
...
@@ -758,9 +782,35 @@ imx_console_get_options(struct imx_port *sport, int *baud,
ubir
=
UBIR
((
u32
)
sport
->
port
.
membase
)
&
0xffff
;
ubmr
=
UBMR
((
u32
)
sport
->
port
.
membase
)
&
0xffff
;
uartclk
=
sport
->
port
.
uartclk
;
*
baud
=
((
uartclk
/
16
)
*
(
ubir
+
1
))
/
(
ubmr
+
1
);
ucfr_rfdiv
=
(
UFCR
((
u32
)
sport
->
port
.
membase
)
&
UFCR_RFDIV
)
>>
7
;
if
(
ucfr_rfdiv
==
6
)
ucfr_rfdiv
=
7
;
else
ucfr_rfdiv
=
6
-
ucfr_rfdiv
;
uartclk
=
imx_get_perclk1
();
uartclk
/=
ucfr_rfdiv
;
{
/*
* The next code provides exact computation of
* baud_raw = round(((uartclk/16) * (ubir + 1)) / (ubmr + 1))
* without need of float support or long long division,
* which would be required to prevent 32bit arithmetic overflow
*/
unsigned
int
mul
=
ubir
+
1
;
unsigned
int
div
=
16
*
(
ubmr
+
1
);
unsigned
int
rem
=
uartclk
%
div
;
baud_raw
=
(
uartclk
/
div
)
*
mul
;
baud_raw
+=
(
rem
*
mul
+
div
/
2
)
/
div
;
*
baud
=
(
baud_raw
+
50
)
/
100
*
100
;
}
if
(
*
baud
!=
baud_raw
)
printk
(
KERN_INFO
"Serial: Console IMX rounded baud rate from %d to %d
\n
"
,
baud_raw
,
*
baud
);
}
}
...
...
@@ -787,6 +837,8 @@ imx_console_setup(struct console *co, char *options)
else
imx_console_get_options
(
sport
,
&
baud
,
&
parity
,
&
bits
);
imx_setup_ufcr
(
sport
,
0
);
return
uart_set_options
(
&
sport
->
port
,
co
,
baud
,
parity
,
bits
,
flow
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录