From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 82E56C77B6E for ; Thu, 13 Apr 2023 20:59:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 426B285D4A; Thu, 13 Apr 2023 22:59:23 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="COdSa2Bu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 452F985CBD; Thu, 13 Apr 2023 22:58:59 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) (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 D133085DCD for ; Thu, 13 Apr 2023 22:58:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D3B9E641B1; Thu, 13 Apr 2023 20:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFAEDC433A0; Thu, 13 Apr 2023 20:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681419529; bh=QArzc7RLxTtsHtmiwUC4I9SXQUJKHnm9IdslukAdeiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=COdSa2BusUVrp6cUT639PQKlhz1AtlRewD88pHp0Owux8e3iKHPbrtP6vHJu2TiBq 8JP5NqD9sHh3SR9NsofDrPsvRkMLMCAT9EtkYoTCmoPezjX0sS+zLwgaGCmscC2XXK UVknuAiq7aa6BFZWdsYu7WvEHolNaGJV2jOIvi4l9sVTe74Iqith+ZGP9BUUZycGo4 lvRHS0318XnNFwQgrb5bySRtUU8koF2Z5KRjhxrKiPGsrBwrf6Adyr2ehL8lLzweUh jROvqDZpSry7UdDuOk7cMSYkhd/I6iDdQc8tWNL3S3Lj7iD6xtxR416Gfgm2b+bB+E J5Ag/E7bpctoA== Received: by pali.im (Postfix) id C71FBEB1; Thu, 13 Apr 2023 22:58:46 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Stefan Roese Cc: Martin Rowe , u-boot@lists.denx.de Subject: [PATCH v2 u-boot-mvebu 3/4] arm: mvebu: spl: Load proper U-Boot from correct eMMC partition Date: Thu, 13 Apr 2023 22:57:49 +0200 Message-Id: <20230413205750.10641-4-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230413205750.10641-1-pali@kernel.org> References: <20230413205750.10641-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean A38x BootROM completely ignores EXT_CSD_PART_CONF eMMC register and tries to load SPL from any partition in defined order. Chosen partition can be determined from the access bits in EXT_CSD_PART_CONF eMMC register. So implement custom spl_mmc_emmc_boot_partition() function to always returns eMMC partition from which BootROM loaded SPL. So this partition would be used for loading proper U-Boot too. Fixes: 2f27db2fbd6e ("arm: mvebu: spl: Load proper U-Boot from selected eMMC boot partition") Signed-off-by: Pali Rohár --- arch/arm/mach-mvebu/spl.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 379daa88a4d8..0688601699f0 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -34,8 +35,9 @@ /* * When loading U-Boot via SPL from eMMC, the kwbimage main header is stored at - * sector 0 and either on HW boot partition or on data partition. Choice of HW - * partition depends on what is configured in eMMC EXT_CSC register. + * sector 0 on some HW/boot partition. Choice of HW partition depends on what is + * set in PART_ACCESS_MASK bits of EXT_CSD_PART_CONF eMMC register. Partition + * access bits into EXT_CSD_PART_CONF are set by the BootROM. * When loading U-Boot via SPL from SD card, the kwbimage main header is stored * at sector 1. * Therefore MBR/GPT partition booting, fixed sector number and fixed eMMC HW @@ -123,6 +125,10 @@ u32 spl_mmc_boot_mode(struct mmc *mmc, const u32 boot_device) { return IS_SD(mmc) ? MMCSD_MODE_RAW : MMCSD_MODE_EMMCBOOT; } +int spl_mmc_emmc_boot_partition(struct mmc *mmc) +{ + return EXT_CSD_EXTRACT_PARTITION_ACCESS(mmc->part_config); +} unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc, unsigned long raw_sect) { -- 2.20.1