From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 05CACC433FE for ; Wed, 12 Jan 2022 13:54:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6128183278; Wed, 12 Jan 2022 14:54:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Lqmqymbf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3F7BF831F9; Wed, 12 Jan 2022 14:54:19 +0100 (CET) Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1943183224 for ; Wed, 12 Jan 2022 14:54:15 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=aford173@gmail.com Received: by mail-io1-xd35.google.com with SMTP id o7so3687259ioo.9 for ; Wed, 12 Jan 2022 05:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eDiLiWEN3n674KMSUUsH1WTZ9PBVx1dNRX3rDC44cvU=; b=LqmqymbfRQzBKm6qgNpyJBtvCi2a13T0mOExOBmyET14Md9/+sdq4Is3nJk+DzM2aC EyMM6TUtmm+GIPxUPKC2JxiM4WbHYxh/WfpPTHSENn1ruDuYp6kkloBZYBVBBbtpaKYy cjnEVd5WyqjZcen9tvStOYKC5/fzWTfWDRxd/H06neDhpT+1NcEx1+6un3Tr+5bBbWBn ZtlNr5IL8ULtkcnF7ApO7x35ipBTyTaJjMj9loVAOukfGad0ZDK8baCg/XY6KDHaaUkH bKCCe8rFNvh7RowWgBBSyOm9m3gZaaJZaKh4cG8giN/9UTz7NOXYqCyk3nL0bu66aCmi CRJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eDiLiWEN3n674KMSUUsH1WTZ9PBVx1dNRX3rDC44cvU=; b=qWJZ7isVXrMvX35kf6gamW9A1bYOCytjLRIGsnHJ3921Syt0Gfu6FXzTKbBjqfLeuz K9bq67rp1vxTKRJzH8LkTROcVltBIff+F98qh5MyZ6oSvESZpwpZrZwJe57o3GoF47JM V9h0lDajYY3Q3rqQ9PoGTEDPoI9NqKklf/mxvBi7zFJ4/0XByQkj7fcRnS04pFBqsYLX UA4IFXvKZSUEogwDKsxn+LZE6x0S9hHKHf+V258+oxZXSUGMN6zUXt/M3XKNJc4D7vt9 lsBjoLP/jR5UqC0Mccpl8JrSupY6ePdZrv6njsCPjSRMAVhLQBOi2WQ/zl43QA4Wf1Co piRg== X-Gm-Message-State: AOAM5334XpR7ScQ1auZqYWTI6k1IFskJmKE7LN6RGBLD4XD8p1fP0BUB oFeAS5cwleEbsIqFmAwTv38EYjPkypU/Bw== X-Google-Smtp-Source: ABdhPJxf64iYRFGk/81PJ60A9g8ADREevUJnRptDXfR39xe/OyqO6Iji7kLu3Q8oofu5sZeh+sHqXw== X-Received: by 2002:a05:6638:190f:: with SMTP id p15mr4536206jal.82.1641995653426; Wed, 12 Jan 2022 05:54:13 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:e0c6:f60a:66d5:e5f1]) by smtp.gmail.com with ESMTPSA id k13sm7967144iow.45.2022.01.12.05.54.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 05:54:12 -0800 (PST) From: Adam Ford To: u-boot@lists.denx.de Cc: peng.fan@nxp.com, haibo.chen@nxp.com, andrey.zhizhikin@leica-geosystems.com, tharvey@gateworks.com, estevam@gmail.com, sbabic@denx.de, aford@beaconembedded.com, Adam Ford Subject: [PATCH 1/2] mmc: fsl_esdhc_imx: Fix fsl_esdhc_wait_dat0 Date: Wed, 12 Jan 2022 07:53:55 -0600 Message-Id: <20220112135356.322069-2-aford173@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220112135356.322069-1-aford173@gmail.com> References: <20220112135356.322069-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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 According to Haibo Chen [1] - the current implementation mmc_wait_dat0, the second mmc_wait_dat0() in mmc_switch_voltage() always return timeout. This causes UHS cards to not properly initialize to their highest rate, and default back for high-speed mode. When reviewing [1] and comparing it to the linux driver, it appears that this function can be accomplished by turning off the clock, and waiting for the clock-standby bit to become active. [1] - https://lists.denx.de/pipermail/u-boot/2021-January/438644.html Reported-by: Tim Harvey Signed-off-by: Adam Ford diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 4c06361bee..e5814232a2 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -1684,9 +1684,15 @@ static int fsl_esdhc_wait_dat0(struct udevice *dev, int state, struct fsl_esdhc_priv *priv = dev_get_priv(dev); struct fsl_esdhc *regs = priv->esdhc_regs; + /* + * Clear the clock-enable and wait for the bit indicating it + * is in standby. + */ + esdhc_clrbits32(®s->vendorspec, VENDORSPEC_CKEN); ret = readx_poll_timeout(esdhc_read32, ®s->prsstat, tmp, - !!(tmp & PRSSTAT_DAT0) == !!state, + (tmp & PRSSTAT_SDSTB), timeout_us); + return ret; } -- 2.32.0