summaryrefslogtreecommitdiff
path: root/drivers/fpga
diff options
context:
space:
mode:
authorLuca Ceresoli <luca@lucaceresoli.net>2020-08-30 19:38:50 +0300
committerMoritz Fischer <mdf@kernel.org>2020-08-31 03:09:05 +0300
commit4e772ab86b3ee24a936b10a291ce31c1f0c2bbb4 (patch)
treecbf70c467546b20a619ddbce8d776cb2754d7bca /drivers/fpga
parenteefe64fba9f2f2328c27ed9d9d02107083a62659 (diff)
downloadlinux-4e772ab86b3ee24a936b10a291ce31c1f0c2bbb4.tar.xz
fpga manager: xilinx-spi: provide better diagnostics on programming failure
When the DONE pin does not go high after programming to confirm programming success, the INIT_B pin provides some info on the reason. Use it if available to provide a more explanatory error message. Reviewed-by: Tom Rix <trix@redhat.com> Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: Moritz Fischer <mdf@kernel.org>
Diffstat (limited to 'drivers/fpga')
-rw-r--r--drivers/fpga/xilinx-spi.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c
index 52aab5a1f0ba..824abbbd631e 100644
--- a/drivers/fpga/xilinx-spi.c
+++ b/drivers/fpga/xilinx-spi.c
@@ -195,7 +195,21 @@ static int xilinx_spi_write_complete(struct fpga_manager *mgr,
return 0;
}
- dev_err(&mgr->dev, "Timeout after config data transfer\n");
+ if (conf->init_b) {
+ ret = gpiod_get_value(conf->init_b);
+
+ if (ret < 0) {
+ dev_err(&mgr->dev, "Error reading INIT_B (%d)\n", ret);
+ return ret;
+ }
+
+ dev_err(&mgr->dev,
+ ret ? "CRC error or invalid device\n"
+ : "Missing sync word or incomplete bitstream\n");
+ } else {
+ dev_err(&mgr->dev, "Timeout after config data transfer\n");
+ }
+
return -ETIMEDOUT;
}