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 93DB0EB64D9 for ; Thu, 6 Jul 2023 17:42:29 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A29CF86139; Thu, 6 Jul 2023 19:42:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="DMngG6Hw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2B7CA86139; Thu, 6 Jul 2023 19:42:25 +0200 (CEST) Received: from mail-yw1-x1129.google.com (mail-yw1-x1129.google.com [IPv6:2607:f8b0:4864:20::1129]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 48E0085C98 for ; Thu, 6 Jul 2023 19:42:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yw1-x1129.google.com with SMTP id 00721157ae682-5728df0a7d9so12448367b3.1 for ; Thu, 06 Jul 2023 10:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1688665341; x=1691257341; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=oP7zw0YaUd77/NHIusWKmli1iCrGYxzielElS07NKAg=; b=DMngG6HwYRa2h9JiyQcXVWbHId98RWb3Mo+mgfMmMRd1wskVYcQSxBnchCixmkkcak PcPW2/kR7dkBmJZyWCY8QpZT3QK/Zkzu4kRxN8tv2Yc04ItWkHFr6BORXU1mHImz8WIv 4kMw1sqriAKvkB6KtKe8+6TU29E0lhCljuUsQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688665341; x=1691257341; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oP7zw0YaUd77/NHIusWKmli1iCrGYxzielElS07NKAg=; b=SnhxHb2VG/bbnjQ8GKFjG5Qr7qB+H9vzFN3fqIU7udqNcq9x0EWk07JuAKmCwVTD4f 3/tV8jAckx/GtObzH+nqr7ckWXHjcikbcVJvUdkvRTe1pRyOrcbLINoqe/ShHCk14zXd We9WNnADRnfy9n2j5Rrd7NWyNGXuI77uPKn4gj2VqoLYlOtLw/a+r9HOyVoAtC/ZQwv2 27C0SaNzG7KqR2cl/RAB0LVsjNMLs87GtK6Rp+MXw+LXICfL0epO2pmgcb6PPNKALP0p M7C6m4Ep0zwtWVecbIpnvAtQyssxAinNN/EEZefxJfZzYZMQtRuyGszmhXt3EooxePyA BlYw== X-Gm-Message-State: ABy/qLYvnL9OEsCoxbXexoI4gHIwIsDXLh1zmvkOwGF8vWk2cy2E1ZPp pFkICjhpyA3WwoYZkegGcjCqRA== X-Google-Smtp-Source: APBJJlFTxrLPxXyHWIVZp31d2j4zwc9aXw4yCpa+lX35FxmaF7OiLPFQMsX2yqlUeUwvmlorNlhadQ== X-Received: by 2002:a0d:dd14:0:b0:57a:250:27ec with SMTP id g20-20020a0ddd14000000b0057a025027ecmr2452123ywe.32.1688665340929; Thu, 06 Jul 2023 10:42:20 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-8731-f9e3-ab03-9278.res6.spectrum.com. [2603:6081:7b00:6400:8731:f9e3:ab03:9278]) by smtp.gmail.com with ESMTPSA id p206-20020a8174d7000000b005704c4d3579sm488355ywc.40.2023.07.06.10.42.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 10:42:20 -0700 (PDT) Date: Thu, 6 Jul 2023 13:42:18 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Jaehoon Chung , u-boot@lists.denx.de Subject: Re: [PATCH v2 u-boot] mmc: spl: Make partition choice in default_spl_mmc_emmc_boot_partition() more explicit Message-ID: <20230706174218.GB7930@bill-the-cat> References: <20230413211057.10975-2-pali@kernel.org> <20230706173502.2796-1-pali@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qAgLFOkdnIkakPsD" Content-Disposition: inline In-Reply-To: <20230706173502.2796-1-pali@kernel.org> X-Clacks-Overhead: GNU Terry Pratchett 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 --qAgLFOkdnIkakPsD Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jul 06, 2023 at 07:35:02PM +0200, Pali Roh=E1r wrote: > To make eMMC partition choosing in default_spl_mmc_emmc_boot_partition() > function better understandable, rewrite it via explicit switch-case code > pattern. >=20 > Also add a warning when eMMC EXT_CSD[179] register is configured by user = to > value which is not suitable for eMMC booting and SPL do not know how to > interpret it. >=20 > Note that when booting from eMMC device via EXT_CSD[179] register is > explicitly disabled then SPL still loads and boots from this eMMC device > from User Area partition. This behavior was not changed in this commit and > should be revisited in the future. >=20 > Signed-off-by: Pali Roh=E1r > --- > Changes in v2: > * Disable showing warning on sama5d2_xplained due to size restrictions > --- > This patch depends on another patch: > mmc: spl: Add comments for default_spl_mmc_emmc_boot_partition() > https://patchwork.ozlabs.org/project/uboot/patch/20230404202805.8523-1-pa= li@kernel.org/ > --- > common/spl/Kconfig | 7 +++++++ > common/spl/spl_mmc.c | 46 ++++++++++++++++++++++++++++++++++++-------- > 2 files changed, 45 insertions(+), 8 deletions(-) >=20 > diff --git a/common/spl/Kconfig b/common/spl/Kconfig > index 865571d4579c..0574d22b3b25 100644 > --- a/common/spl/Kconfig > +++ b/common/spl/Kconfig > @@ -855,6 +855,13 @@ config SPL_MMC_WRITE > help > Enable write access to MMC and SD Cards in SPL > =20 > +config SPL_MMC_WARNINGS > + bool "Print MMC warnings" > + depends on SPL_MMC > + default y if !TARGET_SAMA5D2_XPLAINED > + help > + Print SPL MMC warnings. You can disable this option to reduce SPL siz= e. > + > =20 > config SPL_MPC8XXX_INIT_DDR > bool "Support MPC8XXX DDR init" > diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c > index f7a42a11477d..ec424ceded0e 100644 > --- a/common/spl/spl_mmc.c > +++ b/common/spl/spl_mmc.c > @@ -408,15 +408,45 @@ int default_spl_mmc_emmc_boot_partition(struct mmc = *mmc) > * > * Note: See difference between EXT_CSD_EXTRACT_PARTITION_ACCESS > * and EXT_CSD_EXTRACT_BOOT_PART, specially about User area value. > - * > - * FIXME: When booting from this eMMC device is explicitly > - * disabled then we use User area for booting. This is incorrect. > - * Probably we should skip this eMMC device and select the next > - * one for booting. Or at least throw warning about this fallback. > */ > - part =3D EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config); > - if (part =3D=3D 7) > - part =3D 0; > + if (mmc->part_config =3D=3D MMCPART_NOAVAILABLE) > + part =3D 0; /* If partitions are not supported then we have only User = Area partition */ > + else { > + switch(EXT_CSD_EXTRACT_BOOT_PART(mmc->part_config)) { > + case 0: /* Booting from this eMMC device is disabled */ > +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT > +#ifdef CONFIG_SPL_MMC_WARNINGS > + puts("spl: WARNING: Booting from this eMMC device is disabled in EXT_= CSD[179] register\n"); > + puts("spl: WARNING: Continuing anyway and selecting User Area partiti= on for booting\n"); > +#else > + puts("spl: mmc: fallback to user area\n"); > +#endif > +#endif > + /* FIXME: This is incorrect and probably we should select next eMMC d= evice for booting */ > + part =3D 0; > + break; > + case 1: /* Boot partition 1 is used for booting */ > + part =3D 1; > + break; > + case 2: /* Boot partition 2 is used for booting */ > + part =3D 2; > + break; > + case 7: /* User area is used for booting */ > + part =3D 0; > + break; > + default: /* Other values are reserved */ > +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT > +#ifdef CONFIG_SPL_MMC_WARNINGS > + puts("spl: WARNING: EXT_CSD[179] register is configured to boot from = Reserved value\n"); > + puts("spl: WARNING: Selecting User Area partition for booting\n"); > +#else > + puts("spl: mmc: fallback to user area\n"); > +#endif > +#endif > + part =3D 0; > + break; > + } > + } > #endif Please just use debug() for these messages. --=20 Tom --qAgLFOkdnIkakPsD Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmSm/PQACgkQFHw5/5Y0 tyzUlgwAsS+Qxjz0tYEXA7AqpAbKitNr+O1JB2Y9St6WN5KPY2pboW20/zG0deiJ tzF2FCLp48Iy3l+pp0txBLuwX1GyTrEuMC9poI20Aj9j9+oy9jt6ViUTZIKc2SLq qCUDDdywYZZJC89cG2TU7gJWqgfM2OdMpQsK4IgKK5DQ3Y50OBAsxLANB7TYSIGv /1xi1medzzQjA4t5lrculW4Lrq32h1Cnnw6vdI6N3TwJZIOHLE4xGZi7ngOPwc6D P/nsdyltVBUYMPy/Db3j6+/CKdxyjdnQFQvtZiMboEWz2YM3lAUZyiLJRAcj99qZ id8ZTKv8rnMvf4TavnYD3+JV2KnXBGRWV7ImxkwK62vjvkiL6TXMz82gabJxB5Cg fRrxtSmumz1ecV+hRvKuYcO4pgy139uVocEWA9NTcCBd/naMSRgEZlq7r2RU+1qP aS9rnVPr0b8nTidbK8NR76waeaIaEEx0ukwSdhRb8UDCaYhbe771Ld8m0Ojpr2p+ hfKLPGp2 =/nCM -----END PGP SIGNATURE----- --qAgLFOkdnIkakPsD--