Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp650480imm; Wed, 11 Jul 2018 08:40:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdWLTzeBCaz++tpBUWLfQp9+jMcLxgFrM9Rf+w+V3Ud0BF4tvKwo2Xntk0qdYrwTOpuv47P X-Received: by 2002:a63:8dca:: with SMTP id z193-v6mr27452101pgd.228.1531323631350; Wed, 11 Jul 2018 08:40:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531323631; cv=none; d=google.com; s=arc-20160816; b=0dXFPralOTB+E54P2HjYhf958Zs1OxJoDCPlub9V3T4J2iR1P9yhnDPybYVsI9NK1H H2c6WN/WGosT/TmHI9hTJCnlqEdz5MLwGaDcMH5qi8Z9WtyPOh5A5Ju6u9j0hQt2naFd Ah1JW1C7B5/VrfSxsccTu5N0tBVntP6a/eWexODWF5WZrRcUS0NpzmFXF8qD6JRx0A5I 8pkFnSh3Wj+lwon9oZRZcu2p6iXqkNlG6t0kalKj+TPpjIkoTim2gqiMjMAP7HceLpuv sjI22TLI4aLTuG8z6sx9vL9hHEUJ5DrOYsPN1S30SObB/3S3kybZqPbKJxIdqUo7AiOe L//g== 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 :arc-authentication-results; bh=pdEBOPQ63hxXPhdg1GIvYGrvTpvm+9Vi4lkjmyCpM00=; b=aBXukQHjTfCbmDkMMFxn3qts2zZC0OTc81vWggzMuz6oeYAOS1C2Oz11xpfn+92ZeO CKEyJQyJo6xH0NPmzS8E17xZktj80NSku2sJ1smL1byeNUmA2m9NZnC4t6Cgi9RWTjBS eAyotpgh61zZOsDCKfIHQWHRLzS+xuOVhiux2JrXGKsDqLvRs9TS+0Eao0b8sut1RC0q rtGM3UYpFZmH6WMC+BYN8gt11eV5ADETOwjMd1ukMiD6QIeqgLulPDMXUsUkIfPTIUIB qDwR4eLdQ7oxsj3P4/L8BYOCEiwM05F91hFmD8ncbKhPNSAgd6Sy1MgeC0AjjFfFeHGN kj9A== 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 j91-v6si19349437pld.402.2018.07.11.08.40.16; Wed, 11 Jul 2018 08:40:31 -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 S2387451AbeGKMez (ORCPT + 99 others); Wed, 11 Jul 2018 08:34:55 -0400 Received: from mga06.intel.com ([134.134.136.31]:36427 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733069AbeGKMez (ORCPT ); Wed, 11 Jul 2018 08:34:55 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Jul 2018 05:30:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,338,1526367600"; d="scan'208";a="55702719" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.168]) ([10.237.72.168]) by orsmga007.jf.intel.com with ESMTP; 11 Jul 2018 05:30:46 -0700 Subject: Re: [PATCH] mmc: sdhci-esdhc-imx: disable clocks before changing frequency To: Stefan Agner , ulf.hansson@linaro.org Cc: fabio.estevam@nxp.com, haibo.chen@nxp.com, aisheng.dong@nxp.com, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180705113937.16414-1-stefan@agner.ch> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Wed, 11 Jul 2018 15:29:14 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 MIME-Version: 1.0 In-Reply-To: <20180705113937.16414-1-stefan@agner.ch> 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 05/07/18 14:39, Stefan Agner wrote: > In the uSDHC case (e.g. i.MX 6) clocks only get disabled if frequency > is set to 0. However, it could be that the stack asks for a frequency > change while clocks are on. In that case the function clears the > divider registers (by clearing ESDHC_CLOCK_MASK) while the clock is > enabled! This causes a short period of time where the clock is > undivided (on a i.MX 6DL a clock of 196MHz has been measured). > > For older IP variants the driver disables clock by clearing some bits > in ESDHC_SYSTEM_CONTROL. > > Make sure to disable card clock before chainging frequency for uSDHC chainging -> changing > IP variants too. Also fix indent to make disable/enable clock look > alike. > > Signed-off-by: Stefan Agner > --- > drivers/mmc/host/sdhci-esdhc-imx.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c > index 85fd5a8b0b6d..aa48f4b2541a 100644 > --- a/drivers/mmc/host/sdhci-esdhc-imx.c > +++ b/drivers/mmc/host/sdhci-esdhc-imx.c > @@ -708,14 +708,14 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, > int div = 1; > u32 temp, val; > > + if (esdhc_is_usdhc(imx_data)) { > + val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); > + writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, > + host->ioaddr + ESDHC_VENDOR_SPEC); > + } > + > if (clock == 0) { > host->mmc->actual_clock = 0; > - > - if (esdhc_is_usdhc(imx_data)) { > - val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); > - writel(val & ~ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, > - host->ioaddr + ESDHC_VENDOR_SPEC); > - } > return; > } > > @@ -761,7 +761,7 @@ static inline void esdhc_pltfm_set_clock(struct sdhci_host *host, > if (esdhc_is_usdhc(imx_data)) { > val = readl(host->ioaddr + ESDHC_VENDOR_SPEC); > writel(val | ESDHC_VENDOR_SPEC_FRC_SDCLK_ON, > - host->ioaddr + ESDHC_VENDOR_SPEC); > + host->ioaddr + ESDHC_VENDOR_SPEC); Ideally each patch does only 1 thing. Please make white-space fix-up a separate patch. > } > > mdelay(1); >