Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
gsplhtlxg
clone-Linux
提交
2dc745b6
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,发现更多精彩内容 >>
提交
2dc745b6
编写于
9月 01, 2013
作者:
M
Mark Brown
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'spi/topic/s3c64xx' into spi-next
上级
121a3966
c12f9643
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
69 deletion
+43
-69
drivers/spi/spi-s3c64xx.c
drivers/spi/spi-s3c64xx.c
+43
-69
未找到文件。
drivers/spi/spi-s3c64xx.c
浏览文件 @
2dc745b6
...
...
@@ -172,7 +172,6 @@ struct s3c64xx_spi_port_config {
* @master: Pointer to the SPI Protocol master.
* @cntrlr_info: Platform specific data for the controller this driver manages.
* @tgl_spi: Pointer to the last CS left untoggled by the cs_change hint.
* @queue: To log SPI xfer requests.
* @lock: Controller specific lock.
* @state: Set of FLAGS to indicate status.
* @rx_dmach: Controller's DMA channel for Rx.
...
...
@@ -193,7 +192,6 @@ struct s3c64xx_spi_driver_data {
struct
spi_master
*
master
;
struct
s3c64xx_spi_info
*
cntrlr_info
;
struct
spi_device
*
tgl_spi
;
struct
list_head
queue
;
spinlock_t
lock
;
unsigned
long
sfr_start
;
struct
completion
xfer_completion
;
...
...
@@ -338,8 +336,10 @@ static int acquire_dma(struct s3c64xx_spi_driver_data *sdd)
req
.
cap
=
DMA_SLAVE
;
req
.
client
=
&
s3c64xx_spi_dma_client
;
sdd
->
rx_dma
.
ch
=
(
void
*
)
sdd
->
ops
->
request
(
sdd
->
rx_dma
.
dmach
,
&
req
,
dev
,
"rx"
);
sdd
->
tx_dma
.
ch
=
(
void
*
)
sdd
->
ops
->
request
(
sdd
->
tx_dma
.
dmach
,
&
req
,
dev
,
"tx"
);
sdd
->
rx_dma
.
ch
=
(
struct
dma_chan
*
)(
unsigned
long
)
sdd
->
ops
->
request
(
sdd
->
rx_dma
.
dmach
,
&
req
,
dev
,
"rx"
);
sdd
->
tx_dma
.
ch
=
(
struct
dma_chan
*
)(
unsigned
long
)
sdd
->
ops
->
request
(
sdd
->
tx_dma
.
dmach
,
&
req
,
dev
,
"tx"
);
return
1
;
}
...
...
@@ -386,9 +386,10 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
{
struct
s3c64xx_spi_driver_data
*
sdd
;
struct
dma_slave_config
config
;
struct
scatterlist
sg
;
struct
dma_async_tx_descriptor
*
desc
;
memset
(
&
config
,
0
,
sizeof
(
config
));
if
(
dma
->
direction
==
DMA_DEV_TO_MEM
)
{
sdd
=
container_of
((
void
*
)
dma
,
struct
s3c64xx_spi_driver_data
,
rx_dma
);
...
...
@@ -407,14 +408,8 @@ static void prepare_dma(struct s3c64xx_spi_dma_data *dma,
dmaengine_slave_config
(
dma
->
ch
,
&
config
);
}
sg_init_table
(
&
sg
,
1
);
sg_dma_len
(
&
sg
)
=
len
;
sg_set_page
(
&
sg
,
pfn_to_page
(
PFN_DOWN
(
buf
)),
len
,
offset_in_page
(
buf
));
sg_dma_address
(
&
sg
)
=
buf
;
desc
=
dmaengine_prep_slave_sg
(
dma
->
ch
,
&
sg
,
1
,
dma
->
direction
,
DMA_PREP_INTERRUPT
);
desc
=
dmaengine_prep_slave_single
(
dma
->
ch
,
buf
,
len
,
dma
->
direction
,
DMA_PREP_INTERRUPT
);
desc
->
callback
=
s3c64xx_spi_dmacb
;
desc
->
callback_param
=
dma
;
...
...
@@ -431,27 +426,26 @@ static int s3c64xx_spi_prepare_transfer(struct spi_master *spi)
dma_cap_mask_t
mask
;
int
ret
;
if
(
is_polling
(
sdd
))
return
0
;
dma_cap_zero
(
mask
);
dma_cap_set
(
DMA_SLAVE
,
mask
);
/* Acquire DMA channels */
sdd
->
rx_dma
.
ch
=
dma_request_slave_channel_compat
(
mask
,
filter
,
(
void
*
)
sdd
->
rx_dma
.
dmach
,
dev
,
"rx"
);
if
(
!
sdd
->
rx_dma
.
ch
)
{
dev_err
(
dev
,
"Failed to get RX DMA channel
\n
"
);
ret
=
-
EBUSY
;
goto
out
;
}
if
(
!
is_polling
(
sdd
))
{
dma_cap_zero
(
mask
);
dma_cap_set
(
DMA_SLAVE
,
mask
);
/* Acquire DMA channels */
sdd
->
rx_dma
.
ch
=
dma_request_slave_channel_compat
(
mask
,
filter
,
(
void
*
)
sdd
->
rx_dma
.
dmach
,
dev
,
"rx"
);
if
(
!
sdd
->
rx_dma
.
ch
)
{
dev_err
(
dev
,
"Failed to get RX DMA channel
\n
"
);
ret
=
-
EBUSY
;
goto
out
;
}
sdd
->
tx_dma
.
ch
=
dma_request_slave_channel_compat
(
mask
,
filter
,
(
void
*
)
sdd
->
tx_dma
.
dmach
,
dev
,
"tx"
);
if
(
!
sdd
->
tx_dma
.
ch
)
{
dev_err
(
dev
,
"Failed to get TX DMA channel
\n
"
);
ret
=
-
EBUSY
;
goto
out_rx
;
sdd
->
tx_dma
.
ch
=
dma_request_slave_channel_compat
(
mask
,
filter
,
(
void
*
)
sdd
->
tx_dma
.
dmach
,
dev
,
"tx"
);
if
(
!
sdd
->
tx_dma
.
ch
)
{
dev_err
(
dev
,
"Failed to get TX DMA channel
\n
"
);
ret
=
-
EBUSY
;
goto
out_rx
;
}
}
ret
=
pm_runtime_get_sync
(
&
sdd
->
pdev
->
dev
);
...
...
@@ -1053,8 +1047,6 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
struct
s3c64xx_spi_csinfo
*
cs
=
spi
->
controller_data
;
struct
s3c64xx_spi_driver_data
*
sdd
;
struct
s3c64xx_spi_info
*
sci
;
struct
spi_message
*
msg
;
unsigned
long
flags
;
int
err
;
sdd
=
spi_master_get_devdata
(
spi
->
master
);
...
...
@@ -1068,37 +1060,23 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
return
-
ENODEV
;
}
/* Request gpio only if cs line is asserted by gpio pins */
if
(
sdd
->
cs_gpio
)
{
err
=
gpio_request_one
(
cs
->
line
,
GPIOF_OUT_INIT_HIGH
,
dev_name
(
&
spi
->
dev
));
if
(
err
)
{
dev_err
(
&
spi
->
dev
,
"Failed to get /CS gpio [%d]: %d
\n
"
,
cs
->
line
,
err
);
goto
err_gpio_req
;
if
(
!
spi_get_ctldata
(
spi
))
{
/* Request gpio only if cs line is asserted by gpio pins */
if
(
sdd
->
cs_gpio
)
{
err
=
gpio_request_one
(
cs
->
line
,
GPIOF_OUT_INIT_HIGH
,
dev_name
(
&
spi
->
dev
));
if
(
err
)
{
dev_err
(
&
spi
->
dev
,
"Failed to get /CS gpio [%d]: %d
\n
"
,
cs
->
line
,
err
);
goto
err_gpio_req
;
}
}
}
if
(
!
spi_get_ctldata
(
spi
))
spi_set_ctldata
(
spi
,
cs
);
sci
=
sdd
->
cntrlr_info
;
spin_lock_irqsave
(
&
sdd
->
lock
,
flags
);
list_for_each_entry
(
msg
,
&
sdd
->
queue
,
queue
)
{
/* Is some mssg is already queued for this device */
if
(
msg
->
spi
==
spi
)
{
dev_err
(
&
spi
->
dev
,
"setup: attempt while mssg in queue!
\n
"
);
spin_unlock_irqrestore
(
&
sdd
->
lock
,
flags
);
err
=
-
EBUSY
;
goto
err_msgq
;
}
}
s
pin_unlock_irqrestore
(
&
sdd
->
lock
,
flags
)
;
s
ci
=
sdd
->
cntrlr_info
;
pm_runtime_get_sync
(
&
sdd
->
pdev
->
dev
);
...
...
@@ -1146,7 +1124,6 @@ static int s3c64xx_spi_setup(struct spi_device *spi)
/* setup() returns with device de-selected */
disable_cs
(
sdd
,
spi
);
err_msgq:
gpio_free
(
cs
->
line
);
spi_set_ctldata
(
spi
,
NULL
);
...
...
@@ -1361,16 +1338,14 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
if
(
!
sdd
->
pdev
->
dev
.
of_node
)
{
res
=
platform_get_resource
(
pdev
,
IORESOURCE_DMA
,
0
);
if
(
!
res
)
{
dev_warn
(
&
pdev
->
dev
,
"Unable to get SPI tx dma "
"resource. Switching to poll mode
\n
"
);
dev_warn
(
&
pdev
->
dev
,
"Unable to get SPI tx dma resource. Switching to poll mode
\n
"
);
sdd
->
port_conf
->
quirks
=
S3C64XX_SPI_QUIRK_POLL
;
}
else
sdd
->
tx_dma
.
dmach
=
res
->
start
;
res
=
platform_get_resource
(
pdev
,
IORESOURCE_DMA
,
1
);
if
(
!
res
)
{
dev_warn
(
&
pdev
->
dev
,
"Unable to get SPI rx dma "
"resource. Switching to poll mode
\n
"
);
dev_warn
(
&
pdev
->
dev
,
"Unable to get SPI rx dma resource. Switching to poll mode
\n
"
);
sdd
->
port_conf
->
quirks
=
S3C64XX_SPI_QUIRK_POLL
;
}
else
sdd
->
rx_dma
.
dmach
=
res
->
start
;
...
...
@@ -1440,7 +1415,6 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
spin_lock_init
(
&
sdd
->
lock
);
init_completion
(
&
sdd
->
xfer_completion
);
INIT_LIST_HEAD
(
&
sdd
->
queue
);
ret
=
devm_request_irq
(
&
pdev
->
dev
,
irq
,
s3c64xx_spi_irq
,
0
,
"spi-s3c64xx"
,
sdd
);
...
...
@@ -1462,8 +1436,8 @@ static int s3c64xx_spi_probe(struct platform_device *pdev)
dev_dbg
(
&
pdev
->
dev
,
"Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached
\n
"
,
sdd
->
port_id
,
master
->
num_chipselect
);
dev_dbg
(
&
pdev
->
dev
,
"
\t
IOmem=[
0x%x-0x%x
]
\t
DMA=[Rx-%d, Tx-%d]
\n
"
,
mem_res
->
end
,
mem_res
->
start
,
dev_dbg
(
&
pdev
->
dev
,
"
\t
IOmem=[
%pR
]
\t
DMA=[Rx-%d, Tx-%d]
\n
"
,
mem_res
,
sdd
->
rx_dma
.
dmach
,
sdd
->
tx_dma
.
dmach
);
pm_runtime_enable
(
&
pdev
->
dev
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录