All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port
@ 2017-08-23  4:14 ` Masahiro Yamada
  0 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Adrian Hunter, Christian Daudt,
	Scott Branden, Zhangfei Gao, Kevin Hao, Olof Johansson,
	Masahiro Yamada, Al Cooper, linux-kernel, Brian Norris,
	bcm-kernel-feedback-list, Barry Song, Florian Fainelli,
	Gregory Fong, linux-arm-kernel, Ulf Hansson


[1] implements suspend / resume for sdhci-cadence.c

[2] refactor sdhci-pxav2

[3] add clk handling for suspend/resume hooks of sdhci-pltfm.
    This also cleans up sdhci-brcmstb.c and sdhci-sirf.c

[4] export sdhci_pltfm_suspend/resume to reduce code duplication


Masahiro Yamada (4):
  mmc: sdhci-cadence: add suspend / resume support
  mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
  mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
  mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume

 drivers/mmc/host/sdhci-brcmstb.c | 37 +----------------
 drivers/mmc/host/sdhci-cadence.c | 88 ++++++++++++++++++++++++++++++++++++----
 drivers/mmc/host/sdhci-pltfm.c   | 28 +++++++++++--
 drivers/mmc/host/sdhci-pltfm.h   |  2 +
 drivers/mmc/host/sdhci-pxav2.c   | 30 ++++----------
 drivers/mmc/host/sdhci-sirf.c    | 39 +-----------------
 6 files changed, 114 insertions(+), 110 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port
@ 2017-08-23  4:14 ` Masahiro Yamada
  0 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:14 UTC (permalink / raw)
  To: linux-mmc
  Cc: Barry Song, Florian Fainelli, Kevin Hao, Scott Branden,
	Masahiro Yamada, Christian Daudt, Al Cooper, Adrian Hunter,
	linux-kernel, Hu Ziji, bcm-kernel-feedback-list, Zhangfei Gao,
	Gregory Fong, Olof Johansson, Ulf Hansson, Brian Norris,
	linux-arm-kernel, Piotr Sroka


[1] implements suspend / resume for sdhci-cadence.c

[2] refactor sdhci-pxav2

[3] add clk handling for suspend/resume hooks of sdhci-pltfm.
    This also cleans up sdhci-brcmstb.c and sdhci-sirf.c

[4] export sdhci_pltfm_suspend/resume to reduce code duplication


Masahiro Yamada (4):
  mmc: sdhci-cadence: add suspend / resume support
  mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
  mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
  mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume

 drivers/mmc/host/sdhci-brcmstb.c | 37 +----------------
 drivers/mmc/host/sdhci-cadence.c | 88 ++++++++++++++++++++++++++++++++++++----
 drivers/mmc/host/sdhci-pltfm.c   | 28 +++++++++++--
 drivers/mmc/host/sdhci-pltfm.h   |  2 +
 drivers/mmc/host/sdhci-pxav2.c   | 30 ++++----------
 drivers/mmc/host/sdhci-sirf.c    | 39 +-----------------
 6 files changed, 114 insertions(+), 110 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port
@ 2017-08-23  4:14 ` Masahiro Yamada
  0 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:14 UTC (permalink / raw)
  To: linux-arm-kernel


[1] implements suspend / resume for sdhci-cadence.c

[2] refactor sdhci-pxav2

[3] add clk handling for suspend/resume hooks of sdhci-pltfm.
    This also cleans up sdhci-brcmstb.c and sdhci-sirf.c

[4] export sdhci_pltfm_suspend/resume to reduce code duplication


Masahiro Yamada (4):
  mmc: sdhci-cadence: add suspend / resume support
  mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
  mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
  mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume

 drivers/mmc/host/sdhci-brcmstb.c | 37 +----------------
 drivers/mmc/host/sdhci-cadence.c | 88 ++++++++++++++++++++++++++++++++++++----
 drivers/mmc/host/sdhci-pltfm.c   | 28 +++++++++++--
 drivers/mmc/host/sdhci-pltfm.h   |  2 +
 drivers/mmc/host/sdhci-pxav2.c   | 30 ++++----------
 drivers/mmc/host/sdhci-sirf.c    | 39 +-----------------
 6 files changed, 114 insertions(+), 110 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 1/4] mmc: sdhci-cadence: add suspend / resume support
  2017-08-23  4:14 ` Masahiro Yamada
  (?)
  (?)
@ 2017-08-23  4:15 ` Masahiro Yamada
  2017-08-28 10:11   ` Adrian Hunter
  -1 siblings, 1 reply; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:15 UTC (permalink / raw)
  To: linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Adrian Hunter, Christian Daudt,
	Scott Branden, Zhangfei Gao, Kevin Hao, Olof Johansson,
	Masahiro Yamada, linux-kernel, Ulf Hansson

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 <yamada.masahiro@socionext.com>
---

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(-)

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,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
  2017-08-23  4:14 ` Masahiro Yamada
                   ` (2 preceding siblings ...)
  (?)
@ 2017-08-23  4:15 ` Masahiro Yamada
  -1 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:15 UTC (permalink / raw)
  To: linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Adrian Hunter, Christian Daudt,
	Scott Branden, Zhangfei Gao, Kevin Hao, Olof Johansson,
	Masahiro Yamada, linux-kernel, Ulf Hansson

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 <yamada.masahiro@socionext.com>
Acked-by: Adrian Hunter <adrian.hunter@intel.com>
---

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(-)

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);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
  2017-08-23  4:14 ` Masahiro Yamada
  (?)
