Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1615210pxb; Mon, 11 Oct 2021 09:32:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIEHzhMzn6KYEAQ0zksgu/Us8j7/Wjh/DFy/seU5P2fux4jKArWoMhuMnPpo3RN9jQILUU X-Received: by 2002:a17:90b:380d:: with SMTP id mq13mr31177698pjb.131.1633969922619; Mon, 11 Oct 2021 09:32:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969922; cv=none; d=google.com; s=arc-20160816; b=uRNk5TzUrdy23LqFsz+W7LPyhy+lzZPjXLBq7tL//jPruLza8lanT3dBVbmC/i6/rE as1MQAjRMO714sqPVbPXRMQ0wqxYGiqznGlnyRgCdGqZxacMWSJiTiOaiPN8hRlfxzG+ Isdwh7UL1CqZHvbTeEcASfkBKWXHKPyBcoxbi1sHAg16RrUw73glUAqkt8oYotSzzvCH g9b4AC6bWjCT+BTWHgZu/Q1uxqF/x4nhuviP9JUIkqbPA0UgSFY5xvQUmdIgsCKhuFaK 6fZfZAi2fJb7Yt+5GqoVflvv7XVvg2zCr9WA1A6AtzGUObeHEA+A3Ts1txph70SYbEjZ leYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=mtFR981OROwPnJ45oe6Wx+3DR5ffzov0rEsVagAIt4Y=; b=OUMG0reVmUeIWHMNge7C9ECcoWZBzy3KjEi4p48Z9xExlUjgoCq1tQmVj2AkqjkVQa w50YUQKqblP94KvlUhYo4KDnUV33WUzs+ZG67k4I4ImyKWni4NAPNAkgxJ6Wvmgdqa3W nmeEY81urzWO64YROsk/AFy0wqm/J49HeKn9ubZy1m1z/x7nRmgSG5aeZdUWRoW23BAx BSZObtBus7e9Tlsjs9/7SDDuIAut4eGGF/VGrqhtWsDuttpAa/A6i35LvUzv0sua2vop edWA2r7A/jN9pqwNwuaZSYQKz90eFEELjw7u2c5nR381OUlSS5BUcUOmyNo4SE4aIrKW hwHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KskjEWfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si14804154pfh.201.2021.10.11.09.31.50; Mon, 11 Oct 2021 09:32:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KskjEWfZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237019AbhJKN5H (ORCPT + 99 others); Mon, 11 Oct 2021 09:57:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238022AbhJKNzM (ORCPT ); Mon, 11 Oct 2021 09:55:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 857CA610E7; Mon, 11 Oct 2021 13:52:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633960365; bh=dkgC5TJpvjrMNpCc7gqjtxKbKWAE5KzEPJGx/qq1bNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KskjEWfZgNaqvS2GsOAy8oacks4mLbaOmpMap03fUuZq1mRoZ4Ojs1tIUeZMSCkhk uy1c5ZOHeB+BNTxatyABo8EKtn32NZkfZh9fgJJLH861xe5y8Cw1uYY4v93BcoA3HH 2ULS8a86UrzoPiR+Fp+rA1lmt7UiHTmJTG1rRgR4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.10 09/83] mmc: sdhci-of-at91: wait for calibration done before proceed Date: Mon, 11 Oct 2021 15:45:29 +0200 Message-Id: <20211011134508.673659243@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211011134508.362906295@linuxfoundation.org> References: <20211011134508.362906295@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Claudiu Beznea commit af467fad78f03a42de8b72190f6a595366b870db upstream. Datasheet specifies that at the end of calibration the SDMMC_CALCR_EN bit will be cleared. No commands should be send before calibration is done. Fixes: dbdea70f71d67 ("mmc: sdhci-of-at91: fix CALCR register being rewritten") Fixes: 727d836a375ad ("mmc: sdhci-of-at91: add DT property to enable calibration on full reset") Signed-off-by: Claudiu Beznea Acked-by: Adrian Hunter Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210924082851.2132068-2-claudiu.beznea@microchip.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/host/sdhci-of-at91.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,7 @@ static void sdhci_at91_reset(struct sdhc { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_at91_priv *priv = sdhci_pltfm_priv(pltfm_host); + unsigned int tmp; sdhci_reset(host, mask); @@ -126,6 +128,10 @@ static void sdhci_at91_reset(struct sdhc sdhci_writel(host, calcr | SDMMC_CALCR_ALWYSON | SDMMC_CALCR_EN, SDMMC_CALCR); + + if (read_poll_timeout(sdhci_readl, tmp, !(tmp & SDMMC_CALCR_EN), + 10, 20000, false, host, SDMMC_CALCR)) + dev_err(mmc_dev(host->mmc), "Failed to calibrate\n"); } }