Re: [PATCH v4 5/5] fpga manager: xilinx-spi: provide better diagnostics on programming failure
From: Moritz Fischer
Date: Sun Aug 30 2020 - 20:10:02 EST
On Sun, Aug 30, 2020 at 06:38:50PM +0200, Luca Ceresoli wrote:
> 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@xxxxxxxxxx>
> Signed-off-by: Luca Ceresoli <luca@xxxxxxxxxxxxxxxx>
>
> ---
>
> Changes in v4:
> - add Reviewed-by Tom Rix
>
> Changes in v3: none.
>
> Changes in v2:
> - also check for gpiod_get_value() errors (Tom Rix)
> ---
> drivers/fpga/xilinx-spi.c | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> 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;
> }
>
> --
> 2.28.0
>
Applied to for-next,
Thanks