Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
0fe85d50
cloud-kernel
项目概览
openanolis
/
cloud-kernel
大约 1 年 前同步成功
通知
158
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0fe85d50
编写于
7月 18, 2007
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SPARC64]: Convert parport to of_platform_driver.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
3adf55ad
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
133 addition
and
100 deletion
+133
-100
include/asm-sparc64/parport.h
include/asm-sparc64/parport.h
+133
-100
未找到文件。
include/asm-sparc64/parport.h
浏览文件 @
0fe85d50
...
...
@@ -8,8 +8,9 @@
#define _ASM_SPARC64_PARPORT_H 1
#include <asm/ebus.h>
#include <asm/isa.h>
#include <asm/ns87303.h>
#include <asm/of_device.h>
#include <asm/prom.h>
#define PARPORT_PC_MAX_PORTS PARPORT_MAX
...
...
@@ -35,8 +36,12 @@ static struct sparc_ebus_info {
unsigned
int
addr
;
unsigned
int
count
;
int
lock
;
struct
parport
*
port
;
}
sparc_ebus_dmas
[
PARPORT_PC_MAX_PORTS
];
static
DECLARE_BITMAP
(
dma_slot_map
,
PARPORT_PC_MAX_PORTS
);
static
__inline__
int
request_dma
(
unsigned
int
dmanr
,
const
char
*
device_id
)
{
if
(
dmanr
>=
PARPORT_PC_MAX_PORTS
)
...
...
@@ -98,117 +103,145 @@ static __inline__ unsigned int get_dma_residue(unsigned int dmanr)
return
ebus_dma_residue
(
&
sparc_ebus_dmas
[
dmanr
].
info
);
}
static
int
ebus_ecpp_p
(
struct
linux_ebus_device
*
edev
)
static
int
__devinit
ecpp_probe
(
struct
of_device
*
op
,
const
struct
of_device_id
*
match
)
{
if
(
!
strcmp
(
edev
->
prom_node
->
name
,
"ecpp"
))
return
1
;
if
(
!
strcmp
(
edev
->
prom_node
->
name
,
"parallel"
))
{
const
char
*
compat
;
compat
=
of_get_property
(
edev
->
prom_node
,
"compatible"
,
NULL
);
if
(
compat
&&
(
!
strcmp
(
compat
,
"ecpp"
)
||
!
strcmp
(
compat
,
"ns87317-ecpp"
)
||
!
strcmp
(
compat
+
13
,
"ecpp"
)))
return
1
;
unsigned
long
base
=
op
->
resource
[
0
].
start
;
unsigned
long
config
=
op
->
resource
[
1
].
start
;
unsigned
long
d_base
=
op
->
resource
[
2
].
start
;
unsigned
long
d_len
;
struct
device_node
*
parent
;
struct
parport
*
p
;
int
slot
,
err
;
parent
=
op
->
node
->
parent
;
if
(
!
strcmp
(
parent
->
name
,
"dma"
))
{
p
=
parport_pc_probe_port
(
base
,
base
+
0x400
,
op
->
irqs
[
0
],
PARPORT_DMA_NOFIFO
,
op
->
dev
.
parent
);
if
(
!
p
)
return
-
ENOMEM
;
dev_set_drvdata
(
&
op
->
dev
,
p
);
return
0
;
}
for
(
slot
=
0
;
slot
<
PARPORT_PC_MAX_PORTS
;
slot
++
)
{
if
(
!
test_and_set_bit
(
slot
,
dma_slot_map
))
break
;
}
err
=
-
ENODEV
;
if
(
slot
>=
PARPORT_PC_MAX_PORTS
)
goto
out_err
;
spin_lock_init
(
&
sparc_ebus_dmas
[
slot
].
info
.
lock
);
d_len
=
(
op
->
resource
[
2
].
end
-
d_base
)
+
1UL
;
sparc_ebus_dmas
[
slot
].
info
.
regs
=
of_ioremap
(
&
op
->
resource
[
2
],
0
,
d_len
,
"ECPP DMA"
);
if
(
!
sparc_ebus_dmas
[
slot
].
info
.
regs
)
goto
out_clear_map
;
sparc_ebus_dmas
[
slot
].
info
.
flags
=
0
;
sparc_ebus_dmas
[
slot
].
info
.
callback
=
NULL
;
sparc_ebus_dmas
[
slot
].
info
.
client_cookie
=
NULL
;
sparc_ebus_dmas
[
slot
].
info
.
irq
=
0xdeadbeef
;
strcpy
(
sparc_ebus_dmas
[
slot
].
info
.
name
,
"parport"
);
if
(
ebus_dma_register
(
&
sparc_ebus_dmas
[
slot
].
info
))
goto
out_unmap_regs
;
ebus_dma_irq_enable
(
&
sparc_ebus_dmas
[
slot
].
info
,
1
);
/* Configure IRQ to Push Pull, Level Low */
/* Enable ECP, set bit 2 of the CTR first */
outb
(
0x04
,
base
+
0x02
);
ns87303_modify
(
config
,
PCR
,
PCR_EPP_ENABLE
|
PCR_IRQ_ODRAIN
,
PCR_ECP_ENABLE
|
PCR_ECP_CLK_ENA
|
PCR_IRQ_POLAR
);
/* CTR bit 5 controls direction of port */
ns87303_modify
(
config
,
PTR
,
0
,
PTR_LPT_REG_DIR
);
p
=
parport_pc_probe_port
(
base
,
base
+
0x400
,
op
->
irqs
[
0
],
slot
,
op
->
dev
.
parent
);
err
=
-
ENOMEM
;
if
(
!
p
)
goto
out_disable_irq
;
dev_set_drvdata
(
&
op
->
dev
,
p
);
return
0
;
out_disable_irq:
ebus_dma_irq_enable
(
&
sparc_ebus_dmas
[
slot
].
info
,
0
);
ebus_dma_unregister
(
&
sparc_ebus_dmas
[
slot
].
info
);
out_unmap_regs:
of_iounmap
(
&
op
->
resource
[
2
],
sparc_ebus_dmas
[
slot
].
info
.
regs
,
d_len
);
out_clear_map:
clear_bit
(
slot
,
dma_slot_map
);
out_err:
return
err
;
}
static
int
parport_isa_probe
(
int
count
)
static
int
__devexit
ecpp_remove
(
struct
of_device
*
op
)
{
struct
sparc_isa_bridge
*
isa_br
;
struct
sparc_isa_device
*
isa_dev
;
for_each_isa
(
isa_br
)
{
for_each_isadev
(
isa_dev
,
isa_br
)
{
struct
sparc_isa_device
*
child
;
unsigned
long
base
;
if
(
strcmp
(
isa_dev
->
prom_node
->
name
,
"dma"
))
continue
;
child
=
isa_dev
->
child
;
while
(
child
)
{
if
(
!
strcmp
(
child
->
prom_node
->
name
,
"parallel"
))
break
;
child
=
child
->
next
;
}
if
(
!
child
)
continue
;
base
=
child
->
resource
.
start
;
/* No DMA, see commentary in
* asm-sparc64/floppy.h:isa_floppy_init()
*/
if
(
parport_pc_probe_port
(
base
,
base
+
0x400
,
child
->
irq
,
PARPORT_DMA_NOFIFO
,
&
child
->
bus
->
self
->
dev
))
count
++
;
}
struct
parport
*
p
=
dev_get_drvdata
(
&
op
->
dev
);
int
slot
=
p
->
dma
;
parport_pc_unregister_port
(
p
);
if
(
slot
!=
PARPORT_DMA_NOFIFO
)
{
unsigned
long
d_base
=
op
->
resource
[
2
].
start
;
unsigned
long
d_len
;
d_len
=
(
op
->
resource
[
2
].
end
-
d_base
)
+
1UL
;
ebus_dma_irq_enable
(
&
sparc_ebus_dmas
[
slot
].
info
,
0
);
ebus_dma_unregister
(
&
sparc_ebus_dmas
[
slot
].
info
);
of_iounmap
(
&
op
->
resource
[
2
],
sparc_ebus_dmas
[
slot
].
info
.
regs
,
d_len
);
clear_bit
(
slot
,
dma_slot_map
);
}
return
count
;
return
0
;
}
static
int
parport_pc_find_nonpci_ports
(
int
autoirq
,
int
autodma
)
static
struct
of_device_id
ecpp_match
[]
=
{
{
.
name
=
"ecpp"
,
},
{
.
name
=
"parallel"
,
.
compatible
=
"ecpp"
,
},
{
.
name
=
"parallel"
,
.
compatible
=
"ns87317-ecpp"
,
},
{},
};
static
struct
of_platform_driver
ecpp_driver
=
{
.
name
=
"ecpp"
,
.
match_table
=
ecpp_match
,
.
probe
=
ecpp_probe
,
.
remove
=
__devexit_p
(
ecpp_remove
),
};
static
int
parport_pc_find_nonpci_ports
(
int
autoirq
,
int
autodma
)
{
struct
linux_ebus
*
ebus
;
struct
linux_ebus_device
*
edev
;
int
count
=
0
;
for_each_ebus
(
ebus
)
{
for_each_ebusdev
(
edev
,
ebus
)
{
if
(
ebus_ecpp_p
(
edev
))
{
unsigned
long
base
=
edev
->
resource
[
0
].
start
;
unsigned
long
config
=
edev
->
resource
[
1
].
start
;
unsigned
long
d_base
=
edev
->
resource
[
2
].
start
;
unsigned
long
d_len
;
spin_lock_init
(
&
sparc_ebus_dmas
[
count
].
info
.
lock
);
d_len
=
(
edev
->
resource
[
2
].
end
-
d_base
)
+
1
;
sparc_ebus_dmas
[
count
].
info
.
regs
=
ioremap
(
d_base
,
d_len
);
if
(
!
sparc_ebus_dmas
[
count
].
info
.
regs
)
continue
;
sparc_ebus_dmas
[
count
].
info
.
flags
=
0
;
sparc_ebus_dmas
[
count
].
info
.
callback
=
NULL
;
sparc_ebus_dmas
[
count
].
info
.
client_cookie
=
NULL
;
sparc_ebus_dmas
[
count
].
info
.
irq
=
0xdeadbeef
;
strcpy
(
sparc_ebus_dmas
[
count
].
info
.
name
,
"parport"
);
if
(
ebus_dma_register
(
&
sparc_ebus_dmas
[
count
].
info
))
continue
;
ebus_dma_irq_enable
(
&
sparc_ebus_dmas
[
count
].
info
,
1
);
/* Configure IRQ to Push Pull, Level Low */
/* Enable ECP, set bit 2 of the CTR first */
outb
(
0x04
,
base
+
0x02
);
ns87303_modify
(
config
,
PCR
,
PCR_EPP_ENABLE
|
PCR_IRQ_ODRAIN
,
PCR_ECP_ENABLE
|
PCR_ECP_CLK_ENA
|
PCR_IRQ_POLAR
);
/* CTR bit 5 controls direction of port */
ns87303_modify
(
config
,
PTR
,
0
,
PTR_LPT_REG_DIR
);
if
(
parport_pc_probe_port
(
base
,
base
+
0x400
,
edev
->
irqs
[
0
],
count
,
&
ebus
->
self
->
dev
))
count
++
;
}
}
}
of_register_driver
(
&
ecpp_driver
,
&
of_bus_type
);
count
=
parport_isa_probe
(
count
);
return
count
;
return
0
;
}
#endif
/* !(_ASM_SPARC64_PARPORT_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录