From patchwork Tue Aug 7 06:17:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 143554 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp4112033ljj; Mon, 6 Aug 2018 23:18:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpePgKRl7mant/VESUTd8n9a7MFCoQyL/572U3JveGctvPkKVBHwce63U6Z9xxQq0KmQkKrF X-Received: by 2002:a62:a6db:: with SMTP id r88-v6mr20333564pfl.60.1533622692442; Mon, 06 Aug 2018 23:18:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533622692; cv=none; d=google.com; s=arc-20160816; b=anEhzyYXhUF9kdW33N2E8625ynRkk/zC0h64B+N0/+PYlg2lPzUtVOkzKYyoSvdprc IdKj91y4qlIjMyaOmckbyZF26Pt10SdMH9Tk3XPiQ5dSsi7IMBF4BMPzCsMP97kMuQiN ugz1ERPfsVTpdzGVHmkOTibzAzAVCpAcVR4P4SxYuaVBCbCp+DOqtXO/GXCIADXA4Kg/ 1fV3gDvcBrO+46NmkE6HVWznrCeVkJ+B/lyAdtkCeSaVhdXMZ1Q2mjJlRbrVZJrbHQR2 hxUKBT60UUiHeD0/ev/6/gJIZEsbOEO012StXybLxPcJhSChWJ7N6iUR/6jhetAQ6nBZ xfvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=3851g8x1yTxXIC+JjL3Tt+RgQiz9zZlPaF3kYwhVEPs=; b=osr1FHpkotQnpRR4yEpKybik2huNi0gxkM3GwpZZnroQ34lOWVLgjxUgI6WYOUMXGu NsiaIVJaQucSGkHTQEtBa+qURY3QTRn0oIjKiy4mLg8P5x6ujuWTHHb2Xrf4ZRuiYqU2 Yxdfan7mVk4YVTDsoFoGOPdF8/WDNCXEfCs1nmZP3fLlWf7h4HsGc9xfrGY8jqZOZ7pn QtgsgjcOKedspR3bfNkLKZTKF0KjNGre2AWtQjkSFP+83gVeVzpTOEVjR9fDYVTFgdX6 9Pb5+UOENZNW/VDA45nwL8rzLyqWdD6ea+rM0DqWaleoGGLdgeH3zS4Ih4KNmrnj/ubK 0Bvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=HUOjDLSq; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 s16-v6si409892plp.317.2018.08.06.23.18.12; Mon, 06 Aug 2018 23:18:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com header.s=dec2015msa header.b=HUOjDLSq; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731069AbeHGIaz (ORCPT + 5 others); Tue, 7 Aug 2018 04:30:55 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:39155 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727360AbeHGIaz (ORCPT ); Tue, 7 Aug 2018 04:30:55 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id w776HYgh009463; Tue, 7 Aug 2018 15:17:39 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com w776HYgh009463 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1533622659; bh=vQ1peXoL5EnrlsDxZywosCdynceuZFw0QzMxHmOSOmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HUOjDLSqEHUdMDXObfwPPxBmoWtqx1rC0Js8saVMxlz3y6LL5Yy32px66lbD5o9l+ ANX97qAaP/GQxdgXiW0kzCeq7E1PP+ihVXwJq+mEZJiJF/AgTcatiPr8+nLzhGFvyG 5vKA3/vLmo8YHgLJEVowIZWzEdguMEG3iJvyoseYSXFkeQxArsJmCSQv9fjryzc7+x edMSk96D0GYyt4HE3K9FOBCWSb7r1Mo8U8BN2VAWyBXjIkhfA1L7hE79+bdEYwLQ3B cSXihKRK5kiNujZ/xu/GJuPbDBURWsg5bCZcW4bbK39Oa5u+3aQzWJgi9HcKALuhSP fOfwzBBDKZtWQ== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Wolfram Sang , linux-mmc@vger.kernel.org Cc: Ulf Hansson , linux-renesas-soc@vger.kernel.org, Masami Hiramatsu , Jassi Brar , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [v0.1 PATCH 5/7] mmc: renesas_sdhi: merge clk_{start, stop} functions to set_clock Date: Tue, 7 Aug 2018 15:17:20 +0900 Message-Id: <1533622642-13989-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533622642-13989-1-git-send-email-yamada.masahiro@socionext.com> References: <1533622642-13989-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org renesas_sdhi_clk_start() and renesas_sdhi_clk_stop() are now only called from renesas_sdhi_set_clock(). Merge them. Signed-off-by: Masahiro Yamada --- drivers/mmc/host/renesas_sdhi_core.c | 39 +++++++++++------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 1f4c82e..a15fb2e 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -155,35 +155,16 @@ static unsigned int renesas_sdhi_clk_update(struct tmio_mmc_host *host, return ret == 0 ? best_freq : clk_get_rate(priv->clk); } -static void renesas_sdhi_clk_start(struct tmio_mmc_host *host) -{ - sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN | - sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); - - /* HW engineers overrode docs: no sleep needed on R-Car2+ */ - if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) - usleep_range(10000, 11000); -} - -static void renesas_sdhi_clk_stop(struct tmio_mmc_host *host) -{ - sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & - sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); - - /* HW engineers overrode docs: no sleep needed on R-Car2+ */ - if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) - usleep_range(10000, 11000); -} - static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, unsigned int new_clock) { u32 clk = 0, clock; - if (new_clock == 0) { - renesas_sdhi_clk_stop(host); - return; - } + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & + sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); + + if (new_clock == 0) + goto out; clock = renesas_sdhi_clk_update(host, new_clock) / 512; @@ -194,13 +175,17 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, if ((host->pdata->flags & TMIO_MMC_CLK_ACTUAL) && ((clk >> 22) & 0x1)) clk |= 0xff; - sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, ~CLK_CTL_SCLKEN & - sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, clk & CLK_CTL_DIV_MASK); if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) usleep_range(10000, 11000); - renesas_sdhi_clk_start(host); + sd_ctrl_write16(host, CTL_SD_CARD_CLK_CTL, CLK_CTL_SCLKEN | + sd_ctrl_read16(host, CTL_SD_CARD_CLK_CTL)); + +out: + /* HW engineers overrode docs: no sleep needed on R-Car2+ */ + if (!(host->pdata->flags & TMIO_MMC_MIN_RCAR2)) + usleep_range(10000, 11000); } static void renesas_sdhi_clk_disable(struct tmio_mmc_host *host)