Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FMC DEL 1ns 4cha
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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
Commits
89cf5fee
Commit
89cf5fee
authored
Jul 04, 2014
by
Tomasz Wlostowski
Committed by
Federico Vaga
Feb 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: fixed SDB enumeration for gatewares containing different mezzanine cores
parent
c3f1ce3c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
12 deletions
+116
-12
Makefile
kernel/Makefile
+1
-1
fd-core.c
kernel/fd-core.c
+10
-9
fine-delay.h
kernel/fine-delay.h
+1
-0
fmc-util.c
kernel/fmc-util.c
+102
-0
onewire.c
kernel/onewire.c
+2
-2
No files found.
kernel/Makefile
View file @
89cf5fee
...
...
@@ -33,7 +33,7 @@ obj-m := fmc-fine-delay.o
fmc-fine-delay-objs
=
fd-zio.o fd-irq.o fd-core.o
fmc-fine-delay-objs
+=
onewire.o spi.o i2c.o gpio.o
fmc-fine-delay-objs
+=
acam.o calibrate.o pll.o time.o
fmc-fine-delay-objs
+=
calibration.o
fmc-fine-delay-objs
+=
calibration.o
fmc-util.o
fmc-fine-delay-objs
+=
../fmc-bus/sdb-lib/access.o
fmc-fine-delay-objs
+=
../fmc-bus/sdb-lib/glue.o
...
...
kernel/fd-core.c
View file @
89cf5fee
...
...
@@ -138,7 +138,7 @@ int fd_probe(struct fmc_device *fmc)
struct
fd_dev
*
fd
;
struct
device
*
dev
=
&
fmc
->
dev
;
char
*
fwname
;
int
i
,
index
,
ret
,
ch
;
int
i
,
index
,
ret
,
ch
,
ord
;
/* Validate the new FMC device */
index
=
fmc
->
op
->
validate
(
fmc
,
&
fd_drv
);
...
...
@@ -179,14 +179,15 @@ int fd_probe(struct fmc_device *fmc)
fmc_show_sdb_tree
(
fmc
);
/* Now use SDB to find the base addresses */
fd
->
fd_regs_base
=
fmc_find_sdb_device
(
fmc
->
sdb
,
0xce42
,
0xf19ede1a
,
NULL
);
/* ugly hack for svec testing*/
/* FIXME: this depends on 0x10000/0x20000 being the FD cores
* base addresses */
if
(
!
strcmp
(
fmc
->
carrier_name
,
"SVEC"
)
&&
fmc
->
slot_id
==
1
)
fd
->
fd_regs_base
+=
0x10000
;
ord
=
fmc
->
slot_id
;
fd
->
fd_regs_base
=
fmc_sdb_find_nth_device
(
fmc
->
sdb
,
0xce42
,
0xf19ede1a
,
&
ord
,
NULL
);
if
(
(
signed
long
)
fd
->
fd_regs_base
<
0
)
{
dev_err
(
dev
,
"Can't find the FD core. Wrong gateware?
\n
"
);
}
dev_info
(
dev
,
"fd_regs_base is %x
\n
"
,
fd
->
fd_regs_base
);
fd
->
fd_owregs_base
=
fd
->
fd_regs_base
+
0x500
;
...
...
kernel/fine-delay.h
View file @
89cf5fee
...
...
@@ -382,6 +382,7 @@ extern int fd_eeprom_write(struct fd_dev *fd, int i2c_addr, uint32_t offset,
/* Function exported by calibration.c */
int
fd_handle_eeprom_calibration
(
struct
fd_dev
*
fd
);
signed
long
fmc_sdb_find_nth_device
(
struct
sdb_array
*
tree
,
uint64_t
vid
,
uint32_t
did
,
int
*
ordinal
,
uint32_t
*
size
);
#endif
/* __KERNEL__ */
#endif
/* __FINE_DELAY_H__ */
kernel/fmc-util.c
0 → 100644
View file @
89cf5fee
/*
* Some utility functions not supported in the current version of fmc-bus.
*
* Copyright (C) 2012-2014 CERN (www.cern.ch)
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Author: Alessandro Rubini <rubini@gnudd.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2 as published by the Free Software Foundation or, at your
* option, any later version.
*/
#include <linux/fmc.h>
#include <linux/fmc-sdb.h>
#include <linux/err.h>
#include <asm/byteorder.h>
#include "fine-delay.h"
typedef
int
(
*
sdb_traverse_cb
)
(
uint32_t
address
,
uint32_t
size
,
uint64_t
vid
,
uint32_t
did
);
static
int
traverse_sdb_devices
(
struct
sdb_array
*
tree
,
sdb_traverse_cb
cb
)
{
union
sdb_record
*
r
;
struct
sdb_product
*
p
;
struct
sdb_component
*
c
;
int
i
,
n
=
tree
->
len
,
rv
;
uint64_t
last
,
first
,
vid
;
uint32_t
did
,
size
;
/* FIXME: what if the first interconnect is not at zero? */
for
(
i
=
0
;
i
<
n
;
i
++
)
{
r
=
&
tree
->
record
[
i
];
c
=
&
r
->
dev
.
sdb_component
;
p
=
&
c
->
product
;
if
(
!
IS_ERR
(
tree
->
subtree
[
i
]))
{
rv
=
traverse_sdb_devices
(
tree
->
subtree
[
i
],
cb
);
if
(
rv
>
0
)
return
1
;
}
if
(
r
->
empty
.
record_type
!=
sdb_type_device
)
continue
;
/* record is a device?*/
last
=
__be64_to_cpu
(
c
->
addr_last
);
first
=
__be64_to_cpu
(
c
->
addr_first
);
vid
=
__be64_to_cpu
(
p
->
vendor_id
);
did
=
__be32_to_cpu
(
p
->
device_id
);
size
=
(
uint32_t
)
(
last
+
1
-
first
);
if
(
cb
(
first
+
tree
->
baseaddr
,
size
,
vid
,
did
))
return
1
;
}
return
0
;
}
/* Finds the Nth SDB device that matches (vid/did) pair, where N <= *ordinal.
If N < *ordinal, the value of N is stored at *ordinal.
This magic is used to handle hybrid bistreams (with two or more different
mezzanines). */
signed
long
fmc_sdb_find_nth_device
(
struct
sdb_array
*
tree
,
uint64_t
vid
,
uint32_t
did
,
int
*
ordinal
,
uint32_t
*
size
)
{
int
n
=
-
1
;
uint32_t
current_address
;
uint32_t
current_size
;
int
callback
(
uint32_t
address
,
uint32_t
size
,
uint64_t
vid_
,
uint32_t
did_
)
{
if
(
vid_
==
vid
&&
did_
==
did
)
{
n
++
;
current_address
=
address
;
current_size
=
size
;
if
(
!
ordinal
||
n
==
*
ordinal
)
{
return
1
;
}
}
return
0
;
/* continue scanning */
}
traverse_sdb_devices
(
tree
,
callback
);
if
(
n
>=
0
)
{
if
(
size
)
*
size
=
current_size
;
if
(
ordinal
)
*
ordinal
=
n
;
return
current_address
;
}
return
-
ENODEV
;
}
\ No newline at end of file
kernel/onewire.c
View file @
89cf5fee
...
...
@@ -72,7 +72,7 @@ static int ow_reset(struct fd_dev *fd, int port)
|
CSR_CYC_MSK
|
CSR_RST_MSK
;
ow_writel
(
fd
,
data
,
R_CSR
);
while
(
ow_readl
(
fd
,
R_CSR
)
&
CSR_CYC_MSK
)
/* FIXME: timeout */
;
udelay
(
10
)
;
reg
=
ow_readl
(
fd
,
R_CSR
);
return
~
reg
&
CSR_DAT_MSK
;
}
...
...
@@ -85,7 +85,7 @@ static int slot(struct fd_dev *fd, int port, int bit)
|
CSR_CYC_MSK
|
(
bit
&
CSR_DAT_MSK
);
ow_writel
(
fd
,
data
,
R_CSR
);
while
(
ow_readl
(
fd
,
R_CSR
)
&
CSR_CYC_MSK
)
/* FIXME: timeout */
;
udelay
(
10
)
;
reg
=
ow_readl
(
fd
,
R_CSR
);
return
reg
&
CSR_DAT_MSK
;
}
...
...
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