Skip to content

Commit 022c674

Browse files
rubinigregkh
authored andcommitted
FMC: add documentation for the core
This is selected sections of the current manual for fmc-bus, as developed outside of the kernel before submission. Like the other patches in this set, it corresponds to commit ab23167f of the repository at ohwr.org Signed-off-by: Alessandro Rubini <rubini@gnudd.com> Acked-by: Juan David Gonzalez Cobas <dcobas@cern.ch> Acked-by: Emilio G. Cota <cota@braap.org> Acked-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Acked-by: Rob Landley <rob@landley.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 77864f2 commit 022c674

8 files changed

Lines changed: 821 additions & 0 deletions

File tree

‎Documentation/00-INDEX‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ firmware_class/
187187
- request_firmware() hotplug interface info.
188188
flexible-arrays.txt
189189
- how to make use of flexible sized arrays in linux
190+
fmc/
191+
- information about the FMC bus abstraction
190192
frv/
191193
- Fujitsu FR-V Linux documentation.
192194
futex-requeue-pi.txt

‎Documentation/fmc/00-INDEX‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Documentation in this directory comes from sections of the manual we
3+
wrote for the externally-developed fmc-bus package. The complete
4+
manual as of today (2013-02) is available in PDF format at
5+
http://www.ohwr.org/projects/fmc-bus/files
6+
7+
00-INDEX
8+
- this file.
9+
10+
FMC-and-SDB.txt
11+
- What are FMC and SDB, basic concepts for this framework
12+
13+
API.txt
14+
- The functions that are exported by the bus driver
15+
16+
parameters.txt
17+
- The module parameters
18+
19+
carrier.txt
20+
- writing a carrier (a device)
21+
22+
mezzanine.txt
23+
- writing code for your mezzanine (a driver)
24+
25+
identifiers.txt
26+
- how identification and matching works

