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 D133EC678DB for ; Sat, 4 Mar 2023 10:40:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 90D4985B2A; Sat, 4 Mar 2023 11:40:13 +0100 (CET) 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="dQwHTRU6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 548D085A4A; Sat, 4 Mar 2023 11:40:09 +0100 (CET) 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 41CA4859BA for ; Sat, 4 Mar 2023 11:40:06 +0100 (CET) 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 5E23660B5A; Sat, 4 Mar 2023 10:40:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B1EBC433EF; Sat, 4 Mar 2023 10:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677926403; bh=L7FnTc5/bYWS88WmS0edrr0oHt45uqpgmp4TTt6+jYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQwHTRU6ILNAEcfQhOIH4Fi0V+aZmQ/ARLicwDI9nnaT4l+mF3ElRsK3uCYIGsxvA +XNmJIMPZN2CQHXvdxwDM1LbGBRNNBFNVqqMRU66JRMl/uhKtvK5akD77ABCZ3GNMc MUTjPVTAaE2ZLOD+6u9vhfZeEuDIC24Q95llzRB7jVmStIAKiGhc/jRN72KIbHECzO ckGlG3snTDKxJdUupFwa/gYF6kxsXQy2MAF1sGkD7jewRJTp6ha4pF4LSpHrRlxaFh Ibqsc6EaCK+Otk7W6NaXX3UsKqD6l3Ml/T9xuvRwyDtcSFV0BFukAPyFsxMHQqjwQf iIbTWDZlZo3Xg== Received: by pali.im (Postfix) id 08BA67B3; Sat, 4 Mar 2023 11:40:01 +0100 (CET) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Martin Rowe Cc: u-boot@lists.denx.de Subject: [PATCH RFC u-boot-mvebu 2/2] arm: mvebu: spl: Load proper U-Boot from eMMC Boot 0 partition Date: Sat, 4 Mar 2023 11:38:51 +0100 Message-Id: <20230304103851.18965-3-pali@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20230304103851.18965-1-pali@kernel.org> References: <20230304103851.18965-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.6 at phobos.denx.de X-Virus-Status: Clean Boot configuration stored in EXT_CSC register is completely ignored by BootROM. So we should skip it too in SPL, to load proper U-Boot from the same location as from which was loaded SPL by BootROM. BootROM tries to boot from partitions in this order: Boot 0, Boot 1, User Data Partition. In case SPL+U-Boot is stored on Boot 1 or User Data partition then SPL code skips MMC booting (nothing is valid on Boot 0) and fallback to BootROM booting which loads proper U-Boot from correct partition (Boot 1 or User Data). Implement it via setting CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG and CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION to fixed values for mvebu. Fixes: 2f27db2fbd6e ("arm: mvebu: spl: Load proper U-Boot from selected eMMC boot partition") Signed-off-by: Pali Rohár --- arch/arm/mach-mvebu/Kconfig | 1 + arch/arm/mach-mvebu/spl.c | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig index ba40c59f4a95..dfc50ec91350 100644 --- a/arch/arm/mach-mvebu/Kconfig +++ b/arch/arm/mach-mvebu/Kconfig @@ -336,6 +336,7 @@ config MVEBU_SPL_BOOT_DEVICE_MMC imply SPL_LIBDISK_SUPPORT imply SPL_MMC select SUPPORT_EMMC_BOOT if SPL_MMC + select SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG if SPL_MMC select SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR if SPL_MMC select SPL_BOOTROM_SUPPORT diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c index 6b8c72a71dab..b20eac3dcd38 100644 --- a/arch/arm/mach-mvebu/spl.c +++ b/arch/arm/mach-mvebu/spl.c @@ -34,8 +34,7 @@ /* * 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 of Boot 0 HW partition. * 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 @@ -46,6 +45,7 @@ * Runtime mvebu SPL sector calculation code expects: * - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET=0 * - CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0 + * - CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION=1 */ #ifdef CONFIG_SPL_MMC #ifdef CONFIG_SYS_MMCSD_FS_BOOT @@ -54,11 +54,12 @@ #ifdef CONFIG_SYS_MMCSD_FS_BOOT_PARTITION #error CONFIG_SYS_MMCSD_FS_BOOT_PARTITION is unsupported #endif -#ifdef CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG -#error CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG is unsupported +#ifndef CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG +#error CONFIG_SUPPORT_EMMC_BOOT_OVERRIDE_PART_CONFIG must be enabled for SD/eMMC boot support #endif -#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION -#error CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION is unsupported +#if !defined(CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION) || \ + CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION != 1 +#error CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION must be set to 1 #endif #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION #error CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION is unsupported -- 2.20.1