Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1414275imm; Thu, 12 Jul 2018 01:12:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfiCA59+HzRdQ7bCtrlskYYNvRw7Fl9yOCSe0Iu6+wwGN6ru3h+3M+vk4pgF6Wjk1l5JWHn X-Received: by 2002:a17:902:8f96:: with SMTP id z22-v6mr1213051plo.190.1531383147896; Thu, 12 Jul 2018 01:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531383147; cv=none; d=google.com; s=arc-20160816; b=m90WYKFBhWpDRDe/Kcyoyb+5iy3N0CPggpj9YNn56E7kOnVMOxw6MlAL104kDnNz4D n2EoAnvsxuV4vxdQHWn3kTnvz0jmpPMTh7cNRqdZ7rIOsQH8hAJXX4y6aGH5+AoeK+LK qtWuo3JZetLv8+XPks9e7f2OeaGiqt35Kn4+Ag8CHcH9JkhGaFF9JT1jSlSFCx2iCf55 4UCgOF2KbVzzsGc5sKOLrsX3MMwh1kXNYhxQ/0AUWfI+rJCtQfD2Da5yGdnJU/QnF2Ox eZuXAbMnq4eGaEYVF9PIvz+4lcwkrNZizGI0ZMQhJP2gjFWns3BH23/L3oHrkH0Yi8Yt bdvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=S748qoIXaQfwOIuBiFJPrEGMD08pcJ6w6ExG8TD2iFc=; b=PzLKsx7MARce61wjRiQrm4X45LifCL4LZx6f7WTMqjr+AAitXFe794vR9rV97SMzoS Dmbulf+SSFUminPggzOr6zt+P1CEBueftQ3S2n0Ysg10MEVduf6vOQr3VO0hpF9qqRDk vYt4I69d9I+GdxAC042aPvhWILi/S17jPV4oxSmCL1zR87z9zQmTtzgNSufOiKAlCxJz intazQlJ95qwX45vWHhkg2QB2WnJVoJ/F87yOYtzbjYUR8xZXr74cSyvE93R3lLwq32n 1DqftmJJ98gcZk5vaRKQ47hRJmumEjyiscPtD6eRxLdJpYRoPdMzwhLkQaOlH+li55Pv jpkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=wfsCdYy4; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x19-v6si20243207pgk.80.2018.07.12.01.12.11; Thu, 12 Jul 2018 01:12:27 -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; dkim=pass header.i=@agner.ch header.s=dkim header.b=wfsCdYy4; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732350AbeGLITQ (ORCPT + 99 others); Thu, 12 Jul 2018 04:19:16 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:55898 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727037AbeGLITQ (ORCPT ); Thu, 12 Jul 2018 04:19:16 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 4BB925C21A1; Thu, 12 Jul 2018 10:10:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1531383027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S748qoIXaQfwOIuBiFJPrEGMD08pcJ6w6ExG8TD2iFc=; b=wfsCdYy4LNnRX9x9X3LLLCPvRFpO8MM7fZdK4IpyHO136t/s2mboocKIFkvy+RBqd7PW8j G6Jgu30dOhrr6aOAgPQs+fbfYbvBQGlWB5HbC2KB8bl9HW3nfBV3t4NUkOvWE4iYPM+mp1 VGlZeIimvuZh4g4761TXCcKbeskW6vM= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Date: Thu, 12 Jul 2018 10:10:23 +0200 From: Stefan Agner To: adrian.hunter@intel.com, 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 Subject: Re: [PATCH v2 1/2] mmc: sdhci-esdhc-imx: disable clocks before changing frequency In-Reply-To: <20180712080650.13878-1-stefan@agner.ch> References: <20180712080650.13878-1-stefan@agner.ch> Message-ID: <1e00d6df032983bd588b068d30b48cea@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.4 X-Spamd-Result: default: False [-1.38 / 15.00]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; BAYES_HAM(-1.28)[89.89%]; MIME_GOOD(-0.10)[text/plain]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; DKIM_SIGNED(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; ASN(0.00)[asn:29691, ipnet:2a02:418::/29, country:CH]; TO_DN_NONE(0.00)[]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12.07.2018 10:06, 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 changing frequency for uSDHC > IP variants too. Ignore this patch, its a duplicate. I should not have pressed Ctrl-C while git send-email is working :-) -- Stefan > > Signed-off-by: Stefan Agner > --- > drivers/mmc/host/sdhci-esdhc-imx.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c > b/drivers/mmc/host/sdhci-esdhc-imx.c > index 85fd5a8b0b6d..acacd8481473 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; > }