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
Kirill Smelkov
linux
Commits
f30f072a
Commit
f30f072a
authored
Jan 11, 2016
by
Mark Brown
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'spi/fix/mtk' into spi-linus
parents
16830985
de327e49
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
10 deletions
+18
-10
drivers/spi/spi-mt65xx.c
drivers/spi/spi-mt65xx.c
+18
-10
No files found.
drivers/spi/spi-mt65xx.c
View file @
f30f072a
...
...
@@ -323,7 +323,8 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
struct
spi_device
*
spi
,
struct
spi_transfer
*
xfer
)
{
int
cnt
;
int
cnt
,
remainder
;
u32
reg_val
;
struct
mtk_spi
*
mdata
=
spi_master_get_devdata
(
master
);
mdata
->
cur_transfer
=
xfer
;
...
...
@@ -331,12 +332,16 @@ static int mtk_spi_fifo_transfer(struct spi_master *master,
mtk_spi_prepare_transfer
(
master
,
xfer
);
mtk_spi_setup_packet
(
master
);
if
(
xfer
->
len
%
4
)
cnt
=
xfer
->
len
/
4
+
1
;
else
cnt
=
xfer
->
len
/
4
;
cnt
=
xfer
->
len
/
4
;
iowrite32_rep
(
mdata
->
base
+
SPI_TX_DATA_REG
,
xfer
->
tx_buf
,
cnt
);
remainder
=
xfer
->
len
%
4
;
if
(
remainder
>
0
)
{
reg_val
=
0
;
memcpy
(
&
reg_val
,
xfer
->
tx_buf
+
(
cnt
*
4
),
remainder
);
writel
(
reg_val
,
mdata
->
base
+
SPI_TX_DATA_REG
);
}
mtk_spi_enable_transfer
(
master
);
return
1
;
...
...
@@ -418,7 +423,7 @@ static int mtk_spi_setup(struct spi_device *spi)
static
irqreturn_t
mtk_spi_interrupt
(
int
irq
,
void
*
dev_id
)
{
u32
cmd
,
reg_val
,
cnt
;
u32
cmd
,
reg_val
,
cnt
,
remainder
;
struct
spi_master
*
master
=
dev_id
;
struct
mtk_spi
*
mdata
=
spi_master_get_devdata
(
master
);
struct
spi_transfer
*
trans
=
mdata
->
cur_transfer
;
...
...
@@ -431,12 +436,15 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id)
if
(
!
master
->
can_dma
(
master
,
master
->
cur_msg
->
spi
,
trans
))
{
if
(
trans
->
rx_buf
)
{
if
(
mdata
->
xfer_len
%
4
)
cnt
=
mdata
->
xfer_len
/
4
+
1
;
else
cnt
=
mdata
->
xfer_len
/
4
;
cnt
=
mdata
->
xfer_len
/
4
;
ioread32_rep
(
mdata
->
base
+
SPI_RX_DATA_REG
,
trans
->
rx_buf
,
cnt
);
remainder
=
mdata
->
xfer_len
%
4
;
if
(
remainder
>
0
)
{
reg_val
=
readl
(
mdata
->
base
+
SPI_RX_DATA_REG
);
memcpy
(
trans
->
rx_buf
+
(
cnt
*
4
),
&
reg_val
,
remainder
);
}
}
spi_finalize_current_transfer
(
master
);
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