Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Linux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
E-EXK4 - Operating System Group
projects
Linux
Commits
0faa3146
Commit
0faa3146
authored
11 years ago
by
Mark Brown
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'spi/fix/atmel' into spi-linus
parents
f722406f
f557c98b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
drivers/spi/spi-atmel.c
+38
-9
38 additions, 9 deletions
drivers/spi/spi-atmel.c
with
38 additions
and
9 deletions
drivers/spi/spi-atmel.c
+
38
−
9
View file @
0faa3146
...
@@ -526,13 +526,17 @@ static void atmel_spi_next_xfer_pio(struct spi_master *master,
...
@@ -526,13 +526,17 @@ static void atmel_spi_next_xfer_pio(struct spi_master *master,
}
}
if
(
xfer
->
tx_buf
)
if
(
xfer
->
tx_buf
)
spi_writel
(
as
,
TDR
,
*
(
u8
*
)(
xfer
->
tx_buf
));
if
(
xfer
->
bits_per_word
>
8
)
spi_writel
(
as
,
TDR
,
*
(
u16
*
)(
xfer
->
tx_buf
));
else
spi_writel
(
as
,
TDR
,
*
(
u8
*
)(
xfer
->
tx_buf
));
else
else
spi_writel
(
as
,
TDR
,
0
);
spi_writel
(
as
,
TDR
,
0
);
dev_dbg
(
master
->
dev
.
parent
,
dev_dbg
(
master
->
dev
.
parent
,
" start pio xfer %p: len %u tx %p rx %p
\n
"
,
" start pio xfer %p: len %u tx %p rx %p bitpw %d
\n
"
,
xfer
,
xfer
->
len
,
xfer
->
tx_buf
,
xfer
->
rx_buf
);
xfer
,
xfer
->
len
,
xfer
->
tx_buf
,
xfer
->
rx_buf
,
xfer
->
bits_per_word
);
/* Enable relevant interrupts */
/* Enable relevant interrupts */
spi_writel
(
as
,
IER
,
SPI_BIT
(
RDRF
)
|
SPI_BIT
(
OVRES
));
spi_writel
(
as
,
IER
,
SPI_BIT
(
RDRF
)
|
SPI_BIT
(
OVRES
));
...
@@ -950,21 +954,39 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer)
...
@@ -950,21 +954,39 @@ atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer)
{
{
u8
*
txp
;
u8
*
txp
;
u8
*
rxp
;
u8
*
rxp
;
u16
*
txp16
;
u16
*
rxp16
;
unsigned
long
xfer_pos
=
xfer
->
len
-
as
->
current_remaining_bytes
;
unsigned
long
xfer_pos
=
xfer
->
len
-
as
->
current_remaining_bytes
;
if
(
xfer
->
rx_buf
)
{
if
(
xfer
->
rx_buf
)
{
rxp
=
((
u8
*
)
xfer
->
rx_buf
)
+
xfer_pos
;
if
(
xfer
->
bits_per_word
>
8
)
{
*
rxp
=
spi_readl
(
as
,
RDR
);
rxp16
=
(
u16
*
)(((
u8
*
)
xfer
->
rx_buf
)
+
xfer_pos
);
*
rxp16
=
spi_readl
(
as
,
RDR
);
}
else
{
rxp
=
((
u8
*
)
xfer
->
rx_buf
)
+
xfer_pos
;
*
rxp
=
spi_readl
(
as
,
RDR
);
}
}
else
{
}
else
{
spi_readl
(
as
,
RDR
);
spi_readl
(
as
,
RDR
);
}
}
if
(
xfer
->
bits_per_word
>
8
)
{
as
->
current_remaining_bytes
--
;
as
->
current_remaining_bytes
-=
2
;
if
(
as
->
current_remaining_bytes
<
0
)
as
->
current_remaining_bytes
=
0
;
}
else
{
as
->
current_remaining_bytes
--
;
}
if
(
as
->
current_remaining_bytes
)
{
if
(
as
->
current_remaining_bytes
)
{
if
(
xfer
->
tx_buf
)
{
if
(
xfer
->
tx_buf
)
{
txp
=
((
u8
*
)
xfer
->
tx_buf
)
+
xfer_pos
+
1
;
if
(
xfer
->
bits_per_word
>
8
)
{
spi_writel
(
as
,
TDR
,
*
txp
);
txp16
=
(
u16
*
)(((
u8
*
)
xfer
->
tx_buf
)
+
xfer_pos
+
2
);
spi_writel
(
as
,
TDR
,
*
txp16
);
}
else
{
txp
=
((
u8
*
)
xfer
->
tx_buf
)
+
xfer_pos
+
1
;
spi_writel
(
as
,
TDR
,
*
txp
);
}
}
else
{
}
else
{
spi_writel
(
as
,
TDR
,
0
);
spi_writel
(
as
,
TDR
,
0
);
}
}
...
@@ -1378,6 +1400,13 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
...
@@ -1378,6 +1400,13 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg)
}
}
}
}
if
(
xfer
->
bits_per_word
>
8
)
{
if
(
xfer
->
len
%
2
)
{
dev_dbg
(
&
spi
->
dev
,
"buffer len should be 16 bits aligned
\n
"
);
return
-
EINVAL
;
}
}
/* FIXME implement these protocol options!! */
/* FIXME implement these protocol options!! */
if
(
xfer
->
speed_hz
)
{
if
(
xfer
->
speed_hz
)
{
dev_dbg
(
&
spi
->
dev
,
"no protocol options yet
\n
"
);
dev_dbg
(
&
spi
->
dev
,
"no protocol options yet
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment