Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
c1d926a5
Commit
c1d926a5
authored
Jun 04, 2013
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/fix/xilinx' into spi-linus
parents
ae6c1383
68c315bb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
39 deletions
+35
-39
drivers/spi/spi-xilinx.c
drivers/spi/spi-xilinx.c
+35
-39
No files found.
drivers/spi/spi-xilinx.c
View file @
c1d926a5
...
@@ -267,7 +267,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
...
@@ -267,7 +267,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
{
{
struct
xilinx_spi
*
xspi
=
spi_master_get_devdata
(
spi
->
master
);
struct
xilinx_spi
*
xspi
=
spi_master_get_devdata
(
spi
->
master
);
u32
ipif_ier
;
u32
ipif_ier
;
u16
cr
;
/* We get here with transmitter inhibited */
/* We get here with transmitter inhibited */
...
@@ -276,7 +275,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
...
@@ -276,7 +275,6 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
xspi
->
remaining_bytes
=
t
->
len
;
xspi
->
remaining_bytes
=
t
->
len
;
INIT_COMPLETION
(
xspi
->
done
);
INIT_COMPLETION
(
xspi
->
done
);
xilinx_spi_fill_tx_fifo
(
xspi
);
/* Enable the transmit empty interrupt, which we use to determine
/* Enable the transmit empty interrupt, which we use to determine
* progress on the transmission.
* progress on the transmission.
...
@@ -285,12 +283,41 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
...
@@ -285,12 +283,41 @@ static int xilinx_spi_txrx_bufs(struct spi_device *spi, struct spi_transfer *t)
xspi
->
write_fn
(
ipif_ier
|
XSPI_INTR_TX_EMPTY
,
xspi
->
write_fn
(
ipif_ier
|
XSPI_INTR_TX_EMPTY
,
xspi
->
regs
+
XIPIF_V123B_IIER_OFFSET
);
xspi
->
regs
+
XIPIF_V123B_IIER_OFFSET
);
/* Start the transfer by not inhibiting the transmitter any longer */
for
(;;)
{
cr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_CR_OFFSET
)
&
u16
cr
;
~
XSPI_CR_TRANS_INHIBIT
;
u8
sr
;
xspi
->
write_fn
(
cr
,
xspi
->
regs
+
XSPI_CR_OFFSET
);
xilinx_spi_fill_tx_fifo
(
xspi
);
/* Start the transfer by not inhibiting the transmitter any
* longer
*/
cr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_CR_OFFSET
)
&
~
XSPI_CR_TRANS_INHIBIT
;
xspi
->
write_fn
(
cr
,
xspi
->
regs
+
XSPI_CR_OFFSET
);
wait_for_completion
(
&
xspi
->
done
);
/* A transmit has just completed. Process received data and
* check for more data to transmit. Always inhibit the
* transmitter while the Isr refills the transmit register/FIFO,
* or make sure it is stopped if we're done.
*/
cr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_CR_OFFSET
);
xspi
->
write_fn
(
cr
|
XSPI_CR_TRANS_INHIBIT
,
xspi
->
regs
+
XSPI_CR_OFFSET
);
/* Read out all the data from the Rx FIFO */
sr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_SR_OFFSET
);
while
((
sr
&
XSPI_SR_RX_EMPTY_MASK
)
==
0
)
{
xspi
->
rx_fn
(
xspi
);
sr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_SR_OFFSET
);
}
wait_for_completion
(
&
xspi
->
done
);
/* See if there is more data to send */
if
(
!
xspi
->
remaining_bytes
>
0
)
break
;
}
/* Disable the transmit empty interrupt */
/* Disable the transmit empty interrupt */
xspi
->
write_fn
(
ipif_ier
,
xspi
->
regs
+
XIPIF_V123B_IIER_OFFSET
);
xspi
->
write_fn
(
ipif_ier
,
xspi
->
regs
+
XIPIF_V123B_IIER_OFFSET
);
...
@@ -314,38 +341,7 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
...
@@ -314,38 +341,7 @@ static irqreturn_t xilinx_spi_irq(int irq, void *dev_id)
xspi
->
write_fn
(
ipif_isr
,
xspi
->
regs
+
XIPIF_V123B_IISR_OFFSET
);
xspi
->
write_fn
(
ipif_isr
,
xspi
->
regs
+
XIPIF_V123B_IISR_OFFSET
);
if
(
ipif_isr
&
XSPI_INTR_TX_EMPTY
)
{
/* Transmission completed */
if
(
ipif_isr
&
XSPI_INTR_TX_EMPTY
)
{
/* Transmission completed */
u16
cr
;
complete
(
&
xspi
->
done
);
u8
sr
;
/* A transmit has just completed. Process received data and
* check for more data to transmit. Always inhibit the
* transmitter while the Isr refills the transmit register/FIFO,
* or make sure it is stopped if we're done.
*/
cr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_CR_OFFSET
);
xspi
->
write_fn
(
cr
|
XSPI_CR_TRANS_INHIBIT
,
xspi
->
regs
+
XSPI_CR_OFFSET
);
/* Read out all the data from the Rx FIFO */
sr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_SR_OFFSET
);
while
((
sr
&
XSPI_SR_RX_EMPTY_MASK
)
==
0
)
{
xspi
->
rx_fn
(
xspi
);
sr
=
xspi
->
read_fn
(
xspi
->
regs
+
XSPI_SR_OFFSET
);
}
/* See if there is more data to send */
if
(
xspi
->
remaining_bytes
>
0
)
{
xilinx_spi_fill_tx_fifo
(
xspi
);
/* Start the transfer by not inhibiting the
* transmitter any longer
*/
xspi
->
write_fn
(
cr
,
xspi
->
regs
+
XSPI_CR_OFFSET
);
}
else
{
/* No more data to send.
* Indicate the transfer is completed.
*/
complete
(
&
xspi
->
done
);
}
}
}
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