All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Fiergolski <adrian.fiergolski@fastree3d.com>
To: u-boot@lists.denx.de
Cc: oleksandr.suvorov@foundries.io, ricardo@foundries.io,
	michal.simek@xilinx.com, igor.opaniuk@foundries.io,
	jorge@foundries.io, mr.nuke.me@gmail.com, bmeng.cn@gmail.com,
	hs@denx.de, jagan@amarulasolutions.com, klaus@linux.vnet.ibm.com,
	seanga2@gmail.com, sjg@chromium.org,
	jaeckel-floss@eyet-services.de
Subject: [PATCH v7 5/7] fpga: xilinx: pass xilinx_desc pointer address into load() ops
Date: Mon, 11 Apr 2022 20:00:44 +0200	[thread overview]
Message-ID: <20220411180046.1505209-6-adrian.fiergolski@fastree3d.com> (raw)
In-Reply-To: <20220411180046.1505209-1-adrian.fiergolski@fastree3d.com>

From: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>

Pass an address of xilinx_desc pointer in an fpga_desc into a load()
callback of struct xilinx_fpga_op.
It allows getting parent fpga_desc structure members inside xilinx
fpga drivers.

Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@foundries.io>
Tested-by: Ricardo Salveti <ricardo@foundries.io>
---
 drivers/fpga/spartan2.c | 3 ++-
 drivers/fpga/spartan3.c | 3 ++-
 drivers/fpga/versalpl.c | 2 +-
 drivers/fpga/virtex2.c  | 3 ++-
 drivers/fpga/xilinx.c   | 2 +-
 drivers/fpga/zynqmppl.c | 5 +++--
 drivers/fpga/zynqpl.c   | 3 ++-
 include/xilinx.h        | 2 +-
 8 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/fpga/spartan2.c b/drivers/fpga/spartan2.c
index 3435400e58..f40edb1747 100644
--- a/drivers/fpga/spartan2.c
+++ b/drivers/fpga/spartan2.c
@@ -40,10 +40,11 @@ static int spartan2_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize);
 
 /* ------------------------------------------------------------------------- */
 /* Spartan-II Generic Implementation */
