From patchwork Thu Nov 24 17:06:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 13055199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7EA4C433FE for ; Thu, 24 Nov 2022 17:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229601AbiKXRHT (ORCPT ); Thu, 24 Nov 2022 12:07:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229641AbiKXRHS (ORCPT ); Thu, 24 Nov 2022 12:07:18 -0500 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73303442FF for ; Thu, 24 Nov 2022 09:07:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669309637; x=1700845637; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ezf+rpZocyXRKreSyghX+LViSU68SAwjjHpsXCLRbaA=; b=nNvJVW0uwoQpv9FsrzsHVN8TjYKFcdDGnMrw/FtQEJKLp14EA7Yy5pZV vFn5bqS/ojwcpyMZIsWu3kmH+OnZEvovm47UMzgNIVUtXgTcpGbS9Fbo/ PpHSbXYHBhToegFR10vP/lRyaRxkIW0azSVa+X27TRVVRlgHA0uX0wvdH s2tFnZdj+FcSQ0kE+/xwz6oFcwQix8KTiwVf+GCofKJG3mFUfvUvVYoTC yttJCz7SnvGHOhbpUY2hRWjwArYkZgGKRCzWURPHocCsNtDrVmMTrLtcK a0dSoiEo6r7IHCac3rxPl5PINkVjvz1cZdxgnv/mOK1Cm9++VAruTKMkZ w==; X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="316159890" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="316159890" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 09:07:17 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10541"; a="971313036" X-IronPort-AV: E=Sophos;i="5.96,190,1665471600"; d="scan'208";a="971313036" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO ahunter-VirtualBox.home\044ger.corp.intel.com) ([10.252.33.41]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2022 09:07:11 -0800 From: Adrian Hunter To: Ulf Hansson Cc: Sarthak Garg , Florian Fainelli , Al Cooper , Haibo Chen , Andrew Jeffery , Eugen Hristev , Vignesh Raghavendra , Prabu Thangamuthu , Manjunath M B , Ben Dooks , Jaehoon Chung , Viresh Kumar , Thierry Reding , Hu Ziji , Wolfram Sang , Sascha Hauer , Brian Norris , Wenchao Chen , Chevron Li , linux-mmc@vger.kernel.org Subject: [PATCH 2/4] mmc: sdhci: Avoid unnecessary re-configuration Date: Thu, 24 Nov 2022 19:06:47 +0200 Message-Id: <20221124170649.63851-3-adrian.hunter@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221124170649.63851-1-adrian.hunter@intel.com> References: <20221124170649.63851-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Avoid re-configuring UHS and preset settings when the settings have not changed, irrespective of whether the clock is turning on. Signed-off-by: Adrian Hunter --- drivers/mmc/host/sdhci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 351b09b90d76..3675d69fb590 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2304,7 +2304,6 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) { struct sdhci_host *host = mmc_priv(mmc); bool reinit_uhs = host->reinit_uhs; - bool turning_on_clk = false; u8 ctrl; host->reinit_uhs = false; @@ -2334,8 +2333,6 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) sdhci_enable_preset_value(host, false); if (!ios->clock || ios->clock != host->clock) { - turning_on_clk = ios->clock && !host->clock; - host->ops->set_clock(host, ios->clock); host->clock = ios->clock; @@ -2363,11 +2360,10 @@ void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) host->ops->set_bus_width(host, ios->bus_width); /* - * Special case to avoid multiple clock changes during voltage - * switching. + * Avoid unnecessary changes. In particular, this avoids multiple clock + * changes during voltage switching. */ if (!reinit_uhs && - turning_on_clk && host->timing == ios->timing && host->version >= SDHCI_SPEC_300 && (host->preset_enabled || host->drv_type == ios->drv_type) &&