Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
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
FMC ADC 100M 14b 4cha - Software
Commits
fe0855bf
Commit
fe0855bf
authored
Sep 07, 2012
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spi.c: use fmc_{readl|writel} to access registers
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
6c38bc68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
spi.c
spi.c
+7
-7
No files found.
spi.c
View file @
fe0855bf
...
...
@@ -42,19 +42,19 @@ int fa_spi_xfer(struct fa_dev *fa, int cs, int num_bits,
pr_info
(
"%s:%d out %d
\n
"
,
__func__
,
__LINE__
,
tx
);
/* Put out value in the T0 register*/
writel
((
tx
&
(
num_bits
-
1
)),
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_TX
(
0
));
fmc_writel
(
fa
->
fmc
,
(
tx
&
(
num_bits
-
1
)),
FA_SPI_MEM_OFF
+
FA_SPI_TX
(
0
));
/* Configure SPI controller */
ctrl
|=
FA_SPI_CTRL_ASS
|
/* Automatic handle ChipSelect*/
num_bits
;
/* Transfer num_bits bits */
writel
(
ctrl
,
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_CTRL
);
fmc_writel
(
fa
->
fmc
,
ctrl
,
FA_SPI_MEM_OFF
+
FA_SPI_CTRL
);
/* Set Chip Select */
writel
((
1
<<
cs
),
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_CTRL_ASS
);
fmc_writel
(
fa
->
fmc
,
(
1
<<
cs
),
FA_SPI_MEM_OFF
+
FA_SPI_CTRL_ASS
);
/* Start transfer */
ctrl
|=
FA_SPI_CTRL_BUSY
;
writel
(
ctrl
,
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_CTRL
);
fmc_writel
(
fa
->
fmc
,
ctrl
,
FA_SPI_MEM_OFF
+
FA_SPI_CTRL
);
/* Wait transfer complete */
pr_info
(
"%s:%d
\n
"
,
__func__
,
__LINE__
);
while
(
readl
(
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_CTRL
)
&
FA_SPI_CTRL_BUSY
)
{
while
(
fmc_readl
(
fa
->
fmc
,
FA_SPI_MEM_OFF
+
FA_SPI_CTRL
)
&
FA_SPI_CTRL_BUSY
)
{
pr_info
(
"%s:%d
\n
"
,
__func__
,
__LINE__
);
if
(
jiffies
>
j
)
{
err
=
-
EIO
;
...
...
@@ -63,11 +63,11 @@ int fa_spi_xfer(struct fa_dev *fa, int cs, int num_bits,
}
pr_info
(
"%s:%d
\n
"
,
__func__
,
__LINE__
);
/* Transfer compleate, read data */
*
rx
=
readl
(
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_RX
(
0
))
&
(
num_bits
-
1
);
*
rx
=
fmc_readl
(
fa
->
fmc
,
FA_SPI_MEM_OFF
+
FA_SPI_RX
(
0
))
&
(
num_bits
-
1
);
out:
pr_info
(
"%s:%d in %d
\n
"
,
__func__
,
__LINE__
,
*
rx
);
/* Clear Chip Select */
writel
(
0
,
fa
->
base
+
FA_SPI_MEM_OFF
+
FA_SPI_CTRL_ASS
);
fmc_writel
(
fa
->
fmc
,
0
,
FA_SPI_MEM_OFF
+
FA_SPI_CTRL_ASS
);
return
err
;
}
...
...
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