From patchwork Wed Aug 23 04:15:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 110710 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp3588699qge; Tue, 22 Aug 2017 21:17:31 -0700 (PDT) X-Received: by 10.84.140.5 with SMTP id 5mr1602199pls.38.1503461850930; Tue, 22 Aug 2017 21:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503461850; cv=none; d=google.com; s=arc-20160816; b=Fuxd6ZWTnWZlmO7dv5z51uRCUQp13r5ftyI1rbok4cHnIqR+plNj94D5F6AvKLcJgZ jI4B99X43cdPyRSwtCBZKfZO5+8MK37IOCn/WOL/CcC9yVys3D+ON3Ml1Ve/V9ApyMyB 8QqCT+Xncv0lXijiCwLlDsXCCIvVRDRNYej8zJdnRO/7P/0uBs3YJ7btvCXKiOor71Yx IFEN19dixSeDy+L9+6Tiivj8ZOPKzWJIVwrsdQcUuRVvF73QLoG1/dA4kW15aMIu4nmh L00RlwoDYNv2tXNwF5JWDZypqtRlob4atc6SXN4nNAWI6QhPyCvlr5H+u/ErJGOCn8HK OV3g== 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=OC9iOvjCPc/YkkX7iOHzYL/0LYaFUIgKSfABF93dBHU=; b=GFCt9XrBSmPyiFr04cctrzcsaJm+/YMr7h6/eS3Ae+XVV7KhUjNzqFPzg9swLFq8tl OZVkIDR8UQVCUyQFmJQKYdkEIJfGrCqgSO0K81gFN6+6tsYBARaFb2xxg4KfvZlyw+0w Euz6csCc65S1fuyZCrnVsjdIL2LNjIEnPFVsfSaZInOekN2btp4KegZwPAouRM7Q5+4k 7wniERU9o+KpJXAM0J+BfAVRB8i5AMmw6tkm90hxWHMeR/MAuYbnlwIkn2XLouC7HPxv WI48VQm8v4U6TdnWyAdedZFtwI4aFixp5FDvEgiBPdvJAnO0lgpDOhiMIpM4RFlpZ4Lq 2PZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=SRbX/pwH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 v3si490067plk.95.2017.08.22.21.17.30; Tue, 22 Aug 2017 21:17:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=SRbX/pwH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753285AbdHWERC (ORCPT + 26 others); Wed, 23 Aug 2017 00:17:02 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:19347 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753202AbdHWERA (ORCPT ); Wed, 23 Aug 2017 00:17:00 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v7N4F6Rq020925; Wed, 23 Aug 2017 13:15:08 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v7N4F6Rq020925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1503461708; bh=OC9iOvjCPc/YkkX7iOHzYL/0LYaFUIgKSfABF93dBHU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SRbX/pwHtdlrlcnIDmdGiEhza/P9E1tnNGwpzV5hZGydLNlKNNa0BfzjSnmddAXgm xP193nnpjsIoj6IYP3FBkVftA0StEtCK6bYm7xDtKoxaoRoS+A3Il1lCqcX0XBXD7+ bMVfsVCP75bv40suFFh/isLOpgTZzQziHuxxNd6r6gU24kjwfDbf6b7hq41If8btXK dX7EAjxY9vaFsrLcNreMhnTJixBRXo/t8BeppElBXxBVQafHYTDnwx+SQTQetFHQAk 8yKiqAGw7q5+RdgV04UvhA4bgVI5lWwAiQUPNAMf31k4P5aYOFp3xlj7m+MJr0Aztb gXIBcleRGsk2A== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Piotr Sroka , Hu Ziji , Adrian Hunter , Christian Daudt , Scott Branden , Zhangfei Gao , Kevin Hao , Olof Johansson , Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v4 1/4] mmc: sdhci-cadence: add suspend / resume support Date: Wed, 23 Aug 2017 13:15:00 +0900 Message-Id: <1503461703-16225-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503461703-16225-1-git-send-email-yamada.masahiro@socionext.com> References: <1503461703-16225-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the probe function initializes the PHY, but PHY settings are lost during the sleep state. Restore the PHY registers when resuming. To facilitate this, split sdhci_cdns_phy_init() into the DT parse part and PHY update part so that the latter can be invoked from the resume hook. Signed-off-by: Masahiro Yamada --- Changes in v4: - disable clk if resume fails. Changes in v3: - Use #ifdef CONFIG_PM_SLEEP instead of __maybe_unused - Add own sdhci_cdns_suspend implementation to not depend on the core change Changes in v2: None drivers/mmc/host/sdhci-cadence.c | 106 +++++++++++++++++++++++++++++++++++---- 1 file changed, 97 insertions(+), 9 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 19d5698244b5..3dca3b3c6436 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -67,9 +67,16 @@ */ #define SDHCI_CDNS_MAX_TUNING_LOOP 40 +struct sdhci_cdns_phy_param { + u8 addr; + u8 data; +}; + struct sdhci_cdns_priv { void __iomem *hrs_addr; bool enhanced_strobe; + unsigned int nr_phy_params; + struct sdhci_cdns_phy_param phy_params[0]; }; struct sdhci_cdns_phy_cfg { @@ -115,9 +122,22 @@ static int sdhci_cdns_write_phy_reg(struct sdhci_cdns_priv *priv, return 0; } -static int sdhci_cdns_phy_init(struct device_node *np, - struct sdhci_cdns_priv *priv) +static unsigned int sdhci_cdns_phy_param_count(struct device_node *np) { + unsigned int count = 0; + int i; + + for (i = 0; i < ARRAY_SIZE(sdhci_cdns_phy_cfgs); i++) + if (of_property_read_bool(np, sdhci_cdns_phy_cfgs[i].property)) + count++; + + return count; +} + +static void sdhci_cdns_phy_param_parse(struct device_node *np, + struct sdhci_cdns_priv *priv) +{ + struct sdhci_cdns_phy_param *p = priv->phy_params; u32 val; int ret, i; @@ -127,9 +147,19 @@ static int sdhci_cdns_phy_init(struct device_node *np, if (ret) continue; - ret = sdhci_cdns_write_phy_reg(priv, - sdhci_cdns_phy_cfgs[i].addr, - val); + p->addr = sdhci_cdns_phy_cfgs[i].addr; + p->data = val; + p++; + } +} + +static int sdhci_cdns_phy_init(struct sdhci_cdns_priv *priv) +{ + int ret, i; + + for (i = 0; i < priv->nr_phy_params; i++) { + ret = sdhci_cdns_write_phy_reg(priv, priv->phy_params[i].addr, + priv->phy_params[i].data); if (ret) return ret; } @@ -302,6 +332,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev) struct sdhci_pltfm_host *pltfm_host; struct sdhci_cdns_priv *priv; struct clk *clk; + size_t priv_size; + unsigned int nr_phy_params; int ret; struct device *dev = &pdev->dev; @@ -313,7 +345,9 @@ static int sdhci_cdns_probe(struct platform_device *pdev) if (ret) return ret; - host = sdhci_pltfm_init(pdev, &sdhci_cdns_pltfm_data, sizeof(*priv)); + nr_phy_params = sdhci_cdns_phy_param_count(dev->of_node); + priv_size = sizeof(*priv) + sizeof(priv->phy_params[0]) * nr_phy_params; + host = sdhci_pltfm_init(pdev, &sdhci_cdns_pltfm_data, priv_size); if (IS_ERR(host)) { ret = PTR_ERR(host); goto disable_clk; @@ -322,7 +356,8 @@ static int sdhci_cdns_probe(struct platform_device *pdev) pltfm_host = sdhci_priv(host); pltfm_host->clk = clk; - priv = sdhci_cdns_priv(host); + priv = sdhci_pltfm_priv(pltfm_host); + priv->nr_phy_params = nr_phy_params; priv->hrs_addr = host->ioaddr; priv->enhanced_strobe = false; host->ioaddr += SDHCI_CDNS_SRS_BASE; @@ -336,7 +371,9 @@ static int sdhci_cdns_probe(struct platform_device *pdev) if (ret) goto free; - ret = sdhci_cdns_phy_init(dev->of_node, priv); + sdhci_cdns_phy_param_parse(dev->of_node, priv); + + ret = sdhci_cdns_phy_init(priv); if (ret) goto free; @@ -353,6 +390,57 @@ static int sdhci_cdns_probe(struct platform_device *pdev) return ret; } +#ifdef CONFIG_PM_SLEEP +static int sdhci_cdns_suspend(struct device *dev) +{ + struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + int ret; + + if (host->tuning_mode != SDHCI_TUNING_MODE_3) + mmc_retune_needed(host->mmc); + + ret = sdhci_suspend_host(host); + if (ret) + return ret; + + clk_disable_unprepare(pltfm_host->clk); + + return 0; +} + +static int sdhci_cdns_resume(struct device *dev) +{ + struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + struct sdhci_cdns_priv *priv = sdhci_pltfm_priv(pltfm_host); + int ret; + + ret = clk_prepare_enable(pltfm_host->clk); + if (ret) + return ret; + + ret = sdhci_cdns_phy_init(priv); + if (ret) + goto disable_clk; + + ret = sdhci_resume_host(host); + if (ret) + goto disable_clk; + + return 0; + +disable_clk: + clk_disable_unprepare(pltfm_host->clk); + + return ret; +} +#endif + +static const struct dev_pm_ops sdhci_cdns_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(sdhci_cdns_suspend, sdhci_cdns_resume) +}; + static const struct of_device_id sdhci_cdns_match[] = { { .compatible = "socionext,uniphier-sd4hc" }, { .compatible = "cdns,sd4hc" }, @@ -363,7 +451,7 @@ MODULE_DEVICE_TABLE(of, sdhci_cdns_match); static struct platform_driver sdhci_cdns_driver = { .driver = { .name = "sdhci-cdns", - .pm = &sdhci_pltfm_pmops, + .pm = &sdhci_cdns_pm_ops, .of_match_table = sdhci_cdns_match, }, .probe = sdhci_cdns_probe, From patchwork Wed Aug 23 04:15:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 110708 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp3588356qge; Tue, 22 Aug 2017 21:17:06 -0700 (PDT) X-Received: by 10.101.77.11 with SMTP id i11mr1353993pgt.163.1503461826851; Tue, 22 Aug 2017 21:17:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503461826; cv=none; d=google.com; s=arc-20160816; b=FQc9uvD6URtfaepXrpYYfxO/Nc27yMKYpd8tryqOTBZJx87o0nujRvxWVL9IoKgO/e Mfme1K4Y9+1tCRO/5vZamKk0TEuehMG09DX+dsRR852nYj3pxxqrEDqUriJpvIG1SIVS JgL2hRd8Er/Vc0dqUX5aJmX33b/saZCy0giAAJCZ+Br2jXpw1TxYem2NqC97ukGSFKjC VHTrJhBFlKd3UXjafLb2m5K1zgbA5tvbI860B4b9eBzbLcr1ACn7NOGma4/k712JKYra SBai28si+eeQaOlxdu9tIigzzQ/o8MoYKavXZ+eMrCIeUvQAFvO37ecBFNwOa4C3fp4m TikQ== 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=iQ7PsePFyhFvI5AHZQHHkmtsVHO9IjvMk8I+T0y3p/U=; b=sCEIIIpM5RAJEjyq7KaOm4uJlDBaEjbHvuA2xcDhyzCAsSmrGBqAqwtBPoQlpwo93P hYps1rpZxlzWv1R97l3PMwhzH8OZpWkS0jA79OmbucNso/1EF22OljgCh0B9VqEKM/Oz GBICMTg0Q2flKXIY9cfdD95W5jsntInjuFYRG0K4lQDdo1uOtB0h8g/hvuIc8SszeLGr ndIYwm09uu0rXiXdoeLg7SIozFAMLdykH/PwPPbu/cahICFh3qmdCNFbceHWmYjRI/xE UYZZXGa492YV2QN7p6pmoCnLlictQB18WOhp1CjXO/cxCUO497Wsi+zej4x+eg+4vt3G 7k3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=gqtIaFv6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 q2si395817pgn.704.2017.08.22.21.17.06; Tue, 22 Aug 2017 21:17:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=gqtIaFv6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753311AbdHWERD (ORCPT + 26 others); Wed, 23 Aug 2017 00:17:03 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:19344 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753236AbdHWERA (ORCPT ); Wed, 23 Aug 2017 00:17:00 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v7N4F6Rr020925; Wed, 23 Aug 2017 13:15:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v7N4F6Rr020925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1503461710; bh=iQ7PsePFyhFvI5AHZQHHkmtsVHO9IjvMk8I+T0y3p/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqtIaFv60tvEtJxlnBxV54w4yuCAQNHThd+PDi25t3IQ7ojhTFaxShO1h6QXmR+t5 bDiSIbmcAgZMy1uRs7Mbdr+9c2wzyxERJJOlKdMP4aZAbZ6AwEgD2LexLOe9qtp/T5 pkWQV04ZvOlsXzPyc97KSa2CdKqusRdOuahk3kbCTN1Q1lb4WCkfR916ZSixt6whl2 L4LliUezhyy21pD+YMiSO7AA0XZU3IbFMs6HvEECUBfAUsfjuqw5GNkYF4A9vWR+Nk BVdOPsL7RYbOhLq+fPyaMg8q0zW8wlMAsp6P5GLUfOR7GBF+ZxsTzI130GD6C6v4mt 54YQKsNuMmfkg== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Piotr Sroka , Hu Ziji , Adrian Hunter , Christian Daudt , Scott Branden , Zhangfei Gao , Kevin Hao , Olof Johansson , Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v4 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister() Date: Wed, 23 Aug 2017 13:15:01 +0900 Message-Id: <1503461703-16225-3-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503461703-16225-1-git-send-email-yamada.masahiro@socionext.com> References: <1503461703-16225-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The difference between sdhci_pxav2_remove() and sdhci_pltfm_unregister() is clk_put(). It will go away by using the managed resource clk, then sdhci_pltfm_unregister() can be reused. Also, rename the jump labels to say what the goto does. (Coding style suggested by Documentation/process/coding-style.rst) Signed-off-by: Masahiro Yamada Acked-by: Adrian Hunter --- Changes in v4: None Changes in v3: - Newly added Changes in v2: None drivers/mmc/host/sdhci-pxav2.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/sdhci-pxav2.c b/drivers/mmc/host/sdhci-pxav2.c index 995083ce1c46..8986f9d9cf98 100644 --- a/drivers/mmc/host/sdhci-pxav2.c +++ b/drivers/mmc/host/sdhci-pxav2.c @@ -178,17 +178,17 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) pltfm_host = sdhci_priv(host); - clk = clk_get(dev, "PXA-SDHCLK"); + clk = devm_clk_get(dev, "PXA-SDHCLK"); if (IS_ERR(clk)) { dev_err(dev, "failed to get io clock\n"); ret = PTR_ERR(clk); - goto err_clk_get; + goto free; } pltfm_host->clk = clk; ret = clk_prepare_enable(clk); if (ret) { dev_err(&pdev->dev, "failed to enable io clock\n"); - goto err_clk_enable; + goto free; } host->quirks = SDHCI_QUIRK_BROKEN_ADMA @@ -223,34 +223,18 @@ static int sdhci_pxav2_probe(struct platform_device *pdev) ret = sdhci_add_host(host); if (ret) { dev_err(&pdev->dev, "failed to add host\n"); - goto err_add_host; + goto disable_clk; } return 0; -err_add_host: +disable_clk: clk_disable_unprepare(clk); -err_clk_enable: - clk_put(clk); -err_clk_get: +free: sdhci_pltfm_free(pdev); return ret; } -static int sdhci_pxav2_remove(struct platform_device *pdev) -{ - struct sdhci_host *host = platform_get_drvdata(pdev); - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - - sdhci_remove_host(host, 1); - - clk_disable_unprepare(pltfm_host->clk); - clk_put(pltfm_host->clk); - sdhci_pltfm_free(pdev); - - return 0; -} - static struct platform_driver sdhci_pxav2_driver = { .driver = { .name = "sdhci-pxav2", @@ -258,7 +242,7 @@ static struct platform_driver sdhci_pxav2_driver = { .pm = &sdhci_pltfm_pmops, }, .probe = sdhci_pxav2_probe, - .remove = sdhci_pxav2_remove, + .remove = sdhci_pltfm_unregister, }; module_platform_driver(sdhci_pxav2_driver); From patchwork Wed Aug 23 04:15:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 110709 Delivered-To: patch@linaro.org Received: by 10.140.95.78 with SMTP id h72csp3588383qge; Tue, 22 Aug 2017 21:17:08 -0700 (PDT) X-Received: by 10.84.178.101 with SMTP id y92mr1579460plb.422.1503461828318; Tue, 22 Aug 2017 21:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1503461828; cv=none; d=google.com; s=arc-20160816; b=CNqm9mip0L7QbOlh3fsxMmQzp4cNxnZSTyjoOIa9Wk3IGh0yKXEUwY/dfCyczBC5gA bVAJU5iuhqz515w7i1Rk4EeBuBy77wmU1tlNRNUMb0I5T7gafd65tQOhU++fdSlXWIDy xdQDelZ2edgHrueWgqrr/h+NhhlR+eamXHKulNeHNtsHQgmGemfUmhdE+CnV6VDkhDz0 4477PdSymv8lYZ3GWkC2N5nqAskkaYv2IygtvZTikiZBgA6tPW5VTTvuDS4vjYpYcau7 5cgatJZZ3/c+3sZRhOcOObXcMADVM0lexoCV4NpyWjhu1UGn4Tg0m4KI5/A2hZI78Qc/ xu1w== 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=FwhS68wn/DRb/yfAKpFl76Lzh07QSjEb+YWjsEG/v54=; b=CSKGKzNokcp9xlMUV1o1oygKlMKxrqnhb3fcBaZKjgyTd21Q/MMUfFkilxSueR1Rkq UITi+k0Y9QHew2mNL31Z58gSfNwSC93fplNM69/erikm6tRqkWBsSWBA0qtre0PKuAoJ T8O8XgnpVCLJSAAzFLdGB8pu0pwRFfRzKBQmFjkwrzVyRf64kU9/hIZcCThFbkMb/wn9 hCAWZ0xwOeEcqNf89Gd2pYIv/E/rw+wiIxpchijF9QHdIjFcgh1dtY00xplM6miLqFyr AdvRxO56UxMDih/k8MIdq+QP62l1lgSg0s+EKbcGtX42qZ49kx1Sc+gQBnPxlHxNXLJw mpUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zrpZCQ2W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 e19si418150pgk.199.2017.08.22.21.17.07; Tue, 22 Aug 2017 21:17:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=zrpZCQ2W; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753335AbdHWERF (ORCPT + 26 others); Wed, 23 Aug 2017 00:17:05 -0400 Received: from conuserg-08.nifty.com ([210.131.2.75]:19331 "EHLO conuserg-08.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753201AbdHWERA (ORCPT ); Wed, 23 Aug 2017 00:17:00 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-08.nifty.com with ESMTP id v7N4F6Rt020925; Wed, 23 Aug 2017 13:15:12 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com v7N4F6Rt020925 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1503461712; bh=FwhS68wn/DRb/yfAKpFl76Lzh07QSjEb+YWjsEG/v54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zrpZCQ2WoFuxnlKCTqHrt0piUjh9ZCLpcwXpF6iRs50QXH5o2D0Q/k1GdQXFlbkGl Za+qpBsgsLeJHPS6wQX6zwVtOpQAn6I5UREyqIu93MiPWyHflFf39t33WnuR2Od7wV Ci13FnYcnh71+6fJLqhXMsbIZU5MIRxSPk5Yl2kHTiPe3eCfCzCaU1McP/oSJqT7w/ wO+AoJy3XGmvw0uTbvJ2uxvhymdQt5ioL4pZF8KWDbIOaBH26r3E0RbAXnxw2KqDg3 HhFwc/eQ51dGaE15YLwQtHmJGk/PPiDyjSNrxT00Ljd3nEQGRK8nL0i2acMaYatu4M Qf9aiYAiqDB2Q== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-mmc@vger.kernel.org Cc: Piotr Sroka , Hu Ziji , Adrian Hunter , Christian Daudt , Scott Branden , Zhangfei Gao , Kevin Hao , Olof Johansson , Masahiro Yamada , linux-kernel@vger.kernel.org, Ulf Hansson Subject: [PATCH v4 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume Date: Wed, 23 Aug 2017 13:15:03 +0900 Message-Id: <1503461703-16225-5-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503461703-16225-1-git-send-email-yamada.masahiro@socionext.com> References: <1503461703-16225-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This will be useful when drivers want to reuse either suspend or resume callback instead of whole of sdhci_pltfm_pmops. Signed-off-by: Masahiro Yamada --- Changes in v4: None Changes in v3: None Changes in v2: None drivers/mmc/host/sdhci-cadence.c | 20 +------------------- drivers/mmc/host/sdhci-pltfm.c | 6 ++++-- drivers/mmc/host/sdhci-pltfm.h | 2 ++ 3 files changed, 7 insertions(+), 21 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/sdhci-cadence.c b/drivers/mmc/host/sdhci-cadence.c index 3dca3b3c6436..56529c3d389a 100644 --- a/drivers/mmc/host/sdhci-cadence.c +++ b/drivers/mmc/host/sdhci-cadence.c @@ -391,24 +391,6 @@ static int sdhci_cdns_probe(struct platform_device *pdev) } #ifdef CONFIG_PM_SLEEP -static int sdhci_cdns_suspend(struct device *dev) -{ - struct sdhci_host *host = dev_get_drvdata(dev); - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); - int ret; - - if (host->tuning_mode != SDHCI_TUNING_MODE_3) - mmc_retune_needed(host->mmc); - - ret = sdhci_suspend_host(host); - if (ret) - return ret; - - clk_disable_unprepare(pltfm_host->clk); - - return 0; -} - static int sdhci_cdns_resume(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); @@ -438,7 +420,7 @@ static int sdhci_cdns_resume(struct device *dev) #endif static const struct dev_pm_ops sdhci_cdns_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(sdhci_cdns_suspend, sdhci_cdns_resume) + SET_SYSTEM_SLEEP_PM_OPS(sdhci_pltfm_suspend, sdhci_cdns_resume) }; static const struct of_device_id sdhci_cdns_match[] = { diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index 4c0135e184e9..02bea6159d79 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -209,7 +209,7 @@ int sdhci_pltfm_unregister(struct platform_device *pdev) EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister); #ifdef CONFIG_PM_SLEEP -static int sdhci_pltfm_suspend(struct device *dev) +int sdhci_pltfm_suspend(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -226,8 +226,9 @@ static int sdhci_pltfm_suspend(struct device *dev) return 0; } +EXPORT_SYMBOL_GPL(sdhci_pltfm_suspend); -static int sdhci_pltfm_resume(struct device *dev) +int sdhci_pltfm_resume(struct device *dev) { struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -243,6 +244,7 @@ static int sdhci_pltfm_resume(struct device *dev) return ret; } +EXPORT_SYMBOL_GPL(sdhci_pltfm_resume); #endif const struct dev_pm_ops sdhci_pltfm_pmops = { diff --git a/drivers/mmc/host/sdhci-pltfm.h b/drivers/mmc/host/sdhci-pltfm.h index 957839d0fe37..1e91fb1c020e 100644 --- a/drivers/mmc/host/sdhci-pltfm.h +++ b/drivers/mmc/host/sdhci-pltfm.h @@ -109,6 +109,8 @@ static inline void *sdhci_pltfm_priv(struct sdhci_pltfm_host *host) return host->private; } +int sdhci_pltfm_suspend(struct device *dev); +int sdhci_pltfm_resume(struct device *dev); extern const struct dev_pm_ops sdhci_pltfm_pmops; #endif /* _DRIVERS_MMC_SDHCI_PLTFM_H */