All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env
@ 2021-07-14 14:37 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
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Pali Rohár @ 2021-07-14 14:37 UTC (permalink / raw)
  To: Stefan Roese, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

Ensure that 'env default -a' always set correct value to $fdtfile, even
when custom user variable is already stored in non-volatile env storage
(means that env_get("fdtfile") call returns non-NULL value).

As default value is now correctly set like if specified at compile time in
CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
env_set("fdtfile", ...) call.

So remove wrong skip based on env_get("fdtfile") and then also unneeded
env_set("fdtfile", ...) call.

Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/Marvell/mvebu_armada-37xx/board.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index 6a0e2fc3cd8f..53408d37af9b 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -133,9 +133,6 @@ int board_late_init(void)
 		device_unbind(dev);
 	}
 
-	if (env_get("fdtfile"))
-		return 0;
-
 	/* Ensure that 'env default -a' set correct value to $fdtfile */
 	if (ddr4 && emmc)
 		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
@@ -146,10 +143,6 @@ int board_late_init(void)
 	else
 		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
 
-	/* If $fdtfile was not set explicitly by user then set default value */
-	if (!env_get("fdtfile"))
-		env_set("fdtfile", ptr + sizeof("fdtfile="));
-
 	return 0;
 }
 #endif
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3] arm: mvebu: Espressobin: Use function mmc_get_op_cond() for detecting eMMC
  2021-07-14 14:37 [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env Pali Rohár
@ 2021-07-14 14:37 ` 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
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Pali Rohár @ 2021-07-14 14:37 UTC (permalink / raw)
  To: Stefan Roese, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

Use function mmc_get_op_cond() instead of mmc_init() for detecting presence
of eMMC. Documentation for this function says that it could be used to
detect the presence of SD/eMMC when no card detect logic is available.

This function is also used by mx6cuboxi board for detecting presence of eMMC.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 board/Marvell/mvebu_armada-37xx/board.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index 53408d37af9b..6086996b8062 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_init(mmc_dev) == 0);
+	emmc = (mmc_dev && mmc_get_op_cond(mmc_dev) == 0);
 
 	/* if eMMC is not present then remove it from DM */
 	if (!emmc && mmc_dev) {
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC
  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-14 14:37 ` Pali Rohár
  2021-07-15  5:39   ` Baruch Siach
  2021-07-15  8:03   ` Stefan Roese
  2021-07-15  8:02 ` [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env Stefan Roese
  2021-07-15 10:32 ` Stefan Roese
  3 siblings, 2 replies; 10+ messages in thread
From: Pali Rohár @ 2021-07-14 14:37 UTC (permalink / raw)
  To: Stefan Roese, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

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 +-
 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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC
  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
  2021-07-15  8:03   ` Stefan Roese
  1 sibling, 0 replies; 10+ messages in thread
From: Baruch Siach @ 2021-07-15  5:39 UTC (permalink / raw)
  To: Pali Rohár
  Cc: Stefan Roese, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Fabio Estevam, Peng Fan, u-boot

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 -

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env
  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-14 14:37 ` [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC Pali Rohár
@ 2021-07-15  8:02 ` Stefan Roese
  2021-07-15 10:32 ` Stefan Roese
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2021-07-15  8:02 UTC (permalink / raw)
  To: Pali Rohár, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

On 14.07.21 16:37, Pali Rohár wrote:
> Ensure that 'env default -a' always set correct value to $fdtfile, even
> when custom user variable is already stored in non-volatile env storage
> (means that env_get("fdtfile") call returns non-NULL value).
> 
> As default value is now correctly set like if specified at compile time in
> CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
> env_set("fdtfile", ...) call.
> 
> So remove wrong skip based on env_get("fdtfile") and then also unneeded
> env_set("fdtfile", ...) call.
> 
> Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index 6a0e2fc3cd8f..53408d37af9b 100644
> --- a/board/Marvell/mvebu_armada-37xx/board.c
> +++ b/board/Marvell/mvebu_armada-37xx/board.c
> @@ -133,9 +133,6 @@ int board_late_init(void)
>   		device_unbind(dev);
>   	}
>   
> -	if (env_get("fdtfile"))
> -		return 0;
> -
>   	/* Ensure that 'env default -a' set correct value to $fdtfile */
>   	if (ddr4 && emmc)
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
> @@ -146,10 +143,6 @@ int board_late_init(void)
>   	else
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
>   
> -	/* If $fdtfile was not set explicitly by user then set default value */
> -	if (!env_get("fdtfile"))
> -		env_set("fdtfile", ptr + sizeof("fdtfile="));
> -
>   	return 0;
>   }
>   #endif
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3] arm: mvebu: Espressobin: Use function mmc_get_op_cond() for detecting eMMC
  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
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2021-07-15  8:02 UTC (permalink / raw)
  To: Pali Rohár, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

