Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1990636ybl; Thu, 15 Aug 2019 04:47:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYv7dQB1n3MJa7SQ4ysupHJxunreisw/9SDa+tYbs9O4ADcJE8E8ROzaSzJICGhIq8qcm6 X-Received: by 2002:a65:6081:: with SMTP id t1mr3225995pgu.9.1565869677519; Thu, 15 Aug 2019 04:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565869677; cv=none; d=google.com; s=arc-20160816; b=tvaAh+lpc6vSp6aCZS1GsfejB9+tK5kXJYhvryc2fnPsWAOnklkTotcVZYG6L6BEIQ yknSqZmAUVpQoJNwP+vaiSAeaNpFvhiYovFFvSE82gKyDQddx4kU7nXQVSlmGKEUCuDy FVkjUgI16rWxiPg5dw3eNDQPC0mvlK8ZlK+N20UK1Vqdoa/sHDnk84dZJrzZOzSOPrGG JlWoXh3YKAr6843drVJdG4lgQvAX9w48G3aDipf38JcjNSgzV8pq/a4mlZMaEXCBujmo e3M/Rr/Q8+hORhkW2smD+5D+qPXAAY6jW79q7pPT0Aa2ya9aOPeZ+TAmsxv1jXh6kneX T/zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=Y6aIoWlzF6qjEjJviH42XNIfhAHYgOPylz/sZB9PuFM=; b=zs/WXgwwTLMq0OZjEdrgnZxCPiPxHrjHMuhCiHXKdVXBamfvb2ElmDrwpbE5QDe1pT PBm1nH5bSYPRkHgblfXRgXTyDQ8pQyjTrQtSx/vKk/9N/qxUiejsnrYfePkxvCDVzZ7w 2kxspjDo+iy9729k1rNR1t+g1CaFAcJ15OidI5hQx7yyODN1frSL6+zlko1IGD+rLXFg GsR29baVjjXQzMxavAoSnQaiSq7RWGPt/gHYRx+jOc2ZyG6du2xSTIPIs4tADfz+enfC IkfLjKtiFV1t57Exim7q2j9oghywi4fzf9zN5G86t2nxnO07W4om8vxSzs19FQLO4puQ B4LA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id v15si1878466pfm.238.2019.08.15.04.47.42; Thu, 15 Aug 2019 04:47:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1731565AbfHOL24 (ORCPT + 99 others); Thu, 15 Aug 2019 07:28:56 -0400 Received: from mga05.intel.com ([192.55.52.43]:60658 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728128AbfHOL24 (ORCPT ); Thu, 15 Aug 2019 07:28:56 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Aug 2019 04:28:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,389,1559545200"; d="scan'208";a="184597668" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.122]) ([10.237.72.122]) by FMSMGA003.fm.intel.com with ESMTP; 15 Aug 2019 04:28:53 -0700 Subject: Re: [PATCH v3 1/3] mmc: sdhci: Add PLL Enable support to internal clock setup To: "Michael K. Johnson" Cc: ulf.hansson@linaro.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, Ben Chuang References: <20190726020746.GB12042@people.danlj.org> <20190812225611.GA30758@people.danlj.org> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Thu, 15 Aug 2019 14:27:44 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190812225611.GA30758@people.danlj.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/08/19 1:56 AM, Michael K. Johnson wrote: > The GL9750 and GL9755 chipsets, and possibly others, require PLL Enable > setup as part of the internal clock setup as described in 3.2.1 Internal > Clock Setup Sequence of SD Host Controller Simplified Specification > Version 4.20. This changes the timeouts to the new specification of > 150ms for each step and is documented as safe for "prior versions which > do not support PLL Enable." > > Signed-off-by: Ben Chuang > Co-developed-by: Michael K Johnson Did you mean for this patch to be "From:" Ben Chuang because otherwise "Co-developed-by" the author is redundant. > Signed-off-by: Michael K Johnson > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 59acf8e3331e..9106ebc7a422 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -1636,8 +1636,8 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) > clk |= SDHCI_CLOCK_INT_EN; > sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); > > - /* Wait max 20 ms */ > - timeout = ktime_add_ms(ktime_get(), 20); > + /* Wait max 150 ms */ > + timeout = ktime_add_ms(ktime_get(), 150); Should be a separate patch. > while (1) { > bool timedout = ktime_after(ktime_get(), timeout); > > @@ -1653,6 +1653,29 @@ void sdhci_enable_clk(struct sdhci_host *host, u16 clk) > udelay(10); > } > > + if (host->version >= SDHCI_SPEC_410 && host->v4_mode) { > + clk |= SDHCI_CLOCK_PLL_EN; > + clk &= ~SDHCI_CLOCK_INT_STABLE; > + sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); > + > + /* Wait max 150 ms */ > + timeout = ktime_add_ms(ktime_get(), 150); > + while (1) { > + bool timedout = ktime_after(ktime_get(), timeout); > + > + clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL); > + if (clk & SDHCI_CLOCK_INT_STABLE) > + break; > + if (timedout) { > + pr_err("%s: PLL clock never stabilised.\n", > + mmc_hostname(host->mmc)); > + sdhci_dumpregs(host); > + return; > + } > + udelay(10); > + } > + } > + > clk |= SDHCI_CLOCK_CARD_EN; > sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL); > } > diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h > index 199712e7adbb..72601a4d2e95 100644 > --- a/drivers/mmc/host/sdhci.h > +++ b/drivers/mmc/host/sdhci.h > @@ -114,6 +114,7 @@ > #define SDHCI_DIV_HI_MASK 0x300 > #define SDHCI_PROG_CLOCK_MODE 0x0020 > #define SDHCI_CLOCK_CARD_EN 0x0004 > +#define SDHCI_CLOCK_PLL_EN 0x0008 > #define SDHCI_CLOCK_INT_STABLE 0x0002 > #define SDHCI_CLOCK_INT_EN 0x0001 > >