Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
8e37befc
C
clone-Linux
项目概览
gsplhtlxg
/
clone-Linux
通知
2
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
clone-Linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8e37befc
编写于
9月 01, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'spi/topic/imx' into spi-next
上级
497cb447
27743e0b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
50 deletion
+26
-50
drivers/spi/spi-imx.c
drivers/spi/spi-imx.c
+26
-50
未找到文件。
drivers/spi/spi-imx.c
浏览文件 @
8e37befc
...
...
@@ -619,6 +619,7 @@ static const struct of_device_id spi_imx_dt_ids[] = {
{
.
compatible
=
"fsl,imx51-ecspi"
,
.
data
=
&
imx51_ecspi_devtype_data
,
},
{
/* sentinel */
}
};
MODULE_DEVICE_TABLE
(
of
,
spi_imx_dt_ids
);
static
void
spi_imx_chipselect
(
struct
spi_device
*
spi
,
int
is_active
)
{
...
...
@@ -796,10 +797,11 @@ static int spi_imx_probe(struct platform_device *pdev)
if
(
!
gpio_is_valid
(
cs_gpio
))
continue
;
ret
=
gpio_request
(
spi_imx
->
chipselect
[
i
],
DRIVER_NAME
);
ret
=
devm_gpio_request
(
&
pdev
->
dev
,
spi_imx
->
chipselect
[
i
],
DRIVER_NAME
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"can't get cs gpios
\n
"
);
goto
out_
gpio_free
;
goto
out_
master_put
;
}
}
...
...
@@ -816,50 +818,44 @@ static int spi_imx_probe(struct platform_device *pdev)
(
struct
spi_imx_devtype_data
*
)
pdev
->
id_entry
->
driver_data
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
if
(
!
res
)
{
dev_err
(
&
pdev
->
dev
,
"can't get platform resource
\n
"
);
ret
=
-
ENOMEM
;
goto
out_gpio_free
;
}
if
(
!
request_mem_region
(
res
->
start
,
resource_size
(
res
),
pdev
->
name
))
{
dev_err
(
&
pdev
->
dev
,
"request_mem_region failed
\n
"
);
ret
=
-
EBUSY
;
goto
out_gpio_free
;
}
spi_imx
->
base
=
ioremap
(
res
->
start
,
resource_size
(
res
));
if
(
!
spi_imx
->
base
)
{
ret
=
-
EINVAL
;
goto
out_release_mem
;
spi_imx
->
base
=
devm_ioremap_resource
(
&
pdev
->
dev
,
res
);
if
(
IS_ERR
(
spi_imx
->
base
))
{
ret
=
PTR_ERR
(
spi_imx
->
base
);
goto
out_master_put
;
}
spi_imx
->
irq
=
platform_get_irq
(
pdev
,
0
);
if
(
spi_imx
->
irq
<
0
)
{
ret
=
-
EINVAL
;
goto
out_
iounmap
;
goto
out_
master_put
;
}
ret
=
request_irq
(
spi_imx
->
irq
,
spi_imx_isr
,
0
,
DRIVER_NAME
,
spi_imx
);
ret
=
devm_request_irq
(
&
pdev
->
dev
,
spi_imx
->
irq
,
spi_imx_isr
,
0
,
DRIVER_NAME
,
spi_imx
);
if
(
ret
)
{
dev_err
(
&
pdev
->
dev
,
"can't get irq%d: %d
\n
"
,
spi_imx
->
irq
,
ret
);
goto
out_
iounmap
;
goto
out_
master_put
;
}
spi_imx
->
clk_ipg
=
devm_clk_get
(
&
pdev
->
dev
,
"ipg"
);
if
(
IS_ERR
(
spi_imx
->
clk_ipg
))
{
ret
=
PTR_ERR
(
spi_imx
->
clk_ipg
);
goto
out_
free_irq
;
goto
out_
master_put
;
}
spi_imx
->
clk_per
=
devm_clk_get
(
&
pdev
->
dev
,
"per"
);
if
(
IS_ERR
(
spi_imx
->
clk_per
))
{
ret
=
PTR_ERR
(
spi_imx
->
clk_per
);
goto
out_
free_irq
;
goto
out_
master_put
;
}
clk_prepare_enable
(
spi_imx
->
clk_per
);
clk_prepare_enable
(
spi_imx
->
clk_ipg
);
ret
=
clk_prepare_enable
(
spi_imx
->
clk_per
);
if
(
ret
)
goto
out_master_put
;
ret
=
clk_prepare_enable
(
spi_imx
->
clk_ipg
);
if
(
ret
)
goto
out_put_per
;
spi_imx
->
spi_clk
=
clk_get_rate
(
spi_imx
->
clk_per
);
...
...
@@ -879,47 +875,27 @@ static int spi_imx_probe(struct platform_device *pdev)
return
ret
;
out_clk_put:
clk_disable_unprepare
(
spi_imx
->
clk_per
);
clk_disable_unprepare
(
spi_imx
->
clk_ipg
);
out_free_irq:
free_irq
(
spi_imx
->
irq
,
spi_imx
);
out_iounmap:
iounmap
(
spi_imx
->
base
);
out_release_mem:
release_mem_region
(
res
->
start
,
resource_size
(
res
));
out_gpio_free:
while
(
--
i
>=
0
)
{
if
(
gpio_is_valid
(
spi_imx
->
chipselect
[
i
]))
gpio_free
(
spi_imx
->
chipselect
[
i
]);
}
out_put_per:
clk_disable_unprepare
(
spi_imx
->
clk_per
);
out_master_put:
spi_master_put
(
master
);
kfree
(
master
);
return
ret
;
}
static
int
spi_imx_remove
(
struct
platform_device
*
pdev
)
{
struct
spi_master
*
master
=
platform_get_drvdata
(
pdev
);
struct
resource
*
res
=
platform_get_resource
(
pdev
,
IORESOURCE_MEM
,
0
);
struct
spi_imx_data
*
spi_imx
=
spi_master_get_devdata
(
master
);
int
i
;
spi_bitbang_stop
(
&
spi_imx
->
bitbang
);
writel
(
0
,
spi_imx
->
base
+
MXC_CSPICTRL
);
clk_disable_unprepare
(
spi_imx
->
clk_per
);
clk_disable_unprepare
(
spi_imx
->
clk_ipg
);
free_irq
(
spi_imx
->
irq
,
spi_imx
);
iounmap
(
spi_imx
->
base
);
for
(
i
=
0
;
i
<
master
->
num_chipselect
;
i
++
)
if
(
gpio_is_valid
(
spi_imx
->
chipselect
[
i
]))
gpio_free
(
spi_imx
->
chipselect
[
i
]);
clk_disable_unprepare
(
spi_imx
->
clk_per
);
spi_master_put
(
master
);
release_mem_region
(
res
->
start
,
resource_size
(
res
));
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录