summaryrefslogtreecommitdiff
path: root/drivers/fmc/fmc-sdb.c
diff options
context:
space:
mode:
authorFederico Vaga <federico.vaga@cern.ch>2017-07-18 09:33:24 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-28 17:24:22 +0300
commit9c0dda14951e9ed30b6f04e14bf64a3c69686c5b (patch)
tree2562d71e9f38eb5a6db7e0fff7519c926969f4c9 /drivers/fmc/fmc-sdb.c
parent15b1b0f0d87e34a87172d9b83bd260543a991c2e (diff)
downloadlinux-9c0dda14951e9ed30b6f04e14bf64a3c69686c5b.tar.xz
drivers/fmc: carrier can program FPGA on registration
The initial FPGA may require programming before it is useful. Signed-off-by: Federico Vaga <federico.vaga@cern.ch> Tested-by: Pat Riehecky <riehecky@fnal.gov> Acked-by: Alessandro Rubini <rubini@gnudd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/fmc/fmc-sdb.c')
-rw-r--r--drivers/fmc/fmc-sdb.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c
index 89e37a6cfc66..ffdc1762b580 100644
--- a/drivers/fmc/fmc-sdb.c
+++ b/drivers/fmc/fmc-sdb.c
@@ -127,6 +127,30 @@ int fmc_free_sdb_tree(struct fmc_device *fmc)
EXPORT_SYMBOL(fmc_free_sdb_tree);
/* This helper calls reprogram and inizialized sdb as well */
+int fmc_reprogram_raw(struct fmc_device *fmc, struct fmc_driver *d,
+ void *gw, unsigned long len, int sdb_entry)
+{
+ int ret;
+
+ ret = fmc->op->reprogram_raw(fmc, d, gw, len);
+ if (ret < 0)
+ return ret;
+ if (sdb_entry < 0)
+ return ret;
+
+ /* We are required to find SDB at a given offset */
+ ret = fmc_scan_sdb_tree(fmc, sdb_entry);
+ if (ret < 0) {
+ dev_err(&fmc->dev, "Can't find SDB at address 0x%x\n",
+ sdb_entry);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+EXPORT_SYMBOL(fmc_reprogram_raw);
+
+/* This helper calls reprogram and inizialized sdb as well */
int fmc_reprogram(struct fmc_device *fmc, struct fmc_driver *d, char *gw,
int sdb_entry)
{