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
94d7d1c2
Commit
94d7d1c2
authored
Sep 02, 2019
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:drv:spi: group full-duplex operations in una function
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
dba5e3ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
spi-ocores.c
software/kernel/spi-ocores.c
+24
-11
No files found.
software/kernel/spi-ocores.c
View file @
94d7d1c2
...
@@ -558,6 +558,24 @@ static bool spi_ocores_is_busy(struct spi_ocores *sp)
...
@@ -558,6 +558,24 @@ static bool spi_ocores_is_busy(struct spi_ocores *sp)
return
(
ctrl
&
SPI_OCORES_CTRL_BUSY
);
return
(
ctrl
&
SPI_OCORES_CTRL_BUSY
);
}
}
/**
* Pop RX word and push next TX from current transfer
* @sp: SPI OCORE controller
*
* Return: 0 on success, -ENODATA when there is nothing to process
*/
static
int
spi_ocores_hw_xfer_rxtx
(
struct
spi_ocores
*
sp
)
{
spi_ocores_hw_xfer_rx_pop
(
sp
);
if
(
spi_ocores_sw_xfer_has_pending
(
sp
))
return
-
ENODATA
;
spi_ocores_hw_xfer_tx_push
(
sp
);
spi_ocores_hw_xfer_start
(
sp
);
return
0
;
}
/**
/**
* Process an SPI transfer
* Process an SPI transfer
* @sp: SPI OCORE controller
* @sp: SPI OCORE controller
...
@@ -566,22 +584,17 @@ static bool spi_ocores_is_busy(struct spi_ocores *sp)
...
@@ -566,22 +584,17 @@ static bool spi_ocores_is_busy(struct spi_ocores *sp)
*/
*/
static
int
spi_ocores_process
(
struct
spi_ocores
*
sp
)
static
int
spi_ocores_process
(
struct
spi_ocores
*
sp
)
{
{
int
err
;
if
(
spi_ocores_is_busy
(
sp
))
if
(
spi_ocores_is_busy
(
sp
))
return
-
EBUSY
;
return
-
EBUSY
;
spi_ocores_hw_xfer_rx_pop
(
sp
);
err
=
spi_ocores_hw_xfer_rxtx
(
sp
);
if
(
spi_ocores_sw_xfer_has_pending
(
sp
))
{
if
(
err
==
-
ENODATA
)
{
spi_ocores_hw_xfer_tx_push
(
sp
);
spi_ocores_hw_xfer_start
(
sp
);
}
else
{
int
err
;
spi_ocores_sw_xfer_finish
(
sp
);
spi_ocores_sw_xfer_finish
(
sp
);
err
=
spi_ocores_sw_xfer_next_start
(
sp
);
err
=
spi_ocores_sw_xfer_next_start
(
sp
);
if
(
err
)
{
if
(
err
)
/* Error or no more transfers */
spi_ocores_finalize_current_message
(
sp
);
spi_ocores_finalize_current_message
(
sp
);
}
}
}
return
0
;
return
0
;
...
@@ -614,7 +627,7 @@ static irqreturn_t spi_ocores_irq_handler(int irq, void *arg)
...
@@ -614,7 +627,7 @@ static irqreturn_t spi_ocores_irq_handler(int irq, void *arg)
int
err
;
int
err
;
err
=
spi_ocores_process
(
sp
);
err
=
spi_ocores_process
(
sp
);
if
(
err
)
if
(
err
&&
err
!=
-
ENODATA
)
return
IRQ_NONE
;
return
IRQ_NONE
;
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
...
...
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