All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
To: u-boot@lists.denx.de
Cc: Michal Simek <michal.simek@xilinx.com>,
	Adrian Fiergolski <adrian.fiergolski@fastree3d.com>,
	Ricardo Salveti <ricardo@foundries.io>,
	Jorge Ramirez-Ortiz <jorge@foundries.io>,
	Igor Opaniuk <igor.opaniuk@foundries.io>,
	Oleksandr Suvorov <oleksandr.suvorov@foundries.io>,
	Michal Simek <michal.simek@amd.com>
Subject: [PATCH v12 10/13] fpga: zynqmp: reduce zynqmppl_load() code
Date: Fri, 22 Jul 2022 17:16:11 +0300	[thread overview]
Message-ID: <20220722141614.297383-11-oleksandr.suvorov@foundries.io> (raw)
In-Reply-To: <20220722141614.297383-10-oleksandr.suvorov@foundries.io>

Reduce the function code by calling xilinx_pm_request() once only.
Use the same variable bsize_req to store either bstream size in bytes
or an address of bstream size according to a type required by the
firmware version. Remove obsolete debug().

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
Tested-by: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
---

Changes in v12:
- fix a commit message
- remove obsolete debug() message

 drivers/fpga/zynqmppl.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
index a0624567882..2791f931861 100644
--- a/drivers/fpga/zynqmppl.c
+++ b/drivers/fpga/zynqmppl.c
@@ -207,38 +207,33 @@ static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
 	ulong bin_buf;
 	int ret;
 	u32 buf_lo, buf_hi;
+	u32 bsize_req = (u32)bsize;
 	u32 ret_payload[PAYLOAD_ARG_CNT];
-	bool xilfpga_old = false;
 
 	if (zynqmp_firmware_version() <= PMUFW_V1_0) {
 		puts("WARN: PMUFW v1.0 or less is detected\n");
 		puts("WARN: Not all bitstream formats are supported\n");
 		puts("WARN: Please upgrade PMUFW\n");
-		xilfpga_old = true;
 		if (zynqmp_validate_bitstream(desc, buf, bsize, bsize, &swap))
 			return FPGA_FAIL;
 		bsizeptr = (u32 *)&bsize;
 		flush_dcache_range((ulong)bsizeptr,
 				   (ulong)bsizeptr + sizeof(size_t));
+		bsize_req = (u32)(uintptr_t)bsizeptr;
 		bstype |= BIT(ZYNQMP_FPGA_BIT_NS);
+	} else {
+		bstype = 0;
 	}
 
 	bin_buf = zynqmp_align_dma_buffer((u32 *)buf, bsize, swap);
 
-	debug("%s called!\n", __func__);
 	flush_dcache_range(bin_buf, bin_buf + bsize);
 
 	buf_lo = (u32)bin_buf;
 	buf_hi = upper_32_bits(bin_buf);
 
-	if (xilfpga_old)
-		ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo,
-					buf_hi, (u32)(uintptr_t)bsizeptr,
-					bstype, ret_payload);
-	else
-		ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo,
-					buf_hi, (u32)bsize, 0, ret_payload);
-
+	ret = xilinx_pm_request(PM_FPGA_LOAD, buf_lo, buf_hi,
+				bsize_req, bstype, ret_payload);
 	if (ret)
 		printf("PL FPGA LOAD failed with err: 0x%08x\n", ret);
 
-- 
2.36.1


  reply	other threads:[~2022-07-22 14:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 14:16 [PATCH v12 00/13] fpga: zynqmp: Adding support of loading authenticated images Oleksandr Suvorov
2022-07-22 14:16 ` [PATCH v12 01/13] fpga: add option for loading FPGA secure bitstreams Oleksandr Suvorov
2022-07-22 14:16   ` [PATCH v12 02/13] fpga: xilinx: add missed identifier names Oleksandr Suvorov
2022-07-22 14:16     ` [PATCH v12 03/13] fpga: xilinx: add bitstream flags to driver desc Oleksandr Suvorov
2022-07-22 14:16       ` [PATCH v12 04/13] fpga: zynqmp: add str2flags call Oleksandr Suvorov
2022-07-22 14:16         ` [PATCH v12 05/13] fpga: xilinx: pass compatible flags to xilinx_load() Oleksandr Suvorov
2022-07-22 14:16           ` [PATCH v12 06/13] fpga: pass compatible flags to fpga_load() Oleksandr Suvorov
2022-07-22 14:16             ` [PATCH v12 07/13] fpga: add fpga_compatible2flag Oleksandr Suvorov
2022-07-22 14:16               ` [PATCH v12 08/13] spl: fit: pass real compatible flags to fpga_load() Oleksandr Suvorov
2022-07-22 14:16                 ` [PATCH v12 09/13] fpga: xilinx: pass compatible flags to load() callback Oleksandr Suvorov
2022-07-22 14:16                   ` Oleksandr Suvorov [this message]
2022-07-22 14:16                     ` [PATCH v12 11/13] fpga: zynqmp: add bitstream compatible checking Oleksandr Suvorov
2022-07-22 14:16                       ` [PATCH v12 12/13] fpga: zynqmp: support loading authenticated images Oleksandr Suvorov
2022-07-22 14:16                         ` [PATCH v12 13/13] fpga: zynqmp: support loading encrypted bitfiles Oleksandr Suvorov
2022-07-26  7:32                         ` [PATCH v12 12/13] fpga: zynqmp: support loading authenticated images Michal Simek
2022-07-26  7:32 ` [PATCH v12 00/13] fpga: zynqmp: Adding support of " Michal Simek

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=20220722141614.297383-11-oleksandr.suvorov@foundries.io \
    --to=oleksandr.suvorov@foundries.io \
    --cc=adrian.fiergolski@fastree3d.com \
    --cc=igor.opaniuk@foundries.io \
    --cc=jorge@foundries.io \
    --cc=michal.simek@amd.com \
    --cc=michal.simek@xilinx.com \
    --cc=ricardo@foundries.io \
    --cc=u-boot@lists.denx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.