From patchwork Fri Aug 18 17:55:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 110422 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp1231999qge; Fri, 18 Aug 2017 10:55:53 -0700 (PDT) X-Received: by 10.84.232.11 with SMTP id h11mr10794523plk.126.1503078953879; Fri, 18 Aug 2017 10:55:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503078953; cv=none; d=google.com; s=arc-20160816; b=xX+1sbqYGlqYKgWlthZnOUUC/n7tcCjFZgS4pR3yQEsyMBDVwwvIZ2mYaVXqYbHAeC JSRM3URH3ynZ8mzkP5bXrHdxSpjyObeoe//XBEOcpPdLVjsW/2hQmvbPutg4pRLvI4Dk Qa8iAGt2OB/6OLHI7/1fqQxcOc+0U9aovZOT5TfjXWobFdRQnZ/GUeyFY2B3FuTqrXmM clSgFoJHpcvzSvBOV9rL6A/jsvmIYE/UdYBD6Tq3Hbf5hnv78yRMauw856LUF89cd2fD 91AbgVbGGTTGpCPMVFGXy65aIG3pgbiT9CTsT/34yN75RMyltox/F8j+KMtKX+0N3qHE U0qw== 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:arc-authentication-results; bh=6Q4iXbHvz0Lb+SK44RO3RX/vNKdqK9AyG2NP+vm/+W4=; b=S+ed7y+JkK90qfMIuC195tluRydKITqYydN8Bi01trkDghMBb97z4yOYYyaysmgqcj WbJG6SeTwGagnNlW9qglB3UVeMS29RvFuTBqrfJeJtgS11401gMuKtltrGWfW8K+Ht5J j6ausU+dZV1Hg9yhsQBzhrE/BewApMA3ND4PDRB2SWwRzrtOragbTyHgE8W/hs9N85A/ icfSLjUyao+T56I1Z72b4HgnG416o+tIlVShjTe06+2iLQ1wrdW9zOkpBQZ2UuAnFGm/ JbqTKvyvpxlDVa8Wg31gXUGhUCFsm5aWSVAQ0HMk74rkLkToMmqP7cAahmt5G3mzdjsb xx9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DjtwB0GU; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z185si3834531pgd.200.2017.08.18.10.55.53; Fri, 18 Aug 2017 10:55:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=DjtwB0GU; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751626AbdHRRzw (ORCPT + 9 others); Fri, 18 Aug 2017 13:55:52 -0400 Received: from mail-pg0-f47.google.com ([74.125.83.47]:33171 "EHLO mail-pg0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752092AbdHRRzL (ORCPT ); Fri, 18 Aug 2017 13:55:11 -0400 Received: by mail-pg0-f47.google.com with SMTP id t3so40694735pgt.0 for ; Fri, 18 Aug 2017 10:55:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2ZU07ODgvCEeWb+lW0HUfnrQU2DiuGUHrZ8l/xceBQE=; b=DjtwB0GUCSAXbfEG0U/RICBfAVmQJdkKIHxftf86uiNP88biV6unIW55wi7QDkHrpD IUuXxti+8rBu5zIvLEbF3RjfQhVUbNtxUeCDONMO9S++E6Wd/Rectie1pCahdhsBCYmA OSGO/ZV/hA4xDk2v7nclxjwQvNiJEa1NR1L/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2ZU07ODgvCEeWb+lW0HUfnrQU2DiuGUHrZ8l/xceBQE=; b=ZwgVc0EITxagcNEjQf6W1qa5ww3f8qqL5wXUwS46GW/mBzzSRJyutlZ7OhAJ6hR0wk ISabJ37UZ9RjGaYNBRx+rGtt9hk+p450IpbscFXobK3lHBpOmdql728A3cT//YEPoLzP V1cyJSHqljd3cLpc5Nv6g8PBaozZmyrCcNiWuuj2wLz9UkwpFJJt3YNujm6BMLkiKTKe KrRl931TW7FJ5jw2lF7vu4cz4cgm8GGfeaT9PMt1T8b/1iX9AneCaX5RX+fVCia547RH PG0H7ryLp4RixX2AsM4cWOx5SHtbpZvGPUhSOvj+rsOajyDYpyUhS6vzIAQ4rJ0369CG f78A== X-Gm-Message-State: AHYfb5h6RivrLPQu22x9cMsBBGrNFfY2/0oeBdUqAEDjuTpFCSM1pYik JpKtbDOFRbggy0GnW6HBNQ== X-Received: by 10.101.86.74 with SMTP id m10mr9143282pgs.79.1503078911060; Fri, 18 Aug 2017 10:55:11 -0700 (PDT) Received: from localhost.localdomain (ip68-111-217-79.sd.sd.cox.net. [68.111.217.79]) by smtp.gmail.com with ESMTPSA id 204sm11132553pga.85.2017.08.18.10.55.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Aug 2017 10:55:10 -0700 (PDT) From: Bjorn Andersson To: Adrian Hunter , Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Venkat Gopalakrishnan , Ritesh Harjani Subject: [PATCH 1/2] mmc: sdhci-msm: Utilize bulk clock API Date: Fri, 18 Aug 2017 10:55:05 -0700 Message-Id: <20170818175506.5035-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170818175506.5035-1-bjorn.andersson@linaro.org> References: <20170818175506.5035-1-bjorn.andersson@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org By stuffing the runtime controlled clocks into a clk_bulk_data array we can utilize the newly introduced bulk clock operations and clean up the error paths. This allow us to handle additional clocks in subsequent patch, without the added complexity. Cc: Ritesh Harjani Signed-off-by: Bjorn Andersson --- drivers/mmc/host/sdhci-msm.c | 44 ++++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 28 deletions(-) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index fc73e56eb1e2..71e01cbc38b6 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -131,6 +131,7 @@ struct sdhci_msm_host { struct clk *pclk; /* SDHC peripheral bus clock */ struct clk *bus_clk; /* SDHC bus voter clock */ struct clk *xo_clk; /* TCXO clk needed for FLL feature of cm_dll*/ + struct clk_bulk_data bulk_clks[2]; unsigned long clk_rate; struct mmc_host *mmc; bool use_14lpp_dll_reset; @@ -1167,16 +1168,12 @@ static int sdhci_msm_probe(struct platform_device *pdev) goto bus_clk_disable; } - ret = clk_prepare_enable(msm_host->pclk); - if (ret) - goto bus_clk_disable; - /* Setup SDC MMC clock */ msm_host->clk = devm_clk_get(&pdev->dev, "core"); if (IS_ERR(msm_host->clk)) { ret = PTR_ERR(msm_host->clk); dev_err(&pdev->dev, "SDC MMC clk setup failed (%d)\n", ret); - goto pclk_disable; + goto bus_clk_disable; } /* @@ -1194,9 +1191,13 @@ static int sdhci_msm_probe(struct platform_device *pdev) if (ret) dev_warn(&pdev->dev, "core clock boost failed\n"); - ret = clk_prepare_enable(msm_host->clk); + msm_host->bulk_clks[0].clk = msm_host->clk; + msm_host->bulk_clks[1].clk = msm_host->pclk; + + ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), + msm_host->bulk_clks); if (ret) - goto pclk_disable; + goto bus_clk_disable; core_memres = platform_get_resource(pdev, IORESOURCE_MEM, 1); msm_host->core_mem = devm_ioremap_resource(&pdev->dev, core_memres); @@ -1290,9 +1291,8 @@ static int sdhci_msm_probe(struct platform_device *pdev) pm_runtime_set_suspended(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); clk_disable: - clk_disable_unprepare(msm_host->clk); -pclk_disable: - clk_disable_unprepare(msm_host->pclk); + clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), + msm_host->bulk_clks); bus_clk_disable: if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); @@ -1315,8 +1315,8 @@ static int sdhci_msm_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); - clk_disable_unprepare(msm_host->clk); - clk_disable_unprepare(msm_host->pclk); + clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), + msm_host->bulk_clks); if (!IS_ERR(msm_host->bus_clk)) clk_disable_unprepare(msm_host->bus_clk); sdhci_pltfm_free(pdev); @@ -1330,8 +1330,8 @@ static int sdhci_msm_runtime_suspend(struct device *dev) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); - clk_disable_unprepare(msm_host->clk); - clk_disable_unprepare(msm_host->pclk); + clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks), + msm_host->bulk_clks); return 0; } @@ -1341,21 +1341,9 @@ static int sdhci_msm_runtime_resume(struct device *dev) struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host); - int ret; - ret = clk_prepare_enable(msm_host->clk); - if (ret) { - dev_err(dev, "clk_enable failed for core_clk: %d\n", ret); - return ret; - } - ret = clk_prepare_enable(msm_host->pclk); - if (ret) { - dev_err(dev, "clk_enable failed for iface_clk: %d\n", ret); - clk_disable_unprepare(msm_host->clk); - return ret; - } - - return 0; + return clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks), + msm_host->bulk_clks); } #endif