Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp655502imm; Wed, 11 Jul 2018 08:45:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2/3tUeRXUSdtU+z+j73468gDgl6XOQp6S5qvzyqzy0J7JMCnbQBapUhBmElm47YoelF21 X-Received: by 2002:a63:f:: with SMTP id 15-v6mr21021156pga.430.1531323946175; Wed, 11 Jul 2018 08:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531323946; cv=none; d=google.com; s=arc-20160816; b=mfNZbfN27CAS9TEGozQQ2jE+lysBQRIsAZr9rMXRbYSrv92cdG7YTmfCiXFMJhoJYJ 6gnw7BbycJ8FgHgSm6pBP+stb2YNjdf8a2IONvcOMnNTuDCP9EnGxEaxiXQuYmJiZqt2 P44KTdIdsA/J1oHoIT9bvPDTox9J34g/LFWwM2gI0Gb4G4FzgrMHgi/ORrqOylpabSgr utj45tS0O4zxWnrQaBmDxzVcTz7/xIWz3PGyaYIp2Ka0MWRX7X2WfFhWPh7tzsOXT+lb u1zk3n4Pswv1r4mIAGRDR9JYogv9j2yzJjgDEjIUWyqz51vkWHAV3OX/Xhi8l6VxQuh3 VfHQ== 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=IR8gHxhJpLPBD4bBTI7qYZwQv5dB7zSSf0yho6+XIb8=; b=yuxe4lr+Zy38Uo93eMmOo596sCSWpCHq31Di5EuEIC801Upde9gPiBosCt4Hp4Gzz8 D5voJomxUtavESxQ2490nON44gJGhnuePVqQ/vHCCpn5sSEDBsdTaItCvY+z0D24ror/ W1CZFppqs55v6nOqFLf5ZhxMkgxKM9tfakamVI6ZUO4UgkqFiu6uK7eMbsHjBWaavz3w 7N6kwAthIdS8nZil7+8bJ4meHsPSq5vHq46HaNjVx1+zBtkf+Sk14kQgF7SrGjgBjMJf /UH0BOMY87zJ3Q4fY4/+7vMCzKhkwFb0KVXEiBQYn+M1/ggsLIJXyKd2IRdYNsPGJRq4 QrDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kDRyNOZf; 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 i190-v6si18171261pgc.348.2018.07.11.08.45.30; Wed, 11 Jul 2018 08:45:46 -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=kDRyNOZf; 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 S2387739AbeGKNIV (ORCPT + 99 others); Wed, 11 Jul 2018 09:08:21 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:50793 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387729AbeGKNIV (ORCPT ); Wed, 11 Jul 2018 09:08:21 -0400 Received: by mail-it0-f67.google.com with SMTP id w16-v6so3492849ita.0 for ; Wed, 11 Jul 2018 06:04:06 -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=IR8gHxhJpLPBD4bBTI7qYZwQv5dB7zSSf0yho6+XIb8=; b=kDRyNOZf7ypeQrLK6ZayPqTqcEicu8r3h3+PWNk0hEbgR1CAxUFYBi5l0Fomg4X5ZJ 5QSlh2tIONJNUfqZp6NIGLRbO+B/3usVKr6NWl+EG2nmtL21chjngfhUnTt3nuhONg9U TMLhCwiCOhIX+iyEZ3N7jeU94CsxKCAQKyAO4= 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=IR8gHxhJpLPBD4bBTI7qYZwQv5dB7zSSf0yho6+XIb8=; b=uDdx7CdVIb99sXWkfzIpVYeqiZpSzH+0TGQT95ruiMdzXbeCu+tbJ8DAsKZPpywAxZ krOF0pEJC4S0DynLr0RfiOypbnBD6Xgm0GuzKEday4ua2AmxXuWS6+2722Kk/DXAzJQO kxNtnvAi2JwhgRYzxy5g2WXwlwM3TVayFAHwAwDePPUafIClKHJXK0Bu3aRigfQfkWz5 PgfMfHfq6ZHMHuv8EnXIGX0oPIE8UEsUKO1T+yoHgUYMN6fmIY5TN+qTZCNbYBEIU5Kx In5HfIecHmtoot2H+BfOfEhy1dyNf25ORNAm1YUHs103DciXSar8DeX4UJOzvra1inqZ mgjQ== X-Gm-Message-State: APt69E3xC++PHgypMAyfjtx871IM8WRxtHSASho0JCDGqAhzhZ4uX3NW Ac4uzXk1kv40+gi3AwwES5C9/M8EUjWqG4hC67YacA== X-Received: by 2002:a02:570c:: with SMTP id u12-v6mr24229013jaa.142.1531314246051; Wed, 11 Jul 2018 06:04:06 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:818f:0:0:0:0:0 with HTTP; Wed, 11 Jul 2018 06:04:05 -0700 (PDT) In-Reply-To: References: <20180705113937.16414-1-stefan@agner.ch> From: Ulf Hansson Date: Wed, 11 Jul 2018 15:04:05 +0200 Message-ID: Subject: Re: [PATCH] mmc: sdhci-esdhc-imx: disable clocks before changing frequency To: Adrian Hunter , Stefan Agner Cc: Fabio Estevam , Haibo Chen , Aisheng Dong , "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 11 July 2018 at 14:29, Adrian Hunter wrote: > 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); >> > It turned out that I had already applied this one. I am going to re-base my next branch next week, so dropping the patch by then. Until then, the patch is reverted. Stefan, please send a new version addressing Adrian's comments. Kind regards Uffe