From patchwork Fri Jun 16 12:45:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kishon Vijay Abraham I X-Patchwork-Id: 9791419 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 27B766038E for ; Fri, 16 Jun 2017 12:48:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18B262862B for ; Fri, 16 Jun 2017 12:48:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C9602863A; Fri, 16 Jun 2017 12:48:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD6F72862B for ; Fri, 16 Jun 2017 12:48:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753884AbdFPMsH (ORCPT ); Fri, 16 Jun 2017 08:48:07 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:38610 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753013AbdFPMsF (ORCPT ); Fri, 16 Jun 2017 08:48:05 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v5GCkKYh022325; Fri, 16 Jun 2017 07:46:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1497617180; bh=VxMBX3BfAVVZ4ReUPZeeIbJk1encEl/ARsaQxXrrsuE=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SXyjS1Gl9Fz6guoXTRO0wb1YWGd8arOV1zb6c2K+7PjPv2XyUu8IISsBZJ1IZSwc6 mvLKiZmyd28Cil5Y8vgGZ6KtZUcar+tudjeWrPuB11uSJjye/nSxeB9FNLhwk4kv6v nujmlPofOU47ns8n7rJue/651WOYu9dXXKC6Ov6E= Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id v5GCkF3O012587; Fri, 16 Jun 2017 07:46:15 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Fri, 16 Jun 2017 07:46:14 -0500 Received: from a0393678ub.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v5GCjjBh000652; Fri, 16 Jun 2017 07:46:10 -0500 From: Kishon Vijay Abraham I To: Ulf Hansson , Rob Herring , Tony Lindgren , CC: Russell King , Ravikumar Kattekola , , , , , , Subject: [PATCH 05/16] mmc: host: omap_hsmmc: Set clk rate to the max frequency Date: Fri, 16 Jun 2017 18:15:33 +0530 Message-ID: <20170616124544.15046-6-kishon@ti.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170616124544.15046-1-kishon@ti.com> References: <20170616124544.15046-1-kishon@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Set the clock rate of the functional clock to the max frequency that is passed to the driver either using pdata or dt. Also remove unnecessary setting of host->fclk to NULL. This is in preparation for supporting high frequency modes of operation. Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sekhar Nori --- drivers/mmc/host/omap_hsmmc.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 680934d50919..3ca18e28be01 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -2153,22 +2153,29 @@ static int omap_hsmmc_probe(struct platform_device *pdev) mmc->ops = &omap_hsmmc_ops; - mmc->f_min = OMAP_MMC_MIN_CLOCK; - - if (pdata->max_freq > 0) - mmc->f_max = pdata->max_freq; - else if (mmc->f_max == 0) - mmc->f_max = OMAP_MMC_MAX_CLOCK; - spin_lock_init(&host->irq_lock); host->fclk = devm_clk_get(&pdev->dev, "fck"); if (IS_ERR(host->fclk)) { ret = PTR_ERR(host->fclk); - host->fclk = NULL; goto err1; } + mmc->f_min = OMAP_MMC_MIN_CLOCK; + if (pdata->max_freq) + mmc->f_max = pdata->max_freq; + + if (mmc->f_max) { + ret = clk_set_rate(host->fclk, mmc->f_max); + if (ret) { + dev_err(&pdev->dev, "failed to set clock to %d\n", + mmc->f_max); + goto err1; + } + } else { + mmc->f_max = OMAP_MMC_MAX_CLOCK; + } + if (host->pdata->controller_flags & OMAP_HSMMC_BROKEN_MULTIBLOCK_READ) { dev_info(&pdev->dev, "multiblock reads disabled due to 35xx erratum 2.1.1.128; MMC read performance may suffer\n"); omap_hsmmc_ops.multi_io_quirk = omap_hsmmc_multi_io_quirk;