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.
48