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
7500faf0
Commit
7500faf0
authored
Aug 24, 2012
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core rename fmc_adc to fa_dev
Signed-off-by:
Federico Vaga
<
federico.vaga@gmail.com
>
parent
02c60878
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
51 deletions
+51
-51
fa-core.c
fa-core.c
+11
-11
fa-dma.c
fa-dma.c
+3
-3
fa-zio-drv.c
fa-zio-drv.c
+3
-3
fa-zio-trg.c
fa-zio-trg.c
+6
-6
fmc-adc.h
fmc-adc.h
+12
-12
onewire.c
onewire.c
+16
-16
No files found.
fa-core.c
View file @
7500faf0
...
...
@@ -13,15 +13,15 @@
#include "spec.h"
#include "fmc-adc.h"
static
struct
fmc_driver
f
mc_adc
__drv
;
static
struct
fmc_driver
f
a_dev
__drv
;
static
char
*
fa_binaries
=
FA_GATEWARE_DEFAULT_NAME
;
module_param_named
(
file
,
fa_binaries
,
charp
,
0444
);
/* This structure lists the various subsystems */
struct
fa_modlist
{
char
*
name
;
int
(
*
init
)(
struct
f
mc_adc
*
);
void
(
*
exit
)(
struct
f
mc_adc
*
);
int
(
*
init
)(
struct
f
a_dev
*
);
void
(
*
exit
)(
struct
f
a_dev
*
);
};
#define SUBSYS(x) { #x, fa_ ## x ## _init, fa_ ## x ## _exit }
static
struct
fa_modlist
mods
[]
=
{
...
...
@@ -33,7 +33,7 @@ static struct fa_modlist mods[] = {
int
fa_probe
(
struct
fmc_device
*
fmc
)
{
struct
fa_modlist
*
m
=
NULL
;
struct
f
mc_adc
*
fa
;
struct
f
a_dev
*
fa
;
struct
spec_dev
*
spec
=
fmc
->
carrier_data
;
int
err
,
i
=
0
;
...
...
@@ -43,7 +43,7 @@ int fa_probe(struct fmc_device *fmc)
}
pr_info
(
"%s:%d
\n
"
,
__func__
,
__LINE__
);
/* Driver data */
fa
=
devm_kzalloc
(
&
fmc
->
dev
,
sizeof
(
struct
f
mc_adc
),
GFP_KERNEL
);
fa
=
devm_kzalloc
(
&
fmc
->
dev
,
sizeof
(
struct
f
a_dev
),
GFP_KERNEL
);
if
(
!
fa
)
return
-
ENOMEM
;
fmc_set_drvdata
(
fmc
,
fa
);
...
...
@@ -52,7 +52,7 @@ int fa_probe(struct fmc_device *fmc)
fa
->
base
=
spec
->
remap
[
0
];
/* We first write a new binary (and lm32) within the spec */
err
=
fmc
->
op
->
reprogram
(
fmc
,
&
f
mc_adc
__drv
,
fa_binaries
);
err
=
fmc
->
op
->
reprogram
(
fmc
,
&
f
a_dev
__drv
,
fa_binaries
);
if
(
err
)
{
dev_err
(
fmc
->
hwdev
,
"write firmware
\"
%s
\"
: error %i
\n
"
,
fa_binaries
,
err
);
...
...
@@ -80,13 +80,13 @@ out:
}
int
fa_remove
(
struct
fmc_device
*
fmc
)
{
struct
f
mc_adc
*
fa
=
fmc_get_drvdata
(
fmc
);
struct
f
a_dev
*
fa
=
fmc_get_drvdata
(
fmc
);
fa_zio_exit
(
fa
);
devm_kfree
(
&
fmc
->
dev
,
fa
);
return
0
;
}
static
struct
fmc_driver
f
mc_adc
__drv
=
{
static
struct
fmc_driver
f
a_dev
__drv
=
{
.
driver
.
name
=
KBUILD_MODNAME
,
.
probe
=
fa_probe
,
.
remove
=
fa_remove
,
...
...
@@ -98,13 +98,13 @@ static int fa_init(void)
int
ret
;
pr_debug
(
"%s
\n
"
,
__func__
);
ret
=
fmc_driver_register
(
&
f
mc_adc
__drv
);
ret
=
fmc_driver_register
(
&
f
a_dev
__drv
);
if
(
ret
)
return
ret
;
ret
=
fa_zio_register
();
if
(
ret
)
{
fmc_driver_unregister
(
&
f
mc_adc
__drv
);
fmc_driver_unregister
(
&
f
a_dev
__drv
);
return
ret
;
}
return
0
;
...
...
@@ -113,7 +113,7 @@ static int fa_init(void)
static
void
fa_exit
(
void
)
{
fa_zio_unregister
();
fmc_driver_unregister
(
&
f
mc_adc
__drv
);
fmc_driver_unregister
(
&
f
a_dev
__drv
);
}
module_init
(
fa_init
);
...
...
fa-dma.c
View file @
7500faf0
...
...
@@ -22,7 +22,7 @@
#include "fmc-adc.h"
/* Initialize each element of the scatter list */
static
void
zfad_setup_dma_scatter
(
struct
f
mc_adc
*
fa
,
struct
zio_block
*
block
)
static
void
zfad_setup_dma_scatter
(
struct
f
a_dev
*
fa
,
struct
zio_block
*
block
)
{
struct
scatterlist
*
sg
;
int
bytesleft
=
block
->
datalen
;
...
...
@@ -61,7 +61,7 @@ static void zfad_setup_dma_scatter(struct fmc_adc *fa, struct zio_block *block)
*/
int
zfad_map_dma
(
struct
zio_cset
*
cset
)
{
struct
f
mc_adc
*
fa
=
cset
->
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
cset
->
zdev
->
priv_d
;
struct
scatterlist
*
sg
;
struct
zio_block
*
block
=
cset
->
interleave
->
active_block
;
struct
dma_item
*
items
;
...
...
@@ -170,7 +170,7 @@ out:
*/
void
zfad_unmap_dma
(
struct
zio_cset
*
cset
)
{
struct
f
mc_adc
*
fa
=
cset
->
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
cset
->
zdev
->
priv_d
;
unsigned
int
size
;
dev_dbg
(
fa
->
fmc
->
hwdev
,
"unmap DMA
\n
"
);
...
...
fa-zio-drv.c
View file @
7500faf0
...
...
@@ -291,7 +291,7 @@ static int zfad_input_cset(struct zio_cset *cset)
static
int
zfad_zio_probe
(
struct
zio_device
*
zdev
)
{
struct
f
mc_adc
*
fa
=
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
zdev
->
priv_d
;
dev_dbg
(
&
zdev
->
head
.
dev
,
"%s:%d"
,
__func__
,
__LINE__
);
/* Save also the pointer to the real zio_device */
...
...
@@ -409,7 +409,7 @@ void fa_zio_unregister(void)
/* Init and exit are called for each FMC-ADC card we have */
int
fa_zio_init
(
struct
f
mc_adc
*
fa
)
int
fa_zio_init
(
struct
f
a_dev
*
fa
)
{
struct
device
*
hwdev
=
fa
->
fmc
->
hwdev
;
struct
spec_dev
*
spec
=
fa
->
fmc
->
carrier_data
;
...
...
@@ -463,7 +463,7 @@ out_trg:
return
err
;
}
void
fa_zio_exit
(
struct
f
mc_adc
*
fa
)
void
fa_zio_exit
(
struct
f
a_dev
*
fa
)
{
zio_unregister_device
(
fa
->
hwzdev
);
zio_free_device
(
fa
->
hwzdev
);
...
...
fa-zio-trg.c
View file @
7500faf0
...
...
@@ -23,7 +23,7 @@
struct
zfat_instance
{
struct
zio_ti
ti
;
struct
f
mc_adc
*
fa
;
struct
f
a_dev
*
fa
;
unsigned
int
n_acq_dev
;
/* number of acquisitions on device memory */
unsigned
int
n_err
;
/* number of errors */
...
...
@@ -173,7 +173,7 @@ static const struct zio_sysfs_operations zfat_s_op = {
static
void
zfat_start_next_dma
(
struct
zio_ti
*
ti
)
{
struct
zfat_instance
*
zfat
=
to_zfat_instance
(
ti
);
struct
f
mc_adc
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
zio_channel
*
interleave
=
ti
->
cset
->
interleave
;
struct
zfat_block
*
zfat_block
;
struct
zio_buffer_type
*
zbuf
=
ti
->
cset
->
zbuf
;
...
...
@@ -291,7 +291,7 @@ static void zfat_irq_trg_fire(struct zfat_instance *zfat)
struct
zio_ti
*
ti
=
&
zfat
->
ti
;
struct
zio_channel
*
interleave
=
ti
->
cset
->
interleave
;
struct
zio_buffer_type
*
zbuf
=
ti
->
cset
->
zbuf
;
struct
f
mc_adc
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
zio_control
*
ctrl
;
struct
zio_block
*
block
;
struct
zfat_block
*
zfat_block
;
...
...
@@ -396,7 +396,7 @@ static void zfat_irq_acq_end(struct zfat_instance *zfat)
static
irqreturn_t
zfadc_irq
(
int
irq
,
void
*
ptr
)
{
struct
fmc_device
*
fmc
=
ptr
;
struct
f
mc_adc
*
fa
=
fmc_get_drvdata
(
fmc
);
struct
f
a_dev
*
fa
=
fmc_get_drvdata
(
fmc
);
struct
zfat_instance
*
zfat
=
to_zfat_instance
(
fa
->
zdev
->
cset
->
ti
);
uint32_t
status
;
...
...
@@ -418,7 +418,7 @@ static struct zio_ti *zfat_create(struct zio_trigger_type *trig,
struct
zio_cset
*
cset
,
struct
zio_control
*
ctrl
,
fmode_t
flags
)
{
struct
f
mc_adc
*
fa
=
cset
->
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
cset
->
zdev
->
priv_d
;
struct
zfat_instance
*
zfat
;
int
err
;
...
...
@@ -447,7 +447,7 @@ static struct zio_ti *zfat_create(struct zio_trigger_type *trig,
}
static
void
zfat_destroy
(
struct
zio_ti
*
ti
)
{
struct
f
mc_adc
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
f
a_dev
*
fa
=
ti
->
cset
->
zdev
->
priv_d
;
struct
zfat_instance
*
zfat
=
to_zfat_instance
(
ti
);
/* Disable all interrupt */
...
...
fmc-adc.h
View file @
7500faf0
...
...
@@ -4,8 +4,8 @@
* Driver for the mezzanine ADC for the SPEC
*/
#ifndef _
FMC_ADC
_H_
#define _
FMC_ADC
_H_
#ifndef _
fa_dev
_H_
#define _
fa_dev
_H_
#include <linux/zio.h>
#include "spec.h"
...
...
@@ -38,7 +38,7 @@ struct dma_item {
};
/*
* f
mc_adc
: is the descriptor of the FMC ADC mezzanine
* f
a_dev
: is the descriptor of the FMC ADC mezzanine
*
* @fmc: the pointer to the fmc_device generic structure
* @spec: this driver depends on spec (FIXME no svec at the moment)
...
...
@@ -59,7 +59,7 @@ struct dma_item {
* transfer
* @base: the base address for to access device registers (BAR0)
*/
struct
f
mc_adc
{
struct
f
a_dev
{
struct
fmc_device
*
fmc
;
struct
spec_dev
*
spec
;
struct
zio_device
*
zdev
;
...
...
@@ -229,7 +229,7 @@ enum zfat_irq {
#include <linux/dma-mapping.h>
#include <linux/scatterlist.h>
static
inline
struct
f
mc_adc
*
get_zfadc
(
struct
device
*
dev
)
static
inline
struct
f
a_dev
*
get_zfadc
(
struct
device
*
dev
)
{
switch
(
to_zio_head
(
dev
)
->
zobj_type
)
{
case
ZDEV
:
...
...
@@ -251,12 +251,12 @@ static inline struct spec_dev *get_spec(struct device *dev)
return
get_zfadc
(
dev
)
->
spec
;
}
/* FIXME convert fa_{read|write}_reg to fmc_{writel|readl} when fmc is fixed */
static
inline
uint32_t
fa_read_reg
(
struct
f
mc_adc
*
fa
,
static
inline
uint32_t
fa_read_reg
(
struct
f
a_dev
*
fa
,
const
struct
zio_reg_desc
*
reg
)
{
return
readl
(
fa
->
base
+
reg
->
addr
);
}
static
inline
void
fa_write_reg
(
uint32_t
val
,
struct
f
mc_adc
*
fa
,
static
inline
void
fa_write_reg
(
uint32_t
val
,
struct
f
a_dev
*
fa
,
const
struct
zio_reg_desc
*
reg
)
{
writel
(
val
,
fa
->
base
+
reg
->
addr
);
...
...
@@ -307,15 +307,15 @@ extern const struct zio_reg_desc zfad_regs[];
/* Functions exported by fa-zio.c */
extern
int
fa_zio_register
(
void
);
extern
void
fa_zio_unregister
(
void
);
extern
int
fa_zio_init
(
struct
f
mc_adc
*
fa
);
extern
void
fa_zio_exit
(
struct
f
mc_adc
*
fa
);
extern
int
fa_zio_init
(
struct
f
a_dev
*
fa
);
extern
void
fa_zio_exit
(
struct
f
a_dev
*
fa
);
/* Functions exported by fa-spec.c */
extern
int
fa_spec_init
(
void
);
extern
void
fa_spec_exit
(
void
);
/* Functions exported by onewire.c */
extern
int
fa_onewire_init
(
struct
f
mc_adc
*
fa
);
extern
void
fa_onewire_exit
(
struct
f
mc_adc
*
fa
);
extern
int
fa_onewire_init
(
struct
f
a_dev
*
fa
);
extern
void
fa_onewire_exit
(
struct
f
a_dev
*
fa
);
#endif
/* __KERNEL__ */
#endif
/* _
FMC_ADC
_H_ */
#endif
/* _
fa_dev
_H_ */
onewire.c
View file @
7500faf0
...
...
@@ -53,17 +53,17 @@
#define FD_OW_PORT 0
/* what is this slow? */
static
void
ow_writel
(
struct
f
mc_adc
*
fa
,
uint32_t
val
,
unsigned
long
reg
)
static
void
ow_writel
(
struct
f
a_dev
*
fa
,
uint32_t
val
,
unsigned
long
reg
)
{
writel
(
val
,
fa
->
base
+
FA_OWI_MEM_OFF
+
reg
);
}
static
uint32_t
ow_readl
(
struct
f
mc_adc
*
fa
,
unsigned
long
reg
)
static
uint32_t
ow_readl
(
struct
f
a_dev
*
fa
,
unsigned
long
reg
)
{
return
readl
(
fa
->
base
+
FA_OWI_MEM_OFF
+
reg
);
}
static
int
ow_reset
(
struct
f
mc_adc
*
fa
,
int
port
)
static
int
ow_reset
(
struct
f
a_dev
*
fa
,
int
port
)
{
uint32_t
reg
,
data
;
...
...
@@ -76,7 +76,7 @@ static int ow_reset(struct fmc_adc *fa, int port)
return
~
reg
&
CSR_DAT_MSK
;
}
static
int
slot
(
struct
f
mc_adc
*
fa
,
int
port
,
int
bit
)
static
int
slot
(
struct
f
a_dev
*
fa
,
int
port
,
int
bit
)
{
uint32_t
reg
,
data
;
...
...
@@ -89,17 +89,17 @@ static int slot(struct fmc_adc *fa, int port, int bit)
return
reg
&
CSR_DAT_MSK
;
}
static
int
read_bit
(
struct
f
mc_adc
*
fa
,
int
port
)
static
int
read_bit
(
struct
f
a_dev
*
fa
,
int
port
)
{
return
slot
(
fa
,
port
,
0x1
);
}
static
int
write_bit
(
struct
f
mc_adc
*
fa
,
int
port
,
int
bit
)
static
int
write_bit
(
struct
f
a_dev
*
fa
,
int
port
,
int
bit
)
{
return
slot
(
fa
,
port
,
bit
);
}
static
int
ow_read_byte
(
struct
f
mc_adc
*
fa
,
int
port
)
static
int
ow_read_byte
(
struct
f
a_dev
*
fa
,
int
port
)
{
int
byte
=
0
,
i
;
...
...
@@ -108,7 +108,7 @@ static int ow_read_byte(struct fmc_adc *fa, int port)
return
byte
;
}
static
int
ow_write_byte
(
struct
f
mc_adc
*
fa
,
int
port
,
int
byte
)
static
int
ow_write_byte
(
struct
f
a_dev
*
fa
,
int
port
,
int
byte
)
{
int
data
=
0
;
int
i
;
...
...
@@ -120,7 +120,7 @@ static int ow_write_byte(struct fmc_adc *fa, int port, int byte)
return
0
;
/* success */
}
static
int
ow_write_block
(
struct
f
mc_adc
*
fa
,
int
port
,
uint8_t
*
block
,
int
len
)
static
int
ow_write_block
(
struct
f
a_dev
*
fa
,
int
port
,
uint8_t
*
block
,
int
len
)
{
int
i
;
...
...
@@ -129,7 +129,7 @@ static int ow_write_block(struct fmc_adc *fa, int port, uint8_t *block, int len)
return
0
;
}
static
int
ow_read_block
(
struct
f
mc_adc
*
fa
,
int
port
,
uint8_t
*
block
,
int
len
)
static
int
ow_read_block
(
struct
f
a_dev
*
fa
,
int
port
,
uint8_t
*
block
,
int
len
)
{
int
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
...
...
@@ -137,7 +137,7 @@ static int ow_read_block(struct fmc_adc *fa, int port, uint8_t *block, int len)
return
0
;
}
static
int
ds18x_read_serial
(
struct
f
mc_adc
*
fa
)
static
int
ds18x_read_serial
(
struct
f
a_dev
*
fa
)
{
if
(
!
ow_reset
(
fa
,
0
))
{
pr_err
(
"%s: Failure in resetting one-wire channel
\n
"
,
...
...
@@ -149,7 +149,7 @@ static int ds18x_read_serial(struct fmc_adc *fa)
return
ow_read_block
(
fa
,
FD_OW_PORT
,
fa
->
ds18_id
,
8
);
}
static
int
ds18x_access
(
struct
f
mc_adc
*
fa
)
static
int
ds18x_access
(
struct
f
a_dev
*
fa
)
{
if
(
!
ow_reset
(
fa
,
0
))
goto
out
;
...
...
@@ -168,7 +168,7 @@ out:
return
-
EIO
;
}
static
void
__temp_command_and_next_t
(
struct
f
mc_adc
*
fa
,
int
cfg_reg
)
static
void
__temp_command_and_next_t
(
struct
f
a_dev
*
fa
,
int
cfg_reg
)
{
int
ms
;
...
...
@@ -179,7 +179,7 @@ static void __temp_command_and_next_t(struct fmc_adc *fa, int cfg_reg)
fa
->
next_t
=
jiffies
+
msecs_to_jiffies
(
ms
);
}
int
fa_read_temp
(
struct
f
mc_adc
*
fa
,
int
verbose
)
int
fa_read_temp
(
struct
f
a_dev
*
fa
,
int
verbose
)
{
int
i
,
temp
;
unsigned
long
j
;
...
...
@@ -221,7 +221,7 @@ int fa_read_temp(struct fmc_adc *fa, int verbose)
return
temp
;
}
int
fa_onewire_init
(
struct
f
mc_adc
*
fa
)
int
fa_onewire_init
(
struct
f
a_dev
*
fa
)
{
ow_writel
(
fa
,
((
CLK_DIV_NOR
&
CDR_NOR_MSK
)
|
((
CLK_DIV_OVD
<<
CDR_OVD_OFS
)
&
CDR_OVD_MSK
)),
...
...
@@ -236,7 +236,7 @@ int fa_onewire_init(struct fmc_adc *fa)
return
0
;
}
void
fa_onewire_exit
(
struct
f
mc_adc
*
fa
)
void
fa_onewire_exit
(
struct
f
a_dev
*
fa
)
{
/* Nothing to do */
}
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