u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] spl: fit: Detect a FS load using filename
Date: Thu, 19 May 2016 15:57:56 +0530	[thread overview]
Message-ID: <1463653677-24006-3-git-send-email-lokeshvutla@ti.com> (raw)
In-Reply-To: <1463653677-24006-1-git-send-email-lokeshvutla@ti.com>

Right now a FS load for fit is being detected using the priv field. But
this can be used by others media. So, introduce a filename field to
detect a FS load.

Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
---
 common/spl/spl_fat.c | 4 ++--
 common/spl/spl_fit.c | 6 +++---
 include/spl.h        | 2 ++
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index cdb9811..9df2fc2 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -45,7 +45,7 @@ static ulong spl_fit_read(struct spl_load_info *load, ulong file_offset,
 {
 	loff_t actread;
 	int ret;
-	char *filename = (char *)load->priv;
+	const char *filename = load->filename;
 
 	ret = fat_read_file(filename, buf, file_offset, size, &actread);
 	if (ret)
@@ -79,7 +79,7 @@ int spl_load_image_fat(struct blk_desc *block_dev,
 		debug("Found FIT\n");
 		load.read = spl_fit_read;
 		load.bl_len = 1;
-		load.priv = (void *)filename;
+		load.filename = filename;
 
 		return spl_load_simple_fit(&load, 0, header);
 	} else {
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index a0ea44c..78ce15f 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -87,7 +87,7 @@ static int get_aligned_image_offset(struct spl_load_info *info, int offset)
 	 * aligned to ARCH_DMA_MINALIGN. If it is raw read return the
 	 * block number to which offset belongs.
 	 */
-	if (info->priv)
+	if (info->filename)
 		return offset & ~(ARCH_DMA_MINALIGN - 1);
 
 	return offset / info->bl_len;
@@ -101,7 +101,7 @@ static int get_aligned_image_overhead(struct spl_load_info *info, int offset)
 	 * ARCH_DMA_MINALIGN. If it is raw read return the offset within the
 	 * block.
 	 */
-	if (info->priv)
+	if (info->filename)
 		return offset & (ARCH_DMA_MINALIGN - 1);
 
 	return offset % info->bl_len;
@@ -110,7 +110,7 @@ static int get_aligned_image_overhead(struct spl_load_info *info, int offset)
 static int get_aligned_image_size(struct spl_load_info *info, int data_size,
 				  int offset)
 {
-	if (info->priv)
+	if (info->filename)
 		return data_size + get_aligned_image_overhead(info, offset);
 
 	return (data_size + info->bl_len - 1) / info->bl_len;
diff --git a/include/spl.h b/include/spl.h
index 358e81b..af02a6d 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -35,12 +35,14 @@ struct spl_image_info {
  * @dev: Pointer to the device, e.g. struct mmc *
  * @priv: Private data for the device
  * @bl_len: Block length for reading in bytes
+ * @filename: Name of the fit image file.
  * @read: Function to call to read from the device
  */
 struct spl_load_info {
 	void *dev;
 	void *priv;
 	int bl_len;
+	const char *filename;
 	ulong (*read)(struct spl_load_info *load, ulong sector, ulong count,
 		      void *buf);
 };
-- 
2.8.2

  parent reply	other threads:[~2016-05-19 10:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19 10:27 [U-Boot] [PATCH 0/3] spl: fit: Allow to load FIT using UART boot Lokesh Vutla
2016-05-19 10:27 ` [U-Boot] [PATCH 1/3] spl: fit: Do not print selected dtb during fit load Lokesh Vutla
2016-05-19 13:50   ` Tom Rini
2016-05-19 10:27 ` Lokesh Vutla [this message]
2016-05-19 13:50   ` [U-Boot] [PATCH 2/3] spl: fit: Detect a FS load using filename Tom Rini
2016-05-19 10:27 ` [U-Boot] [PATCH 3/3] spl: Add an option to load a FIT containing U-Boot from UART Lokesh Vutla
2016-05-19 13:51   ` Tom Rini

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=1463653677-24006-3-git-send-email-lokeshvutla@ti.com \
    --to=lokeshvutla@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).