Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 470E3C4338F for ; Tue, 3 Aug 2021 10:12:56 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 80B8460EEA for ; Tue, 3 Aug 2021 10:12:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 80B8460EEA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 45BBC82DD6; Tue, 3 Aug 2021 12:12:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gerhold.net header.i=@gerhold.net header.b="oecJbu9h"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0897182DE4; Tue, 3 Aug 2021 12:12:50 +0200 (CEST) Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [85.215.255.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D40C581BDA for ; Tue, 3 Aug 2021 12:12:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gerhold.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=stephan@gerhold.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1627985565; s=strato-dkim-0002; d=gerhold.net; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=z0rMY0OXDjwVczSoZm+M478PzwIppfnoqTXNpcttU3g=; b=oecJbu9huSM9KAFGZ0nXizasoZ8klZis07WsoJICv/RBPCn+v15nuTAV5uIKn7tcPn 6/KbT1+ubvvtKkL5sLXOskHTRY/xvJ1qwEfGJ0uQ0lOAQiFBn5QOEU7JutMp44POmv4p F4lS8CQFVoq0D4I93yXImXf5cfSNOw/fBjU7vyZX5eOrViPlhX4FfcuhuP7RoptyvUqQ qPLywwggX3lkp/z0k+m6gHzsEBWjSocDRrL9Xa35/c+oRlLYVvMtZ0Q4PshcrwoM9Wre /0DIH8Poz8wElhj0wGCy1mbIb4w2nbDvwTcJN32o0Wrt/YiUzfAoF2dfVm9ET7JY2Aj8 AHJQ== Authentication-Results: strato.com; dkim=none X-RZG-AUTH: ":P3gBZUipdd93FF5ZZvYFPugejmSTVR2nRPhVORvLd4SsytBXTbAOHjRHIhr0eFeAWj8=" X-RZG-CLASS-ID: mo00 Received: from droid.. by smtp.strato.de (RZmta 47.30.1 DYNA|AUTH) with ESMTPSA id D01bd0x73ACj3hp (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 3 Aug 2021 12:12:45 +0200 (CEST) From: Stephan Gerhold To: u-boot@lists.denx.de Cc: Stephan Gerhold , Ramon Fried , Tom Rini Subject: [PATCH v2 1/2] arm: mach-snapdragon: misc: Initialize eMMC if necessary Date: Tue, 3 Aug 2021 12:12:37 +0200 Message-Id: <20210803101238.35596-1-stephan@gerhold.net> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean 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. Reviewed-by: Ramon Fried Signed-off-by: Stephan Gerhold --- (no changes since v1) 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 985625a548..fbd5f4d051 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