Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
e0a7ab4b
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
e0a7ab4b
编写于
8月 30, 2014
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'spi/fix/sh-msiof' into spi-linus
上级
52addcf9
3e81b592
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
38 addition
and
33 deletion
+38
-33
drivers/spi/spi-sh-msiof.c
drivers/spi/spi-sh-msiof.c
+38
-33
未找到文件。
drivers/spi/spi-sh-msiof.c
浏览文件 @
e0a7ab4b
...
@@ -636,48 +636,38 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
...
@@ -636,48 +636,38 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
dma_cookie_t
cookie
;
dma_cookie_t
cookie
;
int
ret
;
int
ret
;
if
(
tx
)
{
/* First prepare and submit the DMA request(s), as this may fail */
ier_bits
|=
IER_TDREQE
|
IER_TDMAE
;
dma_sync_single_for_device
(
p
->
master
->
dma_tx
->
device
->
dev
,
p
->
tx_dma_addr
,
len
,
DMA_TO_DEVICE
);
desc_tx
=
dmaengine_prep_slave_single
(
p
->
master
->
dma_tx
,
p
->
tx_dma_addr
,
len
,
DMA_TO_DEVICE
,
DMA_PREP_INTERRUPT
|
DMA_CTRL_ACK
);
if
(
!
desc_tx
)
return
-
EAGAIN
;
}
if
(
rx
)
{
if
(
rx
)
{
ier_bits
|=
IER_RDREQE
|
IER_RDMAE
;
ier_bits
|=
IER_RDREQE
|
IER_RDMAE
;
desc_rx
=
dmaengine_prep_slave_single
(
p
->
master
->
dma_rx
,
desc_rx
=
dmaengine_prep_slave_single
(
p
->
master
->
dma_rx
,
p
->
rx_dma_addr
,
len
,
DMA_FROM_DEVICE
,
p
->
rx_dma_addr
,
len
,
DMA_FROM_DEVICE
,
DMA_PREP_INTERRUPT
|
DMA_CTRL_ACK
);
DMA_PREP_INTERRUPT
|
DMA_CTRL_ACK
);
if
(
!
desc_rx
)
if
(
!
desc_rx
)
{
return
-
EAGAIN
;
ret
=
-
EAGAIN
;
}
goto
no_dma_rx
;
}
/* 1 stage FIFO watermarks for DMA */
sh_msiof_write
(
p
,
FCTR
,
FCTR_TFWM_1
|
FCTR_RFWM_1
);
/* setup msiof transfer mode registers (32-bit words) */
sh_msiof_spi_set_mode_regs
(
p
,
tx
,
rx
,
32
,
len
/
4
);
sh_msiof_write
(
p
,
IER
,
ier_bits
);
reinit_completion
(
&
p
->
done
);
if
(
rx
)
{
desc_rx
->
callback
=
sh_msiof_dma_complete
;
desc_rx
->
callback
=
sh_msiof_dma_complete
;
desc_rx
->
callback_param
=
p
;
desc_rx
->
callback_param
=
p
;
cookie
=
dmaengine_submit
(
desc_rx
);
cookie
=
dmaengine_submit
(
desc_rx
);
if
(
dma_submit_error
(
cookie
))
{
if
(
dma_submit_error
(
cookie
))
{
ret
=
cookie
;
ret
=
cookie
;
goto
stop_ier
;
goto
no_dma_rx
;
}
}
dma_async_issue_pending
(
p
->
master
->
dma_rx
);
}
}
if
(
tx
)
{
if
(
tx
)
{
ier_bits
|=
IER_TDREQE
|
IER_TDMAE
;
dma_sync_single_for_device
(
p
->
master
->
dma_tx
->
device
->
dev
,
p
->
tx_dma_addr
,
len
,
DMA_TO_DEVICE
);
desc_tx
=
dmaengine_prep_slave_single
(
p
->
master
->
dma_tx
,
p
->
tx_dma_addr
,
len
,
DMA_TO_DEVICE
,
DMA_PREP_INTERRUPT
|
DMA_CTRL_ACK
);
if
(
!
desc_tx
)
{
ret
=
-
EAGAIN
;
goto
no_dma_tx
;
}
if
(
rx
)
{
if
(
rx
)
{
/* No callback */
/* No callback */
desc_tx
->
callback
=
NULL
;
desc_tx
->
callback
=
NULL
;
...
@@ -688,15 +678,30 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
...
@@ -688,15 +678,30 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
cookie
=
dmaengine_submit
(
desc_tx
);
cookie
=
dmaengine_submit
(
desc_tx
);
if
(
dma_submit_error
(
cookie
))
{
if
(
dma_submit_error
(
cookie
))
{
ret
=
cookie
;
ret
=
cookie
;
goto
stop_r
x
;
goto
no_dma_t
x
;
}
}
dma_async_issue_pending
(
p
->
master
->
dma_tx
);
}
}
/* 1 stage FIFO watermarks for DMA */
sh_msiof_write
(
p
,
FCTR
,
FCTR_TFWM_1
|
FCTR_RFWM_1
);
/* setup msiof transfer mode registers (32-bit words) */
sh_msiof_spi_set_mode_regs
(
p
,
tx
,
rx
,
32
,
len
/
4
);
sh_msiof_write
(
p
,
IER
,
ier_bits
);
reinit_completion
(
&
p
->
done
);
/* Now start DMA */
if
(
tx
)
dma_async_issue_pending
(
p
->
master
->
dma_rx
);
if
(
rx
)
dma_async_issue_pending
(
p
->
master
->
dma_tx
);
ret
=
sh_msiof_spi_start
(
p
,
rx
);
ret
=
sh_msiof_spi_start
(
p
,
rx
);
if
(
ret
)
{
if
(
ret
)
{
dev_err
(
&
p
->
pdev
->
dev
,
"failed to start hardware
\n
"
);
dev_err
(
&
p
->
pdev
->
dev
,
"failed to start hardware
\n
"
);
goto
stop_
tx
;
goto
stop_
dma
;
}
}
/* wait for tx fifo to be emptied / rx fifo to be filled */
/* wait for tx fifo to be emptied / rx fifo to be filled */
...
@@ -726,14 +731,14 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
...
@@ -726,14 +731,14 @@ static int sh_msiof_dma_once(struct sh_msiof_spi_priv *p, const void *tx,
stop_reset:
stop_reset:
sh_msiof_reset_str
(
p
);
sh_msiof_reset_str
(
p
);
sh_msiof_spi_stop
(
p
,
rx
);
sh_msiof_spi_stop
(
p
,
rx
);
stop_
tx
:
stop_
dma
:
if
(
tx
)
if
(
tx
)
dmaengine_terminate_all
(
p
->
master
->
dma_tx
);
dmaengine_terminate_all
(
p
->
master
->
dma_tx
);
stop_r
x:
no_dma_t
x:
if
(
rx
)
if
(
rx
)
dmaengine_terminate_all
(
p
->
master
->
dma_rx
);
dmaengine_terminate_all
(
p
->
master
->
dma_rx
);
stop_ier:
sh_msiof_write
(
p
,
IER
,
0
);
sh_msiof_write
(
p
,
IER
,
0
);
no_dma_rx:
return
ret
;
return
ret
;
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录