Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3649691pxb; Sun, 26 Sep 2021 22:49:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8c9BpAc1I37NI5aAEYNLjOrW623RV7xhDzz6AINLBtZ1Zu1ajsphcOSnN6yYjaOrCW0Et X-Received: by 2002:a17:902:c084:b0:13d:c6ef:7cf0 with SMTP id j4-20020a170902c08400b0013dc6ef7cf0mr20880145pld.4.1632721740661; Sun, 26 Sep 2021 22:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632721740; cv=none; d=google.com; s=arc-20160816; b=kN9yDRaXMcrotQHfXccRv5U/+fkuwofTA1ZZxwniULE8MQqVGVZcWzTs1ouf0M/G6Q gCveSVopcwWDi/eR3WQc9KmIAxzeNp5tDuTZYuyJ78lSL+LlGknRx9V6yyPbck1AgQ1Y 96rIrA6p/ubuilXUHPo8G3yJH1OByUOgBaIsunyxQW/4U5QYQ4/e8kRVpkg2bESSg+tH 5LW4o5/QZQB2M7CInHjH9Nz6gRHBZs+JiqdGUbegP9GAYRisJ2i/W/fMGY10Qa5HlD8j gZ8rqf04WN+0WFAuk7Uwh2/r7fzwFaY+7kqH7mLYub08Eum5KGMmKO7kfK0PQaOARN9p +nPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject; bh=6WyRSvwPK7ZpV/02RWTcSLXJk9PLG3Q+rINjcMcHZzA=; b=y0ceQkTmkkqE6ofxkLoi5+Uq5N6FSJug1c9BoTd7Mp7HYgXERMCeElTVrj8YlxVM5s DgsxnYdzuc6UKtw1F7PVzb9RdKNzA1K7AHlLA5SRquE27QU0pZtWn9hOm98YkfDZNb27 9lzxMu18XsqQ3Px/WDJB2LjBRzK0HERNn69kWn42GsAVffaF+zxuGDQvVASJr7qlOGSq PQHtea5pWMJNSRCwFzXjKecfcDy+aMbq1EwhX5yuQUU1NXCF6/ZPGnH46Qawn/YNRlek Rjgm3QqqG4nR2Ve6vJ5liNe4ugT/vabOEnGT9vE77esM42bavNKoWoRpC5ozTGPpQNSs +iBQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r19si17162791plr.249.2021.09.26.22.48.47; Sun, 26 Sep 2021 22:49:00 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232937AbhI0Fte (ORCPT + 99 others); Mon, 27 Sep 2021 01:49:34 -0400 Received: from mga03.intel.com ([134.134.136.65]:52528 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbhI0Fte (ORCPT ); Mon, 27 Sep 2021 01:49:34 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10119"; a="224467283" X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="224467283" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Sep 2021 22:47:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,325,1624345200"; d="scan'208";a="437594752" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.84]) ([10.237.72.84]) by orsmga003.jf.intel.com with ESMTP; 26 Sep 2021 22:47:53 -0700 Subject: Re: [PATCH v2] mmc: sdhci-sprd: Wait until DLL locked after being configured To: Chunyan Zhang , Ulf Hansson Cc: linux-mmc@vger.kernel.org, Baolin Wang , Orson Zhai , Chunyan Zhang , zhenxiong.lai@unisoc.com, yuelin.tang@unisoc.com, LKML References: <20210926092835.146449-1-zhang.lyra@gmail.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <847b5295-ba23-107c-6fee-4e766a86ce7a@intel.com> Date: Mon, 27 Sep 2021 08:48:31 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210926092835.146449-1-zhang.lyra@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/09/21 12:28 pm, Chunyan Zhang wrote: > From: Zhenxiong Lai > > According to the specification, DLL status has to be locked before using it. > > Signed-off-by: Zhenxiong Lai > Signed-off-by: Chunyan Zhang Acked-by: Adrian Hunter > --- > Changes since v1: > * Use read_poll_timeout() instead of while loop. > --- > drivers/mmc/host/sdhci-sprd.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/mmc/host/sdhci-sprd.c b/drivers/mmc/host/sdhci-sprd.c > index 11e375579cfb..f33e9349e4e6 100644 > --- a/drivers/mmc/host/sdhci-sprd.c > +++ b/drivers/mmc/host/sdhci-sprd.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -39,6 +40,9 @@ > #define SDHCI_SPRD_BIT_POSRD_DLY_INV BIT(21) > #define SDHCI_SPRD_BIT_NEGRD_DLY_INV BIT(29) > > +#define SDHCI_SPRD_REG_32_DLL_STS0 0x210 > +#define SDHCI_SPRD_DLL_LOCKED BIT(18) > + > #define SDHCI_SPRD_REG_32_BUSY_POSI 0x250 > #define SDHCI_SPRD_BIT_OUTR_CLK_AUTO_EN BIT(25) > #define SDHCI_SPRD_BIT_INNR_CLK_AUTO_EN BIT(24) > @@ -256,6 +260,15 @@ static void sdhci_sprd_enable_phy_dll(struct sdhci_host *host) > sdhci_writel(host, tmp, SDHCI_SPRD_REG_32_DLL_CFG); > /* wait 1ms */ > usleep_range(1000, 1250); > + > + if (read_poll_timeout(sdhci_readl, tmp, (tmp & SDHCI_SPRD_DLL_LOCKED), > + 2000, USEC_PER_SEC, false, host, SDHCI_SPRD_REG_32_DLL_STS0)) { > + pr_err("%s: DLL locked fail!\n", mmc_hostname(host->mmc)); > + pr_info("%s: DLL_STS0 : 0x%x, DLL_CFG : 0x%x\n", > + mmc_hostname(host->mmc), > + sdhci_readl(host, SDHCI_SPRD_REG_32_DLL_STS0), > + sdhci_readl(host, SDHCI_SPRD_REG_32_DLL_CFG)); > + } > } > > static void sdhci_sprd_set_clock(struct sdhci_host *host, unsigned int clock) >