Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp615970imm; Thu, 5 Jul 2018 06:11:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfQl5loFBi7yVBaD2cJBk0rweC4hk0ylaWiC9PT6C84opc2FhDpOAIWdHu1ZRA66qFbWOHq X-Received: by 2002:a17:902:7481:: with SMTP id h1-v6mr6273832pll.183.1530796270559; Thu, 05 Jul 2018 06:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530796270; cv=none; d=google.com; s=arc-20160816; b=cpBPUP2pF5VgGUm/g+4lv8hl0TnMn1F+kCH2ySKpGuq+RLaSjjW/zcUaEotQ5NHjmx yryL5eS8u1uJLtXloSrlfwd4rWZDLAvhKRig0nk97BuMWUtllOPlySssM+G021/t40BH fzFEhxjE1jETceAQ1t7dgO5bRn53mKBlu73ZHmtP7AEyXnCBNCazitjO9gl6b8f4h+FH Sd6tmTMHMfk7neWfjI0aCIItZGPJCdD1ZXC9BUSCSrZRgspst7sM95dqIDSHwv+wsSO6 W91yA07qNWOpFOELRJ0ow/kN7fp9zOSx/h/5G9x7mdYXfpSvfpqdy3/XvICmmbC+qPfB xxEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Fe8j+6MxvYAr7ONStUnksGWHHmGE9fpfBjjpvTXpylc=; b=bYxlSQZlCais4XnFhjBu5iIgGOQRwBijgSAfvlh3hJJGudoMX+jB0+5phr4pTW52Du ZDe1DJ6M3x0ptxIoDZcxLrNeVIZAO2pOkJ5o7HlMKfLWjHZ57dYvN1B86O4Rx5hXZvgc Ni1XhQ0GkqRMDQAX0FZck/shMLikyRUTwBxw5squIuA3HRpyMhbRkHmPHILAA9rk+qCQ i4ZYjRMgldh/ETDxmxt7tth++tVWC7kzHO/n09KEI5oT+blp/vOwgF+nPXsf8cVZ1Sy7 Q8Xc4ZiMor4NYbVs4eP0d69vhBZaPWAyHaJ7LPGQ0tvjZQ5aOttgXiud2S6VNBH3etB4 GDvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TfZAovrl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u134-v6si6247722pfc.244.2018.07.05.06.10.56; Thu, 05 Jul 2018 06:11:10 -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=@linaro.org header.s=google header.b=TfZAovrl; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754762AbeGENJr (ORCPT + 99 others); Thu, 5 Jul 2018 09:09:47 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:42649 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754608AbeGENJo (ORCPT ); Thu, 5 Jul 2018 09:09:44 -0400 Received: by mail-io0-f195.google.com with SMTP id r24-v6so7673939ioh.9 for ; Thu, 05 Jul 2018 06:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Fe8j+6MxvYAr7ONStUnksGWHHmGE9fpfBjjpvTXpylc=; b=TfZAovrlujwTc5ozKaQpkUdZzVCVx93xERjOEIdtCAq+GzFcJZjnltXnGQU6uNzcBl epQVtvM0q18fvvsw2ENx+lm29fnl4pCMmaRxmIQPtp2+XvdPdsMo1NQJU+ReeuNWIViR eUThkRVbZPUgSw45a8G5eea+1JOX7gL723z+g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Fe8j+6MxvYAr7ONStUnksGWHHmGE9fpfBjjpvTXpylc=; b=WbARpaVjCuhQYnMiL+jGKh3IqqoS9lRgDh34yc6CnfB1IT9gDTQhdoYj1FDQ1hXnDT U3BbxXpxtNXNMgzHMYueWKUnb1DVaWVRP3Qe40LgVXbN0hjGIJznzWpwu1/VXlLjll0C ej6o/nV4XtW0F0FE6OOZ2MP7XF3LN1BcVgs4c+fUrOCOPJF8FBoS0fPX6TBvSq1WKgM0 9jWZqFV13rgdiMadHFN4IvXRYpXfITHA3rf4dbnezIBSEqVbJVuVqZGmuCvgNm1+7YG9 KK/VkYu7woNsl4d3JWBHIpryggk/ccmYSbB8w4ijGNgBk7798oF6YNkNQh0oHGypYwFI AhPg== X-Gm-Message-State: AOUpUlE1KgzlKfbci9/9NkwQFP0iEfSTgHr51rbz+hiQRpSImoNeOQpL HjouXr6sWRYRmH7gCMV4ptV66QGHxvYnCufkBdExQA== X-Received: by 2002:a6b:144c:: with SMTP id 73-v6mr4772365iou.218.1530796183608; Thu, 05 Jul 2018 06:09:43 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:818f:0:0:0:0:0 with HTTP; Thu, 5 Jul 2018 06:09:43 -0700 (PDT) In-Reply-To: <20180705121500.6256-1-stefan@agner.ch> References: <20180705121500.6256-1-stefan@agner.ch> From: Ulf Hansson Date: Thu, 5 Jul 2018 15:09:43 +0200 Message-ID: Subject: Re: [PATCH] mmc: sdhci-esdhc-imx: disable clocks before changing frequency To: Stefan Agner Cc: Adrian Hunter , marcel@ziswiler.com, "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5 July 2018 at 14:15, 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 > IP variants too. Also fix indent to make disable/enable clock look > alike. > > Signed-off-by: Stefan Agner Thanks, applied for next! Please tell if you want this for fixes and if I should add a stable tag. Kind regards Uffe > --- > 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); > } > > mdelay(1); > -- > 2.18.0 >