aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/fmc/API.txt
diff options
context:
space:
mode:
authorAlessandro Rubini <rubini@gnudd.com>2013-06-18 17:47:24 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-18 18:41:03 -0400
commit022c674728f45ad22ce2bb5eb628ac9d3dbc3aea (patch)
tree9268f37b9182fe5c2947b998a5fad3074112b1bd /Documentation/fmc/API.txt
parent77864f2e0a824a92bd93b4c9ad22c31d28ff55a6 (diff)
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>
Diffstat (limited to 'Documentation/fmc/API.txt')
-rw-r--r--Documentation/fmc/API.txt47
1 files changed, 47 insertions, 0 deletions
diff --git a/Documentation/fmc/API.txt b/Documentation/fmc/API.txt
new file mode 100644
index 000000000000..06b06b92c794
--- /dev/null
+++ b/Documentation/fmc/API.txt
@@ -0,0 +1,47 @@
1Functions Exported by fmc.ko
2****************************
3
4The FMC core exports the usual 4 functions that are needed for a bus to
5work, 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
23The data structure that describe a device is detailed in *note FMC
24Device::, the one that describes a driver is detailed in *note FMC
25Driver::. Please note that structures of type fmc_device must be
26allocated by the caller, but must not be released after unregistering.
27The fmc-bus itself takes care of releasing the structure when their use
28count reaches zero - actually, the device model does that in lieu of us.
29
30The functions to register and unregister n devices are meant to be used
31by carriers that host more than one mezzanine. The devices must all be
32registered at the same time because if the FPGA is reprogrammed, all
33devices in the array are affected. Usually, the driver matching the
34first device will reprogram the FPGA, so other devices must know they
35are already driven by a reprogrammed FPGA.
36
37If a carrier hosts slots that are driven by different FPGA devices, it
38should register as a group only mezzanines that are driven by the same
39FPGA, for the reason outlined above.
40
41Finally, the fmc_reprogram function calls the reprogram method (see
42*note The API Offered by Carriers:: and also scans the memory area for
43an SDB tree. You can pass -1 as sdb_entry to disable such scan.
44Otherwise, the function fails if no tree is found at the specified
45entry point. The function is meant to factorize common code, and by
46the time you read this it is already used by the spec-sw and fine-delay
47modules.