-static int spartan2_load(xilinx_desc *desc, const void *buf, size_t bsize,
+static int spartan2_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 			 bitstream_type bstype)
 {
 	int ret_val = FPGA_FAIL;
+	xilinx_desc *desc = *desc_ptr;
 
 	switch (desc->iface) {
 	case slave_serial:
diff --git a/drivers/fpga/spartan3.c b/drivers/fpga/spartan3.c
index 4850c99352..b7c1ddd40f 100644
--- a/drivers/fpga/spartan3.c
+++ b/drivers/fpga/spartan3.c
@@ -44,10 +44,11 @@ static int spartan3_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize);
 
 /* ------------------------------------------------------------------------- */
 /* Spartan-II Generic Implementation */
-static int spartan3_load(xilinx_desc *desc, const void *buf, size_t bsize,
+static int spartan3_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 			 bitstream_type bstype)
 {
 	int ret_val = FPGA_FAIL;
+	xilinx_desc *desc = *desc_ptr;
 
 	switch (desc->iface) {
 	case slave_serial:
diff --git a/drivers/fpga/versalpl.c b/drivers/fpga/versalpl.c
index c44a7d3455..9464cae22e 100644
--- a/drivers/fpga/versalpl.c
+++ b/drivers/fpga/versalpl.c
@@ -26,7 +26,7 @@ static ulong versal_align_dma_buffer(ulong *buf, u32 len)
 	return (ulong)buf;
 }
 
-static int versal_load(xilinx_desc *desc, const void *buf, size_t bsize,
+static int versal_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 		       bitstream_type bstype)
 {
 	ulong bin_buf;
diff --git a/drivers/fpga/virtex2.c b/drivers/fpga/virtex2.c
index b3e0537bab..d0369d320b 100644
--- a/drivers/fpga/virtex2.c
+++ b/drivers/fpga/virtex2.c
@@ -93,10 +93,11 @@ static int virtex2_ssm_dump(xilinx_desc *desc, const void *buf, size_t bsize);
 static int virtex2_ss_load(xilinx_desc *desc, const void *buf, size_t bsize);
 static int virtex2_ss_dump(xilinx_desc *desc, const void *buf, size_t bsize);
 
-static int virtex2_load(xilinx_desc *desc, const void *buf, size_t bsize,
+static int virtex2_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 			bitstream_type bstype)
 {
 	int ret_val = FPGA_FAIL;
+	xilinx_desc *desc = *desc_ptr;
 
 	switch (desc->iface) {
 	case slave_serial:
diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c
index 640baac66e..f89ae8fe10 100644
--- a/drivers/fpga/xilinx.c
+++ b/drivers/fpga/xilinx.c
@@ -153,7 +153,7 @@ int xilinx_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 		return FPGA_FAIL;
 	}
 
-	return desc->operations->load(desc, buf, bsize, bstype);
+	return desc->operations->load(desc_ptr, buf, bsize, bstype);
 }
 
 #if defined(CONFIG_CMD_FPGA_LOADFS)
diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
index 8ff12bf50a..c7f9f4ae84 100644
--- a/drivers/fpga/zynqmppl.c
+++ b/drivers/fpga/zynqmppl.c
@@ -199,8 +199,8 @@ static int zynqmp_validate_bitstream(xilinx_desc *desc, const void *buf,
 	return 0;
 }
 
-static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
-		     bitstream_type bstype)
+static int zynqmp_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
+		       bitstream_type bstype)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(u32, bsizeptr, 1);
 	u32 swap = 0;
@@ -209,6 +209,7 @@ static int zynqmp_load(xilinx_desc *desc, const void *buf, size_t bsize,
 	u32 buf_lo, buf_hi;
 	u32 ret_payload[PAYLOAD_ARG_CNT];
 	bool xilfpga_old = false;
+	xilinx_desc *desc = *desc_ptr;
 
 	if (zynqmp_firmware_version() <= PMUFW_V1_0) {
 		puts("WARN: PMUFW v1.0 or less is detected\n");
diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c
index 2de40109a8..c5d9dbcedf 100644
--- a/drivers/fpga/zynqpl.c
+++ b/drivers/fpga/zynqpl.c
@@ -370,11 +370,12 @@ static int zynq_validate_bitstream(xilinx_desc *desc, const void *buf,
 	return 0;
 }
 
-static int zynq_load(xilinx_desc *desc, const void *buf, size_t bsize,
+static int zynq_load(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 		     bitstream_type bstype)
 {
 	unsigned long ts; /* Timestamp */
 	u32 isr_status, swap;
+	xilinx_desc *desc = *desc_ptr;
 
 	/*
 	 * send bsize inplace of blocksize as it was not a bitstream
diff --git a/include/xilinx.h b/include/xilinx.h
index 06ecc9a842..a7efe0e876 100644
--- a/include/xilinx.h
+++ b/include/xilinx.h
@@ -48,7 +48,7 @@ typedef struct {		/* typedef xilinx_desc */
 } xilinx_desc;			/* end, typedef xilinx_desc */
 
 struct xilinx_fpga_op {
-	int (*load)(xilinx_desc *desc, const void *buf, size_t bsize,
+	int (*load)(xilinx_desc **desc_ptr, const void *buf, size_t bsize,
 		    bitstream_type bstype);
 	int (*loadfs)(xilinx_desc *desc, const void *buf, size_t bsize,
 		      fpga_fs_info *fpga_fsinfo);
-- 
2.35.1


  parent reply	other threads:[~2022-04-11 18:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 18:00 [PATCH v7 0/7] fpga: zynqmp: Adding support of loading authenticated images Adrian Fiergolski
2022-04-11 18:00 ` [PATCH v7 1/7] fpga: add option for loading FPGA secure bitstreams Adrian Fiergolski
2022-04-11 18:00 ` [PATCH v7 2/7] fpga: add fit_fpga_load function Adrian Fiergolski
2022-05-03  7:42   ` Michal Simek
2022-05-04 14:28     ` Adrian Fiergolski
2022-05-04 18:26       ` Oleksandr Suvorov
2022-05-09 10:30         ` Adrian Fiergolski
2022-05-09 11:41           ` Oleksandr Suvorov
2022-05-09 11:02       ` Oleksandr Suvorov
2022-05-09 11:35         ` Adrian Fiergolski
2022-05-09 13:28           ` Oleksandr Suvorov
2022-05-09 13:34             ` Adrian Fiergolski
2022-05-16 14:25               ` Michal Simek
2022-05-18  8:47                 ` Oleksandr Suvorov
2022-05-31 23:17                 ` Oleksandr Suvorov
2022-04-11 18:00 ` [PATCH v7 3/7] fpga: xilinx: pass an address of xilinx_desc in fpga_desc Adrian Fiergolski
2022-04-11 18:00 ` [PATCH v7 4/7] fpga: xilinx: add missed identifier names Adrian Fiergolski
2022-05-03  7:43   ` Michal Simek
2022-04-11 18:00 ` Adrian Fiergolski [this message]
2022-05-03  7:44   ` [PATCH v7 5/7] fpga: xilinx: pass xilinx_desc pointer address into load() ops Michal Simek
2022-04-11 18:00 ` [PATCH v7 6/7] fpga: zynqmp: support loading authenticated images Adrian Fiergolski
2022-05-03  7:55   ` Michal Simek
2022-05-07 22:19     ` Oleksandr Suvorov
2022-04-11 18:00 ` [PATCH v7 7/7] fpga: zynqmp: support loading encrypted bitfiles Adrian Fiergolski
2022-05-03  7:56 ` [PATCH v7 0/7] fpga: zynqmp: Adding support of loading authenticated images 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=20220411180046.1505209-6-adrian.fiergolski@fastree3d.com \
    --to=adrian.fiergolski@fastree3d.com \
    --cc=bmeng.cn@gmail.com \
    --cc=hs@denx.de \
    --cc=igor.opaniuk@foundries.io \
    --cc=jaeckel-floss@eyet-services.de \
    --cc=jagan@amarulasolutions.com \
    --cc=jorge@foundries.io \
    --cc=klaus@linux.vnet.ibm.com \
    --cc=michal.simek@xilinx.com \
    --cc=mr.nuke.me@gmail.com \
    --cc=oleksandr.suvorov@foundries.io \
    --cc=ricardo@foundries.io \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --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.