‎Documentation/fmc/API.txt‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Functions Exported by fmc.ko
2+
****************************
3+
4+
The FMC core exports the usual 4 functions that are needed for a bus to
5+
work, and a few more:
6+
7+
int fmc_driver_register(struct fmc_driver *drv);
8+
void fmc_driver_unregister(struct fmc_driver *drv);
9+
int fmc_device_register(struct fmc_device *fmc);
10+
void fmc_device_unregister(struct fmc_device *fmc);
11+
12+
int fmc_device_register_n(struct fmc_device **fmc, int n);
13+
void fmc_device_unregister_n(struct fmc_device **fmc, int n);
14+
15+
uint32_t fmc_readl(struct fmc_device *fmc, int offset);
16+
void fmc_writel(struct fmc_device *fmc, uint32_t val, int off);
17+
void *fmc_get_drvdata(struct fmc_device *fmc);
18+
void fmc_set_drvdata(struct fmc_device *fmc, void *data);
19+
20+
int fmc_reprogram(struct fmc_device *f, struct fmc_driver *d, char *gw,
21+
int sdb_entry);
22+
23+
The data structure that describe a device is detailed in *note FMC
24+
Device::, the one that describes a driver is detailed in *note FMC
25+
Driver::. Please note that structures of type fmc_device must be
26+
allocated by the caller, but must not be released after unregistering.
27+
The fmc-bus itself takes care of releasing the structure when their use
28+
count reaches zero - actually, the device model does that in lieu of us.
29+
30+
The functions to register and unregister n devices are meant to be used
31+
by carriers that host more than one mezzanine. The devices must all be
32+
registered at the same time because if the FPGA is reprogrammed, all
33+
devices in the array are affected. Usually, the driver matching the
34+
first device will reprogram the FPGA, so other devices must know they
35+
are already driven by a reprogrammed FPGA.
36+
37+
If a carrier hosts slots that are driven by different FPGA devices, it
38+
should register as a group only mezzanines that are driven by the same
39+
FPGA, for the reason outlined above.
40+
41+
Finally, the fmc_reprogram function calls the reprogram method (see
42+
*note The API Offered by Carriers:: and also scans the memory area for
43+
an SDB tree. You can pass -1 as sdb_entry to disable such scan.
44+
Otherwise, the function fails if no tree is found at the specified
45+
entry point. The function is meant to factorize common code, and by
46+
the time you read this it is already used by the spec-sw and fine-delay
47+
modules.

‎Documentation/fmc/FMC-and-SDB.txt‎

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
2+
FMC (FPGA Mezzanine Card) is the standard we use for our I/O devices,
3+
in the context of White Rabbit and related hardware.
4+
5+
In our I/O environments we need to write drivers for each mezzanine
6+
card, and such drivers must work regardless of the carrier being used.
7+
To achieve this, we abstract the FMC interface.
8+
9+
We have a carrier for PCI-E called SPEC and one for VME called SVEC,
10+
but more are planned. Also, we support stand-alone devices (usually
11+
plugged on a SPEC card), controlled through Etherbone, developed by GSI.
12+
13+
Code and documentation for the FMC bus was born as part of the spec-sw
14+
project, but now it lives in its own project. Other projects, i.e.
15+
software support for the various carriers, should include this as a
16+
submodule.
17+
18+
The most up to date version of code and documentation is always
19+
available from the repository you can clone from:
20+
21+
git://ohwr.org/fmc-projects/fmc-bus.git (read-only)
22+
git@ohwr.org:fmc-projects/fmc-bus.git (read-write for developers)
23+
24+
Selected versions of the documentation, as well as complete tar
25+
archives for selected revisions are placed to the Files section of the
26+
project: `http://www.ohwr.org/projects/fmc-bus/files'
27+
28+
29+
What is FMC
30+
***********
31+
32+
FMC, as said, stands for "FPGA Mezzanine Card". It is a standard
33+
developed by the VME consortium called VITA (VMEbus International Trade
34+
Association and ratified by ANSI, the American National Standard
35+
Institute. The official documentation is called "ANSI-VITA 57.1".
36+
37+
The FMC card is an almost square PCB, around 70x75 millimeters, that is
38+
called mezzanine in this document. It usually lives plugged into
39+
another PCB for power supply and control; such bigger circuit board is
40+
called carrier from now on, and a single carrier may host more than one
41+
mezzanine.
42+
43+
In the typical application the mezzanine is mostly analog while the
44+
carrier is mostly digital, and hosts an FPGA that must be configured to
45+
match the specific mezzanine and the desired application. Thus, you may
46+
need to load different FPGA images to drive different instances of the
47+
same mezzanine.
48+
49+
FMC, as such, is not a bus in the usual meaning of the term, because
50+
most carriers have only one connector, and carriers with several
51+
connectors have completely separate electrical connections to them.
52+
This package, however, implements a bus as a software abstraction.
53+
54+
55+
What is SDB
56+
***********
57+
58+
SDB (Self Describing Bus) is a set of data structures that we use for
59+
enumerating the internal structure of an FPGA image. We also use it as
60+
a filesystem inside the FMC EEPROM.
61+
62+
SDB is not mandatory for use of this FMC kernel bus, but if you have SDB
63+
this package can make good use of it. SDB itself is developed in the
64+
fpga-config-space OHWR project. The link to the repository is
65+
`git://ohwr.org/hdl-core-lib/fpga-config-space.git' and what is used in
66+
this project lives in the sdbfs subdirectory in there.
67+
68+
SDB support for FMC is described in *note FMC Identification:: and
69+
*note SDB Support::
70+
71+
72+
SDB Support
73+
***********
74+
75+
The fmc.ko bus driver exports a few functions to help drivers taking
76+
advantage of the SDB information that may be present in your own FPGA
77+
memory image.
78+
79+
The module exports the following functions, in the special header
80+
<linux/fmc-sdb.h>. The linux/ prefix in the name is there because we
81+
plan to submit it upstream in the future, and don't want to force
82+
changes on our drivers if that happens.
83+
84+
int fmc_scan_sdb_tree(struct fmc_device *fmc, unsigned long address);
85+
void fmc_show_sdb_tree(struct fmc_device *fmc);
86+
signed long fmc_find_sdb_device(struct sdb_array *tree, uint64_t vendor,
87+
uint32_t device, unsigned long *sz);
88+
int fmc_free_sdb_tree(struct fmc_device *fmc);

0 commit comments

Comments
 (0)