From patchwork Tue May 12 13:09:54 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: 1288427 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 49LypV3g8kz9sSs for ; Tue, 12 May 2020 23:10:23 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4639481CF8; Tue, 12 May 2020 15:10:15 +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 2512081CFA; Tue, 12 May 2020 15:10:13 +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,SPF_HELO_NONE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from 10.mo7.mail-out.ovh.net (10.mo7.mail-out.ovh.net [178.33.250.56]) (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 E19E481CA5 for ; Tue, 12 May 2020 15:10:09 +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 player776.ha.ovh.net (unknown [10.110.115.238]) by mo7.mail-out.ovh.net (Postfix) with ESMTP id CD90E160A8B for ; Tue, 12 May 2020 15:10:03 +0200 (CEST) Received: from armadeus.com (91-171-241-78.subs.proxad.net [91.171.241.78]) (Authenticated sender: sebastien.szymanski@armadeus.com) by player776.ha.ovh.net (Postfix) with ESMTPSA id B969112550068; Tue, 12 May 2020 13:09:57 +0000 (UTC) Authentication-Results: garm.ovh; auth=pass (GARM-96R001368a0cb8-161d-4889-9149-6ca9ec3a465f,7DFDD5B19605C6C4536540E55E314D8219C8C3C7) smtp.auth=sebastien.szymanski@armadeus.com 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 , =?utf-8?q?S=C3=A9bastien_Szymanski?= Subject: [PATCH 1/1] imx: rom api: fix image offset computation Date: Tue, 12 May 2020 15:09:54 +0200 Message-Id: <20200512130954.4882-1-sebastien.szymanski@armadeus.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 X-Ovh-Tracer-Id: 11541318470591009817 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrledvgdehjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufffkofggtgfgsehtkeertdertdejnecuhfhrohhmpefurogsrghsthhivghnucfuiiihmhgrnhhskhhiuceoshgvsggrshhtihgvnhdrshiihihmrghnshhkihesrghrmhgruggvuhhsrdgtohhmqeenucggtffrrghtthgvrhhnpefhgfegffefieeghfdvlefgtdeiheejvdelvefgvedtgeeffffgjeeutdduhedtfeenucfkpheptddrtddrtddrtddpledurddujedurddvgedurdejkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejjeeirdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomhepshgvsggrshhtihgvnhdrshiihihmrghnshhkihesrghrmhgruggvuhhsrdgtohhmpdhrtghpthhtohepuhdqsghoohhtsehlihhsthhsrdguvghngidruggv 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 According to the table 6-25 "Primary image offset and IVT offset details", in the IMX8MNRM, the ROM expects the following image offset: SD: 32KB eMMC: 0 if image is in boot partion and 32KB if it is on user partition NAND: 0 FlexSPI: 4KB SPI: 0 On eMMC, it is more likely that U-Boot is on the boot partion, so rework the offset computation by handling the two specific cases (SD and FlexSPI). Signed-off-by: Sébastien Szymanski --- arch/arm/mach-imx/spl_imx_romapi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c index 5dc0f7174e..1e9d7bd9ab 100644 --- a/arch/arm/mach-imx/spl_imx_romapi.c +++ b/arch/arm/mach-imx/spl_imx_romapi.c @@ -84,10 +84,12 @@ static int spl_romapi_load_image_seekable(struct spl_image_info *spl_image, image_offset, pagesize, offset); if (((rom_bt_dev >> 16) & 0xff) == BT_DEV_TYPE_FLEXSPINOR) - offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512; + offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x1000; + else if (((rom_bt_dev >> 16) & 0xff) == BT_DEV_TYPE_SD) + offset = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000; else offset = image_offset + - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 512 - 0x8000; + 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,