Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC TDC 1ns 5cha - Software
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 TDC 1ns 5cha - Software
Commits
736d8971
Commit
736d8971
authored
Aug 12, 2016
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: do not use FMC io function directly
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
aeb5f99c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
26 deletions
+28
-26
fmc-tdc.h
kernel/fmc-tdc.h
+12
-10
ft-core.c
kernel/ft-core.c
+3
-3
ft-irq.c
kernel/ft-irq.c
+8
-8
ft-zio.c
kernel/ft-zio.c
+3
-3
onewire.c
kernel/onewire.c
+2
-2
No files found.
kernel/fmc-tdc.h
View file @
736d8971
...
@@ -164,28 +164,30 @@ struct fmctdc_dev {
...
@@ -164,28 +164,30 @@ struct fmctdc_dev {
uint64_t
sequence
;
/**< Board time-stamp sequence number */
uint64_t
sequence
;
/**< Board time-stamp sequence number */
};
};
static
inline
u
int32_t
ft_readl
(
struct
fmctdc_dev
*
ft
,
unsigned
long
reg
)
static
inline
u
32
ft_ioread
(
struct
fmctdc_dev
*
ft
,
unsigned
long
addr
)
{
{
return
fmc_readl
(
ft
->
fmc
,
ft
->
ft_core_base
+
reg
);
return
fmc_readl
(
ft
->
fmc
,
addr
);
}
}
static
inline
void
ft_
writel
(
struct
fmctdc_dev
*
ft
,
uint32_t
v
,
static
inline
void
ft_
iowrite
(
struct
fmctdc_dev
*
ft
,
unsigned
long
reg
)
u32
value
,
unsigned
long
addr
)
{
{
fmc_writel
(
ft
->
fmc
,
v
,
ft
->
ft_core_base
+
reg
);
fmc_writel
(
ft
->
fmc
,
v
alue
,
addr
);
}
}
static
inline
u
32
ft_ioread
(
struct
fmctdc_dev
*
ft
,
unsigned
long
addr
)
static
inline
u
int32_t
ft_readl
(
struct
fmctdc_dev
*
ft
,
unsigned
long
reg
)
{
{
return
f
mc_readl
(
ft
->
fmc
,
addr
);
return
f
t_ioread
(
ft
,
ft
->
ft_core_base
+
reg
);
}
}
static
inline
void
ft_
iowrite
(
struct
fmctdc_dev
*
ft
,
static
inline
void
ft_
writel
(
struct
fmctdc_dev
*
ft
,
uint32_t
v
,
u32
value
,
unsigned
long
addr
)
unsigned
long
reg
)
{
{
f
mc_writel
(
ft
->
fmc
,
value
,
addr
);
f
t_iowrite
(
ft
,
v
,
ft
->
ft_core_base
+
reg
);
}
}
void
ft_enable_acquisition
(
struct
fmctdc_dev
*
ft
,
int
enable
);
void
ft_enable_acquisition
(
struct
fmctdc_dev
*
ft
,
int
enable
);
int
ft_acam_init
(
struct
fmctdc_dev
*
ft
);
int
ft_acam_init
(
struct
fmctdc_dev
*
ft
);
...
...
kernel/ft-core.c
View file @
736d8971
...
@@ -58,15 +58,15 @@ static int ft_reset_core(struct fmctdc_dev *ft)
...
@@ -58,15 +58,15 @@ static int ft_reset_core(struct fmctdc_dev *ft)
dev_dbg
(
&
ft
->
fmc
->
dev
,
"Un-resetting FMCs...
\n
"
);
dev_dbg
(
&
ft
->
fmc
->
dev
,
"Un-resetting FMCs...
\n
"
);
/* Reset - reset bits are shifted by 1 */
/* Reset - reset bits are shifted by 1 */
f
mc_writel
(
ft
->
fmc
,
~
(
1
<<
(
ft
->
fmc
->
slot_id
+
shift
)),
addr
);
f
t_iowrite
(
ft
,
~
(
1
<<
(
ft
->
fmc
->
slot_id
+
shift
)),
addr
);
udelay
(
5000
);
udelay
(
5000
);
val
=
f
mc_readl
(
ft
->
fmc
,
addr
);
val
=
f
t_ioread
(
ft
,
addr
);
val
|=
(
1
<<
(
ft
->
fmc
->
slot_id
+
shift
));
val
|=
(
1
<<
(
ft
->
fmc
->
slot_id
+
shift
));
/* Un-Reset */
/* Un-Reset */
f
mc_writel
(
ft
->
fmc
,
val
,
addr
);
f
t_iowrite
(
ft
,
val
,
addr
);
return
0
;
return
0
;
}
}
...
...
kernel/ft-irq.c
View file @
736d8971
...
@@ -229,13 +229,13 @@ static int ft_timestap_get(struct zio_cset *cset, struct ft_hw_timestamp *hwts,
...
@@ -229,13 +229,13 @@ static int ft_timestap_get(struct zio_cset *cset, struct ft_hw_timestamp *hwts,
fifo_addr
+=
last
?
TDC_FIFO_LAST
:
TDC_FIFO_OUT
;
fifo_addr
+=
last
?
TDC_FIFO_LAST
:
TDC_FIFO_OUT
;
for
(
i
=
0
;
i
<
TDC_FIFO_OUT_N
;
++
i
)
{
for
(
i
=
0
;
i
<
TDC_FIFO_OUT_N
;
++
i
)
{
data
[
i
]
=
f
mc_readl
(
ft
->
fmc
,
fifo_addr
+
i
*
4
);
data
[
i
]
=
f
t_ioread
(
ft
,
fifo_addr
+
i
*
4
);
dev_vdbg
(
&
cset
->
head
.
dev
,
"FIFO read 0x%x from 0x%x
\n
"
,
dev_vdbg
(
&
cset
->
head
.
dev
,
"FIFO read 0x%x from 0x%x
\n
"
,
data
[
i
],
fifo_addr
+
i
*
4
);
data
[
i
],
fifo_addr
+
i
*
4
);
}
}
if
(
last
)
{
if
(
last
)
{
valid
=
!!
(
f
mc_readl
(
ft
->
fmc
,
fifo_addr
+
TDC_FIFO_LAST_CSR
)
&
valid
=
!!
(
f
t_ioread
(
ft
,
fifo_addr
+
TDC_FIFO_LAST_CSR
)
&
TDC_FIFO_LAST_CSR_VALID
);
TDC_FIFO_LAST_CSR_VALID
);
}
}
...
@@ -280,7 +280,7 @@ static irqreturn_t ft_irq_handler(int irq, void *dev_id)
...
@@ -280,7 +280,7 @@ static irqreturn_t ft_irq_handler(int irq, void *dev_id)
struct
zio_cset
*
cset
;
struct
zio_cset
*
cset
;
int
i
;
int
i
;
irq_stat
=
f
mc_readl
(
ft
->
fmc
,
ft
->
ft_irq_base
+
TDC_REG_EIC_ISR
);
irq_stat
=
f
t_ioread
(
ft
,
ft
->
ft_irq_base
+
TDC_REG_EIC_ISR
);
if
(
!
irq_stat
)
if
(
!
irq_stat
)
return
IRQ_NONE
;
return
IRQ_NONE
;
...
@@ -304,19 +304,19 @@ irq:
...
@@ -304,19 +304,19 @@ irq:
ft_readout_fifo_one
(
cset
);
ft_readout_fifo_one
(
cset
);
fifo_csr_addr
=
ft
->
ft_buffer_base
+
fifo_csr_addr
=
ft
->
ft_buffer_base
+
TDC_FIFO_OFFSET
*
cset
->
index
+
TDC_FIFO_CSR
;
TDC_FIFO_OFFSET
*
cset
->
index
+
TDC_FIFO_CSR
;
fifo_stat
=
f
mc_readl
(
ft
->
fmc
,
fifo_csr_addr
);
fifo_stat
=
f
t_ioread
(
ft
,
fifo_csr_addr
);
if
(
!
(
fifo_stat
&
TDC_FIFO_CSR_EMPTY
))
if
(
!
(
fifo_stat
&
TDC_FIFO_CSR_EMPTY
))
continue
;
/* Still something to read */
continue
;
/* Still something to read */
/* Ack the interrupt, nothing to read anymore */
/* Ack the interrupt, nothing to read anymore */
f
mc_writel
(
ft
->
fmc
,
1
<<
i
,
f
t_iowrite
(
ft
,
1
<<
i
,
ft
->
ft_irq_base
+
TDC_REG_EIC_ISR
);
ft
->
ft_irq_base
+
TDC_REG_EIC_ISR
);
tmp_irq_stat
&=
(
~
(
1
<<
i
));
tmp_irq_stat
&=
(
~
(
1
<<
i
));
}
}
}
while
(
tmp_irq_stat
);
}
while
(
tmp_irq_stat
);
/* Meanwhile we got another interrupt? then repeat */
/* Meanwhile we got another interrupt? then repeat */
irq_stat
=
f
mc_readl
(
ft
->
fmc
,
ft
->
ft_irq_base
+
TDC_REG_EIC_ISR
);
irq_stat
=
f
t_ioread
(
ft
,
ft
->
ft_irq_base
+
TDC_REG_EIC_ISR
);
if
(
irq_stat
)
if
(
irq_stat
)
goto
irq
;
goto
irq
;
...
@@ -336,7 +336,7 @@ int ft_irq_init(struct fmctdc_dev *ft)
...
@@ -336,7 +336,7 @@ int ft_irq_init(struct fmctdc_dev *ft)
ft_writel
(
ft
,
40
,
TDC_REG_IRQ_TIMEOUT
);
ft_writel
(
ft
,
40
,
TDC_REG_IRQ_TIMEOUT
);
/* disable timestamp readout IRQ, user will enable it manually */
/* disable timestamp readout IRQ, user will enable it manually */
f
mc_writel
(
ft
->
fmc
,
0x1F
,
ft
->
ft_irq_base
+
TDC_REG_EIC_IDR
);
f
t_iowrite
(
ft
,
0x1F
,
ft
->
ft_irq_base
+
TDC_REG_EIC_IDR
);
/* pass the core's base addr as the VIC IRQ vector. */
/* pass the core's base addr as the VIC IRQ vector. */
/* fixme: vector table points to the bridge instead of
/* fixme: vector table points to the bridge instead of
...
@@ -357,6 +357,6 @@ int ft_irq_init(struct fmctdc_dev *ft)
...
@@ -357,6 +357,6 @@ int ft_irq_init(struct fmctdc_dev *ft)
void
ft_irq_exit
(
struct
fmctdc_dev
*
ft
)
void
ft_irq_exit
(
struct
fmctdc_dev
*
ft
)
{
{
f
mc_writel
(
ft
->
fmc
,
~
0
,
ft
->
ft_irq_base
+
TDC_REG_EIC_IDR
);
f
t_iowrite
(
ft
,
~
0
,
ft
->
ft_irq_base
+
TDC_REG_EIC_IDR
);
fmc_irq_free
(
ft
->
fmc
);
fmc_irq_free
(
ft
->
fmc
);
}
}
kernel/ft-zio.c
View file @
736d8971
...
@@ -287,18 +287,18 @@ static void ft_change_flags(struct zio_obj_head *head, unsigned long mask)
...
@@ -287,18 +287,18 @@ static void ft_change_flags(struct zio_obj_head *head, unsigned long mask)
ien
=
ft_readl
(
ft
,
TDC_REG_INPUT_ENABLE
);
ien
=
ft_readl
(
ft
,
TDC_REG_INPUT_ENABLE
);
if
(
chan
->
flags
&
ZIO_STATUS
)
{
if
(
chan
->
flags
&
ZIO_STATUS
)
{
/* DISABLED */
/* DISABLED */
f
mc_writel
(
ft
->
fmc
,
1
<<
chan
->
cset
->
index
,
f
t_iowrite
(
ft
,
1
<<
chan
->
cset
->
index
,
ft
->
ft_irq_base
+
TDC_REG_EIC_IDR
);
ft
->
ft_irq_base
+
TDC_REG_EIC_IDR
);
st
->
cur_seq_id
=
0
;
st
->
cur_seq_id
=
0
;
st
->
expected_edge
=
1
;
st
->
expected_edge
=
1
;
zio_trigger_abort_disable
(
chan
->
cset
,
0
);
zio_trigger_abort_disable
(
chan
->
cset
,
0
);
/* Reset last time-stamp (seq number and valid)*/
/* Reset last time-stamp (seq number and valid)*/
//ft_
writel
(ft, TDC_FIFO_LAST_CSR_VALID | TDC_FIFO_LAST_CSR_RST_SEQ,
//ft_
iowrite
(ft, TDC_FIFO_LAST_CSR_VALID | TDC_FIFO_LAST_CSR_RST_SEQ,
// TDC_FIFO_LAST_CSR);
// TDC_FIFO_LAST_CSR);
}
else
{
}
else
{
/* ENABLED */
/* ENABLED */
f
mc_writel
(
ft
->
fmc
,
1
<<
chan
->
cset
->
index
,
f
t_iowrite
(
ft
,
1
<<
chan
->
cset
->
index
,
ft
->
ft_irq_base
+
TDC_REG_EIC_IER
);
ft
->
ft_irq_base
+
TDC_REG_EIC_IER
);
zio_arm_trigger
(
chan
->
cset
->
ti
);
zio_arm_trigger
(
chan
->
cset
->
ti
);
}
}
...
...
kernel/onewire.c
View file @
736d8971
...
@@ -56,12 +56,12 @@
...
@@ -56,12 +56,12 @@
static
void
ow_writel
(
struct
fmctdc_dev
*
ft
,
uint32_t
val
,
unsigned
long
reg
)
static
void
ow_writel
(
struct
fmctdc_dev
*
ft
,
uint32_t
val
,
unsigned
long
reg
)
{
{
f
mc_writel
(
ft
->
fmc
,
val
,
ft
->
ft_owregs_base
+
reg
);
f
t_iowrite
(
ft
,
val
,
ft
->
ft_owregs_base
+
reg
);
}
}
static
uint32_t
ow_readl
(
struct
fmctdc_dev
*
ft
,
unsigned
long
reg
)
static
uint32_t
ow_readl
(
struct
fmctdc_dev
*
ft
,
unsigned
long
reg
)
{
{
return
f
mc_readl
(
ft
->
fmc
,
ft
->
ft_owregs_base
+
reg
);
return
f
t_ioread
(
ft
,
ft
->
ft_owregs_base
+
reg
);
}
}
static
int
ow_reset
(
struct
fmctdc_dev
*
ft
,
int
port
)
static
int
ow_reset
(
struct
fmctdc_dev
*
ft
,
int
port
)
...
...
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