From patchwork Thu Aug 23 04:44:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 144865 Delivered-To: patch@linaro.org Received: by 2002:a2e:164a:0:0:0:0:0 with SMTP id 10-v6csp685508ljw; Wed, 22 Aug 2018 21:45:46 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZneFDkr++OHv2iA8UXXujQez/qo4hOiJgtCOqw/6ElJPXqpZjqKao7CQwwmSkGwYX1C+Ak X-Received: by 2002:a65:64d1:: with SMTP id t17-v6mr5600311pgv.207.1534999546563; Wed, 22 Aug 2018 21:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534999546; cv=none; d=google.com; s=arc-20160816; b=n5UbyZjoMd/BX2lUMSteY/sg4fvlEcyE+wJOHNEi3sq8scOmyueS+m5vJhGGaCkctq 3Jh6sewNn3/moqnuyF5un/4aSVFammV5GoYUeJjpTKzKLIuseeI3thGV2ETwmPL4UO1G XnMstYSqlNvLqt4Ftp3CFs3DEtg9G8Z55dzeoE5oEayQcgDUn2+z2j0Adf3KN74J2vuF O4t6q+A18DE2tX7eVyMTcUIRA8m58RwPSJfRGJKmTvAloICky7Aaw33+OMYk6NprPO+j L+hgZid5nbaRaplxk/OCMLgi1fHWlnh36s482cxF1tCI8KTgUQvw2hSjF54Jx4NBsK6Y 7oyA== 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=aZPuDo0cJpVKtlXh3mnagFYyO0uUQwqRbzpkWf/IazM=; b=BiuGttOpOFp5tqydiH7MAIpYCoE4idvzKR9fUhWu8RpJGq5Lzopxz7hLzJyc921XJ/ xXB5m0pUmKeF0+RVfDFobbQtM9D9PwqktK1tnJsduJLG5MhE1xEqaFW+xHA0DCF3bfDj egqfO2GdMd/leg+BNOBouqAHVKMrWCi7803fFzffaOcAIn/04lN88eDglrzZkqEN6GXx jkG09CrmZrXo8nWGQOsBTOkEZiaHsrGJRT7TonAJLZm3RVmgAls7WsyAhbofltW/yhGV wE7iHHDg7wwvIfMPyRhA+4XuMs8WZUZkkYpLlnEVJzmHMsOpOlUb7OBmxTwvqMsVWzOX UZ7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vx2ZpZst; 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 v33-v6si3502791pga.439.2018.08.22.21.45.46; Wed, 22 Aug 2018 21:45:46 -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=vx2ZpZst; 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 S1728264AbeHWINc (ORCPT + 5 others); Thu, 23 Aug 2018 04:13:32 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:47875 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726204AbeHWINb (ORCPT ); Thu, 23 Aug 2018 04:13:31 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w7N4ilM5021677; Thu, 23 Aug 2018 13:44:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w7N4ilM5021677 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1534999492; bh=aZPuDo0cJpVKtlXh3mnagFYyO0uUQwqRbzpkWf/IazM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vx2ZpZstArU3l1FxY8k+D+Yj7prI836YNV4KJBqJfkl7EgVG/SknI3ZgR0cU17MGE KL5odK7AX6FfBmZhFXqEvjDoxmapFWfQr6rl3DrRixxeMtLsG8D6xUNpeLxFwQtOEw 74/zSQ3Z4BquDF/7AgXrPlE7QCIdqsj3xB8dNTOXYu+9dWJD7pqYjO8hKlQM2GAuZP V0pr7kqkQwOY+FNzRU+jPLz0/JhFrROlmV1a5fYClgn7eIWcwZuhdxpQ99d+XVVIx/ h8lhGBZPIkubtxBGuBu2wi9v3KAHFQC6RvLF39qTn0wmBLsmYv1itR3plTJZrwwdI6 cY/EH3f4e8kGw== 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: [PATCH v3 5/6] mmc: renesas_sdhi: merge clk_{start, stop} functions to set_clock Date: Thu, 23 Aug 2018 13:44:19 +0900 Message-Id: <1534999460-15111-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534999460-15111-1-git-send-email-yamada.masahiro@socionext.com> References: <1534999460-15111-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 v3: None Changes in v2: None drivers/mmc/host/renesas_sdhi_core.c | 38 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 26 deletions(-) -- 2.7.4 Reviewed-by: Wolfram Sang Tested-by: Wolfram Sang diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index cb6e889..0e88737 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -155,35 +155,17 @@ 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) +static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, + unsigned int new_clock) { - 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); -} + u32 clk = 0, clock; -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) + goto out; - if (new_clock == 0) { - renesas_sdhi_clk_stop(host); - return; - } /* * Both HS400 and HS200/SD104 set 200MHz, but some devices need to * set 400MHz to distinguish the CPG settings in HS400. @@ -206,13 +188,17 @@ static void renesas_sdhi_set_clock(struct tmio_mmc_host *host, 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)