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
34904623
Commit
34904623
authored
Feb 19, 2017
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/topic/dma' into spi-next
parents
42af2f5c
1ce24864
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
8 deletions
+37
-8
drivers/spi/spi-mt65xx.c
drivers/spi/spi-mt65xx.c
+33
-4
drivers/spi/spi.c
drivers/spi/spi.c
+4
-4
No files found.
drivers/spi/spi-mt65xx.c
View file @
34904623
...
...
@@ -73,7 +73,7 @@
#define MTK_SPI_IDLE 0
#define MTK_SPI_PAUSED 1
#define MTK_SPI_MAX_FIFO_SIZE 32
#define MTK_SPI_MAX_FIFO_SIZE 32
U
#define MTK_SPI_PACKET_SIZE 1024
struct
mtk_spi_compatible
{
...
...
@@ -333,7 +333,7 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
struct
mtk_spi
*
mdata
=
spi_master_get_devdata
(
master
);
mdata
->
cur_transfer
=
xfer
;
mdata
->
xfer_len
=
xfer
->
len
;
mdata
->
xfer_len
=
min
(
MTK_SPI_MAX_FIFO_SIZE
,
xfer
->
len
)
;
mtk_spi_prepare_transfer
(
master
,
xfer
);
mtk_spi_setup_packet
(
master
);
...
...
@@ -410,7 +410,10 @@ static bool mtk_spi_can_dma(struct spi_master *master,
struct
spi_device
*
spi
,
struct
spi_transfer
*
xfer
)
{
return
xfer
->
len
>
MTK_SPI_MAX_FIFO_SIZE
;
/* Buffers for DMA transactions must be 4-byte aligned */
return
(
xfer
->
len
>
MTK_SPI_MAX_FIFO_SIZE
&&
(
unsigned
long
)
xfer
->
tx_buf
%
4
==
0
&&
(
unsigned
long
)
xfer
->
rx_buf
%
4
==
0
);
}
static
int
mtk_spi_setup
(
struct
spi_device
*
spi
)
...
...
@@ -451,7 +454,33 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
&
reg_val
,
remainder
);
}
}
spi_finalize_current_transfer
(
master
);
trans
->
len
-=
mdata
->
xfer_len
;
if
(
!
trans
->
len
)
{
spi_finalize_current_transfer
(
master
);
return
IRQ_HANDLED
;
}
if
(
trans
->
tx_buf
)
trans
->
tx_buf
+=
mdata
->
xfer_len
;
if
(
trans
->
rx_buf
)
trans
->
rx_buf
+=
mdata
->
xfer_len
;
mdata
->
xfer_len
=
min
(
MTK_SPI_MAX_FIFO_SIZE
,
trans
->
len
);
mtk_spi_setup_packet
(
master
);
cnt
=
trans
->
len
/
4
;
iowrite32_rep
(
mdata
->
base
+
SPI_TX_DATA_REG
,
trans
->
tx_buf
,
cnt
);
remainder
=
trans
->
len
%
4
;
if
(
remainder
>
0
)
{
reg_val
=
0
;
memcpy
(
&
reg_val
,
trans
->
tx_buf
+
(
cnt
*
4
),
remainder
);
writel
(
reg_val
,
mdata
->
base
+
SPI_TX_DATA_REG
);
}
mtk_spi_enable_transfer
(
master
);
return
IRQ_HANDLED
;
}
...
...
drivers/spi/spi.c
View file @
34904623
...
...
@@ -807,12 +807,12 @@ static int __spi_map_msg(struct spi_master *master, struct spi_message *msg)
if
(
master
->
dma_tx
)
tx_dev
=
master
->
dma_tx
->
device
->
dev
;
else
tx_dev
=
&
master
->
dev
;
tx_dev
=
master
->
dev
.
parent
;
if
(
master
->
dma_rx
)
rx_dev
=
master
->
dma_rx
->
device
->
dev
;
else
rx_dev
=
&
master
->
dev
;
rx_dev
=
master
->
dev
.
parent
;
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
if
(
!
master
->
can_dma
(
master
,
msg
->
spi
,
xfer
))
...
...
@@ -854,12 +854,12 @@ static int __spi_unmap_msg(struct spi_master *master, struct spi_message *msg)
if
(
master
->
dma_tx
)
tx_dev
=
master
->
dma_tx
->
device
->
dev
;
else
tx_dev
=
&
master
->
dev
;
tx_dev
=
master
->
dev
.
parent
;
if
(
master
->
dma_rx
)
rx_dev
=
master
->
dma_rx
->
device
->
dev
;
else
rx_dev
=
&
master
->
dev
;
rx_dev
=
master
->
dev
.
parent
;
list_for_each_entry
(
xfer
,
&
msg
->
transfers
,
transfer_list
)
{
if
(
!
master
->
can_dma
(
master
,
msg
->
spi
,
xfer
))
...
...
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