Re: [PATCH 2/3] fpga manager: xilinx-spi: provide better diagnostics on programming failure
From: Tom Rix <trix@redhat.com>
Date: 2020-08-17 18:15:53
Also in:
linux-fpga, lkml
The other two patches are fine. On 8/17/20 9:59 AM, Luca Ceresoli wrote:
quoted hunk ↗ jump to hunk
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. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> --- drivers/fpga/xilinx-spi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)diff --git a/drivers/fpga/xilinx-spi.c b/drivers/fpga/xilinx-spi.c index 502fae0d1d85..2aa942bb1114 100644 --- a/drivers/fpga/xilinx-spi.c +++ b/drivers/fpga/xilinx-spi.c@@ -169,7 +169,16 @@ static int xilinx_spi_write_complete(struct fpga_manager *mgr, return xilinx_spi_apply_cclk_cycles(conf); } - dev_err(&mgr->dev, "Timeout after config data transfer.\n"); + if (conf->init_b) { + int init_b_asserted = gpiod_get_value(conf->init_b);
gpiod_get_value can fail. So maybe need split the first statement. init_b_asserted < 0 ? "invalid device" As the if-else statement is getting complicated, embedding the ? : makes this hard to read. 'if,else if, else' would be better.
+
+ dev_err(&mgr->dev,
+ init_b_asserted ? "CRC error or invalid device\n"
+ : "Missing sync word or incomplete bitstream\n");
+ } else {
+ dev_err(&mgr->dev, "Timeout after config data transfer.\n");patch 3 removes '.' s , and you just added one back in ?
+ } + return -ETIMEDOUT; }
Reviewed-by: Tom Rix <trix@redhat.com> _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel