Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha - 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 DEL 1ns 4cha - Software
Commits
0df35d87
Commit
0df35d87
authored
Oct 22, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
massive but trivial: rename spec_fd to fd_dev
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
8e38e8d4
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
126 additions
and
126 deletions
+126
-126
acam.c
kernel/acam.c
+11
-11
calibrate.c
kernel/calibrate.c
+7
-7
fd-core.c
kernel/fd-core.c
+7
-7
fd-zio.c
kernel/fd-zio.c
+16
-16
fine-delay.h
kernel/fine-delay.h
+34
-34
gpio.c
kernel/gpio.c
+10
-10
i2c.c
kernel/i2c.c
+14
-14
onewire.c
kernel/onewire.c
+16
-16
pll.c
kernel/pll.c
+4
-4
spi.c
kernel/spi.c
+3
-3
time.c
kernel/time.c
+4
-4
No files found.
kernel/acam.c
View file @
0df35d87
...
...
@@ -83,7 +83,7 @@ static int acam_calc_pll(uint64_t tref, int bin, int *hsdiv_out,
return
(
bin
+
1
)
/
3
;
/* We are in I-Mode, R-Mode bin is 1/3 if this */
}
static
void
acam_set_address
(
struct
spec_fd
*
fd
,
int
addr
)
static
void
acam_set_address
(
struct
fd_dev
*
fd
,
int
addr
)
{
if
(
addr
==
fd
->
acam_addr
)
return
;
...
...
@@ -96,33 +96,33 @@ static void acam_set_address(struct spec_fd *fd, int addr)
}
/* Warning: acam_readl and acam_writel only work if GCR.BYPASS is set */
uint32_t
acam_readl
(
struct
spec_fd
*
fd
,
int
reg
)
uint32_t
acam_readl
(
struct
fd_dev
*
fd
,
int
reg
)
{
acam_set_address
(
fd
,
reg
);
fd_writel
(
fd
,
FD_TDCSR_READ
,
FD_REG_TDCSR
);
return
fd_readl
(
fd
,
FD_REG_TDR
)
&
ACAM_MASK
;
}
void
acam_writel
(
struct
spec_fd
*
fd
,
int
val
,
int
reg
)
void
acam_writel
(
struct
fd_dev
*
fd
,
int
val
,
int
reg
)
{
acam_set_address
(
fd
,
reg
);
fd_writel
(
fd
,
val
,
FD_REG_TDR
);
fd_writel
(
fd
,
FD_TDCSR_WRITE
,
FD_REG_TDCSR
);
}
static
void
acam_set_bypass
(
struct
spec_fd
*
fd
,
int
on
)
static
void
acam_set_bypass
(
struct
fd_dev
*
fd
,
int
on
)
{
/* FIXME: this zeroes all other GCR bits */
fd_writel
(
fd
,
on
?
FD_GCR_BYPASS
:
0
,
FD_REG_GCR
);
}
static
inline
int
acam_is_pll_locked
(
struct
spec_fd
*
fd
)
static
inline
int
acam_is_pll_locked
(
struct
fd_dev
*
fd
)
{
return
!
(
acam_readl
(
fd
,
12
)
&
AR12_NotLocked
);
}
/* Two test functions to verify the bus is working -- Tom */
static
int
acam_test_addr_bit
(
struct
spec_fd
*
fd
,
int
base
,
int
bit
,
static
int
acam_test_addr_bit
(
struct
fd_dev
*
fd
,
int
base
,
int
bit
,
int
data
)
{
int
addr1
=
base
;
...
...
@@ -156,7 +156,7 @@ out:
return
-
EIO
;
}
static
int
acam_test_bus
(
struct
spec_fd
*
fd
)
static
int
acam_test_bus
(
struct
fd_dev
*
fd
)
{
int
err
=
0
,
i
,
v
;
...
...
@@ -248,7 +248,7 @@ static struct acam_mode_setup fd_acam_table[] = {
};
/* To configure the thing, follow the table, but treat 5 and 7 as special */
static
int
__acam_config
(
struct
spec_fd
*
fd
,
struct
acam_mode_setup
*
s
)
static
int
__acam_config
(
struct
fd_dev
*
fd
,
struct
acam_mode_setup
*
s
)
{
int
i
,
hsdiv
,
refdiv
,
reg7val
;
struct
acam_init_data
*
p
;
...
...
@@ -289,7 +289,7 @@ static int __acam_config(struct spec_fd *fd, struct acam_mode_setup *s)
return
0
;
}
int
fd_acam_config
(
struct
spec_fd
*
fd
,
enum
fd_acam_modes
mode
)
int
fd_acam_config
(
struct
fd_dev
*
fd
,
enum
fd_acam_modes
mode
)
{
struct
acam_mode_setup
*
s
;
int
i
;
...
...
@@ -301,7 +301,7 @@ int fd_acam_config(struct spec_fd *fd, enum fd_acam_modes mode)
return
-
EINVAL
;
}
int
fd_acam_init
(
struct
spec_fd
*
fd
)
int
fd_acam_init
(
struct
fd_dev
*
fd
)
{
int
ret
;
fd
->
acam_addr
=
-
1
;
/* First time must be activated */
...
...
@@ -343,7 +343,7 @@ int fd_acam_init(struct spec_fd *fd)
return
0
;
}
void
fd_acam_exit
(
struct
spec_fd
*
fd
)
void
fd_acam_exit
(
struct
fd_dev
*
fd
)
{
del_timer_sync
(
&
fd
->
temp_timer
);
}
kernel/calibrate.c
View file @
0df35d87
...
...
@@ -22,21 +22,21 @@
#include "hw/fd_channel_regs.h"
/* TEMP! */
static
void
acam_set_bypass
(
struct
spec_fd
*
fd
,
int
on
)
static
void
acam_set_bypass
(
struct
fd_dev
*
fd
,
int
on
)
{
/* FIXME: this zeroes all other GCR bits */
fd_writel
(
fd
,
on
?
FD_GCR_BYPASS
:
0
,
FD_REG_GCR
);
}
static
int
acam_test_delay_transfer_function
(
struct
spec_fd
*
fd
)
static
int
acam_test_delay_transfer_function
(
struct
fd_dev
*
fd
)
{
/* FIXME */
return
0
;
}
/* Evaluates 2nd order polynomial. Coefs have 32 fractional bits. */
static
int
fd_eval_polynomial
(
struct
spec_fd
*
fd
)
static
int
fd_eval_polynomial
(
struct
fd_dev
*
fd
)
{
int64_t
x
=
fd
->
temp
;
int64_t
*
coef
=
fd
->
calib
.
frr_poly
;
...
...
@@ -58,7 +58,7 @@ struct delay_stats {
};
/* Note: channel is the "internal" one: 0..3 */
static
uint64_t
output_delay_ps
(
struct
spec_fd
*
fd
,
int
ch
,
int
fine
,
int
n
,
static
uint64_t
output_delay_ps
(
struct
fd_dev
*
fd
,
int
ch
,
int
fine
,
int
n
,
struct
delay_stats
*
stats
)
{
int
i
;
...
...
@@ -145,7 +145,7 @@ static void __pr_fixed(char *head, uint64_t val, char *tail)
((
int
)(
val
&
0xffff
)
*
1000
)
>>
16
,
tail
);
}
static
int
fd_find_8ns_tap
(
struct
spec_fd
*
fd
,
int
ch
)
static
int
fd_find_8ns_tap
(
struct
fd_dev
*
fd
,
int
ch
)
{
int
l
=
0
,
mid
,
r
=
FD_NUM_TAPS
-
1
;
uint64_t
bias
,
dly
;
...
...
@@ -177,7 +177,7 @@ static int fd_find_8ns_tap(struct spec_fd *fd, int ch)
}
int
fd_calibrate_outputs
(
struct
spec_fd
*
fd
)
int
fd_calibrate_outputs
(
struct
fd_dev
*
fd
)
{
int
ret
,
ch
;
int
measured
,
fitted
,
new
;
...
...
@@ -211,7 +211,7 @@ int fd_calibrate_outputs(struct spec_fd *fd)
/* Called from a timer any few seconds */
void
fd_update_calibration
(
unsigned
long
arg
)
{
struct
spec_fd
*
fd
=
(
void
*
)
arg
;
struct
fd_dev
*
fd
=
(
void
*
)
arg
;
int
ch
,
fitted
,
new
;
fd_read_temp
(
fd
,
0
/* not verbose */
);
...
...
kernel/fd-core.c
View file @
0df35d87
...
...
@@ -58,7 +58,7 @@ static struct fd_calib fd_default_calib = {
};
/* The reset function (by Tomasz) */
static
void
fd_do_reset
(
struct
spec_fd
*
fd
,
int
hw_reset
)
static
void
fd_do_reset
(
struct
fd_dev
*
fd
,
int
hw_reset
)
{
if
(
hw_reset
)
{
fd_writel
(
fd
,
FD_RSTR_LOCK_W
(
0xdead
)
|
FD_RSTR_RST_CORE_MASK
,
...
...
@@ -80,7 +80,7 @@ static void fd_do_reset(struct spec_fd *fd, int hw_reset)
}
/* Some init procedures to be intermixed with subsystems */
int
fd_gpio_defaults
(
struct
spec_fd
*
fd
)
int
fd_gpio_defaults
(
struct
fd_dev
*
fd
)
{
fd_gpio_dir
(
fd
,
FD_GPIO_TRIG_INTERNAL
,
FD_GPIO_OUT
);
fd_gpio_set
(
fd
,
FD_GPIO_TRIG_INTERNAL
);
...
...
@@ -93,7 +93,7 @@ int fd_gpio_defaults(struct spec_fd *fd)
return
0
;
}
int
fd_reset_again
(
struct
spec_fd
*
fd
)
int
fd_reset_again
(
struct
fd_dev
*
fd
)
{
unsigned
long
j
;
...
...
@@ -118,8 +118,8 @@ int fd_reset_again(struct spec_fd *fd)
/* This structure lists the various subsystems */
struct
fd_modlist
{
char
*
name
;
int
(
*
init
)(
struct
spec_fd
*
);
void
(
*
exit
)(
struct
spec_fd
*
);
int
(
*
init
)(
struct
fd_dev
*
);
void
(
*
exit
)(
struct
fd_dev
*
);
};
...
...
@@ -141,7 +141,7 @@ static struct fd_modlist mods[] = {
int
fd_probe
(
struct
fmc_device
*
fmc
)
{
struct
fd_modlist
*
m
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
struct
spec_dev
*
spec
;
struct
device
*
dev
=
fmc
->
hwdev
;
char
*
fwname
;
...
...
@@ -261,7 +261,7 @@ out:
int
fd_remove
(
struct
fmc_device
*
fmc
)
{
struct
fd_modlist
*
m
;
struct
spec_fd
*
fd
=
fmc
->
mezzanine_data
;
struct
fd_dev
*
fd
=
fmc
->
mezzanine_data
;
int
i
=
ARRAY_SIZE
(
mods
);
if
(
!
test_bit
(
FD_FLAG_INITED
,
&
fd
->
flags
))
/* FIXME: ditch this */
...
...
kernel/fd-zio.c
View file @
0df35d87
...
...
@@ -105,7 +105,7 @@ static int fd_zio_info_tdc(struct device *dev, struct zio_attribute *zattr,
uint32_t
*
usr_val
)
{
struct
zio_cset
*
cset
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
cset
=
to_zio_cset
(
dev
);
fd
=
cset
->
zdev
->
private_data
;
...
...
@@ -130,7 +130,7 @@ static int fd_zio_info_output(struct device *dev, struct zio_attribute *zattr,
uint32_t
*
usr_val
)
{
struct
zio_cset
*
cset
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
int
ch
;
cset
=
to_zio_cset
(
dev
);
...
...
@@ -154,7 +154,7 @@ static int fd_zio_info_output(struct device *dev, struct zio_attribute *zattr,
return
0
;
}
static
int
fd_wr_mode
(
struct
spec_fd
*
fd
,
int
on
)
static
int
fd_wr_mode
(
struct
fd_dev
*
fd
,
int
on
)
{
if
(
on
)
{
fd_writel
(
fd
,
FD_TCR_WR_ENABLE
,
FD_REG_TCR
);
...
...
@@ -166,7 +166,7 @@ static int fd_wr_mode(struct spec_fd *fd, int on)
return
0
;
}
static
int
fd_wr_query
(
struct
spec_fd
*
fd
)
static
int
fd_wr_query
(
struct
fd_dev
*
fd
)
{
int
ena
=
test_bit
(
FD_FLAG_WR_MODE
,
&
fd
->
flags
);
...
...
@@ -184,7 +184,7 @@ static int fd_zio_info_get(struct device *dev, struct zio_attribute *zattr,
{
struct
fd_time
t
;
struct
zio_device
*
zdev
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
struct
zio_attribute
*
attr
;
if
(
__fd_get_type
(
dev
)
==
FD_TYPE_INPUT
)
...
...
@@ -218,7 +218,7 @@ static int fd_zio_conf_tdc(struct device *dev, struct zio_attribute *zattr,
uint32_t
usr_val
)
{
struct
zio_cset
*
cset
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
uint32_t
reg
;
int
change
;
...
...
@@ -281,7 +281,7 @@ static int fd_zio_conf_output(struct device *dev, struct zio_attribute *zattr,
uint32_t
usr_val
)
{
struct
zio_cset
*
cset
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
int
ch
;
cset
=
to_zio_cset
(
dev
);
...
...
@@ -305,7 +305,7 @@ static int fd_zio_conf_set(struct device *dev, struct zio_attribute *zattr,
{
struct
fd_time
t
;
struct
zio_device
*
zdev
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
struct
zio_attribute
*
attr
;
if
(
__fd_get_type
(
dev
)
==
FD_TYPE_INPUT
)
...
...
@@ -435,7 +435,7 @@ static inline void __fd_apply_offset(uint32_t *a, int32_t off_pico)
}
}
static
int
fd_read_fifo
(
struct
spec_fd
*
fd
,
struct
zio_channel
*
chan
)
static
int
fd_read_fifo
(
struct
fd_dev
*
fd
,
struct
zio_channel
*
chan
)
{
struct
zio_control
*
ctrl
;
uint32_t
*
v
,
reg
;
...
...
@@ -504,7 +504,7 @@ static int fd_timer_period_jiffies; /* converted from ms at init time */
static
void
fd_timer_fn
(
unsigned
long
arg
)
{
struct
spec_fd
*
fd
=
(
void
*
)
arg
;
struct
fd_dev
*
fd
=
(
void
*
)
arg
;
struct
zio_channel
*
chan
=
NULL
;
struct
zio_device
*
zdev
=
fd
->
zdev
;
int
i
;
...
...
@@ -539,7 +539,7 @@ out:
}
/* Internal output engine */
static
void
__fd_zio_output
(
struct
spec_fd
*
fd
,
int
index1_4
,
uint32_t
*
attrs
)
static
void
__fd_zio_output
(
struct
fd_dev
*
fd
,
int
index1_4
,
uint32_t
*
attrs
)
{
int
ch
=
index1_4
-
1
;
int
mode
=
attrs
[
FD_ATTR_OUT_MODE
];
...
...
@@ -609,7 +609,7 @@ static void __fd_zio_output(struct spec_fd *fd, int index1_4, uint32_t *attrs)
static
int
fd_zio_output
(
struct
zio_cset
*
cset
)
{
int
i
;
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
struct
zio_control
*
ctrl
;
fd
=
cset
->
zdev
->
private_data
;
...
...
@@ -638,7 +638,7 @@ static int fd_zio_output(struct zio_cset *cset)
*/
static
int
fd_zio_input
(
struct
zio_cset
*
cset
)
{
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
fd
=
cset
->
zdev
->
private_data
;
/* Configure the device for input */
...
...
@@ -664,7 +664,7 @@ static int fd_zio_input(struct zio_cset *cset)
*/
static
int
fd_zio_probe
(
struct
zio_device
*
zdev
)
{
struct
spec_fd
*
fd
;
struct
fd_dev
*
fd
;
/* link the new device from the fd structure */
fd
=
zdev
->
private_data
;
...
...
@@ -799,7 +799,7 @@ void fd_zio_unregister(void)
}
/* Init and exit are called for each FD card we have */
int
fd_zio_init
(
struct
spec_fd
*
fd
)
int
fd_zio_init
(
struct
fd_dev
*
fd
)
{
int
err
=
0
;
struct
spec_dev
*
spec
;
...
...
@@ -831,7 +831,7 @@ int fd_zio_init(struct spec_fd *fd)
return
0
;
}
void
fd_zio_exit
(
struct
spec_fd
*
fd
)
void
fd_zio_exit
(
struct
fd_dev
*
fd
)
{
del_timer_sync
(
&
fd
->
fifo_timer
);
zio_unregister_device
(
fd
->
hwzdev
);
...
...
kernel/fine-delay.h
View file @
0df35d87
...
...
@@ -163,7 +163,7 @@ struct fd_ch {
};
/* This is the device we use all around */
struct
spec_fd
{
struct
fd_dev
{
spinlock_t
lock
;
unsigned
long
flags
;
struct
fmc_device
*
fmc
;
...
...
@@ -217,11 +217,11 @@ static inline void fd_split_pico(uint64_t pico,
*
frac
=
(
*
frac
<<
12
)
/
8000
;
}
static
inline
uint32_t
fd_readl
(
struct
spec_fd
*
fd
,
unsigned
long
reg
)
static
inline
uint32_t
fd_readl
(
struct
fd_dev
*
fd
,
unsigned
long
reg
)
{
return
readl
(
fd
->
regs
+
reg
);
}
static
inline
void
fd_writel
(
struct
spec_fd
*
fd
,
uint32_t
v
,
unsigned
long
reg
)
static
inline
void
fd_writel
(
struct
fd_dev
*
fd
,
uint32_t
v
,
unsigned
long
reg
)
{
writel
(
v
,
fd
->
regs
+
reg
);
}
...
...
@@ -232,14 +232,14 @@ static inline void __check_chan(int x)
}
static
inline
uint32_t
fd_ch_readl
(
struct
spec_fd
*
fd
,
int
ch
,
static
inline
uint32_t
fd_ch_readl
(
struct
fd_dev
*
fd
,
int
ch
,
unsigned
long
reg
)
{
__check_chan
(
ch
);
return
fd_readl
(
fd
,
0x100
+
ch
*
0x100
+
reg
);
}
static
inline
void
fd_ch_writel
(
struct
spec_fd
*
fd
,
int
ch
,
static
inline
void
fd_ch_writel
(
struct
fd_dev
*
fd
,
int
ch
,
uint32_t
v
,
unsigned
long
reg
)
{
__check_chan
(
ch
);
...
...
@@ -299,66 +299,66 @@ static inline void __check_output(int x)
#define FD_GPIO_CAL_DISABLE 0x0080
/* 0 enables calibration */
/* Functions exported by spi.c */
extern
int
fd_spi_xfer
(
struct
spec_fd
*
fd
,
int
ss
,
int
num_bits
,
extern
int
fd_spi_xfer
(
struct
fd_dev
*
fd
,
int
ss
,
int
num_bits
,
uint32_t
in
,
uint32_t
*
out
);
extern
int
fd_spi_init
(
struct
spec_fd
*
fd
);
extern
void
fd_spi_exit
(
struct
spec_fd
*
fd
);
extern
int
fd_spi_init
(
struct
fd_dev
*
fd
);
extern
void
fd_spi_exit
(
struct
fd_dev
*
fd
);
/* Functions exported by pll.c */
extern
int
fd_pll_init
(
struct
spec_fd
*
fd
);
extern
void
fd_pll_exit
(
struct
spec_fd
*
fd
);
extern
int
fd_pll_init
(
struct
fd_dev
*
fd
);
extern
void
fd_pll_exit
(
struct
fd_dev
*
fd
);
/* Functions exported by onewire.c */
extern
int
fd_onewire_init
(
struct
spec_fd
*
fd
);
extern
void
fd_onewire_exit
(
struct
spec_fd
*
fd
);
extern
int
fd_read_temp
(
struct
spec_fd
*
fd
,
int
verbose
);
extern
int
fd_onewire_init
(
struct
fd_dev
*
fd
);
extern
void
fd_onewire_exit
(
struct
fd_dev
*
fd
);
extern
int
fd_read_temp
(
struct
fd_dev
*
fd
,
int
verbose
);
/* Functions exported by acam.c */
extern
int
fd_acam_init
(
struct
spec_fd
*
fd
);
extern
void
fd_acam_exit
(
struct
spec_fd
*
fd
);
extern
uint32_t
acam_readl
(
struct
spec_fd
*
fd
,
int
reg
);
extern
void
acam_writel
(
struct
spec_fd
*
fd
,
int
val
,
int
reg
);
extern
int
fd_acam_init
(
struct
fd_dev
*
fd
);
extern
void
fd_acam_exit
(
struct
fd_dev
*
fd
);
extern
uint32_t
acam_readl
(
struct
fd_dev
*
fd
,
int
reg
);
extern
void
acam_writel
(
struct
fd_dev
*
fd
,
int
val
,
int
reg
);
/* Functions exported by calibrate.c, called within acam.c */
extern
int
fd_calibrate_outputs
(
struct
spec_fd
*
fd
);
extern
int
fd_calibrate_outputs
(
struct
fd_dev
*
fd
);
extern
void
fd_update_calibration
(
unsigned
long
arg
);
extern
int
fd_calib_period_s
;
/* Functions exported by gpio.c */
extern
int
fd_gpio_init
(
struct
spec_fd
*
fd
);
extern
void
fd_gpio_exit
(
struct
spec_fd
*
fd
);
extern
void
fd_gpio_dir
(
struct
spec_fd
*
fd
,
int
pin
,
int
dir
);
extern
void
fd_gpio_val
(
struct
spec_fd
*
fd
,
int
pin
,
int
val
);
extern
void
fd_gpio_set_clr
(
struct
spec_fd
*
fd
,
int
pin
,
int
set
);
extern
int
fd_dump_mcp
(
struct
spec_fd
*
fd
);
extern
int
fd_gpio_init
(
struct
fd_dev
*
fd
);
extern
void
fd_gpio_exit
(
struct
fd_dev
*
fd
);
extern
void
fd_gpio_dir
(
struct
fd_dev
*
fd
,
int
pin
,
int
dir
);
extern
void
fd_gpio_val
(
struct
fd_dev
*
fd
,
int
pin
,
int
val
);
extern
void
fd_gpio_set_clr
(
struct
fd_dev
*
fd
,
int
pin
,
int
set
);
extern
int
fd_dump_mcp
(
struct
fd_dev
*
fd
);
#define fd_gpio_set(fd, pin) fd_gpio_set_clr((fd), (pin), 1)
#define fd_gpio_clr(fd, pin) fd_gpio_set_clr((fd), (pin), 0)
/* Functions exported by time.c */
extern
int
fd_time_init
(
struct
spec_fd
*
fd
);
extern
void
fd_time_exit
(
struct
spec_fd
*
fd
);
extern
int
fd_time_set
(
struct
spec_fd
*
fd
,
struct
fd_time
*
t
,
extern
int
fd_time_init
(
struct
fd_dev
*
fd
);
extern
void
fd_time_exit
(
struct
fd_dev
*
fd
);
extern
int
fd_time_set
(
struct
fd_dev
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
);
extern
int
fd_time_get
(
struct
spec_fd
*
fd
,
struct
fd_time
*
t
,
extern
int
fd_time_get
(
struct
fd_dev
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
);
/* Functions exported by fd-zio.c */
extern
int
fd_zio_register
(
void
);
extern
void
fd_zio_unregister
(
void
);
extern
int
fd_zio_init
(
struct
spec_fd
*
fd
);
extern
void
fd_zio_exit
(
struct
spec_fd
*
fd
);
extern
int
fd_zio_init
(
struct
fd_dev
*
fd
);
extern
void
fd_zio_exit
(
struct
fd_dev
*
fd
);
/* Functions exported by fd-spec.c */
extern
int
fd_spec_init
(
void
);
extern
void
fd_spec_exit
(
void
);
/* Functions exported by i2c.c */
extern
int
fd_i2c_init
(
struct
spec_fd
*
fd
);
extern
void
fd_i2c_exit
(
struct
spec_fd
*
fd
);
extern
int
fd_eerom_read
(
struct
spec_fd
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
extern
int
fd_i2c_init
(
struct
fd_dev
*
fd
);
extern
void
fd_i2c_exit
(
struct
fd_dev
*
fd
);
extern
int
fd_eerom_read
(
struct
fd_dev
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
void
*
buf
,
size_t
size
);
extern
int
fd_eeprom_write
(
struct
spec_fd
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
extern
int
fd_eeprom_write
(
struct
fd_dev
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
void
*
buf
,
size_t
size
);
...
...
kernel/gpio.c
View file @
0df35d87
...
...
@@ -16,18 +16,18 @@
#define SPI_RETRIES 100
static
int
gpio_writel
(
struct
spec_fd
*
fd
,
int
val
,
int
reg
)
static
int
gpio_writel
(
struct
fd_dev
*
fd
,
int
val
,
int
reg
)
{
int
rval
=
fd_spi_xfer
(
fd
,
FD_CS_GPIO
,
24
,
0x4e0000
|
(
reg
<<
8
)
|
val
,
NULL
);
fd_spi_xfer
(
fd
,
FD_CS_NONE
,
24
,
0
,
NULL
);
return
rval
;
}
static
int
gpio_readl
(
struct
spec_fd
*
fd
,
int
reg
)
static
int
gpio_readl
(
struct
fd_dev
*
fd
,
int
reg
)
{
uint32_t
ret
;
int
err
;
...
...
@@ -43,7 +43,7 @@ static int gpio_readl(struct spec_fd *fd, int reg)
return
ret
&
0xff
;
}
static
int
gpio_writel_with_retry
(
struct
spec_fd
*
fd
,
int
val
,
int
reg
)
static
int
gpio_writel_with_retry
(
struct
fd_dev
*
fd
,
int
val
,
int
reg
)
{
int
retries
=
SPI_RETRIES
,
rv
;
while
(
retries
--
)
...
...
@@ -61,7 +61,7 @@ static int gpio_writel_with_retry(struct spec_fd *fd, int val, int reg)
return
-
EIO
;
}
void
fd_gpio_dir
(
struct
spec_fd
*
fd
,
int
mask
,
int
dir
)
void
fd_gpio_dir
(
struct
fd_dev
*
fd
,
int
mask
,
int
dir
)
{
fd
->
mcp_iodir
&=
~
mask
;
if
(
dir
==
FD_GPIO_IN
)
...
...
@@ -71,7 +71,7 @@ void fd_gpio_dir(struct spec_fd *fd, int mask, int dir)
gpio_writel_with_retry
(
fd
,
(
fd
->
mcp_iodir
>>
8
),
FD_MCP_IODIR
+
1
);
}
void
fd_gpio_val
(
struct
spec_fd
*
fd
,
int
mask
,
int
values
)
void
fd_gpio_val
(
struct
fd_dev
*
fd
,
int
mask
,
int
values
)
{
fd
->
mcp_olat
&=
~
mask
;
...
...
@@ -81,7 +81,7 @@ void fd_gpio_val(struct spec_fd *fd, int mask, int values)
gpio_writel_with_retry
(
fd
,
(
fd
->
mcp_olat
>>
8
),
FD_MCP_OLAT
+
1
);
}
void
fd_gpio_set_clr
(
struct
spec_fd
*
fd
,
int
mask
,
int
set
)
void
fd_gpio_set_clr
(
struct
fd_dev
*
fd
,
int
mask
,
int
set
)
{
if
(
set
)
fd_gpio_val
(
fd
,
mask
,
mask
);
...
...
@@ -89,7 +89,7 @@ void fd_gpio_set_clr(struct spec_fd *fd, int mask, int set)
fd_gpio_val
(
fd
,
mask
,
0
);
}
int
fd_gpio_init
(
struct
spec_fd
*
fd
)
int
fd_gpio_init
(
struct
fd_dev
*
fd
)
{
int
i
,
val
;
...
...
@@ -120,12 +120,12 @@ out:
return
-
EIO
;
}
void
fd_gpio_exit
(
struct
spec_fd
*
fd
)
void
fd_gpio_exit
(
struct
fd_dev
*
fd
)
{
/* nothing to do */
}
int
fd_dump_mcp
(
struct
spec_fd
*
fd
)
int
fd_dump_mcp
(
struct
fd_dev
*
fd
)
{
printk
(
KERN_DEBUG
"MCP23S17 register dump
\n
"
);
printk
(
KERN_DEBUG
"IOCON: 0x%02x
\n
"
,
gpio_readl
(
fd
,
FD_MCP_IOCON
));
...
...
kernel/i2c.c
View file @
0df35d87
...
...
@@ -54,7 +54,7 @@ static void dumpstruct(char *name, void *ptr, int size)
printk
(
"
\n
"
);
}
static
void
set_sda
(
struct
spec_fd
*
fd
,
int
val
)
static
void
set_sda
(
struct
fd_dev
*
fd
,
int
val
)
{
uint32_t
reg
;
...
...
@@ -64,7 +64,7 @@ static void set_sda(struct spec_fd *fd, int val)
fd_writel
(
fd
,
reg
,
FD_REG_I2CR
);
}
static
void
set_scl
(
struct
spec_fd
*
fd
,
int
val
)
static
void
set_scl
(
struct
fd_dev
*
fd
,
int
val
)
{
uint32_t
reg
;
...
...
@@ -74,25 +74,25 @@ static void set_scl(struct spec_fd *fd, int val)
fd_writel
(
fd
,
reg
,
FD_REG_I2CR
);
}
static
int
get_sda
(
struct
spec_fd
*
fd
)
static
int
get_sda
(
struct
fd_dev
*
fd
)
{
return
fd_readl
(
fd
,
FD_REG_I2CR
)
&
FD_I2CR_SDA_IN
?
1
:
0
;
};
static
void
mi2c_start
(
struct
spec_fd
*
fd
)
static
void
mi2c_start
(
struct
fd_dev
*
fd
)
{
set_sda
(
fd
,
0
);
set_scl
(
fd
,
0
);
}
static
void
mi2c_stop
(
struct
spec_fd
*
fd
)
static
void
mi2c_stop
(
struct
fd_dev
*
fd
)
{
set_sda
(
fd
,
0
);
set_scl
(
fd
,
1
);
set_sda
(
fd
,
1
);
}
int
mi2c_put_byte
(
struct
spec_fd
*
fd
,
int
data
)
int
mi2c_put_byte
(
struct
fd_dev
*
fd
,
int
data
)
{
int
i
;
int
ack
;
...
...
@@ -114,7 +114,7 @@ int mi2c_put_byte(struct spec_fd *fd, int data)
return
ack
?
-
EIO
:
0
;
/* ack low == success */
}
int
mi2c_get_byte
(
struct
spec_fd
*
fd
,
unsigned
char
*
data
,
int
sendack
)
int
mi2c_get_byte
(
struct
fd_dev
*
fd
,
unsigned
char
*
data
,
int
sendack
)
{
int
i
;
int
indata
=
0
;
...
...
@@ -139,13 +139,13 @@ int mi2c_get_byte(struct spec_fd *fd, unsigned char *data, int sendack)
return
0
;
}
void
mi2c_init
(
struct
spec_fd
*
fd
)
void
mi2c_init
(
struct
fd_dev
*
fd
)
{
set_scl
(
fd
,
1
);
set_sda
(
fd
,
1
);
}
void
mi2c_scan
(
struct
spec_fd
*
fd
)
void
mi2c_scan
(
struct
fd_dev
*
fd
)
{
int
i
;
for
(
i
=
0
;
i
<
256
;
i
+=
2
)
{
...
...
@@ -158,7 +158,7 @@ void mi2c_scan(struct spec_fd *fd)
}
/* FIXME: this is very inefficient: read several bytes in a row instead */
int
fd_eeprom_read
(
struct
spec_fd
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
int
fd_eeprom_read
(
struct
fd_dev
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
void
*
buf
,
size_t
size
)
{
int
i
;
...
...
@@ -185,7 +185,7 @@ int fd_eeprom_read(struct spec_fd *fd, int i2c_addr, uint32_t offset,
return
size
;
}
int
fd_eeprom_write
(
struct
spec_fd
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
int
fd_eeprom_write
(
struct
fd_dev
*
fd
,
int
i2c_addr
,
uint32_t
offset
,
void
*
buf
,
size_t
size
)
{
int
i
,
busy
;
...
...
@@ -214,7 +214,7 @@ int fd_eeprom_write(struct spec_fd *fd, int i2c_addr, uint32_t offset,
}
/* The user requested to load the configuration from file */
static
void
fd_i2c_load_calib
(
struct
spec_fd
*
fd
,
static
void
fd_i2c_load_calib
(
struct
fd_dev
*
fd
,
struct
fd_calib_on_eeprom
*
cal_ee
)
{
const
struct
firmware
*
fw
;
...
...
@@ -244,7 +244,7 @@ static void fd_i2c_load_calib(struct spec_fd *fd,
}
int
fd_i2c_init
(
struct
spec_fd
*
fd
)
int
fd_i2c_init
(
struct
fd_dev
*
fd
)
{
struct
fd_calib_on_eeprom
*
cal_ee
;
u32
hash
;
...
...
@@ -322,7 +322,7 @@ load:
return
0
;
}
void
fd_i2c_exit
(
struct
spec_fd
*
fd
)
void
fd_i2c_exit
(
struct
fd_dev
*
fd
)
{
/* nothing to do */
}
...
...
kernel/onewire.c
View file @
0df35d87
...
...
@@ -54,17 +54,17 @@
#define FD_OW_PORT 0
/* what is this slow? */
static
void
ow_writel
(
struct
spec_fd
*
fd
,
uint32_t
val
,
unsigned
long
reg
)
static
void
ow_writel
(
struct
fd_dev
*
fd
,
uint32_t
val
,
unsigned
long
reg
)
{
writel
(
val
,
fd
->
ow_regs
+
reg
);
}
static
uint32_t
ow_readl
(
struct
spec_fd
*
fd
,
unsigned
long
reg
)
static
uint32_t
ow_readl
(
struct
fd_dev
*
fd
,
unsigned
long
reg
)
{
return
readl
(
fd
->
ow_regs
+
reg
);
}
static
int
ow_reset
(
struct
spec_fd
*
fd
,
int
port
)
static
int
ow_reset
(
struct
fd_dev
*
fd
,
int
port
)
{
uint32_t
reg
,
data
;
...
...
@@ -77,7 +77,7 @@ static int ow_reset(struct spec_fd *fd, int port)
return
~
reg
&
CSR_DAT_MSK
;
}
static
int
slot
(
struct
spec_fd
*
fd
,
int
port
,
int
bit
)
static
int
slot
(
struct
fd_dev
*
fd
,
int
port
,
int
bit
)
{
uint32_t
reg
,
data
;
...
...
@@ -90,17 +90,17 @@ static int slot(struct spec_fd *fd, int port, int bit)
return
reg
&
CSR_DAT_MSK
;
}
static
int
read_bit
(
struct
spec_fd
*
fd
,
int
port
)
static
int
read_bit
(
struct
fd_dev
*
fd
,
int
port
)
{
return
slot
(
fd
,
port
,
0x1
);
}
static
int
write_bit
(
struct
spec_fd
*
fd
,
int
port
,
int
bit
)
static
int
write_bit
(
struct
fd_dev
*
fd
,
int
port
,
int
bit
)
{
return
slot
(
fd
,
port
,
bit
);
}
static
int
ow_read_byte
(
struct
spec_fd
*
fd
,
int
port
)
static
int
ow_read_byte
(
struct
fd_dev
*
fd
,
int
port
)
{
int
byte
=
0
,
i
;
...
...
@@ -109,7 +109,7 @@ static int ow_read_byte(struct spec_fd *fd, int port)
return
byte
;
}
static
int
ow_write_byte
(
struct
spec_fd
*
fd
,
int
port
,
int
byte
)
static
int
ow_write_byte
(
struct
fd_dev
*
fd
,
int
port
,
int
byte
)
{
int
data
=
0
;
int
i
;
...
...
@@ -121,7 +121,7 @@ static int ow_write_byte(struct spec_fd *fd, int port, int byte)
return
0
;
/* success */
}
static
int
ow_write_block
(
struct
spec_fd
*
fd
,
int
port
,
uint8_t
*
block
,
int
len
)
static
int
ow_write_block
(
struct
fd_dev
*
fd
,
int
port
,
uint8_t
*
block
,
int
len
)
{
int
i
;
...
...
@@ -130,7 +130,7 @@ static int ow_write_block(struct spec_fd *fd, int port, uint8_t *block, int len)
return
0
;
}
static
int
ow_read_block
(
struct
spec_fd
*
fd
,
int
port
,
uint8_t
*
block
,
int
len
)
static
int
ow_read_block
(
struct
fd_dev
*
fd
,
int
port
,
uint8_t
*
block
,
int
len
)
{
int
i
;
for
(
i
=
0
;
i
<
len
;
i
++
)
...
...
@@ -138,7 +138,7 @@ static int ow_read_block(struct spec_fd *fd, int port, uint8_t *block, int len)
return
0
;
}
static
int
ds18x_read_serial
(
struct
spec_fd
*
fd
)
static
int
ds18x_read_serial
(
struct
fd_dev
*
fd
)
{
if
(
!
ow_reset
(
fd
,
0
))
{
pr_err
(
"%s: Failure in resetting one-wire channel
\n
"
,
...
...
@@ -150,7 +150,7 @@ static int ds18x_read_serial(struct spec_fd *fd)
return
ow_read_block
(
fd
,
FD_OW_PORT
,
fd
->
ds18_id
,
8
);
}
static
int
ds18x_access
(
struct
spec_fd
*
fd
)
static
int
ds18x_access
(
struct
fd_dev
*
fd
)
{
if
(
!
ow_reset
(
fd
,
0
))
goto
out
;
...
...
@@ -169,7 +169,7 @@ out:
return
-
EIO
;
}
static
void
__temp_command_and_next_t
(
struct
spec_fd
*
fd
,
int
cfg_reg
)
static
void
__temp_command_and_next_t
(
struct
fd_dev
*
fd
,
int
cfg_reg
)
{
int
ms
;
...
...
@@ -180,7 +180,7 @@ static void __temp_command_and_next_t(struct spec_fd *fd, int cfg_reg)
fd
->
next_t
=
jiffies
+
msecs_to_jiffies
(
ms
);
}
int
fd_read_temp
(
struct
spec_fd
*
fd
,
int
verbose
)
int
fd_read_temp
(
struct
fd_dev
*
fd
,
int
verbose
)
{
int
i
,
temp
;
unsigned
long
j
;
...
...
@@ -222,7 +222,7 @@ int fd_read_temp(struct spec_fd *fd, int verbose)
return
temp
;
}
int
fd_onewire_init
(
struct
spec_fd
*
fd
)
int
fd_onewire_init
(
struct
fd_dev
*
fd
)
{
int
i
;
...
...
@@ -244,7 +244,7 @@ int fd_onewire_init(struct spec_fd *fd)
return
0
;
}
void
fd_onewire_exit
(
struct
spec_fd
*
fd
)
void
fd_onewire_exit
(
struct
fd_dev
*
fd
)
{
/* Nothing to do */
}
kernel/pll.c
View file @
0df35d87
...
...
@@ -18,12 +18,12 @@
#include "fine-delay.h"
#include "hw/pll_config.h"
/* the table to be written */
static
int
pll_writel
(
struct
spec_fd
*
fd
,
int
val
,
int
reg
)
static
int
pll_writel
(
struct
fd_dev
*
fd
,
int
val
,
int
reg
)
{
return
fd_spi_xfer
(
fd
,
FD_CS_PLL
,
24
,
(
reg
<<
8
)
|
val
,
NULL
);
}
static
int
pll_readl
(
struct
spec_fd
*
fd
,
int
reg
)
static
int
pll_readl
(
struct
fd_dev
*
fd
,
int
reg
)
{
uint32_t
ret
;
int
err
;
...
...
@@ -34,7 +34,7 @@ static int pll_readl(struct spec_fd *fd, int reg)
return
ret
&
0xff
;
}
int
fd_pll_init
(
struct
spec_fd
*
fd
)
int
fd_pll_init
(
struct
fd_dev
*
fd
)
{
int
i
;
unsigned
long
j
;
...
...
@@ -99,7 +99,7 @@ out:
return
-
EIO
;
}
void
fd_pll_exit
(
struct
spec_fd
*
fd
)
void
fd_pll_exit
(
struct
fd_dev
*
fd
)
{
/* nothing to do */
}
...
...
kernel/spi.c
View file @
0df35d87
...
...
@@ -17,7 +17,7 @@
#include "fine-delay.h"
#include "hw/fd_main_regs.h"
int
fd_spi_xfer
(
struct
spec_fd
*
fd
,
int
ss
,
int
num_bits
,
int
fd_spi_xfer
(
struct
fd_dev
*
fd
,
int
ss
,
int
num_bits
,
uint32_t
in
,
uint32_t
*
out
)
{
uint32_t
scr
=
0
,
r
;
...
...
@@ -44,13 +44,13 @@ int fd_spi_xfer(struct spec_fd *fd, int ss, int num_bits,
}
int
fd_spi_init
(
struct
spec_fd
*
fd
)
int
fd_spi_init
(
struct
fd_dev
*
fd
)
{
/* nothing to do */
return
0
;
}
void
fd_spi_exit
(
struct
spec_fd
*
fd
)
void
fd_spi_exit
(
struct
fd_dev
*
fd
)
{
/* nothing to do */
}
...
...
kernel/time.c
View file @
0df35d87
...
...
@@ -18,7 +18,7 @@
#include "hw/fd_main_regs.h"
/* If fd_time is not null, use it. if ts is not null, use it, else current */
int
fd_time_set
(
struct
spec_fd
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
)
int
fd_time_set
(
struct
fd_dev
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
)
{
uint32_t
tcr
,
gcr
;
unsigned
long
flags
;
...
...
@@ -52,7 +52,7 @@ int fd_time_set(struct spec_fd *fd, struct fd_time *t, struct timespec *ts)
}
/* If fd_time is not null, use it. Otherwise use ts */
int
fd_time_get
(
struct
spec_fd
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
)
int
fd_time_get
(
struct
fd_dev
*
fd
,
struct
fd_time
*
t
,
struct
timespec
*
ts
)
{
uint32_t
tcr
,
h
,
l
,
c
;
unsigned
long
flags
;
...
...
@@ -76,7 +76,7 @@ int fd_time_get(struct spec_fd *fd, struct fd_time *t, struct timespec *ts)
return
0
;
}
int
fd_time_init
(
struct
spec_fd
*
fd
)
int
fd_time_init
(
struct
fd_dev
*
fd
)
{
struct
timespec
ts
=
{
0
,
0
};
...
...
@@ -84,7 +84,7 @@ int fd_time_init(struct spec_fd *fd)
return
fd_time_set
(
fd
,
NULL
,
&
ts
);
}
void
fd_time_exit
(
struct
spec_fd
*
fd
)
void
fd_time_exit
(
struct
fd_dev
*
fd
)
{
/* 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