Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Linux-御风守护者
linux
提交
f57caaef
L
linux
项目概览
Linux-御风守护者
/
linux
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
L
linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f57caaef
编写于
6月 29, 2006
作者:
D
David S. Miller
提交者:
David S. Miller
6月 29, 2006
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[SERIO] i8042-sparcio.h: Convert to of_driver framework.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
ff0d2fc6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
69 addition
and
39 deletion
+69
-39
drivers/input/serio/i8042-sparcio.h
drivers/input/serio/i8042-sparcio.h
+69
-39
未找到文件。
drivers/input/serio/i8042-sparcio.h
浏览文件 @
f57caaef
...
...
@@ -3,11 +3,9 @@
#include <linux/config.h>
#include <asm/io.h>
#ifdef CONFIG_PCI
#include <asm/oplib.h>
#include <asm/
ebus
.h>
#
endif
#include <asm/
prom
.h>
#
include <asm/of_device.h>
static
int
i8042_kbd_irq
=
-
1
;
static
int
i8042_aux_irq
=
-
1
;
...
...
@@ -48,54 +46,83 @@ static inline void i8042_write_command(int val)
#define OBP_PS2MS_NAME1 "kdmouse"
#define OBP_PS2MS_NAME2 "mouse"
static
int
__devinit
sparc_i8042_probe
(
struct
of_device
*
op
,
const
struct
of_device_id
*
match
)
{
struct
device_node
*
dp
=
op
->
node
;
dp
=
dp
->
child
;
while
(
dp
)
{
if
(
!
strcmp
(
dp
->
name
,
OBP_PS2KBD_NAME1
)
||
!
strcmp
(
dp
->
name
,
OBP_PS2KBD_NAME2
))
{
struct
of_device
*
kbd
=
of_find_device_by_node
(
dp
);
unsigned
int
irq
=
kbd
->
irqs
[
0
];
if
(
irq
==
0xffffffff
)
irq
=
op
->
irqs
[
0
];
i8042_kbd_irq
=
irq
;
kbd_iobase
=
of_ioremap
(
&
kbd
->
resource
[
0
],
0
,
8
,
"kbd"
);
}
else
if
(
!
strcmp
(
dp
->
name
,
OBP_PS2MS_NAME1
)
||
!
strcmp
(
dp
->
name
,
OBP_PS2MS_NAME2
))
{
struct
of_device
*
ms
=
of_find_device_by_node
(
dp
);
unsigned
int
irq
=
ms
->
irqs
[
0
];
if
(
irq
==
0xffffffff
)
irq
=
op
->
irqs
[
0
];
i8042_aux_irq
=
irq
;
}
dp
=
dp
->
sibling
;
}
return
0
;
}
static
int
__devexit
sparc_i8042_remove
(
struct
of_device
*
op
)
{
of_iounmap
(
kbd_iobase
,
8
);
return
0
;
}
static
struct
of_device_id
sparc_i8042_match
[]
=
{
{
.
name
=
"8042"
,
},
{},
};
MODULE_DEVICE_TABLE
(
of
,
i8042_match
);
static
struct
of_platform_driver
sparc_i8042_driver
=
{
.
name
=
"i8042"
,
.
match_table
=
sparc_i8042_match
,
.
probe
=
sparc_i8042_probe
,
.
remove
=
__devexit_p
(
sparc_i8042_remove
),
};
static
int
__init
i8042_platform_init
(
void
)
{
#ifndef CONFIG_PCI
return
-
ENODEV
;
#else
char
prop
[
128
];
int
len
;
struct
device_node
*
root
=
of_find_node_by_path
(
"/"
);
len
=
prom_getproperty
(
prom_root_node
,
"name"
,
prop
,
sizeof
(
prop
));
if
(
len
<
0
)
{
printk
(
"i8042: Cannot get name property of root OBP node.
\n
"
);
return
-
ENODEV
;
}
if
(
strncmp
(
prop
,
"SUNW,JavaStation-1"
,
len
)
==
0
)
{
if
(
!
strcmp
(
root
->
name
,
"SUNW,JavaStation-1"
))
{
/* Hardcoded values for MrCoffee. */
i8042_kbd_irq
=
i8042_aux_irq
=
13
|
0x20
;
kbd_iobase
=
ioremap
(
0x71300060
,
8
);
if
(
!
kbd_iobase
)
return
-
ENODEV
;
}
else
{
struct
linux_ebus
*
ebus
;
struct
linux_ebus_device
*
edev
;
struct
linux_ebus_child
*
child
;
for_each_ebus
(
ebus
)
{
for_each_ebusdev
(
edev
,
ebus
)
{
if
(
!
strcmp
(
edev
->
prom_node
->
name
,
"8042"
))
goto
edev_found
;
}
}
return
-
ENODEV
;
edev_found:
for_each_edevchild
(
edev
,
child
)
{
if
(
!
strcmp
(
child
->
prom_node
->
name
,
OBP_PS2KBD_NAME1
)
||
!
strcmp
(
child
->
prom_node
->
name
,
OBP_PS2KBD_NAME2
))
{
i8042_kbd_irq
=
child
->
irqs
[
0
];
kbd_iobase
=
ioremap
(
child
->
resource
[
0
].
start
,
8
);
}
if
(
!
strcmp
(
child
->
prom_node
->
name
,
OBP_PS2MS_NAME1
)
||
!
strcmp
(
child
->
prom_node
->
name
,
OBP_PS2MS_NAME2
))
i8042_aux_irq
=
child
->
irqs
[
0
];
}
int
err
=
of_register_driver
(
&
sparc_i8042_driver
,
&
of_bus_type
);
if
(
err
)
return
err
;
if
(
i8042_kbd_irq
==
-
1
||
i8042_aux_irq
==
-
1
)
{
printk
(
"i8042: Error, 8042 device lacks both kbd and "
"mouse nodes.
\n
"
);
if
(
kbd_iobase
)
{
of_iounmap
(
kbd_iobase
,
8
);
kbd_iobase
=
(
void
__iomem
*
)
NULL
;
}
return
-
ENODEV
;
}
}
...
...
@@ -109,7 +136,10 @@ static int __init i8042_platform_init(void)
static
inline
void
i8042_platform_exit
(
void
)
{
#ifdef CONFIG_PCI
iounmap
(
kbd_iobase
);
struct
device_node
*
root
=
of_find_node_by_path
(
"/"
);
if
(
strcmp
(
root
->
name
,
"SUNW,JavaStation-1"
))
of_unregister_driver
(
&
sparc_i8042_driver
);
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录