From patchwork Thu Apr 13 20:57:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1768647 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=jtsbc3Ht; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PyBlY73Yfz1yZr for ; Fri, 14 Apr 2023 06:59:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A602685D68; Thu, 13 Apr 2023 22:59:04 +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="jtsbc3Ht"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6F44F85D13; Thu, 13 Apr 2023 22:58:56 +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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 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 71C6085D6B 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 818F7641AD; Thu, 13 Apr 2023 20:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EC9EC433D2; 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=1681419528; bh=nnqDVqw8CNBIbPrZYEv5mMJ8WEhFVcHTLtcwn7QqeiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtsbc3HthHJHNFKvA5TvoX18lJuetfwsqmK5B2hILv9SEg0tG9TdyvK/GPN0MHjih cHLh2TQkKDIQ40+xV9Um+CMIY5fgxqesqib/N6Uid9HJPwPe2QciBEjToCDU3k4LXd X2qtHv8TeYKVS/v2jgILzjqqSFOgrYSgN87B7Tx0KaOObFEbV8DIoEFKpK61wrVwyH ar7enPtAOXuIxA//d1CircEtWtVeKKB/5yPTzME2tdyhIl0xQ4K5ed0kHujoXMCtgI O5TMPi3CKZod9Iwgyc1YIAgHNkQUb+3beUH+ffww4dOVRsLhA4ZEAyTIrqFGBtvAXu Db4ObXRHRi6VQ== Received: by pali.im (Postfix) id 7E778CC2; Thu, 13 Apr 2023 22:58:46 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Stefan Roese Cc: Martin Rowe , u-boot@lists.denx.de Subject: [PATCH v2 u-boot-mvebu 1/4] tools: kwboot: Fix MMC partitions documentation Date: Thu, 13 Apr 2023 22:57:47 +0200 Message-Id: <20230413205750.10641-2-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 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 Boot configuration stored in EXT_CSD_PART_CONF register is completely ignored by BootROM. Fixes: fa03279e198d ("tools: kwboot: Add image type documentation") Signed-off-by: Pali Rohár --- tools/kwboot.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/kwboot.c b/tools/kwboot.c index 6bef4610ff8f..550d2494ff68 100644 --- a/tools/kwboot.c +++ b/tools/kwboot.c @@ -119,9 +119,12 @@ * 1024 bytes long sector sizes and also can be changed at runtime. * * For MMC-compatible devices, image can be stored at offset 0 or at offset - * 2 MB. If MMC device supports HW boot partitions then image must be stored - * on the HW partition as is configured in the EXT_CSC register (it can be - * either boot or user data). + * 2 MB. If eMMC device supports HW/boot partitions then image is read from + * partitions in following order: Boot 1, Boot 2, RPMB, GP 1, GP 2, GP 3, + * GP 4, User Data, Boot 1, Boot 2. (Boot 1 and Boot 2 are really repeated). + * Boot configuration stored in EXT_CSD_PART_CONF eMMC register is completely + * ignored by the BootROM. But it sets PARTITION_ACCESS bits of that register + * to the selected partition from which it loaded image. * * Note that source address for SDIO image is stored in byte unit, like for * any other images (except SATA). Marvell Functional Specifications for From patchwork Thu Apr 13 20:57:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1768649 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=LywF6GK6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PyBlz1K5vz1yZr for ; Fri, 14 Apr 2023 06:59:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F6F385E02; Thu, 13 Apr 2023 22:59:18 +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="LywF6GK6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3D94385ABA; Thu, 13 Apr 2023 22:58:59 +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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 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 C597D85DB6 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 A3DBA641B0; Thu, 13 Apr 2023 20:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AACC7C4339B; 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=1681419528; bh=XU+YFJEd9iRrDT7/lWfSNwLDGpbm++zowCm5p9KH3Kk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LywF6GK6hj/ghV9urr2uKnedWKta13DJckiK4XBEmqByp+1TEqZ75fL8YV+C5SDgu bzoRi5IWkalqOPJgulZgj8bkbWsDZm1oXgZJmksNeQE31rSRCMmLAl3dsk0lNt19Ff rEoJ+3Oszg+vm1ESGwPWeZS6xiQ0Z0Uf/79p8yeW6cOwOg08ZllreRS6JA67pqc0Mk mFXN5+IrkySaeM+FfusjXmb+6XzZY1r9yh7xGbZ7CHNAJg8DgDA+pSB15jySWLY/sC oPMK4vL3UKI+6DtYJk7gZJWZ+4glVecfom087ZNgTPJoYddgKc69xwThMuVZy7fQYp ugqUULUPxdQGg== Received: by pali.im (Postfix) id A6954E10; Thu, 13 Apr 2023 22:58:46 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Stefan Roese Cc: Martin Rowe , u-boot@lists.denx.de Subject: [PATCH v2 u-boot-mvebu 2/4] mmc: Read eMMC partition access bits before card reset Date: Thu, 13 Apr 2023 22:57:48 +0200 Message-Id: <20230413205750.10641-3-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 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 eMMC specification in section "Access partitions" says that all reset events will restore the access bits in PARTITION_CONFIG CSD register to default User Data Area value (0b000). So read partition access bits from PARTITION_CONFIG CSD register before issuing card reset. This allows SPL/U-Boot to get information which eMMC partition was in use before SPL/U-Boot was booted. For some platforms this is the way how to determinate boot partition from which BootROM loaded SPL. Signed-off-by: Pali Rohár --- drivers/mmc/mmc.c | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index dde251c87bc7..771432de354d 100644 --- a/drivers/mmc/mmc.c +++ b/drivers/mmc/mmc.c @@ -2329,8 +2329,17 @@ static int mmc_startup_v4(struct mmc *mmc) /* store the partition info of emmc */ mmc->part_support = ext_csd[EXT_CSD_PARTITIONING_SUPPORT]; if ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) || - ext_csd[EXT_CSD_BOOT_MULT]) - mmc->part_config = ext_csd[EXT_CSD_PART_CONF]; + ext_csd[EXT_CSD_BOOT_MULT]) { + /* + * At this stage PART_ACCESS_MASK bits in ext_csd[] are already cleared. + * But it is possible that they were already filled into mmc->part_config. + */ + if (mmc->part_config == MMCPART_NOAVAILABLE) + mmc->part_config = ext_csd[EXT_CSD_PART_CONF]; + else + mmc->part_config = (ext_csd[EXT_CSD_PART_CONF] & ~PART_ACCESS_MASK) | + (mmc->part_config & PART_ACCESS_MASK); + } if (part_completed && (ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & ENHNCD_SUPPORT)) mmc->part_attr = ext_csd[EXT_CSD_PARTITIONS_ATTRIBUTE]; @@ -2600,7 +2609,6 @@ static int mmc_startup(struct mmc *mmc) #if CONFIG_IS_ENABLED(MMC_WRITE) mmc->erase_grp_size = 1; #endif - mmc->part_config = MMCPART_NOAVAILABLE; err = mmc_startup_v4(mmc); if (err) @@ -2848,9 +2856,26 @@ int mmc_get_op_cond(struct mmc *mmc, bool quiet) return err; mmc->ddr_mode = 0; + mmc->part_config = MMCPART_NOAVAILABLE; + retry: mmc_set_initial_state(mmc); + /* + * Read partition access bits from partition config register before card reset command + * because these bits are reset to default value (User Data Area) during card reset. + * This allows us to preserve original value of partition access bits used by the code + * which loaded us (for example BootROM) and use it for board specific boot purposes. + */ + if (mmc->part_config == MMCPART_NOAVAILABLE) { + ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, MMC_MAX_BLOCK_LEN); + err = mmc_send_ext_csd(mmc, ext_csd); + if (err == 0 && + ((ext_csd[EXT_CSD_PARTITIONING_SUPPORT] & PART_SUPPORT) || + ext_csd[EXT_CSD_BOOT_MULT])) + mmc->part_config = ext_csd[EXT_CSD_PART_CONF] & PART_ACCESS_MASK; + } + /* Reset the Card */ err = mmc_go_idle(mmc); From patchwork Thu Apr 13 20:57:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1768650 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=COdSa2Bu; dkim-atps=neutral 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 ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PyBmB0WGmz1yZr for ; Fri, 14 Apr 2023 06:59:54 +1000 (AEST) 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) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 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_Roh=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 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) { From patchwork Thu Apr 13 20:57:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Pali_Roh=C3=A1r?= X-Patchwork-Id: 1768648 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.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: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=o+EVo5ay; dkim-atps=neutral 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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4PyBlp1D7Vz1yZr for ; Fri, 14 Apr 2023 06:59:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 045A085DA9; Thu, 13 Apr 2023 22:59:10 +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="o+EVo5ay"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 89CE185ABA; Thu, 13 Apr 2023 22:58:56 +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=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (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 44DAE85D68 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 D4EF6641B2; Thu, 13 Apr 2023 20:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFACCC4339C; 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=rH5FPopY37CnhZTwFL7edFqwb+JUHpiXQSQbRyKTIrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o+EVo5ayKlD9ImVmLQfx3jPaIT8E6kcFFPIQZEljKqckKON/Xr20UqGz3ay8Iyn4t PZhZ+45nFpZHwzPWcZraRfD3Dvh+BFwR/rEBrgDgx+PuAVdUh8UsTLmRcFBmlyJwe4 7uyENKykI3FcSxNvZtfg9YKnKl/BigQT2U4DDtyBoeAGH/GwXAOlA+vgDNuHUIFOeG XlFXVIgNC9pOO+jx1SNFDBfI1tnwlYaVdocho99OqY35TmWx4IBzo3SYDKpzUyJPkG bBusH3uzr9HxHjuxyjLbEEsx/Btidfmqk+EuvZ2Rv8o3Vo+8OFy31SeB+/hJeUVPiI A5b86lBIWlFng== Received: by pali.im (Postfix) id E954212C1; Thu, 13 Apr 2023 22:58:46 +0200 (CEST) From: =?utf-8?q?Pali_Roh=C3=A1r?= To: Stefan Roese Cc: Martin Rowe , u-boot@lists.denx.de Subject: [PATCH v2 u-boot-mvebu 4/4] arm: mvebu: clearfog: Update eMMC/SD/SATA instructions Date: Thu, 13 Apr 2023 22:57:50 +0200 Message-Id: <20230413205750.10641-5-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 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 BootROM and neither SPL does not use eMMC boot acknowledgement or boot enable bits in EXT_CSD_PART_CONF eMMC register. And also fixed SATA disk sector 0x141 is not used at all. Signed-off-by: Pali Rohár Tested-by: Martin Rowe --- board/solidrun/clearfog/README | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README index ed4a712c5aa2..c86b37061a30 100644 --- a/board/solidrun/clearfog/README +++ b/board/solidrun/clearfog/README @@ -1,7 +1,7 @@ Update from original Marvell U-Boot to mainline U-Boot: ------------------------------------------------------- -Generate the U-Boot image with these commands: +Generate the U-Boot image for eMMC/SD with these commands: $ make clearfog_defconfig $ make @@ -9,7 +9,7 @@ $ make The resulting image including the SPL binary with the full DDR setup is "u-boot-with-spl.kwb". -Now all you need to do is copy this image on a SD card. +Now all you need to do is copy this image on a SD card's sector 1. For example with this command: $ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1 @@ -20,12 +20,6 @@ of "/dev/sdX" here! Install U-Boot on eMMC: ----------------------- -To make SPL load the main U-Boot image from the eMMC boot partition enable -eMMC boot acknowledgement and boot partition with the following U-Boot -command: - - mmc partconf 0 1 1 0 - Install U-Boot on eMMC boot partition from Linux running on Clearfog: echo 0 > /sys/block/mmcblk0boot0/force_ro @@ -37,8 +31,14 @@ Consider initial boot from UART (see below). Install U-Boot on SATA: ----------------------- -When loading the main U-Boot image from raw SATA sector, set -CONFIG_SPL_SATA_RAW_U_BOOT_SECTOR to 0x141. +Generate the U-Boot image for SATA with these commands: + +$ make clearfog_sata_defconfig +$ make + +Copy image on a SATA disk's sector 1: + +$ sudo dd if=u-boot-with-spl.kwb of=/dev/sdX bs=512 seek=1 Boot selection: ---------------