From patchwork Thu Aug 25 05:52:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 74643 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp666663qga; Wed, 24 Aug 2016 22:51:14 -0700 (PDT) X-Received: by 10.194.127.163 with SMTP id nh3mr5690021wjb.74.1472104274150; Wed, 24 Aug 2016 22:51:14 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id dw15si12164099wjb.134.2016.08.24.22.51.12; Wed, 24 Aug 2016 22:51:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@nifty.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0F6E04B99D; Thu, 25 Aug 2016 07:51:10 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ggFUyOVqBGxY; Thu, 25 Aug 2016 07:51:09 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 80AF84B93F; Thu, 25 Aug 2016 07:51:09 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 341974B951 for ; Thu, 25 Aug 2016 07:51:04 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id D7j8Kmgg0lg1 for ; Thu, 25 Aug 2016 07:51:04 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from conuserg-11.nifty.com (conuserg-11.nifty.com [210.131.2.78]) by theia.denx.de (Postfix) with ESMTPS id 797B64B811 for ; Thu, 25 Aug 2016 07:50:58 +0200 (CEST) Received: from beagle.diag.org (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id u7P5oZi4017421; Thu, 25 Aug 2016 14:50:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com u7P5oZi4017421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1472104237; bh=06UaVluqXHCcRh5TJTZPjiwKPTa+DViKX76alxbcXRE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0mWwzkxRwxCdGvjvenYvbtMSQip8GUvF5orrHxbjZhGmVKGzr6nrA2FzUhHPu/IyR YRwsqfFZGodkDZD4M3V31XPE8Zg756xVZunqVS45Cto/mdxqiwMY8ytGptEX4q58Yo YNRSYiVEliws3JqQo2N2ugHSa3BryTotNuHo0AcJyM70q3q5ApZkCotPY1kNLtzUcV 5GFyC4dIKH75+ihHdqizWxzesCYI7e3XW39kWncKiAmRN6CC0yc0i7HTPCiXwAAndN xJndMtX5u+Vpp9f9AOXLtdgbDjK5eotCDkGkIzwdpCv7KBy3+PpX04Za2+RprsM9ZW S3fFeZKQkznbA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: u-boot@lists.denx.de Date: Thu, 25 Aug 2016 14:52:38 +0900 Message-Id: <1472104359-23551-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1472104359-23551-1-git-send-email-yamada.masahiro@socionext.com> References: <1472104359-23551-1-git-send-email-yamada.masahiro@socionext.com> Subject: [U-Boot] [PATCH 4/5] mmc: uniphier-sd: just return if already set to desired clock rate X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With this, we can save unnecessary udelay(). Signed-off-by: Masahiro Yamada --- drivers/mmc/uniphier-sd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 1.9.1 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index 40a5c85..701b26f 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -571,6 +571,9 @@ static void uniphier_sd_set_clk_rate(struct uniphier_sd_priv *priv, val = UNIPHIER_SD_CLKCTL_DIV1024; tmp = readl(priv->regbase + UNIPHIER_SD_CLKCTL); + if (tmp & UNIPHIER_SD_CLKCTL_SCLKEN && + (tmp & UNIPHIER_SD_CLKCTL_DIV_MASK) == val) + return; /* stop the clock before changing its rate to avoid a glitch signal */ tmp &= ~UNIPHIER_SD_CLKCTL_SCLKEN; @@ -582,6 +585,8 @@ static void uniphier_sd_set_clk_rate(struct uniphier_sd_priv *priv, tmp |= UNIPHIER_SD_CLKCTL_SCLKEN; writel(tmp, priv->regbase + UNIPHIER_SD_CLKCTL); + + udelay(1000); } static int uniphier_sd_set_ios(struct udevice *dev) @@ -599,8 +604,6 @@ static int uniphier_sd_set_ios(struct udevice *dev) uniphier_sd_set_ddr_mode(priv, mmc); uniphier_sd_set_clk_rate(priv, mmc); - udelay(1000); - return 0; }