From: Michael Tretter <m.tretter@pengutronix.de>
To: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Cc: barebox@lists.infradead.org, str@pengutronix.de
Subject: Re: [PATCH] firmware: zynqmp: fix loading for PMU FWv1.1
Date: Fri, 23 Jun 2023 16:14:36 +0200 [thread overview]
Message-ID: <20230623141436.GA19302@pengutronix.de> (raw)
In-Reply-To: <20230623114348.26213-1-s.trumtrar@pengutronix.de>
On Fri, 23 Jun 2023 13:42:56 +0200, Steffen Trumtrar wrote:
> FPGA programming on ZynqMP is done by the PMU. The SoC just hands a
> file to the PMU and lets it load this file to the FPGA.
>
> The bitstream that is sent to the FPGA consists of two headers, the
> optional struct bs_header and a binary-header. See comment in driver:
>
> (...)
> * Bitstream can be provided with an optinal header (`struct bs_header`).
> * The true bitstream starts with the binary-header composed of 21 words:
> (...)
>
> The PMUFW v1.0 had a feature for taking the bitstream only, skipping
> the header, or including the binary-header and only skipping the
> optional header. This is controlled via the BIT_ONLY_BIN flag. When
> the flag is set, the complete header should be skipped.
>
> The current implementation sets the flag *and* sends the binary-header
> to the PMU:
>
> header_length = get_header_length(mgr->buf, mgr->size);
> (...)
> body = (u32 *)&mgr->buf[header_length];
>
> get_header_length searches for the first DUMMY_WORD, i.e. the beginning
> of the binary header. Then we set body to this offset, skipping the
> optional header.
>
> The flag is always set to ZYNQMP_FPGA_BIT_ONLY_BIN, which is then obviously
> incorrect. It seems like the PMUFW v1.0 was capable of still handling this
> although the flag was set.
>
> The newer PMUFW v1.1 doesn't support this and expects the flag to be
> unset and getting handed binary-header+bitstream. This is the same as
> the linux kernel handles bitstream loading on the ZynqMP. There the flag
> is also always unset.
>
> As this wasn't correct in the first place (although it most likely still
> worked depending on PMUFW and its configuration), we won't break anything
> when we just set the flag to zero as the PMUFW v1.1 expects it.
>
> TLDR: set fpga_load flags to zero to fix firmwareloading with newer
> PMUFW versions.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Reviewed-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
> drivers/firmware/zynqmp-fpga.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/firmware/zynqmp-fpga.c b/drivers/firmware/zynqmp-fpga.c
> index 9c160e9098..1a9a5c1b2c 100644
> --- a/drivers/firmware/zynqmp-fpga.c
> +++ b/drivers/firmware/zynqmp-fpga.c
> @@ -206,7 +206,7 @@ static int fpgamgr_program_finish(struct firmware_handler *fh)
> enum xilinx_byte_order byte_order;
> dma_addr_t addr;
> int status = 0;
> - u8 flags = ZYNQMP_FPGA_BIT_ONLY_BIN;
> + u8 flags = 0;
>
> if (!mgr->buf) {
> status = -ENOBUFS;
> --
> 2.41.0
>
>
next prev parent reply other threads:[~2023-06-23 14:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-23 11:42 Steffen Trumtrar
2023-06-23 14:14 ` Michael Tretter [this message]
2023-06-26 9:59 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230623141436.GA19302@pengutronix.de \
--to=m.tretter@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=s.trumtrar@pengutronix.de \
--cc=str@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox