From patchwork Mon Dec 7 17:15:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 1412139 X-Patchwork-Delegate: narmstrong@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=agner.ch header.i=@agner.ch header.a=rsa-sha256 header.s=dkim header.b=sKfAPdcw; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CqVLw4DyDz9sW8 for ; Tue, 8 Dec 2020 04:15:36 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1F2C082637; Mon, 7 Dec 2020 18:15:33 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch 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=agner.ch header.i=@agner.ch header.b="sKfAPdcw"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D02D982641; Mon, 7 Dec 2020 18:15:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) (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 5CFF38232D for ; Mon, 7 Dec 2020 18:15:29 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=agner.ch Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=stefan@agner.ch Received: from allenwind.lan (unknown [IPv6:2a02:169:3df5:0:6d9:f5ff:fe22:28bf]) by mail.kmu-office.ch (Postfix) with ESMTPSA id D0C085C0054; Mon, 7 Dec 2020 18:15:28 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1607361328; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=bw2aVtsXrOx0jDtoEYEL//WE69PbmHuJZDXVPEtFi+A=; b=sKfAPdcwSPs/r0UcgAatxr1PdO8etBh2rmWgq0c5fDn59DRfAtcwVlbTsfgV7XvnF1SGOV 8eo24OzZuCTuptClRby4ACbalp63a+RahEpZM4zoMfOcgqaQRdNC+IerwMpw4h+irRLCiz zVedm3ecMgq4/Ixbd4IGnpmUJCTHEZ4= From: Stefan Agner To: narmstrong@baylibre.com Cc: peng.fan@nxp.com, u-boot-amlogic@groups.io, u-boot@lists.denx.de, Stefan Agner Subject: [PATCH] mmc: meson-gx: change clock phase value on AGX SoCs Date: Mon, 7 Dec 2020 18:15:27 +0100 Message-Id: <132c6c42aee5b4f34aca3a629423641c78302ce0.1607361086.git.stefan@agner.ch> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 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.102.3 at phobos.denx.de X-Virus-Status: Clean Amlogic AGX SoCs seem to have issue communicating with some eMMC devices (in particular with a Micron 128GB eMMC 5.1). The device is detected with 1-bit bus width, and at higher temperature loading pretty much anything from the storage fails: (e.g. fs_devread read error - block). When phase is set to 270° it is detected with 8-bit bus width and is working fine accross all temperatures. Signed-off-by: Stefan Agner --- Hi Neil, I debugged this issue today on an ODROID N2+ not booting reliably. I am not sure if we can safely switch to 270° for all SoCs with amlogic,meson-axg-mmc, but I guess we have to try and see what happens? I will do a bit broader testing in the comming days here. Btw, I do see that 180° is also set in Linux. Do you have a patch to address this in Linux? -- Stefan arch/arm/include/asm/arch-meson/sd_emmc.h | 1 + drivers/mmc/meson_gx_mmc.c | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h b/arch/arm/include/asm/arch-meson/sd_emmc.h index cb16f75fc6..db5e058098 100644 --- a/arch/arm/include/asm/arch-meson/sd_emmc.h +++ b/arch/arm/include/asm/arch-meson/sd_emmc.h @@ -14,6 +14,7 @@ enum meson_gx_mmc_compatible { MMC_COMPATIBLE_GX, + MMC_COMPATIBLE_AGX, MMC_COMPATIBLE_SM1, }; diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c index 5facbfdd9a..2c27113c10 100644 --- a/drivers/mmc/meson_gx_mmc.c +++ b/drivers/mmc/meson_gx_mmc.c @@ -64,14 +64,15 @@ static void meson_mmc_config_clock(struct mmc *mmc) /* * SM1 SoCs doesn't work fine over 50MHz with CLK_CO_PHASE_180 + * AGX SoCs don't work reliable with some eMMCs with CLK_CO_PHASE_180 * If CLK_CO_PHASE_270 is used, it's more stable than other. * Other SoCs use CLK_CO_PHASE_180 by default. * It needs to find what is a proper value about each SoCs. */ - if (meson_gx_mmc_is_compatible(mmc->dev, MMC_COMPATIBLE_SM1)) - meson_mmc_clk |= CLK_CO_PHASE_270; - else + if (meson_gx_mmc_is_compatible(mmc->dev, MMC_COMPATIBLE_GX)) meson_mmc_clk |= CLK_CO_PHASE_180; + else + meson_mmc_clk |= CLK_CO_PHASE_270; /* 180 phase tx clock */ meson_mmc_clk |= CLK_TX_PHASE_000; @@ -327,7 +328,7 @@ int meson_mmc_bind(struct udevice *dev) static const struct udevice_id meson_mmc_match[] = { { .compatible = "amlogic,meson-gx-mmc", .data = MMC_COMPATIBLE_GX }, - { .compatible = "amlogic,meson-axg-mmc", .data = MMC_COMPATIBLE_GX }, + { .compatible = "amlogic,meson-axg-mmc", .data = MMC_COMPATIBLE_AGX }, { .compatible = "amlogic,meson-sm1-mmc", .data = MMC_COMPATIBLE_SM1 }, { /* sentinel */ } };