From: Baruch Siach <baruch@tkos.co.il>
To: "Pali Rohár" <pali@kernel.org>
Cc: "Stefan Roese" <sr@denx.de>, "Andre Heider" <a.heider@gmail.com>,
"Gérald Kerma" <gerald@gk2.net>,
"Konstantin Porotchkin" <kostap@marvell.com>,
"Fabio Estevam" <festevam@gmail.com>,
"Peng Fan" <peng.fan@nxp.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC
Date: Thu, 15 Jul 2021 08:39:05 +0300 [thread overview]
Message-ID: <87lf68rv9i.fsf@tarshish> (raw)
In-Reply-To: <20210714143729.2396-3-pali@kernel.org>
Hi Pali,
On Wed, Jul 14 2021, Pali Rohár wrote:
> Add a new 'quiet' argument to mmc_get_op_cond() function which avoids
> printing error message when SD/eMMC card is not detected.
>
> Espressobin and mx6cuboxi boards use this function for detecting presence
> of eMMC and therefore it is expected and normal that eMMC does not have to
> be connected. So error message "Card did not respond to voltage select!"
> should be skipped in this case as it is not an error.
>
> Signed-off-by: Pali Rohár <pali@kernel.org>
> ---
> board/Marvell/mvebu_armada-37xx/board.c | 2 +-
Ordering this patch before #2 would make it smaller.
baruch
> board/solidrun/mx6cuboxi/mx6cuboxi.c | 2 +-
> drivers/mmc/mmc.c | 7 ++++---
> include/mmc.h | 3 ++-
> 4 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index 6086996b8062..fdc873b1952f 100644
> --- a/board/Marvell/mvebu_armada-37xx/board.c
> +++ b/board/Marvell/mvebu_armada-37xx/board.c
> @@ -124,7 +124,7 @@ int board_late_init(void)
>
> /* eMMC is mmc dev num 1 */
> mmc_dev = find_mmc_device(1);
> - emmc = (mmc_dev && mmc_get_op_cond(mmc_dev) == 0);
> + emmc = (mmc_dev && mmc_get_op_cond(mmc_dev, true) == 0);
>
> /* if eMMC is not present then remove it from DM */
> if (!emmc && mmc_dev) {
> diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> index 3eadc38f6fd4..6207bf8253ab 100644
> --- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
> +++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
> @@ -374,7 +374,7 @@ static bool has_emmc(void)
> mmc = find_mmc_device(2);
> if (!mmc)
> return 0;
> - return (mmc_get_op_cond(mmc) < 0) ? 0 : 1;
> + return (mmc_get_op_cond(mmc, true) < 0) ? 0 : 1;
> }
>
> int checkboard(void)
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 1e83007286b2..8078a89f18cb 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -2766,7 +2766,7 @@ static int mmc_power_cycle(struct mmc *mmc)
> return mmc_power_on(mmc);
> }
>
> -int mmc_get_op_cond(struct mmc *mmc)
> +int mmc_get_op_cond(struct mmc *mmc, bool quiet)
> {
> bool uhs_en = supports_uhs(mmc->cfg->host_caps);
> int err;
> @@ -2842,7 +2842,8 @@ retry:
>
> if (err) {
> #if !defined(CONFIG_SPL_BUILD) || defined(CONFIG_SPL_LIBCOMMON_SUPPORT)
> - pr_err("Card did not respond to voltage select! : %d\n", err);
> + if (!quiet)
> + pr_err("Card did not respond to voltage select! : %d\n", err);
> #endif
> return -EOPNOTSUPP;
> }
> @@ -2882,7 +2883,7 @@ int mmc_start_init(struct mmc *mmc)
> return -ENOMEDIUM;
> }
>
> - err = mmc_get_op_cond(mmc);
> + err = mmc_get_op_cond(mmc, false);
>
> if (!err)
> mmc->init_in_progress = 1;
> diff --git a/include/mmc.h b/include/mmc.h
> index 6f943e78b740..0bf19de20e52 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -900,9 +900,10 @@ int mmc_set_bkops_enable(struct mmc *mmc);
> * the presence of SD/eMMC when no card detect logic is available.
> *
> * @param mmc Pointer to a MMC device struct
> + * @param quiet Be quiet, do not print error messages when card is not detected.
> * @return 0 on success, <0 on error.
> */
> -int mmc_get_op_cond(struct mmc *mmc);
> +int mmc_get_op_cond(struct mmc *mmc, bool quiet);
>
> /**
> * Start device initialization and return immediately; it does not block on
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
next prev parent reply other threads:[~2021-07-15 5:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 14:37 [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env Pali Rohár
2021-07-14 14:37 ` [PATCH 2/3] arm: mvebu: Espressobin: Use function mmc_get_op_cond() for detecting eMMC Pali Rohár
2021-07-15 8:02 ` Stefan Roese
2021-07-14 14:37 ` [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC Pali Rohár
2021-07-15 5:39 ` Baruch Siach [this message]
2021-07-15 8:03 ` Stefan Roese
2021-07-15 8:20 ` Stefan Roese
2021-07-15 8:41 ` Jaehoon Chung
2021-07-15 8:02 ` [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env Stefan Roese
2021-07-15 10:32 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87lf68rv9i.fsf@tarshish \
--to=baruch@tkos.co.il \
--cc=a.heider@gmail.com \
--cc=festevam@gmail.com \
--cc=gerald@gk2.net \
--cc=kostap@marvell.com \
--cc=pali@kernel.org \
--cc=peng.fan@nxp.com \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox