diff mbox series

[1/2] arm: mach-snapdragon: misc: Initialize eMMC if necessary

Message ID 20210802145231.85305-1-stephan@gerhold.net
State Superseded
Delegated to: Tom Rini
Headers show
Series [1/2] arm: mach-snapdragon: misc: Initialize eMMC if necessary | expand

Commit Message

Stephan Gerhold Aug. 2, 2021, 2:52 p.m. UTC
At the moment U-Boot produces an empty MAC address (02:00:00:00:00:00)
if the eMMC is not used by anything in U-Boot (e.g. with
CONFIG_ENV_IS_NOWHERE=y instead of having the environment on eMMC).
This happens because then there is nothing that actually initializes
the eMMC and reads the "cid" that is later accessed.

To fix this, call mmc_init() to ensure the eMMC is initialized.
There is no functional difference if the eMMC is already initialized
since then mmc_init() will just return without doing anything.

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---

 arch/arm/mach-snapdragon/misc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ramon Fried Aug. 2, 2021, 11:14 p.m. UTC | #1
On Mon, Aug 2, 2021 at 5:52 PM Stephan Gerhold <stephan@gerhold.net> wrote:
>
> At the moment U-Boot produces an empty MAC address (02:00:00:00:00:00)
> if the eMMC is not used by anything in U-Boot (e.g. with
> CONFIG_ENV_IS_NOWHERE=y instead of having the environment on eMMC).
> This happens because then there is nothing that actually initializes
> the eMMC and reads the "cid" that is later accessed.
>
> To fix this, call mmc_init() to ensure the eMMC is initialized.
> There is no functional difference if the eMMC is already initialized
> since then mmc_init() will just return without doing anything.
>
> Cc: Ramon Fried <rfried.dev@gmail.com>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
>
>  arch/arm/mach-snapdragon/misc.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm/mach-snapdragon/misc.c b/arch/arm/mach-snapdragon/misc.c
> index aaa561c2c6..5c062e9636 100644
> --- a/arch/arm/mach-snapdragon/misc.c
> +++ b/arch/arm/mach-snapdragon/misc.c
> @@ -33,6 +33,9 @@ u32 msm_board_serial(void)
>         if (!mmc_dev)
>                 return 0;
>
> +       if (mmc_init(mmc_dev))
> +               return 0;
> +
>         return UNSTUFF_BITS(mmc_dev->cid, 16, 32);
>  }
>
> --
> 2.32.0
>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
diff mbox series

Patch

diff --git a/arch/arm/mach-snapdragon/misc.c b/arch/arm/mach-snapdragon/misc.c
index aaa561c2c6..5c062e9636 100644
--- a/arch/arm/mach-snapdragon/misc.c
+++ b/arch/arm/mach-snapdragon/misc.c
@@ -33,6 +33,9 @@  u32 msm_board_serial(void)
 	if (!mmc_dev)
 		return 0;
 
+	if (mmc_init(mmc_dev))
+		return 0;
+
 	return UNSTUFF_BITS(mmc_dev->cid, 16, 32);
 }