Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
e259a3ae
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e259a3ae
编写于
8月 20, 2007
作者:
R
Russell King
提交者:
Russell King
10月 12, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[ARM] pxa: convert PXA serial drivers to use platform resources
Signed-off-by:
N
Russell King
<
rmk+kernel@arm.linux.org.uk
>
上级
08197f6e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
120 addition
and
78 deletion
+120
-78
arch/arm/mach-pxa/generic.c
arch/arm/mach-pxa/generic.c
+59
-0
drivers/serial/pxa.c
drivers/serial/pxa.c
+61
-78
未找到文件。
arch/arm/mach-pxa/generic.c
浏览文件 @
e259a3ae
...
...
@@ -267,21 +267,80 @@ void __init set_pxa_fb_parent(struct device *parent_dev)
pxa_device_fb
.
dev
.
parent
=
parent_dev
;
}
static
struct
resource
pxa_resource_ffuart
[]
=
{
{
.
start
=
__PREG
(
FFUART
),
.
end
=
__PREG
(
FFUART
)
+
35
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_FFUART
,
.
end
=
IRQ_FFUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_ffuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
0
,
.
resource
=
pxa_resource_ffuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_ffuart
),
};
static
struct
resource
pxa_resource_btuart
[]
=
{
{
.
start
=
__PREG
(
BTUART
),
.
end
=
__PREG
(
BTUART
)
+
35
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_BTUART
,
.
end
=
IRQ_BTUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_btuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
1
,
.
resource
=
pxa_resource_btuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_btuart
),
};
static
struct
resource
pxa_resource_stuart
[]
=
{
{
.
start
=
__PREG
(
STUART
),
.
end
=
__PREG
(
STUART
)
+
35
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_STUART
,
.
end
=
IRQ_STUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_stuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
2
,
.
resource
=
pxa_resource_stuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_stuart
),
};
static
struct
resource
pxa_resource_hwuart
[]
=
{
{
.
start
=
__PREG
(
HWUART
),
.
end
=
__PREG
(
HWUART
)
+
47
,
.
flags
=
IORESOURCE_MEM
,
},
{
.
start
=
IRQ_HWUART
,
.
end
=
IRQ_HWUART
,
.
flags
=
IORESOURCE_IRQ
,
}
};
struct
platform_device
pxa_device_hwuart
=
{
.
name
=
"pxa2xx-uart"
,
.
id
=
3
,
.
resource
=
pxa_resource_hwuart
,
.
num_resources
=
ARRAY_SIZE
(
pxa_resource_hwuart
),
};
static
struct
resource
pxai2c_resources
[]
=
{
...
...
drivers/serial/pxa.c
浏览文件 @
e259a3ae
...
...
@@ -582,7 +582,7 @@ serial_pxa_type(struct uart_port *port)
#ifdef CONFIG_SERIAL_PXA_CONSOLE
static
struct
uart_pxa_port
serial_pxa_ports
[
];
static
struct
uart_pxa_port
*
serial_pxa_ports
[
4
];
static
struct
uart_driver
serial_pxa_reg
;
#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
...
...
@@ -632,7 +632,7 @@ static void serial_pxa_console_putchar(struct uart_port *port, int ch)
static
void
serial_pxa_console_write
(
struct
console
*
co
,
const
char
*
s
,
unsigned
int
count
)
{
struct
uart_pxa_port
*
up
=
&
serial_pxa_ports
[
co
->
index
];
struct
uart_pxa_port
*
up
=
serial_pxa_ports
[
co
->
index
];
unsigned
int
ier
;
/*
...
...
@@ -662,7 +662,9 @@ serial_pxa_console_setup(struct console *co, char *options)
if
(
co
->
index
==
-
1
||
co
->
index
>=
serial_pxa_reg
.
nr
)
co
->
index
=
0
;
up
=
&
serial_pxa_ports
[
co
->
index
];
up
=
serial_pxa_ports
[
co
->
index
];
if
(
!
up
)
return
-
ENODEV
;
if
(
options
)
uart_parse_options
(
options
,
&
baud
,
&
parity
,
&
bits
,
&
flow
);
...
...
@@ -680,15 +682,6 @@ static struct console serial_pxa_console = {
.
data
=
&
serial_pxa_reg
,
};
static
int
__init
serial_pxa_console_init
(
void
)
{
register_console
(
&
serial_pxa_console
);
return
0
;
}
console_initcall
(
serial_pxa_console_init
);
#define PXA_CONSOLE &serial_pxa_console
#else
#define PXA_CONSOLE NULL
...
...
@@ -714,73 +707,13 @@ struct uart_ops serial_pxa_pops = {
.
verify_port
=
serial_pxa_verify_port
,
};
static
struct
uart_pxa_port
serial_pxa_ports
[]
=
{
{
/* FFUART */
.
name
=
"FFUART"
,
.
cken
=
CKEN_FFUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
FFUART
,
.
mapbase
=
__PREG
(
FFUART
),
.
irq
=
IRQ_FFUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
0
,
},
},
{
/* BTUART */
.
name
=
"BTUART"
,
.
cken
=
CKEN_BTUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
BTUART
,
.
mapbase
=
__PREG
(
BTUART
),
.
irq
=
IRQ_BTUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
1
,
},
},
{
/* STUART */
.
name
=
"STUART"
,
.
cken
=
CKEN_STUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
STUART
,
.
mapbase
=
__PREG
(
STUART
),
.
irq
=
IRQ_STUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
2
,
},
},
{
/* HWUART */
.
name
=
"HWUART"
,
.
cken
=
CKEN_HWUART
,
.
port
=
{
.
type
=
PORT_PXA
,
.
iotype
=
UPIO_MEM
,
.
membase
=
(
void
*
)
&
HWUART
,
.
mapbase
=
__PREG
(
HWUART
),
.
irq
=
IRQ_HWUART
,
.
uartclk
=
921600
*
16
,
.
fifosize
=
64
,
.
ops
=
&
serial_pxa_pops
,
.
line
=
3
,
},
}
};
static
struct
uart_driver
serial_pxa_reg
=
{
.
owner
=
THIS_MODULE
,
.
driver_name
=
"PXA serial"
,
.
dev_name
=
"ttyS"
,
.
major
=
TTY_MAJOR
,
.
minor
=
64
,
.
nr
=
ARRAY_SIZE
(
serial_pxa_ports
)
,
.
nr
=
4
,
.
cons
=
PXA_CONSOLE
,
};
...
...
@@ -806,10 +739,60 @@ static int serial_pxa_resume(struct platform_device *dev)
static
int
serial_pxa_probe
(
struct
platform_device
*
dev
)
{
serial_pxa_ports
[
dev
->
id
].
port
.
dev
=
&
dev
->
dev
;
uart_add_one_port
(
&
serial_pxa_reg
,
&
serial_pxa_ports
[
dev
->
id
].
port
);
platform_set_drvdata
(
dev
,
&
serial_pxa_ports
[
dev
->
id
]);
struct
uart_pxa_port
*
sport
;
struct
resource
*
mmres
,
*
irqres
;
int
ret
;
mmres
=
platform_get_resource
(
dev
,
IORESOURCE_MEM
,
0
);
irqres
=
platform_get_resource
(
dev
,
IORESOURCE_IRQ
,
0
);
if
(
!
mmres
||
!
irqres
)
return
-
ENODEV
;
sport
=
kzalloc
(
sizeof
(
struct
uart_pxa_port
),
GFP_KERNEL
);
if
(
!
sport
)
return
-
ENOMEM
;
sport
->
port
.
type
=
PORT_PXA
;
sport
->
port
.
iotype
=
UPIO_MEM
;
sport
->
port
.
mapbase
=
mmres
->
start
;
sport
->
port
.
irq
=
irqres
->
start
;
sport
->
port
.
fifosize
=
64
;
sport
->
port
.
ops
=
&
serial_pxa_pops
;
sport
->
port
.
line
=
dev
->
id
;
sport
->
port
.
dev
=
&
dev
->
dev
;
sport
->
port
.
flags
=
UPF_IOREMAP
|
UPF_BOOT_AUTOCONF
;
sport
->
port
.
uartclk
=
921600
*
16
;
/*
* Is it worth keeping this?
*/
if
(
mmres
->
start
==
__PREG
(
FFUART
))
sport
->
name
=
"FFUART"
;
else
if
(
mmres
->
start
==
__PREG
(
BTUART
))
sport
->
name
=
"BTUART"
;
else
if
(
mmres
->
start
==
__PREG
(
STUART
))
sport
->
name
=
"STUART"
;
else
if
(
mmres
->
start
==
__PREG
(
HWUART
))
sport
->
name
=
"HWUART"
;
else
sport
->
name
=
"???"
;
sport
->
port
.
membase
=
ioremap
(
mmres
->
start
,
mmres
->
end
-
mmres
->
start
+
1
);
if
(
!
sport
->
port
.
membase
)
{
ret
=
-
ENOMEM
;
goto
err_free
;
}
serial_pxa_ports
[
dev
->
id
]
=
sport
;
uart_add_one_port
(
&
serial_pxa_reg
,
&
sport
->
port
);
platform_set_drvdata
(
dev
,
sport
);
return
0
;
err_free:
kfree
(
sport
);
return
ret
;
}
static
int
serial_pxa_remove
(
struct
platform_device
*
dev
)
...
...
@@ -818,8 +801,8 @@ static int serial_pxa_remove(struct platform_device *dev)
platform_set_drvdata
(
dev
,
NULL
);
if
(
sport
)
uart_remove_one_port
(
&
serial_pxa_reg
,
&
sport
->
port
);
uart_remove_one_port
(
&
serial_pxa_reg
,
&
sport
->
port
);
kfree
(
s
port
);
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录