From patchwork Wed May 13 14:02:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?S=C3=A9bastien_Szymanski?= X-Patchwork-Id: 1289328 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=armadeus.com Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49MbwV5ZBMz9sTb for ; Thu, 14 May 2020 00:02:50 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id F0A3E81D0D; Wed, 13 May 2020 16:02:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=armadeus.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 2DE498167B; Wed, 13 May 2020 16:02:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 17.mo7.mail-out.ovh.net (17.mo7.mail-out.ovh.net [188.165.35.227]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8F7FE8167B for ; Wed, 13 May 2020 16:02:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=armadeus.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sebastien.szymanski@armadeus.com Received: from player759.ha.ovh.net (unknown [10.110.115.238]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id 19CA015FC98 for ; Wed, 13 May 2020 16:02:41 +0200 (CEST) Received: from armadeus.com (91-171-241-78.subs.proxad.net [91.171.241.78]) (Authenticated sender: sebastien.szymanski@armadeus.com) by player759.ha.ovh.net (Postfix) with ESMTPSA id 05EDB1258AC4A; Wed, 13 May 2020 14:02:28 +0000 (UTC) From: =?utf-8?q?S=C3=A9bastien_Szymanski?= To: u-boot@lists.denx.de Cc: "NXP i . MX U-Boot Team" , Fabio Estevam , Peng Fan , Stefano Babic , Patrick Wildt , =?utf-8?q?S=C3=A9bastien_Szymanski?= Subject: [PATCH v2 1/1] imx: rom api: fix image offset computation Date: Wed, 13 May 2020 16:02:28 +0200 Message-Id: <20200513140228.8552-1-sebastien.szymanski@armadeus.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 18302628887305671705 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrleeggdejudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpefurogsrghsthhivghnucfuiiihmhgrnhhskhhiuceoshgvsggrshhtihgvnhdrshiihihmrghnshhkihesrghrmhgruggvuhhsrdgtohhmqeenucggtffrrghtthgvrhhnpefhgfegffefieeghfdvlefgtdeiheejvdelvefgvedtgeeffffgjeeutdduhedtfeenucfkpheptddrtddrtddrtddpledurddujedurddvgedurdejkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejheelrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshgvsggrshhtihgvnhdrshiihihmrghnshhkihesrghrmhgruggvuhhsrdgtohhmpdhrtghpthhtohepuhdqsghoohhtsehlihhsthhsrdguvghngidruggv X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean 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 --- 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);