Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Simple PCIe FMC carrier SPEC
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Simple PCIe FMC carrier SPEC
Commits
a1a8d2cb
Commit
a1a8d2cb
authored
Aug 12, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv:dma: split DMA control func
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
4f2c8eaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
19 deletions
+34
-19
spec-gn412x-dma.c
software/kernel/spec-gn412x-dma.c
+34
-19
No files found.
software/kernel/spec-gn412x-dma.c
View file @
a1a8d2cb
...
@@ -183,7 +183,7 @@ struct gn412x_dma_tx_hw {
...
@@ -183,7 +183,7 @@ struct gn412x_dma_tx_hw {
* @pending_list: list of pending transfers
* @pending_list: list of pending transfers
* @tx_curr: current transfer
* @tx_curr: current transfer
* @task: tasklet for DMA start
* @task: tasklet for DMA start
* @lock: protects
the pending_list and tx_curr from concurrent changes
* @lock: protects
: pending_list, tx_curr, sconfig
* @sconfig: channel configuration to be used
* @sconfig: channel configuration to be used
* @error: number of errors detected
* @error: number of errors detected
*/
*/
...
@@ -539,30 +539,45 @@ static enum dma_status gn412x_dma_tx_status(struct dma_chan *chan,
...
@@ -539,30 +539,45 @@ static enum dma_status gn412x_dma_tx_status(struct dma_chan *chan,
return
DMA_ERROR
;
return
DMA_ERROR
;
}
}
static
int
gn412x_dma_slave_config
(
struct
dma_chan
*
chan
,
struct
dma_slave_config
*
sconfig
)
{
struct
gn412x_dma_chan
*
gn412x_dma_chan
=
to_gn412x_dma_chan
(
chan
);
unsigned
long
flags
;
spin_lock_irqsave
(
&
gn412x_dma_chan
->
lock
,
flags
);
memcpy
(
&
gn412x_dma_chan
->
sconfig
,
sconfig
,
sizeof
(
struct
dma_slave_config
));
spin_unlock_irqrestore
(
&
gn412x_dma_chan
->
lock
,
flags
);
return
0
;
}
static
int
gn412x_dma_terminate_all
(
struct
dma_chan
*
chan
)
{
struct
gn412x_dma_device
*
gn412x_dma
=
to_gn412x_dma_device
(
chan
->
device
);
gn412x_dma_ctrl_abort
(
gn412x_dma
);
/* FIXME remove all pending */
if
(
!
gn412x_dma_is_abort
(
gn412x_dma
))
{
dev_err
(
&
gn412x_dma
->
pdev
->
dev
,
"Failed to abort DMA transfer
\n
"
);
return
-
EINVAL
;
}
return
0
;
}
static
int
gn412x_dma_device_control
(
struct
dma_chan
*
chan
,
static
int
gn412x_dma_device_control
(
struct
dma_chan
*
chan
,
enum
dma_ctrl_cmd
cmd
,
enum
dma_ctrl_cmd
cmd
,
unsigned
long
arg
)
unsigned
long
arg
)
{
{
struct
gn412x_dma_device
*
gn412x_dma
=
to_gn412x_dma_device
(
chan
->
device
);
switch
(
cmd
)
{
switch
(
cmd
)
{
case
DMA_SLAVE_CONFIG
:
{
case
DMA_SLAVE_CONFIG
:
struct
gn412x_dma_chan
*
gn412x_dma_chan
=
to_gn412x_dma_chan
(
chan
);
return
gn412x_dma_slave_config
(
chan
,
struct
dma_slave_config
*
sconfig
=
(
struct
dma_slave_config
*
)
arg
;
(
struct
dma_slave_config
*
)
arg
);
memcpy
(
&
gn412x_dma_chan
->
sconfig
,
sconfig
,
sizeof
(
struct
dma_slave_config
));
break
;
}
case
DMA_TERMINATE_ALL
:
case
DMA_TERMINATE_ALL
:
gn412x_dma_ctrl_abort
(
gn412x_dma
);
return
gn412x_dma_terminate_all
(
chan
);
/* FIXME remove all pending */
if
(
!
gn412x_dma_is_abort
(
gn412x_dma
))
{
dev_err
(
&
gn412x_dma
->
pdev
->
dev
,
"Failed to abort DMA transfer
\n
"
);
return
-
EINVAL
;
}
break
;
case
DMA_PAUSE
:
case
DMA_PAUSE
:
break
;
break
;
case
DMA_RESUME
:
case
DMA_RESUME
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment