From patchwork Thu Aug 16 07:16:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 144323 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1729537ljj; Thu, 16 Aug 2018 00:17:51 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzzDcIA4cSJhBp3YqEtn6w7sePG8LNxT4vXwqIRo9z1BrNljx3lqjdpiPZNC5m8Kjywxxai X-Received: by 2002:a17:902:8541:: with SMTP id d1-v6mr28132509plo.81.1534403871562; Thu, 16 Aug 2018 00:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534403871; cv=none; d=google.com; s=arc-20160816; b=Jp8TpU4KltCl4MIGCCpTDnxMDM4hXhZx6BLgiCl0/G2F8X3prurV9sv08NeQOuKZak YKPR6HHdk+4yrBBUCZPsfy00OEikI6vDUojkewcA0oiYC1Qv0vCKGaB5gA55bPspsQ6a UVMoLu1t4XcQxlqtx6VpFmPxboKkZWEMYmQGezgE2bium+MJ9GYIsTxbp26CklHgTHCp WHKGQEcvN3mPLofXulkNbWKI5Puw41sdH4+f2Ha+UDCArTBYyYaZMZduOwCiBEi2Ngwu PaLo4cgqR+iACvnJnlrFGXrXFo+AFVTTU6yAAkreSf0J5Pfxyf9wpSQlZ1u3eRABCncr D0nQ== 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=1THgspRs7J/CvA6Et2CW6NHJzt0aZosTZKkkdPhTrGM=; b=RKkqAgDLNHb+oWmnyQj7KuOzrQ0aksfdxu9CwcFV9lbcttiixbAzizjbW9+a2H7Qxc Yx5/4ybQsN4Rj8oYoBCMoeoFfs8rpdCW7LNri7HIunRA1CfALd1jvjeCn4Hpa/C3GV3E 6OzoRLNa286e8q+VyWEbIELwoauOgB7q6/Asudyhrf5ewEw5JD2Yi1tg8+vj664Ho7w6 WooKl3Oj+7itpxfWkIb/SlasKvc3ElTZow+uWlEe4gr1b3w6knFKywL8IT0r/JZafmz9 EhqxQMEFiaWIDwfJp//SYyjt52yChzy5qjaa36+VffQU4+PWbIpTa3MXM79IGFc3oZTB lyog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=cQvIca4v; 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 f12-v6si24878828pgm.601.2018.08.16.00.17.51; Thu, 16 Aug 2018 00:17:51 -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=pass header.i=@nifty.com header.s=dec2015msa header.b=cQvIca4v; 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 S2389280AbeHPKOQ (ORCPT + 5 others); Thu, 16 Aug 2018 06:14:16 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:17415 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389276AbeHPKOQ (ORCPT ); Thu, 16 Aug 2018 06:14:16 -0400 Received: from grover.tkatk1.zaq.ne.jp (zaqdadce369.zaq.ne.jp [218.220.227.105]) (authenticated) by conuserg-09.nifty.com with ESMTP id w7G7Gu2L008336; Thu, 16 Aug 2018 16:17:00 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w7G7Gu2L008336 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1534403821; bh=1THgspRs7J/CvA6Et2CW6NHJzt0aZosTZKkkdPhTrGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cQvIca4v7hwpQVxEnHCMZDWV4G28jhe1CUW1iT9HMCuVrbSXsZfZN4zzoVEmhj7/q YXSq1TID0vNdkCUqeninQA2UGdyZNLQjahpl6j1MVHo2nNpo1kJPgzYEwRuEaRpbFa c2MDOvZE0d3AvBFxG+E0HoOVQrjsh3RI1bC/Zdje3tgJwN/XyNiPSHoAyNRA5Vvo+W 9x5Vat/lk6qbR/pMPPM/yr10eeyvmAmpHCzRMGJ8gf61m4gLdqaCLJL/M7brfn0Jv/ gVaTYNvZ74tnlT0sGLl0E6Im6aOdqbIvOUixpuzzY5M17QWf5/ChwyvKAWNT162ePc b4oKF+j6RLH3Q== X-Nifty-SrcIP: [218.220.227.105] From: Masahiro Yamada To: linux-mmc@vger.kernel.org, Wolfram Sang Cc: Masami Hiramatsu , Jassi Brar , Ulf Hansson , linux-renesas-soc@vger.kernel.org, Masahiro Yamada Subject: [PATCH v2 5/7] mmc: renesas_sdhi: merge clk_{start, stop} functions to set_clock Date: Thu, 16 Aug 2018 16:16:37 +0900 Message-Id: <1534403799-10594-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534403799-10594-1-git-send-email-yamada.masahiro@socionext.com> References: <1534403799-10594-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 --- Changes in v2: None drivers/mmc/host/renesas_sdhi_core.c | 39 +++++++++++------------------------- 1 file changed, 12 insertions(+), 27 deletions(-) -- 2.7.4 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)