Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC ADC 100M 14b 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
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
Commits
a907ade6
Commit
a907ade6
authored
Aug 12, 2020
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drv: improve the FSM functions to wait for states
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
b09303f3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
25 deletions
+32
-25
fa-core.c
kernel/fa-core.c
+28
-0
fa-dma.c
kernel/fa-dma.c
+1
-25
fmc-adc-100m14b4cha.h
kernel/fmc-adc-100m14b4cha.h
+3
-0
No files found.
kernel/fa-core.c
View file @
a907ade6
...
...
@@ -241,6 +241,34 @@ int zfad_set_range(struct fa_dev *fa, struct zio_channel *chan,
return
0
;
}
static
enum
fa100m14b4c_fsm_state
fa_fsm_get_state
(
struct
fa_dev
*
fa
)
{
return
fa_readl
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
ZFA_STA_FSM
]);
}
static
bool
fa_fsm_is_state
(
struct
fa_dev
*
fa
,
enum
fa100m14b4c_fsm_state
state
)
{
return
fa_fsm_get_state
(
fa
)
==
state
;
}
int
fa_fsm_wait_state
(
struct
fa_dev
*
fa
,
enum
fa100m14b4c_fsm_state
state
,
unsigned
int
timeout_us
)
{
unsigned
long
timeout
;
timeout
=
jiffies
+
usecs_to_jiffies
(
timeout_us
);
while
(
!
fa_fsm_is_state
(
fa
,
state
))
{
cpu_relax
();
if
(
time_after
(
jiffies
,
timeout
))
return
-
ETIMEDOUT
;
}
return
0
;
}
/*
* zfad_fsm_command
* @fa: the fmc-adc descriptor
...
...
kernel/fa-dma.c
View file @
a907ade6
...
...
@@ -86,30 +86,6 @@ static uint32_t zfad_dev_mem_offset(struct zio_cset *cset)
return
dev_mem_off
;
}
/**
* zfad_wait_idle
* @cset: ZIO channel set
* @try: how many times poll for IDLE
* @udelay: us between two consecutive delay
*
* @return: it returns 0 on success. If the IDLE status never comes, then it returns
* the status value
*/
static
int
zfad_wait_idle
(
struct
zio_cset
*
cset
,
unsigned
int
try
,
unsigned
int
udelay
)
{
struct
fa_dev
*
fa
=
cset
->
zdev
->
priv_d
;
uint32_t
val
=
0
;
while
(
try
--
&&
val
!=
FA100M14B4C_STATE_IDLE
)
{
udelay
(
udelay
);
val
=
fa_readl
(
fa
,
fa
->
fa_adc_csr_base
,
&
zfad_regs
[
ZFA_STA_FSM
]);
}
return
val
!=
FA100M14B4C_STATE_IDLE
?
val
:
0
;
}
static
unsigned
int
zfad_block_n_pages
(
struct
zio_block
*
block
)
{
unsigned
int
nr_pages
;
...
...
@@ -416,7 +392,7 @@ static int zfad_dma_start(struct zio_cset *cset)
}
dma_dev_id
=
r
->
start
;
err
=
zfad_wait_idle
(
cset
,
5
,
1
);
err
=
fa_fsm_wait_state
(
fa
,
FA100M14B4C_STATE_IDLE
,
10
);
if
(
err
)
{
dev_warn
(
fa
->
msgdev
,
"Can't start DMA on the last acquisition, "
...
...
kernel/fmc-adc-100m14b4cha.h
View file @
a907ade6
...
...
@@ -607,6 +607,9 @@ extern void zfad_reset_offset(struct fa_dev *fa);
extern
int
zfad_convert_hw_range
(
uint32_t
bitmask
);
extern
int32_t
fa_temperature_read
(
struct
fa_dev
*
fa
);
extern
int
fa_trigger_software
(
struct
fa_dev
*
fa
);
extern
int
fa_fsm_wait_state
(
struct
fa_dev
*
fa
,
enum
fa100m14b4c_fsm_state
state
,
unsigned
int
timeout_us
);
/* Temporarily, user values are the same as hardware values */
extern
int
zfad_convert_user_range
(
uint32_t
user_val
);
...
...
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