Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4363235pxb; Mon, 27 Sep 2021 15:35:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQXrPwTZUMMwj1SyfX4izEuGJPR1jQZuH59wl6d/UImrIJrG6BxI4UN3heg2r6hfYhkwQK X-Received: by 2002:a17:906:700f:: with SMTP id n15mr2884683ejj.319.1632782120902; Mon, 27 Sep 2021 15:35:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632782120; cv=none; d=google.com; s=arc-20160816; b=VZwyfy+3/v/wpEGsMIzvmXOR7akizJ6qttQ9qfaSFnbR9GBBf6hXEbo9ouBcsWvsEn 6Ib+O7qyDaED0itCmuWu/zVoPce8VYatzVSEwQ19rDj1Bz6K7YuicJD+qUkAaGKnSJBm xzxG0xF+QhRRJXdUNbnxyjNytK22BSPKN2nDq8kqfg4eqByYvhJfklbOK3C2H6YNIy46 AuLMQQh7nlMqM9r3dQUXhsVm8M5wK33hnPOXcq9VUgYen2bO5Qmg7A4+mcynBpnPW1wP bWMrEhD2xxfU4o4rGhxz0O489wn5LsZfT3sJE4tOfzq4z4t09f1bkOa9AAOH+vzdOLjt sCsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=mylYr9AxO1lp/qjqY3iRM44WQJLHrj/GgtihC6w17dA=; b=NRk/E524aD3dnVeDUpXqa2Xfb0a2HXmkkBabFrw28kOrNgqGoUJkno6vcl0Ulz4v95 iUHmPNFf6kULJLwOMjWoUBiHDgLHz4s2y/gK/9G//e5b60t3FMb4FCbWfAzzQZda859H f7lOn/I+DYGBzPxheCuQhJn2goNkjlcawOXS8meAL2LTvAcpNozNiaySJjywqYbph6WL fklKLPcKHsw1xrWxq9Slr9xsHHHFj86EtimwqK9xr45U+dKFnrT9xMRG5ax/mJWFxI86 6Ufu/rbKduKbV1zxEqTANwjI76VDiOX6wihTP2bHTJPJMQU3VnzzSnLA92hELH2DRYA4 FaCQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uZdSs2h7; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s1si17108748edt.171.2021.09.27.15.34.57; Mon, 27 Sep 2021 15:35:20 -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=@linaro.org header.s=google header.b=uZdSs2h7; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237936AbhI0Wec (ORCPT + 99 others); Mon, 27 Sep 2021 18:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58162 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237791AbhI0Web (ORCPT ); Mon, 27 Sep 2021 18:34:31 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C0E9C061604 for ; Mon, 27 Sep 2021 15:32:52 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id b15so82823050lfe.7 for ; Mon, 27 Sep 2021 15:32:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mylYr9AxO1lp/qjqY3iRM44WQJLHrj/GgtihC6w17dA=; b=uZdSs2h7nd01pW0t9cpgr5Cba8CT1umQcEJ2lHA0ntFmU4NeTExjMhagqDQgy/WbM8 rDB64bTKZhlk48jrpydjYgSpiT8Vk+08AqHHT90Ke/+LOZ9KbAqBIy+JSeSdg2VMx9Ne tSOF58fk8b0uzBp5RIK8yA6sjl8YB8wUc3n5UsWfl4751/Nm/cEZnJpfA3D6rPIy0BdM 8OaU72xx8ENuKjghJkOOZN68bMrXknjRABGAHTw+G3pMjbLaR1LWFHDwZ5pY6z7lY9Cf trV7YIXiUxtYoNSposH2DLu1/NGpk6V2A5mM3ZO5GUPRB02wLyTy1BeZZBQN87bkXUH+ 5rsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mylYr9AxO1lp/qjqY3iRM44WQJLHrj/GgtihC6w17dA=; b=TyCSWjOBKZ92p7eWzGgP1ChJ9QINIvNtWOKk1ml1V9Dm2vTPPPdMqKRvoRBGIXlwut c2ZPkPLxq9XU90y6hwLPLh1MhYNy9iGRbCN/gVvespjsz/glXHZBYwnSGjmSsyz/g3PR U77pe6/lPLo2qiuKjG04clRELhU74U1B3WlexivJU/cISEWbhImgFEbm+9UrpxxOw8lh 4Q+6hPCC+8RYbY5+uf/qRHajCzztQABGGzHt+1pWv7gqdDgKXqZHWHnwSScVd1sO4aok IGJPM56sXrOD1qo7Q7icwCQCcM6DbPdp2UnxGY5u9mW8CbnI8IYXUSAftFgz7Domj8Tt RLxw== X-Gm-Message-State: AOAM533XXMqLToy1Uw1GS0YTG40xPUeCOF7feWYxshCfTDJ7Bz47JnCb 7k6UoREdBRUpVYC7z1odzsN02fKA5y9eLDocA9uGMA== X-Received: by 2002:a2e:1548:: with SMTP id 8mr2296321ljv.229.1632781970877; Mon, 27 Sep 2021 15:32:50 -0700 (PDT) MIME-Version: 1.0 References: <20210926092835.146449-1-zhang.lyra@gmail.com> In-Reply-To: <20210926092835.146449-1-zhang.lyra@gmail.com> From: Ulf Hansson Date: Tue, 28 Sep 2021 00:32:14 +0200 Message-ID: Subject: Re: [PATCH v2] mmc: sdhci-sprd: Wait until DLL locked after being configured To: Chunyan Zhang Cc: Adrian Hunter , linux-mmc , Baolin Wang , Orson Zhai , Chunyan Zhang , zhenxiong.lai@unisoc.com, yuelin.tang@unisoc.com, LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 26 Sept 2021 at 11:28, 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 Applied for next, thanks! Kind regards Uffe > --- > 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) > -- > 2.25.1 >