Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
9d7f7363
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看板
提交
9d7f7363
编写于
11月 21, 2009
作者:
R
Russell King
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ARM: PNX4008: move i2c_adapter structure inside the drivers private data
Signed-off-by:
N
Russell King
<
rmk+kernel@arm.linux.org.uk
>
上级
44c5d739
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
36 deletion
+26
-36
arch/arm/mach-pnx4008/i2c.c
arch/arm/mach-pnx4008/i2c.c
+3
-15
drivers/i2c/busses/i2c-pnx.c
drivers/i2c/busses/i2c-pnx.c
+20
-20
include/linux/i2c-pnx.h
include/linux/i2c-pnx.h
+3
-1
未找到文件。
arch/arm/mach-pnx4008/i2c.c
浏览文件 @
9d7f7363
...
...
@@ -18,32 +18,20 @@
#include <mach/irqs.h>
#include <mach/i2c.h>
static
struct
i2c_adapter
pnx_adapter0
=
{
.
name
=
I2C_CHIP_NAME
"0"
,
};
static
struct
i2c_adapter
pnx_adapter1
=
{
.
name
=
I2C_CHIP_NAME
"1"
,
};
static
struct
i2c_adapter
pnx_adapter2
=
{
.
name
=
"USB-I2C"
,
};
static
struct
i2c_pnx_data
i2c0_data
=
{
.
adapter
=
&
pnx_adapter0
,
.
name
=
I2C_CHIP_NAME
"0"
,
.
base
=
PNX4008_I2C1_BASE
,
.
irq
=
I2C_1_INT
,
};
static
struct
i2c_pnx_data
i2c1_data
=
{
.
adapter
=
&
pnx_adapter1
,
.
name
=
I2C_CHIP_NAME
"1"
,
.
base
=
PNX4008_I2C2_BASE
,
.
irq
=
I2C_2_INT
,
};
static
struct
i2c_pnx_data
i2c2_data
=
{
.
adapter
=
&
pnx_adapter2
,
.
name
=
"USB-I2C"
,
.
base
=
(
PNX4008_USB_CONFIG_BASE
+
0x300
),
.
irq
=
USB_I2C_INT
,
};
...
...
drivers/i2c/busses/i2c-pnx.c
浏览文件 @
9d7f7363
...
...
@@ -551,8 +551,7 @@ static struct i2c_algorithm pnx_algorithm = {
static
int
i2c_pnx_controller_suspend
(
struct
platform_device
*
pdev
,
pm_message_t
state
)
{
struct
i2c_pnx_data
*
i2c_pnx
=
platform_get_drvdata
(
pdev
);
struct
i2c_pnx_algo_data
*
alg_data
=
i2c_pnx
->
adapter
->
algo_data
;
struct
i2c_pnx_algo_data
*
alg_data
=
platform_get_drvdata
(
pdev
);
/* FIXME: shouldn't this be clk_disable? */
clk_enable
(
alg_data
->
clk
);
...
...
@@ -562,8 +561,7 @@ static int i2c_pnx_controller_suspend(struct platform_device *pdev,
static
int
i2c_pnx_controller_resume
(
struct
platform_device
*
pdev
)
{
struct
i2c_pnx_data
*
i2c_pnx
=
platform_get_drvdata
(
pdev
);
struct
i2c_pnx_algo_data
*
alg_data
=
i2c_pnx
->
adapter
->
algo_data
;
struct
i2c_pnx_algo_data
*
alg_data
=
platform_get_drvdata
(
pdev
);
return
clk_enable
(
alg_data
->
clk
);
}
...
...
@@ -580,7 +578,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
unsigned
long
freq
;
struct
i2c_pnx_data
*
i2c_pnx
=
pdev
->
dev
.
platform_data
;
if
(
!
i2c_pnx
||
!
i2c_pnx
->
adapter
)
{
if
(
!
i2c_pnx
||
!
i2c_pnx
->
name
)
{
dev_err
(
&
pdev
->
dev
,
"%s: no platform data supplied
\n
"
,
__func__
);
ret
=
-
EINVAL
;
...
...
@@ -593,10 +591,15 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
goto
err_kzalloc
;
}
platform_set_drvdata
(
pdev
,
i2c_pnx
);
platform_set_drvdata
(
pdev
,
alg_data
);
i2c_pnx
->
adapter
->
algo
=
&
pnx_algorithm
;
i2c_pnx
->
adapter
->
algo_data
=
alg_data
;
strlcpy
(
alg_data
->
adapter
.
name
,
i2c_pnx
->
name
,
sizeof
(
alg_data
->
adapter
.
name
));
alg_data
->
adapter
.
dev
.
parent
=
&
pdev
->
dev
;
alg_data
->
adapter
.
algo
=
&
pnx_algorithm
;
alg_data
->
adapter
.
algo_data
=
alg_data
;
alg_data
->
adapter
.
nr
=
pdev
->
id
;
alg_data
->
i2c_pnx
=
i2c_pnx
;
alg_data
->
clk
=
clk_get
(
&
pdev
->
dev
,
NULL
);
if
(
IS_ERR
(
alg_data
->
clk
))
{
...
...
@@ -606,7 +609,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
init_timer
(
&
alg_data
->
mif
.
timer
);
alg_data
->
mif
.
timer
.
function
=
i2c_pnx_timeout
;
alg_data
->
mif
.
timer
.
data
=
(
unsigned
long
)
i2c_pnx
->
adapter
;
alg_data
->
mif
.
timer
.
data
=
(
unsigned
long
)
&
alg_data
->
adapter
;
/* Register I/O resource */
if
(
!
request_mem_region
(
i2c_pnx
->
base
,
I2C_PNX_REGION_SIZE
,
...
...
@@ -654,26 +657,24 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
init_completion
(
&
alg_data
->
mif
.
complete
);
ret
=
request_irq
(
i2c_pnx
->
irq
,
i2c_pnx_interrupt
,
0
,
pdev
->
name
,
i2c_pnx
->
adapter
);
0
,
pdev
->
name
,
&
alg_data
->
adapter
);
if
(
ret
)
goto
out_clock
;
/* Register this adapter with the I2C subsystem */
i2c_pnx
->
adapter
->
dev
.
parent
=
&
pdev
->
dev
;
i2c_pnx
->
adapter
->
nr
=
pdev
->
id
;
ret
=
i2c_add_numbered_adapter
(
i2c_pnx
->
adapter
);
ret
=
i2c_add_numbered_adapter
(
&
alg_data
->
adapter
);
if
(
ret
<
0
)
{
dev_err
(
&
pdev
->
dev
,
"I2C: Failed to add bus
\n
"
);
goto
out_irq
;
}
dev_dbg
(
&
pdev
->
dev
,
"%s: Master at %#8x, irq %d.
\n
"
,
i2c_pnx
->
adapter
->
name
,
i2c_pnx
->
base
,
i2c_pnx
->
irq
);
alg_data
->
adapter
.
name
,
i2c_pnx
->
base
,
i2c_pnx
->
irq
);
return
0
;
out_irq:
free_irq
(
i2c_pnx
->
irq
,
i2c_pnx
->
adapter
);
free_irq
(
i2c_pnx
->
irq
,
&
alg_data
->
adapter
);
out_clock:
clk_disable
(
alg_data
->
clk
);
out_unmap:
...
...
@@ -692,12 +693,11 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
static
int
__devexit
i2c_pnx_remove
(
struct
platform_device
*
pdev
)
{
struct
i2c_pnx_data
*
i2c_pnx
=
platform_get_drvdata
(
pdev
);
struct
i2c_adapter
*
adap
=
i2c_pnx
->
adapter
;
struct
i2c_pnx_algo_data
*
alg_data
=
adap
->
algo_data
;
struct
i2c_pnx_algo_data
*
alg_data
=
platform_get_drvdata
(
pdev
);
struct
i2c_pnx_data
*
i2c_pnx
=
alg_data
->
i2c_pnx
;
free_irq
(
i2c_pnx
->
irq
,
i2c_pnx
->
adapter
);
i2c_del_adapter
(
adap
);
free_irq
(
i2c_pnx
->
irq
,
&
alg_data
->
adapter
);
i2c_del_adapter
(
&
alg_data
->
adapter
);
clk_disable
(
alg_data
->
clk
);
iounmap
(
alg_data
->
ioaddr
);
release_mem_region
(
i2c_pnx
->
base
,
I2C_PNX_REGION_SIZE
);
...
...
include/linux/i2c-pnx.h
浏览文件 @
9d7f7363
...
...
@@ -29,10 +29,12 @@ struct i2c_pnx_algo_data {
struct
i2c_pnx_mif
mif
;
int
last
;
struct
clk
*
clk
;
struct
i2c_pnx_data
*
i2c_pnx
;
struct
i2c_adapter
adapter
;
};
struct
i2c_pnx_data
{
struct
i2c_adapter
*
adapter
;
const
char
*
name
;
u32
base
;
int
irq
;
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录