From patchwork Thu Apr 23 08:16:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6260201 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 46D6D9F313 for ; Thu, 23 Apr 2015 08:16:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 687C620380 for ; Thu, 23 Apr 2015 08:16:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 71D3B20149 for ; Thu, 23 Apr 2015 08:16:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756740AbbDWIQI (ORCPT ); Thu, 23 Apr 2015 04:16:08 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:19697 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755790AbbDWIQH (ORCPT ); Thu, 23 Apr 2015 04:16:07 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 23 Apr 2015 17:16:06 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 3D4AD5B0E3; Thu, 23 Apr 2015 17:16:06 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 346371806F; Thu, 23 Apr 2015 17:16:06 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 290CA1800A; Thu, 23 Apr 2015 17:16:06 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id TAN29775; Thu, 23 Apr 2015 17:16:06 +0900 X-IronPort-AV: E=Sophos;i="5.11,629,1422889200"; d="scan'208";a="184687472" Received: from mail-hk1lp0124.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.124]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 23 Apr 2015 17:16:05 +0900 Authentication-Results: linaro.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB308.apcprd06.prod.outlook.com (10.141.37.28) with Microsoft SMTP Server (TLS) id 15.1.136.25; Thu, 23 Apr 2015 08:16:04 +0000 Message-ID: <87618ngt1d.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 4/7 v4] mmc: sh_mmcif: separate sh_mmcif_clk_update() into setup and prepare User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Ulf Hansson , Simon CC: linux-mmc , Magnus , Linux-SH , Laurent , kobayashi In-Reply-To: <87d22vgt8u.wl%kuninori.morimoto.gx@renesas.com> References: <873840a4ch.wl%kuninori.morimoto.gx@renesas.com> <87d22vgt8u.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 23 Apr 2015 08:16:04 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: TY1PR01CA0031.jpnprd01.prod.outlook.com (25.164.162.141) To HKNPR06MB308.apcprd06.prod.outlook.com (10.141.37.28) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB308; X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(87976001)(76176999)(36756003)(62966003)(54356999)(40100003)(83506001)(122386002)(50986999)(66066001)(53416004)(50466002)(4001350100001)(19580395003)(23726002)(77156002)(2950100001)(19580405001)(77096005)(46102003)(33646002)(92566002)(5001770100001)(46406003)(42186005)(229853001)(86362001)(47776003)(4001430100001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB308; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002010)(5005006); SRVR:HKNPR06MB308; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB308; X-Forefront-PRVS: 0555EC8317 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Apr 2015 08:16:04.2810 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB308 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current sh_mmcif_clk_update() is called from probe() and set_ios(), but, the purpose of later one is just clk_prepare_enable(). No need to setup mmc->f_max/f_min in many times. This patch separe sh_mmcif_clk_update() into clk_prepare_enable() and mmc->f_max/f_min setup. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi Acked-by: Geert Uytterhoeven --- v3 -> v4 - new patch, this is tidyup patch drivers/mmc/host/sh_mmcif.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c index ff4f8c0..d2f1158 100644 --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -978,18 +978,12 @@ static void sh_mmcif_request(struct mmc_host *mmc, struct mmc_request *mrq) sh_mmcif_start_cmd(host, mrq); } -static int sh_mmcif_clk_update(struct sh_mmcif_host *host) +static void sh_mmcif_clk_setup(struct sh_mmcif_host *host) { - int ret = clk_prepare_enable(host->clk); + unsigned int clk = clk_get_rate(host->clk); - if (!ret) { - unsigned int clk = clk_get_rate(host->clk); - - host->mmc->f_max = clk / 2; - host->mmc->f_min = clk / 512; - } - - return ret; + host->mmc->f_max = clk / 2; + host->mmc->f_min = clk / 512; } static void sh_mmcif_set_power(struct sh_mmcif_host *host, struct mmc_ios *ios) @@ -1046,7 +1040,8 @@ static void sh_mmcif_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) if (ios->clock) { if (!host->power) { - sh_mmcif_clk_update(host); + clk_prepare_enable(host->clk); + pm_runtime_get_sync(&host->pd->dev); host->power = true; sh_mmcif_sync_reset(host); @@ -1447,10 +1442,13 @@ static int sh_mmcif_probe(struct platform_device *pdev) dev_err(dev, "cannot get clock: %d\n", ret); goto err_pm; } - ret = sh_mmcif_clk_update(host); + + ret = clk_prepare_enable(host->clk); if (ret < 0) goto err_pm; + sh_mmcif_clk_setup(host); + ret = pm_runtime_resume(dev); if (ret < 0) goto err_clk;