Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
37516385
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 4 年多
通知
15
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
37516385
编写于
10月 28, 2010
作者:
B
Ben Dooks
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'for-2637/i2c/i2c-nomadik' into next-i2c
上级
aa62f85d
f868fc35
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
21 addition
and
15 deletion
+21
-15
drivers/i2c/busses/i2c-nomadik.c
drivers/i2c/busses/i2c-nomadik.c
+21
-15
未找到文件。
drivers/i2c/busses/i2c-nomadik.c
浏览文件 @
37516385
/*
/*
* Copyright (C) 2009 ST-Ericsson
* Copyright (C) 2009 ST-Ericsson
SA
* Copyright (C) 2009 STMicroelectronics
* Copyright (C) 2009 STMicroelectronics
*
*
* I2C master mode controller driver, used in Nomadik 8815
* I2C master mode controller driver, used in Nomadik 8815
...
@@ -103,6 +103,9 @@
...
@@ -103,6 +103,9 @@
/* maximum threshold value */
/* maximum threshold value */
#define MAX_I2C_FIFO_THRESHOLD 15
#define MAX_I2C_FIFO_THRESHOLD 15
/* per-transfer delay, required for the hardware to stabilize */
#define I2C_DELAY 150
enum
i2c_status
{
enum
i2c_status
{
I2C_NOP
,
I2C_NOP
,
I2C_ON_GOING
,
I2C_ON_GOING
,
...
@@ -118,7 +121,7 @@ enum i2c_operation {
...
@@ -118,7 +121,7 @@ enum i2c_operation {
};
};
/* controller response timeout in ms */
/* controller response timeout in ms */
#define I2C_TIMEOUT_MS
5
00
#define I2C_TIMEOUT_MS
20
00
/**
/**
* struct i2c_nmk_client - client specific data
* struct i2c_nmk_client - client specific data
...
@@ -250,6 +253,8 @@ static int init_hw(struct nmk_i2c_dev *dev)
...
@@ -250,6 +253,8 @@ static int init_hw(struct nmk_i2c_dev *dev)
{
{
int
stat
;
int
stat
;
clk_enable
(
dev
->
clk
);
stat
=
flush_i2c_fifo
(
dev
);
stat
=
flush_i2c_fifo
(
dev
);
if
(
stat
)
if
(
stat
)
return
stat
;
return
stat
;
...
@@ -263,6 +268,9 @@ static int init_hw(struct nmk_i2c_dev *dev)
...
@@ -263,6 +268,9 @@ static int init_hw(struct nmk_i2c_dev *dev)
dev
->
cli
.
operation
=
I2C_NO_OPERATION
;
dev
->
cli
.
operation
=
I2C_NO_OPERATION
;
clk_disable
(
dev
->
clk
);
udelay
(
I2C_DELAY
);
return
0
;
return
0
;
}
}
...
@@ -431,7 +439,6 @@ static int read_i2c(struct nmk_i2c_dev *dev)
...
@@ -431,7 +439,6 @@ static int read_i2c(struct nmk_i2c_dev *dev)
(
void
)
init_hw
(
dev
);
(
void
)
init_hw
(
dev
);
status
=
-
ETIMEDOUT
;
status
=
-
ETIMEDOUT
;
}
}
return
status
;
return
status
;
}
}
...
@@ -502,9 +509,9 @@ static int write_i2c(struct nmk_i2c_dev *dev)
...
@@ -502,9 +509,9 @@ static int write_i2c(struct nmk_i2c_dev *dev)
/**
/**
* nmk_i2c_xfer() - I2C transfer function used by kernel framework
* nmk_i2c_xfer() - I2C transfer function used by kernel framework
* @i2c_adap
-
Adapter pointer to the controller
* @i2c_adap
:
Adapter pointer to the controller
* @msgs
[] -
Pointer to data to be written.
* @msgs
:
Pointer to data to be written.
* @num_msgs
-
Number of messages to be executed
* @num_msgs
:
Number of messages to be executed
*
*
* This is the function called by the generic kernel i2c_transfer()
* This is the function called by the generic kernel i2c_transfer()
* or i2c_smbus...() API calls. Note that this code is protected by the
* or i2c_smbus...() API calls. Note that this code is protected by the
...
@@ -559,6 +566,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
...
@@ -559,6 +566,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
if
(
status
)
if
(
status
)
return
status
;
return
status
;
clk_enable
(
dev
->
clk
);
/* setup the i2c controller */
/* setup the i2c controller */
setup_i2c_controller
(
dev
);
setup_i2c_controller
(
dev
);
...
@@ -591,10 +600,13 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
...
@@ -591,10 +600,13 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
dev_err
(
&
dev
->
pdev
->
dev
,
"%s
\n
"
,
dev_err
(
&
dev
->
pdev
->
dev
,
"%s
\n
"
,
cause
>=
ARRAY_SIZE
(
abort_causes
)
cause
>=
ARRAY_SIZE
(
abort_causes
)
?
"unknown reason"
:
abort_causes
[
cause
]);
?
"unknown reason"
:
abort_causes
[
cause
]);
clk_disable
(
dev
->
clk
);
return
status
;
return
status
;
}
}
mdelay
(
1
);
udelay
(
I2C_DELAY
);
}
}
clk_disable
(
dev
->
clk
);
/* return the no. messages processed */
/* return the no. messages processed */
if
(
status
)
if
(
status
)
return
status
;
return
status
;
...
@@ -605,6 +617,7 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
...
@@ -605,6 +617,7 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap,
/**
/**
* disable_interrupts() - disable the interrupts
* disable_interrupts() - disable the interrupts
* @dev: private data of controller
* @dev: private data of controller
* @irq: interrupt number
*/
*/
static
int
disable_interrupts
(
struct
nmk_i2c_dev
*
dev
,
u32
irq
)
static
int
disable_interrupts
(
struct
nmk_i2c_dev
*
dev
,
u32
irq
)
{
{
...
@@ -794,10 +807,7 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
...
@@ -794,10 +807,7 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg)
static
unsigned
int
nmk_i2c_functionality
(
struct
i2c_adapter
*
adap
)
static
unsigned
int
nmk_i2c_functionality
(
struct
i2c_adapter
*
adap
)
{
{
return
I2C_FUNC_I2C
return
I2C_FUNC_I2C
|
I2C_FUNC_SMBUS_EMUL
;
|
I2C_FUNC_SMBUS_BYTE_DATA
|
I2C_FUNC_SMBUS_WORD_DATA
|
I2C_FUNC_SMBUS_I2C_BLOCK
;
}
}
static
const
struct
i2c_algorithm
nmk_i2c_algo
=
{
static
const
struct
i2c_algorithm
nmk_i2c_algo
=
{
...
@@ -857,8 +867,6 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
...
@@ -857,8 +867,6 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
goto
err_no_clk
;
goto
err_no_clk
;
}
}
clk_enable
(
dev
->
clk
);
adap
=
&
dev
->
adap
;
adap
=
&
dev
->
adap
;
adap
->
dev
.
parent
=
&
pdev
->
dev
;
adap
->
dev
.
parent
=
&
pdev
->
dev
;
adap
->
owner
=
THIS_MODULE
;
adap
->
owner
=
THIS_MODULE
;
...
@@ -895,7 +903,6 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
...
@@ -895,7 +903,6 @@ static int __devinit nmk_i2c_probe(struct platform_device *pdev)
return
0
;
return
0
;
err_init_hw:
err_init_hw:
clk_disable
(
dev
->
clk
);
err_add_adap:
err_add_adap:
clk_put
(
dev
->
clk
);
clk_put
(
dev
->
clk
);
err_no_clk:
err_no_clk:
...
@@ -928,7 +935,6 @@ static int __devexit nmk_i2c_remove(struct platform_device *pdev)
...
@@ -928,7 +935,6 @@ static int __devexit nmk_i2c_remove(struct platform_device *pdev)
iounmap
(
dev
->
virtbase
);
iounmap
(
dev
->
virtbase
);
if
(
res
)
if
(
res
)
release_mem_region
(
res
->
start
,
resource_size
(
res
));
release_mem_region
(
res
->
start
,
resource_size
(
res
));
clk_disable
(
dev
->
clk
);
clk_put
(
dev
->
clk
);
clk_put
(
dev
->
clk
);
platform_set_drvdata
(
pdev
,
NULL
);
platform_set_drvdata
(
pdev
,
NULL
);
kfree
(
dev
);
kfree
(
dev
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录