@ 2017-08-23  4:15   ` Masahiro Yamada
  -1 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:15 UTC (permalink / raw)
  To: linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Adrian Hunter, Christian Daudt,
	Scott Branden, Zhangfei Gao, Kevin Hao, Olof Johansson,
	Masahiro Yamada, Al Cooper, linux-kernel, Brian Norris,
	bcm-kernel-feedback-list, Barry Song, Florian Fainelli,
	Gregory Fong, linux-arm-kernel, Ulf Hansson

This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
sdhci: disable the clock in sdhci_pltfm_unregister()") did for
unregister hooks.

sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
so that the drivers can reuse sdhci_pltfm_pmops.

The following drivers did not previously touch pltfm_host->clk during
suspend/resume, but now do:
  - sdhci-bcm-kona.c
  - sdhci-dove.c
  - sdhci-iproc.c
  - sdhci-pxav2.c
  - sdhci-tegra.c
  - sdhci-xenon.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v4:
  - Disable clk when resume fails

Changes in v3: None
Changes in v2:
  - Fix build error reported by kbuild test robot

 drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
 drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
 drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
 3 files changed, 22 insertions(+), 76 deletions(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index e2f638338e8f..6d461fcdd663 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -21,41 +21,6 @@
 
 #include "sdhci-pltfm.h"
 
-#ifdef CONFIG_PM_SLEEP
-
-static int sdhci_brcmstb_suspend(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int res;
-
-	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
-		mmc_retune_needed(host->mmc);
-
-	res = sdhci_suspend_host(host);
-	if (res)
-		return res;
-	clk_disable_unprepare(pltfm_host->clk);
-	return res;
-}
-
-static int sdhci_brcmstb_resume(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int err;
-
-	err = clk_prepare_enable(pltfm_host->clk);
-	if (err)
-		return err;
-	return sdhci_resume_host(host);
-}
-
-#endif /* CONFIG_PM_SLEEP */
-
-static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
-			sdhci_brcmstb_resume);
-
 static const struct sdhci_ops sdhci_brcmstb_ops = {
 	.set_clock = sdhci_set_clock,
 	.set_bus_width = sdhci_set_bus_width,
@@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
 static struct platform_driver sdhci_brcmstb_driver = {
 	.driver		= {
 		.name	= "sdhci-brcmstb",
-		.pm	= &sdhci_brcmstb_pmops,
+		.pm	= &sdhci_pltfm_pmops,
 		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
 	},
 	.probe		= sdhci_brcmstb_probe,
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e090d8c42ddb..4c0135e184e9 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
 static int sdhci_pltfm_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);
 
-	return sdhci_suspend_host(host);
+	ret = sdhci_suspend_host(host);
+	if (ret)
+		return ret;
+
+	clk_disable_unprepare(pltfm_host->clk);
+
+	return 0;
 }
 
 static int sdhci_pltfm_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	int ret;
+
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret)
+		return ret;
 
-	return sdhci_resume_host(host);
+	ret = sdhci_resume_host(host);
+	if (ret)
+		clk_disable_unprepare(pltfm_host->clk);
+
+	return ret;
 }
 #endif
 
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index c251c6c0a112..0c7aa89df4e2 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int sdhci_sirf_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(pltfm_host->clk);
-
-	return 0;
-}
-
-static int sdhci_sirf_resume(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int ret;
-
-	ret = clk_enable(pltfm_host->clk);
-	if (ret) {
-		dev_dbg(dev, "Resume: Error enabling clock\n");
-		return ret;
-	}
-
-	return sdhci_resume_host(host);
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
-
 static const struct of_device_id sdhci_sirf_of_match[] = {
 	{ .compatible = "sirf,prima2-sdhc" },
 	{ }
@@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
 	.driver		= {
 		.name	= "sdhci-sirf",
 		.of_match_table = sdhci_sirf_of_match,
-		.pm	= &sdhci_sirf_pm_ops,
+		.pm	= &sdhci_pltfm_pmops,
 	},
 	.probe		= sdhci_sirf_probe,
 	.remove		= sdhci_pltfm_unregister,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
@ 2017-08-23  4:15   ` Masahiro Yamada
  0 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:15 UTC (permalink / raw)
  To: linux-mmc
  Cc: Barry Song, Florian Fainelli, Kevin Hao, Scott Branden,
	Masahiro Yamada, Christian Daudt, Al Cooper, Adrian Hunter,
	linux-kernel, Hu Ziji, bcm-kernel-feedback-list, Zhangfei Gao,
	Gregory Fong, Olof Johansson, Ulf Hansson, Brian Norris,
	linux-arm-kernel, Piotr Sroka

This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
sdhci: disable the clock in sdhci_pltfm_unregister()") did for
unregister hooks.

sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
so that the drivers can reuse sdhci_pltfm_pmops.

The following drivers did not previously touch pltfm_host->clk during
suspend/resume, but now do:
  - sdhci-bcm-kona.c
  - sdhci-dove.c
  - sdhci-iproc.c
  - sdhci-pxav2.c
  - sdhci-tegra.c
  - sdhci-xenon.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v4:
  - Disable clk when resume fails

Changes in v3: None
Changes in v2:
  - Fix build error reported by kbuild test robot

 drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
 drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
 drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
 3 files changed, 22 insertions(+), 76 deletions(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index e2f638338e8f..6d461fcdd663 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -21,41 +21,6 @@
 
 #include "sdhci-pltfm.h"
 
-#ifdef CONFIG_PM_SLEEP
-
-static int sdhci_brcmstb_suspend(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int res;
-
-	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
-		mmc_retune_needed(host->mmc);
-
-	res = sdhci_suspend_host(host);
-	if (res)
-		return res;
-	clk_disable_unprepare(pltfm_host->clk);
-	return res;
-}
-
-static int sdhci_brcmstb_resume(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int err;
-
-	err = clk_prepare_enable(pltfm_host->clk);
-	if (err)
-		return err;
-	return sdhci_resume_host(host);
-}
-
-#endif /* CONFIG_PM_SLEEP */
-
-static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
-			sdhci_brcmstb_resume);
-
 static const struct sdhci_ops sdhci_brcmstb_ops = {
 	.set_clock = sdhci_set_clock,
 	.set_bus_width = sdhci_set_bus_width,
@@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
 static struct platform_driver sdhci_brcmstb_driver = {
 	.driver		= {
 		.name	= "sdhci-brcmstb",
-		.pm	= &sdhci_brcmstb_pmops,
+		.pm	= &sdhci_pltfm_pmops,
 		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
 	},
 	.probe		= sdhci_brcmstb_probe,
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e090d8c42ddb..4c0135e184e9 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
 static int sdhci_pltfm_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);
 
-	return sdhci_suspend_host(host);
+	ret = sdhci_suspend_host(host);
+	if (ret)
+		return ret;
+
+	clk_disable_unprepare(pltfm_host->clk);
+
+	return 0;
 }
 
 static int sdhci_pltfm_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	int ret;
+
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret)
+		return ret;
 
-	return sdhci_resume_host(host);
+	ret = sdhci_resume_host(host);
+	if (ret)
+		clk_disable_unprepare(pltfm_host->clk);
+
+	return ret;
 }
 #endif
 
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index c251c6c0a112..0c7aa89df4e2 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int sdhci_sirf_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(pltfm_host->clk);
-
-	return 0;
-}
-
-static int sdhci_sirf_resume(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int ret;
-
-	ret = clk_enable(pltfm_host->clk);
-	if (ret) {
-		dev_dbg(dev, "Resume: Error enabling clock\n");
-		return ret;
-	}
-
-	return sdhci_resume_host(host);
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
-
 static const struct of_device_id sdhci_sirf_of_match[] = {
 	{ .compatible = "sirf,prima2-sdhc" },
 	{ }
@@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
 	.driver		= {
 		.name	= "sdhci-sirf",
 		.of_match_table = sdhci_sirf_of_match,
-		.pm	= &sdhci_sirf_pm_ops,
+		.pm	= &sdhci_pltfm_pmops,
 	},
 	.probe		= sdhci_sirf_probe,
 	.remove		= sdhci_pltfm_unregister,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
@ 2017-08-23  4:15   ` Masahiro Yamada
  0 siblings, 0 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:15 UTC (permalink / raw)
  To: linux-arm-kernel

This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
sdhci: disable the clock in sdhci_pltfm_unregister()") did for
unregister hooks.

sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
so that the drivers can reuse sdhci_pltfm_pmops.

The following drivers did not previously touch pltfm_host->clk during
suspend/resume, but now do:
  - sdhci-bcm-kona.c
  - sdhci-dove.c
  - sdhci-iproc.c
  - sdhci-pxav2.c
  - sdhci-tegra.c
  - sdhci-xenon.c

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Changes in v4:
  - Disable clk when resume fails

Changes in v3: None
Changes in v2:
  - Fix build error reported by kbuild test robot

 drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
 drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
 drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
 3 files changed, 22 insertions(+), 76 deletions(-)

diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
index e2f638338e8f..6d461fcdd663 100644
--- a/drivers/mmc/host/sdhci-brcmstb.c
+++ b/drivers/mmc/host/sdhci-brcmstb.c
@@ -21,41 +21,6 @@
 
 #include "sdhci-pltfm.h"
 
-#ifdef CONFIG_PM_SLEEP
-
-static int sdhci_brcmstb_suspend(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int res;
-
-	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
-		mmc_retune_needed(host->mmc);
-
-	res = sdhci_suspend_host(host);
-	if (res)
-		return res;
-	clk_disable_unprepare(pltfm_host->clk);
-	return res;
-}
-
-static int sdhci_brcmstb_resume(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int err;
-
-	err = clk_prepare_enable(pltfm_host->clk);
-	if (err)
-		return err;
-	return sdhci_resume_host(host);
-}
-
-#endif /* CONFIG_PM_SLEEP */
-
-static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
-			sdhci_brcmstb_resume);
-
 static const struct sdhci_ops sdhci_brcmstb_ops = {
 	.set_clock = sdhci_set_clock,
 	.set_bus_width = sdhci_set_bus_width,
@@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
 static struct platform_driver sdhci_brcmstb_driver = {
 	.driver		= {
 		.name	= "sdhci-brcmstb",
-		.pm	= &sdhci_brcmstb_pmops,
+		.pm	= &sdhci_pltfm_pmops,
 		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
 	},
 	.probe		= sdhci_brcmstb_probe,
diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
index e090d8c42ddb..4c0135e184e9 100644
--- a/drivers/mmc/host/sdhci-pltfm.c
+++ b/drivers/mmc/host/sdhci-pltfm.c
@@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
 static int sdhci_pltfm_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);
 
-	return sdhci_suspend_host(host);
+	ret = sdhci_suspend_host(host);
+	if (ret)
+		return ret;
+
+	clk_disable_unprepare(pltfm_host->clk);
+
+	return 0;
 }
 
 static int sdhci_pltfm_resume(struct device *dev)
 {
 	struct sdhci_host *host = dev_get_drvdata(dev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	int ret;
+
+	ret = clk_prepare_enable(pltfm_host->clk);
+	if (ret)
+		return ret;
 
-	return sdhci_resume_host(host);
+	ret = sdhci_resume_host(host);
+	if (ret)
+		clk_disable_unprepare(pltfm_host->clk);
+
+	return ret;
 }
 #endif
 
diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
index c251c6c0a112..0c7aa89df4e2 100644
--- a/drivers/mmc/host/sdhci-sirf.c
+++ b/drivers/mmc/host/sdhci-sirf.c
@@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int sdhci_sirf_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(pltfm_host->clk);
-
-	return 0;
-}
-
-static int sdhci_sirf_resume(struct device *dev)
-{
-	struct sdhci_host *host = dev_get_drvdata(dev);
-	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
-	int ret;
-
-	ret = clk_enable(pltfm_host->clk);
-	if (ret) {
-		dev_dbg(dev, "Resume: Error enabling clock\n");
-		return ret;
-	}
-
-	return sdhci_resume_host(host);
-}
-#endif
-
-static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
-
 static const struct of_device_id sdhci_sirf_of_match[] = {
 	{ .compatible = "sirf,prima2-sdhc" },
 	{ }
@@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
 	.driver		= {
 		.name	= "sdhci-sirf",
 		.of_match_table = sdhci_sirf_of_match,
-		.pm	= &sdhci_sirf_pm_ops,
+		.pm	= &sdhci_pltfm_pmops,
 	},
 	.probe		= sdhci_sirf_probe,
 	.remove		= sdhci_pltfm_unregister,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v4 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume
  2017-08-23  4:14 ` Masahiro Yamada
                   ` (4 preceding siblings ...)
  (?)
@ 2017-08-23  4:15 ` Masahiro Yamada
  2017-08-28 10:36   ` Adrian Hunter
  -1 siblings, 1 reply; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-23  4:15 UTC (permalink / raw)
  To: linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Adrian Hunter, Christian Daudt,
	Scott Branden, Zhangfei Gao, Kevin Hao, Olof Johansson,
	Masahiro Yamada, linux-kernel, Ulf Hansson

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 <yamada.masahiro@socionext.com>
---

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(-)

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 */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 1/4] mmc: sdhci-cadence: add suspend / resume support
  2017-08-23  4:15 ` [PATCH v4 1/4] mmc: sdhci-cadence: add suspend / resume support Masahiro Yamada
@ 2017-08-28 10:11   ` Adrian Hunter
  0 siblings, 0 replies; 18+ messages in thread
From: Adrian Hunter @ 2017-08-28 10:11 UTC (permalink / raw)
  To: Masahiro Yamada, linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Christian Daudt, Scott Branden,
	Zhangfei Gao, Kevin Hao, Olof Johansson, linux-kernel,
	Ulf Hansson

On 23/08/17 07:15, Masahiro Yamada wrote:
> 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 <yamada.masahiro@socionext.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> 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(-)
> 
> 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,
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
  2017-08-23  4:15   ` Masahiro Yamada
@ 2017-08-28 10:34     ` Adrian Hunter
  -1 siblings, 0 replies; 18+ messages in thread
From: Adrian Hunter @ 2017-08-28 10:34 UTC (permalink / raw)
  To: Masahiro Yamada, linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Christian Daudt, Scott Branden,
	Zhangfei Gao, Kevin Hao, Olof Johansson, Al Cooper, linux-kernel,
	Brian Norris, bcm-kernel-feedback-list, Barry Song,
	Florian Fainelli, Gregory Fong, linux-arm-kernel, Ulf Hansson

On 23/08/17 07:15, Masahiro Yamada wrote:
> This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
> sdhci: disable the clock in sdhci_pltfm_unregister()") did for
> unregister hooks.
> 
> sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
> hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
> so that the drivers can reuse sdhci_pltfm_pmops.
> 
> The following drivers did not previously touch pltfm_host->clk during
> suspend/resume, but now do:
>   - sdhci-bcm-kona.c
>   - sdhci-dove.c
>   - sdhci-iproc.c
>   - sdhci-pxav2.c
>   - sdhci-tegra.c
>   - sdhci-xenon.c
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Would have been nice to see some more Acks on this but from sdhci point of view:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> Changes in v4:
>   - Disable clk when resume fails
> 
> Changes in v3: None
> Changes in v2:
>   - Fix build error reported by kbuild test robot
> 
>  drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
>  drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
>  drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
>  3 files changed, 22 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> index e2f638338e8f..6d461fcdd663 100644
> --- a/drivers/mmc/host/sdhci-brcmstb.c
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -21,41 +21,6 @@
>  
>  #include "sdhci-pltfm.h"
>  
> -#ifdef CONFIG_PM_SLEEP
> -
> -static int sdhci_brcmstb_suspend(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int res;
> -
> -	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> -		mmc_retune_needed(host->mmc);
> -
> -	res = sdhci_suspend_host(host);
> -	if (res)
> -		return res;
> -	clk_disable_unprepare(pltfm_host->clk);
> -	return res;
> -}
> -
> -static int sdhci_brcmstb_resume(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int err;
> -
> -	err = clk_prepare_enable(pltfm_host->clk);
> -	if (err)
> -		return err;
> -	return sdhci_resume_host(host);
> -}
> -
> -#endif /* CONFIG_PM_SLEEP */
> -
> -static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
> -			sdhci_brcmstb_resume);
> -
>  static const struct sdhci_ops sdhci_brcmstb_ops = {
>  	.set_clock = sdhci_set_clock,
>  	.set_bus_width = sdhci_set_bus_width,
> @@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
>  static struct platform_driver sdhci_brcmstb_driver = {
>  	.driver		= {
>  		.name	= "sdhci-brcmstb",
> -		.pm	= &sdhci_brcmstb_pmops,
> +		.pm	= &sdhci_pltfm_pmops,
>  		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
>  	},
>  	.probe		= sdhci_brcmstb_probe,
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index e090d8c42ddb..4c0135e184e9 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>  static int sdhci_pltfm_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);
>  
> -	return sdhci_suspend_host(host);
> +	ret = sdhci_suspend_host(host);
> +	if (ret)
> +		return ret;
> +
> +	clk_disable_unprepare(pltfm_host->clk);
> +
> +	return 0;
>  }
>  
>  static int sdhci_pltfm_resume(struct device *dev)
>  {
>  	struct sdhci_host *host = dev_get_drvdata(dev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	int ret;
> +
> +	ret = clk_prepare_enable(pltfm_host->clk);
> +	if (ret)
> +		return ret;
>  
> -	return sdhci_resume_host(host);
> +	ret = sdhci_resume_host(host);
> +	if (ret)
> +		clk_disable_unprepare(pltfm_host->clk);
> +
> +	return ret;
>  }
>  #endif
>  
> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
> index c251c6c0a112..0c7aa89df4e2 100644
> --- a/drivers/mmc/host/sdhci-sirf.c
> +++ b/drivers/mmc/host/sdhci-sirf.c
> @@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int sdhci_sirf_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(pltfm_host->clk);
> -
> -	return 0;
> -}
> -
> -static int sdhci_sirf_resume(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int ret;
> -
> -	ret = clk_enable(pltfm_host->clk);
> -	if (ret) {
> -		dev_dbg(dev, "Resume: Error enabling clock\n");
> -		return ret;
> -	}
> -
> -	return sdhci_resume_host(host);
> -}
> -#endif
> -
> -static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
> -
>  static const struct of_device_id sdhci_sirf_of_match[] = {
>  	{ .compatible = "sirf,prima2-sdhc" },
>  	{ }
> @@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
>  	.driver		= {
>  		.name	= "sdhci-sirf",
>  		.of_match_table = sdhci_sirf_of_match,
> -		.pm	= &sdhci_sirf_pm_ops,
> +		.pm	= &sdhci_pltfm_pmops,
>  	},
>  	.probe		= sdhci_sirf_probe,
>  	.remove		= sdhci_pltfm_unregister,
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
@ 2017-08-28 10:34     ` Adrian Hunter
  0 siblings, 0 replies; 18+ messages in thread
From: Adrian Hunter @ 2017-08-28 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

On 23/08/17 07:15, Masahiro Yamada wrote:
> This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
> sdhci: disable the clock in sdhci_pltfm_unregister()") did for
> unregister hooks.
> 
> sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
> hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
> so that the drivers can reuse sdhci_pltfm_pmops.
> 
> The following drivers did not previously touch pltfm_host->clk during
> suspend/resume, but now do:
>   - sdhci-bcm-kona.c
>   - sdhci-dove.c
>   - sdhci-iproc.c
>   - sdhci-pxav2.c
>   - sdhci-tegra.c
>   - sdhci-xenon.c
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Would have been nice to see some more Acks on this but from sdhci point of view:

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> Changes in v4:
>   - Disable clk when resume fails
> 
> Changes in v3: None
> Changes in v2:
>   - Fix build error reported by kbuild test robot
> 
>  drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
>  drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
>  drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
>  3 files changed, 22 insertions(+), 76 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
> index e2f638338e8f..6d461fcdd663 100644
> --- a/drivers/mmc/host/sdhci-brcmstb.c
> +++ b/drivers/mmc/host/sdhci-brcmstb.c
> @@ -21,41 +21,6 @@
>  
>  #include "sdhci-pltfm.h"
>  
> -#ifdef CONFIG_PM_SLEEP
> -
> -static int sdhci_brcmstb_suspend(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int res;
> -
> -	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> -		mmc_retune_needed(host->mmc);
> -
> -	res = sdhci_suspend_host(host);
> -	if (res)
> -		return res;
> -	clk_disable_unprepare(pltfm_host->clk);
> -	return res;
> -}
> -
> -static int sdhci_brcmstb_resume(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int err;
> -
> -	err = clk_prepare_enable(pltfm_host->clk);
> -	if (err)
> -		return err;
> -	return sdhci_resume_host(host);
> -}
> -
> -#endif /* CONFIG_PM_SLEEP */
> -
> -static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
> -			sdhci_brcmstb_resume);
> -
>  static const struct sdhci_ops sdhci_brcmstb_ops = {
>  	.set_clock = sdhci_set_clock,
>  	.set_bus_width = sdhci_set_bus_width,
> @@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
>  static struct platform_driver sdhci_brcmstb_driver = {
>  	.driver		= {
>  		.name	= "sdhci-brcmstb",
> -		.pm	= &sdhci_brcmstb_pmops,
> +		.pm	= &sdhci_pltfm_pmops,
>  		.of_match_table = of_match_ptr(sdhci_brcm_of_match),
>  	},
>  	.probe		= sdhci_brcmstb_probe,
> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
> index e090d8c42ddb..4c0135e184e9 100644
> --- a/drivers/mmc/host/sdhci-pltfm.c
> +++ b/drivers/mmc/host/sdhci-pltfm.c
> @@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>  static int sdhci_pltfm_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);
>  
> -	return sdhci_suspend_host(host);
> +	ret = sdhci_suspend_host(host);
> +	if (ret)
> +		return ret;
> +
> +	clk_disable_unprepare(pltfm_host->clk);
> +
> +	return 0;
>  }
>  
>  static int sdhci_pltfm_resume(struct device *dev)
>  {
>  	struct sdhci_host *host = dev_get_drvdata(dev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	int ret;
> +
> +	ret = clk_prepare_enable(pltfm_host->clk);
> +	if (ret)
> +		return ret;
>  
> -	return sdhci_resume_host(host);
> +	ret = sdhci_resume_host(host);
> +	if (ret)
> +		clk_disable_unprepare(pltfm_host->clk);
> +
> +	return ret;
>  }
>  #endif
>  
> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
> index c251c6c0a112..0c7aa89df4e2 100644
> --- a/drivers/mmc/host/sdhci-sirf.c
> +++ b/drivers/mmc/host/sdhci-sirf.c
> @@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -static int sdhci_sirf_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(pltfm_host->clk);
> -
> -	return 0;
> -}
> -
> -static int sdhci_sirf_resume(struct device *dev)
> -{
> -	struct sdhci_host *host = dev_get_drvdata(dev);
> -	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> -	int ret;
> -
> -	ret = clk_enable(pltfm_host->clk);
> -	if (ret) {
> -		dev_dbg(dev, "Resume: Error enabling clock\n");
> -		return ret;
> -	}
> -
> -	return sdhci_resume_host(host);
> -}
> -#endif
> -
> -static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
> -
>  static const struct of_device_id sdhci_sirf_of_match[] = {
>  	{ .compatible = "sirf,prima2-sdhc" },
>  	{ }
> @@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
>  	.driver		= {
>  		.name	= "sdhci-sirf",
>  		.of_match_table = sdhci_sirf_of_match,
> -		.pm	= &sdhci_sirf_pm_ops,
> +		.pm	= &sdhci_pltfm_pmops,
>  	},
>  	.probe		= sdhci_sirf_probe,
>  	.remove		= sdhci_pltfm_unregister,
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume
  2017-08-23  4:15 ` [PATCH v4 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume Masahiro Yamada
@ 2017-08-28 10:36   ` Adrian Hunter
  0 siblings, 0 replies; 18+ messages in thread
From: Adrian Hunter @ 2017-08-28 10:36 UTC (permalink / raw)
  To: Masahiro Yamada, linux-mmc
  Cc: Piotr Sroka, Hu Ziji, Christian Daudt, Scott Branden,
	Zhangfei Gao, Kevin Hao, Olof Johansson, linux-kernel,
	Ulf Hansson

On 23/08/17 07:15, Masahiro Yamada wrote:
> 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 <yamada.masahiro@socionext.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
> 
> 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(-)
> 
> 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 */
> 

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
  2017-08-28 10:34     ` Adrian Hunter
@ 2017-08-28 15:35       ` Alan Cooper
  -1 siblings, 0 replies; 18+ messages in thread
From: Alan Cooper @ 2017-08-28 15:35 UTC (permalink / raw)
  To: Adrian Hunter
  Cc: Masahiro Yamada, linux-mmc, Piotr Sroka, Hu Ziji,
	Christian Daudt, Scott Branden, Zhangfei Gao, Kevin Hao,
	Olof Johansson, linux-kernel, Brian Norris, BCM Kernel Feedback,
	Barry Song, Florian Fainelli, Gregory Fong, linux-arm-kernel,
	Ulf Hansson

> On 23/08/17 07:15, Masahiro Yamada wrote:
> > This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
> > sdhci: disable the clock in sdhci_pltfm_unregister()") did for
> > unregister hooks.
> >
> > sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
> > hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
> > so that the drivers can reuse sdhci_pltfm_pmops.
> >
> > The following drivers did not previously touch pltfm_host->clk during
> > suspend/resume, but now do:
> >   - sdhci-bcm-kona.c
> >   - sdhci-dove.c
> >   - sdhci-iproc.c
> >   - sdhci-pxav2.c
> >   - sdhci-tegra.c
> >   - sdhci-xenon.c
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> Would have been nice to see some more Acks on this but from sdhci point of view:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Looks good for sdhci-brcmstb.c

Acked-by: Al Cooper <alcooperx@gmail.com>



On Mon, Aug 28, 2017 at 6:34 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 23/08/17 07:15, Masahiro Yamada wrote:
>> This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
>> sdhci: disable the clock in sdhci_pltfm_unregister()") did for
>> unregister hooks.
>>
>> sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
>> hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
>> so that the drivers can reuse sdhci_pltfm_pmops.
>>
>> The following drivers did not previously touch pltfm_host->clk during
>> suspend/resume, but now do:
>>   - sdhci-bcm-kona.c
>>   - sdhci-dove.c
>>   - sdhci-iproc.c
>>   - sdhci-pxav2.c
>>   - sdhci-tegra.c
>>   - sdhci-xenon.c
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> Would have been nice to see some more Acks on this but from sdhci point of view:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>> ---
>>
>> Changes in v4:
>>   - Disable clk when resume fails
>>
>> Changes in v3: None
>> Changes in v2:
>>   - Fix build error reported by kbuild test robot
>>
>>  drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
>>  drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
>>  drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
>>  3 files changed, 22 insertions(+), 76 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>> index e2f638338e8f..6d461fcdd663 100644
>> --- a/drivers/mmc/host/sdhci-brcmstb.c
>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>> @@ -21,41 +21,6 @@
>>
>>  #include "sdhci-pltfm.h"
>>
>> -#ifdef CONFIG_PM_SLEEP
>> -
>> -static int sdhci_brcmstb_suspend(struct device *dev)
>> -{
>> -     struct sdhci_host *host = dev_get_drvdata(dev);
>> -     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> -     int res;
>> -
>> -     if (host->tuning_mode != SDHCI_TUNING_MODE_3)
>> -             mmc_retune_needed(host->mmc);
>> -
>> -     res = sdhci_suspend_host(host);
>> -     if (res)
>> -             return res;
>> -     clk_disable_unprepare(pltfm_host->clk);
>> -     return res;
>> -}
>> -
>> -static int sdhci_brcmstb_resume(struct device *dev)
>> -{
>> -     struct sdhci_host *host = dev_get_drvdata(dev);
>> -     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> -     int err;
>> -
>> -     err = clk_prepare_enable(pltfm_host->clk);
>> -     if (err)
>> -             return err;
>> -     return sdhci_resume_host(host);
>> -}
>> -
>> -#endif /* CONFIG_PM_SLEEP */
>> -
>> -static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
>> -                     sdhci_brcmstb_resume);
>> -
>>  static const struct sdhci_ops sdhci_brcmstb_ops = {
>>       .set_clock = sdhci_set_clock,
>>       .set_bus_width = sdhci_set_bus_width,
>> @@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
>>  static struct platform_driver sdhci_brcmstb_driver = {
>>       .driver         = {
>>               .name   = "sdhci-brcmstb",
>> -             .pm     = &sdhci_brcmstb_pmops,
>> +             .pm     = &sdhci_pltfm_pmops,
>>               .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>>       },
>>       .probe          = sdhci_brcmstb_probe,
>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>> index e090d8c42ddb..4c0135e184e9 100644
>> --- a/drivers/mmc/host/sdhci-pltfm.c
>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>> @@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>>  static int sdhci_pltfm_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);
>>
>> -     return sdhci_suspend_host(host);
>> +     ret = sdhci_suspend_host(host);
>> +     if (ret)
>> +             return ret;
>> +
>> +     clk_disable_unprepare(pltfm_host->clk);
>> +
>> +     return 0;
>>  }
>>
>>  static int sdhci_pltfm_resume(struct device *dev)
>>  {
>>       struct sdhci_host *host = dev_get_drvdata(dev);
>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +     int ret;
>> +
>> +     ret = clk_prepare_enable(pltfm_host->clk);
>> +     if (ret)
>> +             return ret;
>>
>> -     return sdhci_resume_host(host);
>> +     ret = sdhci_resume_host(host);
>> +     if (ret)
>> +             clk_disable_unprepare(pltfm_host->clk);
>> +
>> +     return ret;
>>  }
>>  #endif
>>
>> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
>> index c251c6c0a112..0c7aa89df4e2 100644
>> --- a/drivers/mmc/host/sdhci-sirf.c
>> +++ b/drivers/mmc/host/sdhci-sirf.c
>> @@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>>       return ret;
>>  }
>>
>> -#ifdef CONFIG_PM_SLEEP
>> -static int sdhci_sirf_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(pltfm_host->clk);
>> -
>> -     return 0;
>> -}
>> -
>> -static int sdhci_sirf_resume(struct device *dev)
>> -{
>> -     struct sdhci_host *host = dev_get_drvdata(dev);
>> -     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> -     int ret;
>> -
>> -     ret = clk_enable(pltfm_host->clk);
>> -     if (ret) {
>> -             dev_dbg(dev, "Resume: Error enabling clock\n");
>> -             return ret;
>> -     }
>> -
>> -     return sdhci_resume_host(host);
>> -}
>> -#endif
>> -
>> -static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
>> -
>>  static const struct of_device_id sdhci_sirf_of_match[] = {
>>       { .compatible = "sirf,prima2-sdhc" },
>>       { }
>> @@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
>>       .driver         = {
>>               .name   = "sdhci-sirf",
>>               .of_match_table = sdhci_sirf_of_match,
>> -             .pm     = &sdhci_sirf_pm_ops,
>> +             .pm     = &sdhci_pltfm_pmops,
>>       },
>>       .probe          = sdhci_sirf_probe,
>>       .remove         = sdhci_pltfm_unregister,
>>
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
@ 2017-08-28 15:35       ` Alan Cooper
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Cooper @ 2017-08-28 15:35 UTC (permalink / raw)
  To: linux-arm-kernel

> On 23/08/17 07:15, Masahiro Yamada wrote:
> > This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
> > sdhci: disable the clock in sdhci_pltfm_unregister()") did for
> > unregister hooks.
> >
> > sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
> > hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
> > so that the drivers can reuse sdhci_pltfm_pmops.
> >
> > The following drivers did not previously touch pltfm_host->clk during
> > suspend/resume, but now do:
> >   - sdhci-bcm-kona.c
> >   - sdhci-dove.c
> >   - sdhci-iproc.c
> >   - sdhci-pxav2.c
> >   - sdhci-tegra.c
> >   - sdhci-xenon.c
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> Would have been nice to see some more Acks on this but from sdhci point of view:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

Looks good for sdhci-brcmstb.c

Acked-by: Al Cooper <alcooperx@gmail.com>



On Mon, Aug 28, 2017 at 6:34 AM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> On 23/08/17 07:15, Masahiro Yamada wrote:
>> This commit provides similar cleanups as commit 83eacdfa2529 ("mmc:
>> sdhci: disable the clock in sdhci_pltfm_unregister()") did for
>> unregister hooks.
>>
>> sdhci-brcmstb.c and sdhci-sirf.c implement their own suspend/resume
>> hooks to handle pltfm_host->clk.  Move clock handling to sdhci_pltfm.c
>> so that the drivers can reuse sdhci_pltfm_pmops.
>>
>> The following drivers did not previously touch pltfm_host->clk during
>> suspend/resume, but now do:
>>   - sdhci-bcm-kona.c
>>   - sdhci-dove.c
>>   - sdhci-iproc.c
>>   - sdhci-pxav2.c
>>   - sdhci-tegra.c
>>   - sdhci-xenon.c
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> Would have been nice to see some more Acks on this but from sdhci point of view:
>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>
>
>> ---
>>
>> Changes in v4:
>>   - Disable clk when resume fails
>>
>> Changes in v3: None
>> Changes in v2:
>>   - Fix build error reported by kbuild test robot
>>
>>  drivers/mmc/host/sdhci-brcmstb.c | 37 +------------------------------------
>>  drivers/mmc/host/sdhci-pltfm.c   | 22 ++++++++++++++++++++--
>>  drivers/mmc/host/sdhci-sirf.c    | 39 +--------------------------------------
>>  3 files changed, 22 insertions(+), 76 deletions(-)
>>
>> diff --git a/drivers/mmc/host/sdhci-brcmstb.c b/drivers/mmc/host/sdhci-brcmstb.c
>> index e2f638338e8f..6d461fcdd663 100644
>> --- a/drivers/mmc/host/sdhci-brcmstb.c
>> +++ b/drivers/mmc/host/sdhci-brcmstb.c
>> @@ -21,41 +21,6 @@
>>
>>  #include "sdhci-pltfm.h"
>>
>> -#ifdef CONFIG_PM_SLEEP
>> -
>> -static int sdhci_brcmstb_suspend(struct device *dev)
>> -{
>> -     struct sdhci_host *host = dev_get_drvdata(dev);
>> -     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> -     int res;
>> -
>> -     if (host->tuning_mode != SDHCI_TUNING_MODE_3)
>> -             mmc_retune_needed(host->mmc);
>> -
>> -     res = sdhci_suspend_host(host);
>> -     if (res)
>> -             return res;
>> -     clk_disable_unprepare(pltfm_host->clk);
>> -     return res;
>> -}
>> -
>> -static int sdhci_brcmstb_resume(struct device *dev)
>> -{
>> -     struct sdhci_host *host = dev_get_drvdata(dev);
>> -     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> -     int err;
>> -
>> -     err = clk_prepare_enable(pltfm_host->clk);
>> -     if (err)
>> -             return err;
>> -     return sdhci_resume_host(host);
>> -}
>> -
>> -#endif /* CONFIG_PM_SLEEP */
>> -
>> -static SIMPLE_DEV_PM_OPS(sdhci_brcmstb_pmops, sdhci_brcmstb_suspend,
>> -                     sdhci_brcmstb_resume);
>> -
>>  static const struct sdhci_ops sdhci_brcmstb_ops = {
>>       .set_clock = sdhci_set_clock,
>>       .set_bus_width = sdhci_set_bus_width,
>> @@ -131,7 +96,7 @@ MODULE_DEVICE_TABLE(of, sdhci_brcm_of_match);
>>  static struct platform_driver sdhci_brcmstb_driver = {
>>       .driver         = {
>>               .name   = "sdhci-brcmstb",
>> -             .pm     = &sdhci_brcmstb_pmops,
>> +             .pm     = &sdhci_pltfm_pmops,
>>               .of_match_table = of_match_ptr(sdhci_brcm_of_match),
>>       },
>>       .probe          = sdhci_brcmstb_probe,
>> diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c
>> index e090d8c42ddb..4c0135e184e9 100644
>> --- a/drivers/mmc/host/sdhci-pltfm.c
>> +++ b/drivers/mmc/host/sdhci-pltfm.c
>> @@ -212,18 +212,36 @@ EXPORT_SYMBOL_GPL(sdhci_pltfm_unregister);
>>  static int sdhci_pltfm_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);
>>
>> -     return sdhci_suspend_host(host);
>> +     ret = sdhci_suspend_host(host);
>> +     if (ret)
>> +             return ret;
>> +
>> +     clk_disable_unprepare(pltfm_host->clk);
>> +
>> +     return 0;
>>  }
>>
>>  static int sdhci_pltfm_resume(struct device *dev)
>>  {
>>       struct sdhci_host *host = dev_get_drvdata(dev);
>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> +     int ret;
>> +
>> +     ret = clk_prepare_enable(pltfm_host->clk);
>> +     if (ret)
>> +             return ret;
>>
>> -     return sdhci_resume_host(host);
>> +     ret = sdhci_resume_host(host);
>> +     if (ret)
>> +             clk_disable_unprepare(pltfm_host->clk);
>> +
>> +     return ret;
>>  }
>>  #endif
>>
>> diff --git a/drivers/mmc/host/sdhci-sirf.c b/drivers/mmc/host/sdhci-sirf.c
>> index c251c6c0a112..0c7aa89df4e2 100644
>> --- a/drivers/mmc/host/sdhci-sirf.c
>> +++ b/drivers/mmc/host/sdhci-sirf.c
>> @@ -230,43 +230,6 @@ static int sdhci_sirf_probe(struct platform_device *pdev)
>>       return ret;
>>  }
>>
>> -#ifdef CONFIG_PM_SLEEP
>> -static int sdhci_sirf_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(pltfm_host->clk);
>> -
>> -     return 0;
>> -}
>> -
>> -static int sdhci_sirf_resume(struct device *dev)
>> -{
>> -     struct sdhci_host *host = dev_get_drvdata(dev);
>> -     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>> -     int ret;
>> -
>> -     ret = clk_enable(pltfm_host->clk);
>> -     if (ret) {
>> -             dev_dbg(dev, "Resume: Error enabling clock\n");
>> -             return ret;
>> -     }
>> -
>> -     return sdhci_resume_host(host);
>> -}
>> -#endif
>> -
>> -static SIMPLE_DEV_PM_OPS(sdhci_sirf_pm_ops, sdhci_sirf_suspend, sdhci_sirf_resume);
>> -
>>  static const struct of_device_id sdhci_sirf_of_match[] = {
>>       { .compatible = "sirf,prima2-sdhc" },
>>       { }
>> @@ -277,7 +240,7 @@ static struct platform_driver sdhci_sirf_driver = {
>>       .driver         = {
>>               .name   = "sdhci-sirf",
>>               .of_match_table = sdhci_sirf_of_match,
>> -             .pm     = &sdhci_sirf_pm_ops,
>> +             .pm     = &sdhci_pltfm_pmops,
>>       },
>>       .probe          = sdhci_sirf_probe,
>>       .remove         = sdhci_pltfm_unregister,
>>
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port
  2017-08-23  4:14 ` Masahiro Yamada
  (?)
@ 2017-08-30 13:13   ` Ulf Hansson
  -1 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2017-08-30 13:13 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-mmc, Barry Song, Florian Fainelli, Kevin Hao,
	Scott Branden, Christian Daudt, Al Cooper, Adrian Hunter,
	linux-kernel, Hu Ziji, BCM Kernel Feedback, Zhangfei Gao,
	Gregory Fong, Olof Johansson, Brian Norris, linux-arm-kernel,
	Piotr Sroka

On 23 August 2017 at 06:14, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> [1] implements suspend / resume for sdhci-cadence.c
>
> [2] refactor sdhci-pxav2
>
> [3] add clk handling for suspend/resume hooks of sdhci-pltfm.
>     This also cleans up sdhci-brcmstb.c and sdhci-sirf.c
>
> [4] export sdhci_pltfm_suspend/resume to reduce code duplication
>
>
> Masahiro Yamada (4):
>   mmc: sdhci-cadence: add suspend / resume support
>   mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
>   mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
>   mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume
>
>  drivers/mmc/host/sdhci-brcmstb.c | 37 +----------------
>  drivers/mmc/host/sdhci-cadence.c | 88 ++++++++++++++++++++++++++++++++++++----
>  drivers/mmc/host/sdhci-pltfm.c   | 28 +++++++++++--
>  drivers/mmc/host/sdhci-pltfm.h   |  2 +
>  drivers/mmc/host/sdhci-pxav2.c   | 30 ++++----------
>  drivers/mmc/host/sdhci-sirf.c    | 39 +-----------------
>  6 files changed, 114 insertions(+), 110 deletions(-)
>

Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port
@ 2017-08-30 13:13   ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2017-08-30 13:13 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linux-mmc, Barry Song, Florian Fainelli, Kevin Hao,
	Scott Branden, Christian Daudt, Al Cooper, Adrian Hunter,
	linux-kernel, Hu Ziji, BCM Kernel Feedback, Zhangfei Gao,
	Gregory Fong, Olof Johansson, Brian Norris, linux-arm-kernel,
	Piotr Sroka

On 23 August 2017 at 06:14, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> [1] implements suspend / resume for sdhci-cadence.c
>
> [2] refactor sdhci-pxav2
>
> [3] add clk handling for suspend/resume hooks of sdhci-pltfm.
>     This also cleans up sdhci-brcmstb.c and sdhci-sirf.c
>
> [4] export sdhci_pltfm_suspend/resume to reduce code duplication
>
>
> Masahiro Yamada (4):
>   mmc: sdhci-cadence: add suspend / resume support
>   mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
>   mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
>   mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume
>
>  drivers/mmc/host/sdhci-brcmstb.c | 37 +----------------
>  drivers/mmc/host/sdhci-cadence.c | 88 ++++++++++++++++++++++++++++++++++++----
>  drivers/mmc/host/sdhci-pltfm.c   | 28 +++++++++++--
>  drivers/mmc/host/sdhci-pltfm.h   |  2 +
>  drivers/mmc/host/sdhci-pxav2.c   | 30 ++++----------
>  drivers/mmc/host/sdhci-sirf.c    | 39 +-----------------
>  6 files changed, 114 insertions(+), 110 deletions(-)
>

Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port
@ 2017-08-30 13:13   ` Ulf Hansson
  0 siblings, 0 replies; 18+ messages in thread
From: Ulf Hansson @ 2017-08-30 13:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 23 August 2017 at 06:14, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>
> [1] implements suspend / resume for sdhci-cadence.c
>
> [2] refactor sdhci-pxav2
>
> [3] add clk handling for suspend/resume hooks of sdhci-pltfm.
>     This also cleans up sdhci-brcmstb.c and sdhci-sirf.c
>
> [4] export sdhci_pltfm_suspend/resume to reduce code duplication
>
>
> Masahiro Yamada (4):
>   mmc: sdhci-cadence: add suspend / resume support
>   mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister()
>   mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume
>   mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume
>
>  drivers/mmc/host/sdhci-brcmstb.c | 37 +----------------
>  drivers/mmc/host/sdhci-cadence.c | 88 ++++++++++++++++++++++++++++++++++++----
>  drivers/mmc/host/sdhci-pltfm.c   | 28 +++++++++++--
>  drivers/mmc/host/sdhci-pltfm.h   |  2 +
>  drivers/mmc/host/sdhci-pxav2.c   | 30 ++++----------
>  drivers/mmc/host/sdhci-sirf.c    | 39 +-----------------
>  6 files changed, 114 insertions(+), 110 deletions(-)
>

Thanks, applied for next!

Kind regards
Uffe

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-08-30 13:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-23  4:14 [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port Masahiro Yamada
2017-08-23  4:14 ` Masahiro Yamada
2017-08-23  4:14 ` Masahiro Yamada
2017-08-23  4:15 ` [PATCH v4 1/4] mmc: sdhci-cadence: add suspend / resume support Masahiro Yamada
2017-08-28 10:11   ` Adrian Hunter
2017-08-23  4:15 ` [PATCH v4 2/4] mmc: sdhci-pxav2: switch to managed clk and sdhci_pltfm_unregister() Masahiro Yamada
2017-08-23  4:15 ` [PATCH v4 3/4] mmc: sdhci: enable/disable the clock in sdhci_pltfm_suspend/resume Masahiro Yamada
2017-08-23  4:15   ` Masahiro Yamada
2017-08-23  4:15   ` Masahiro Yamada
2017-08-28 10:34   ` Adrian Hunter
2017-08-28 10:34     ` Adrian Hunter
2017-08-28 15:35     ` Alan Cooper
2017-08-28 15:35       ` Alan Cooper
2017-08-23  4:15 ` [PATCH v4 4/4] mmc: sdhci-pltfm: export sdhci_pltfm_suspend/resume Masahiro Yamada
2017-08-28 10:36   ` Adrian Hunter
2017-08-30 13:13 ` [PATCH v4 0/4] mmc: sdhci: refactor PM in sdhci-pltfm add support PM for cadence port Ulf Hansson
2017-08-30 13:13   ` Ulf Hansson
2017-08-30 13:13   ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.