All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sébastien Szymanski" <sebastien.szymanski@armadeus.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/1] imx: rom api: fix image offset computation
Date: Wed, 13 May 2020 16:02:28 +0200	[thread overview]
Message-ID: <20200513140228.8552-1-sebastien.szymanski@armadeus.com> (raw)

When not booting from FlexSPI, the offset computation is:

offset = image_offset + CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000;

When booting from SD card or eMMC user partition, image_offset is
0x8000. It is useless to add and remove 0x8000.
When booting from other device, image_offset is 0 so this computation is wrong.

Simplfy this computation to work on all booting devices.

Signed-off-by: S?bastien Szymanski <sebastien.szymanski@armadeus.com>
---

Changes from v2:
 * Previous version was wrong.

 arch/arm/mach-imx/spl_imx_romapi.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c
index 5dc0f7174e..78dd005e7f 100644
--- a/arch/arm/mach-imx/spl_imx_romapi.c
+++ b/arch/arm/mach-imx/spl_imx_romapi.c
@@ -83,12 +83,7 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image,
 	printf("image offset 0x%x, pagesize 0x%x, ivt offset 0x%x\n",
 	       image_offset, pagesize, offset);
 
-	if (((rom_bt_dev >> 16) & 0xff) ==  BT_DEV_TYPE_FLEXSPINOR)
-		offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512;
-	else
-		offset = image_offset +
-			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000;
-
+	offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512;
 	size = ALIGN(sizeof(struct image_header), pagesize);
 	ret = g_rom_api->download_image((u8 *)header, offset, size,
 					((uintptr_t)header) ^ offset ^ size);
-- 
2.26.2

             reply	other threads:[~2020-05-13 14:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-13 14:02 Sébastien Szymanski [this message]
2020-06-08 17:22 ` [PATCH v2 1/1] imx: rom api: fix image offset computation sbabic at denx.de
2020-06-09  4:03   ` [EXT] " Ye Li
2020-06-09  8:31     ` Sébastien Szymanski
2020-06-09  9:19       ` Stefano Babic

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=20200513140228.8552-1-sebastien.szymanski@armadeus.com \
    --to=sebastien.szymanski@armadeus.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.