On 14.07.21 16:37, Pali Rohár wrote:
> Use function mmc_get_op_cond() instead of mmc_init() for detecting presence
> of eMMC. Documentation for this function says that it could be used to
> detect the presence of SD/eMMC when no card detect logic is available.
> 
> This function is also used by mx6cuboxi board for detecting presence of eMMC.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index 53408d37af9b..6086996b8062 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_init(mmc_dev) == 0);
> +	emmc = (mmc_dev && mmc_get_op_cond(mmc_dev) == 0);
>   
>   	/* if eMMC is not present then remove it from DM */
>   	if (!emmc && mmc_dev) {
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC
  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
@ 2021-07-15  8:03   ` Stefan Roese
  2021-07-15  8:20     ` Stefan Roese
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Roese @ 2021-07-15  8:03 UTC (permalink / raw)
  To: Pali Rohár, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

On 14.07.21 16:37, 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>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 2 +-
>   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
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC
  2021-07-15  8:03   ` Stefan Roese
@ 2021-07-15  8:20     ` Stefan Roese
  2021-07-15  8:41       ` Jaehoon Chung
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Roese @ 2021-07-15  8:20 UTC (permalink / raw)
  To: Pali Rohár, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan,
	Jaehoon Chung
  Cc: u-boot

(added Jaehoon as MMC co-maintainer)

On 15.07.21 10:03, Stefan Roese wrote:
> On 14.07.21 16:37, 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>
> 
> Reviewed-by: Stefan Roese <sr@denx.de>

Peng, Jaehoon are you okay with this patch? If yes, is it okay that
I will pull it via the marvell tree?

Thanks,
Stefan

> Thanks,
> Stefan
> 
>> ---
>>   board/Marvell/mvebu_armada-37xx/board.c | 2 +-
>>   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
>>
> 
> 
> Viele Grüße,
> Stefan
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3] mmc: mmc_get_op_cond: Allow quiet detection of eMMC
  2021-07-15  8:20     ` Stefan Roese
@ 2021-07-15  8:41       ` Jaehoon Chung
  0 siblings, 0 replies; 10+ messages in thread
From: Jaehoon Chung @ 2021-07-15  8:41 UTC (permalink / raw)
  To: Stefan Roese, Pali Rohár, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

Hi Stefan,

On 7/15/21 5:20 PM, Stefan Roese wrote:
> (added Jaehoon as MMC co-maintainer)
> 
> On 15.07.21 10:03, Stefan Roese wrote:
>> On 14.07.21 16:37, 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>
>>
>> Reviewed-by: Stefan Roese <sr@denx.de>
> 
> Peng, Jaehoon are you okay with this patch? If yes, is it okay that
> I will pull it via the marvell tree?

I don't have any objection.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

Best Regards,
Jaehoon Chung

> 
> Thanks,
> Stefan
> 
>> Thanks,
>> Stefan
>>
>>> ---
>>>   board/Marvell/mvebu_armada-37xx/board.c | 2 +-
>>>   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
>>>
>>
>>
>> Viele Grüße,
>> Stefan
>>
> 
> 
> Viele Grüße,
> Stefan
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env
  2021-07-14 14:37 [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env Pali Rohár
                   ` (2 preceding siblings ...)
  2021-07-15  8:02 ` [PATCH 1/3] arm: mvebu: Espressobin: Fix setting $fdtfile env Stefan Roese
@ 2021-07-15 10:32 ` Stefan Roese
  3 siblings, 0 replies; 10+ messages in thread
From: Stefan Roese @ 2021-07-15 10:32 UTC (permalink / raw)
  To: Pali Rohár, Andre Heider, Gérald Kerma,
	Konstantin Porotchkin, Baruch Siach, Fabio Estevam, Peng Fan
  Cc: u-boot

On 14.07.21 16:37, Pali Rohár wrote:
> Ensure that 'env default -a' always set correct value to $fdtfile, even
> when custom user variable is already stored in non-volatile env storage
> (means that env_get("fdtfile") call returns non-NULL value).
> 
> As default value is now correctly set like if specified at compile time in
> CONFIG_EXTRA_ENV_SETTINGS, there is no need to set $fdtfile explicitly via
> env_set("fdtfile", ...) call.
> 
> So remove wrong skip based on env_get("fdtfile") and then also unneeded
> env_set("fdtfile", ...) call.
> 
> Fixes: c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable")
> Signed-off-by: Pali Rohár <pali@kernel.org>

All patches:

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
>   board/Marvell/mvebu_armada-37xx/board.c | 7 -------
>   1 file changed, 7 deletions(-)
> 
> diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
> index 6a0e2fc3cd8f..53408d37af9b 100644
> --- a/board/Marvell/mvebu_armada-37xx/board.c
> +++ b/board/Marvell/mvebu_armada-37xx/board.c
> @@ -133,9 +133,6 @@ int board_late_init(void)
>   		device_unbind(dev);
>   	}
>   
> -	if (env_get("fdtfile"))
> -		return 0;
> -
>   	/* Ensure that 'env default -a' set correct value to $fdtfile */
>   	if (ddr4 && emmc)
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin-v7-emmc.dtb");
> @@ -146,10 +143,6 @@ int board_late_init(void)
>   	else
>   		strcpy(ptr, "fdtfile=marvell/armada-3720-espressobin.dtb");
>   
> -	/* If $fdtfile was not set explicitly by user then set default value */
> -	if (!env_get("fdtfile"))
> -		env_set("fdtfile", ptr + sizeof("fdtfile="));
> -
>   	return 0;
>   }
>   #endif
> 


Viele Grüße,
Stefan

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-07-15 10:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.