All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dalon Westergreen <dwesterg@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] common: image: update boot_get_fpga to support arbitrary fpga image
Date: Sun, 19 Feb 2017 11:49:58 -0800	[thread overview]
Message-ID: <1487533799-28788-2-git-send-email-dwesterg@gmail.com> (raw)
In-Reply-To: <1487533799-28788-1-git-send-email-dwesterg@gmail.com>

The implementation of boot_get_fpga only supported one fpga family.
This modification allows for any of the fpga devices supported by
fpga_load to be used.

Signed-off-by: Dalon Westergreen <dwesterg@gmail.com>
---
 common/image.c | 37 ++++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/common/image.c b/common/image.c
index 0f88984..792d371 100644
--- a/common/image.c
+++ b/common/image.c
@@ -1306,7 +1306,7 @@ int boot_get_setup(bootm_headers_t *images, uint8_t arch,
 }
 
 #if IMAGE_ENABLE_FIT
-#if defined(CONFIG_FPGA) && defined(CONFIG_FPGA_XILINX)
+#if defined(CONFIG_FPGA)
 int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 		  uint8_t arch, const ulong *ld_start, ulong * const ld_len)
 {
@@ -1318,7 +1318,8 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 	int err;
 	int devnum = 0; /* TODO support multi fpga platforms */
 	const fpga_desc * const desc = fpga_get_desc(devnum);
-	xilinx_desc *desc_xilinx = desc->devdesc;
+	xilinx_desc *desc_xilinx;
+	bitstream_type bstype;
 
 	/* Check to see if the images struct has a FIT configuration */
 	if (!genimg_has_config(images)) {
@@ -1365,22 +1366,28 @@ int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
 			return fit_img_result;
 		}
 
-		if (img_len >= desc_xilinx->size) {
+		switch (desc->devtype) {
+		case fpga_xilinx:
+			desc_xilinx = desc->devdesc;
+			if (img_len >= desc_xilinx->size) {
+				name = "full";
+				bstype = BIT_FULL;
+			} else {
+				name = "partial";
+				bstype = BIT_PARTIAL;
+			}
+			break;
+		default:
 			name = "full";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_FULL);
-			if (err)
-				err = fpga_load(devnum, (const void *)img_data,
-						img_len, BIT_FULL);
-		} else {
-			name = "partial";
-			err = fpga_loadbitstream(devnum, (char *)img_data,
-						 img_len, BIT_PARTIAL);
-			if (err)
-				err = fpga_load(devnum, (const void *)img_data,
-						img_len, BIT_PARTIAL);
+			bstype = BIT_FULL;
 		}
 
+		err = fpga_loadbitstream(devnum, (char *)img_data,
+					 img_len, bstype);
+		if (err)
+			err = fpga_load(devnum, (const void *)img_data,
+					img_len, bstype);
+
 		if (err)
 			return err;
 
-- 
2.7.4

  reply	other threads:[~2017-02-19 19:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-19 19:49 [U-Boot] [PATCH 0/2] common: fitimage support for arbitrary fpga type Dalon Westergreen
2017-02-19 19:49 ` Dalon Westergreen [this message]
2017-02-19 20:07   ` [U-Boot] [PATCH 1/2] common: image: update boot_get_fpga to support arbitrary fpga image Marek Vasut
2017-02-19 20:43     ` Dalon Westergreen
2017-02-19 20:49       ` Marek Vasut
2017-02-19 20:58         ` Dalon Westergreen
2017-02-19 21:12           ` Marek Vasut
2017-02-19 21:21             ` Dalon Westergreen
2017-02-19 21:26               ` Marek Vasut
2017-02-20  9:24                 ` Michal Simek
2017-02-20 14:24                   ` Dalon Westergreen
2017-02-20  9:22           ` Michal Simek
2017-02-20 14:30             ` Dalon Westergreen
2017-02-20 14:59               ` Michal Simek
2017-02-20 17:35                 ` Moritz Fischer
2017-02-20 22:38                   ` Marek Vasut
2017-02-19 19:49 ` [U-Boot] [PATCH 2/2] common: bootm: add support for arbitrary fgpa configuration Dalon Westergreen

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=1487533799-28788-2-git-send-email-dwesterg@gmail.com \
    --to=dwesterg@gmail.com \
    --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.