public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] mmc: arasan: adapt to runtime pm
@ 2017-04-20  5:44 Shubhrajyoti Datta
  2017-04-20  5:44 ` [PATCH 2/2] mmc: arasan: Add polling card detect Shubhrajyoti Datta
  2017-04-25 10:17 ` [PATCH 1/2] mmc: arasan: adapt to runtime pm Adrian Hunter
  0 siblings, 2 replies; 8+ messages in thread
From: Shubhrajyoti Datta @ 2017-04-20  5:44 UTC (permalink / raw)
  To: linux-mmc
  Cc: ulf.hansson, adrian.hunter, michal.simek, shubhrajyoti.datta,
	Shubhrajyoti Datta

Currently the clock are enabled at probe and released at driver
removal. This moves to enable before mmc read/ write and disables
after it.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 50 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 1cfd7f9..812e75a 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/phy/phy.h>
+#include <linux/pm_runtime.h>
 #include <linux/regmap.h>
 #include "sdhci-pltfm.h"
 #include <linux/of.h>
@@ -373,10 +374,44 @@ static int sdhci_arasan_resume(struct device *dev)
 
 	return sdhci_resume_host(host);
 }
+
+static int sdhci_arasan_runtime_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct sdhci_host *host = platform_get_drvdata(pdev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
+	int ret;
+
+	ret = sdhci_runtime_suspend_host(host);
+
+	clk_disable_unprepare(pltfm_host->clk);
+	clk_disable_unprepare(sdhci_arasan->clk_ahb);
+
+	return ret;
+}
+
+static int sdhci_arasan_runtime_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct sdhci_host *host = platform_get_drvdata(pdev);
+	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
+
+	clk_prepare_enable(pltfm_host->clk);
+	clk_prepare_enable(sdhci_arasan->clk_ahb);
+
+	return sdhci_runtime_resume_host(host);
+}
 #endif /* ! CONFIG_PM_SLEEP */
 
-static SIMPLE_DEV_PM_OPS(sdhci_arasan_dev_pm_ops, sdhci_arasan_suspend,
-			 sdhci_arasan_resume);
+static const struct dev_pm_ops sdhci_arasan_dev_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(sdhci_arasan_suspend,
+				sdhci_arasan_resume)
+	SET_RUNTIME_PM_OPS(sdhci_arasan_runtime_suspend,
+			   sdhci_arasan_runtime_resume,
+			   NULL)
+};
 
 static const struct of_device_id sdhci_arasan_of_match[] = {
 	/* SoC-specific compatible strings w/ soc_ctl_map */
@@ -637,6 +672,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 		goto clk_dis_ahb;
 	}
 
+	pm_runtime_get_noresume(&pdev->dev);
+	pm_runtime_set_active(&pdev->dev);
+	pm_runtime_enable(&pdev->dev);
+	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
+	pm_runtime_use_autosuspend(&pdev->dev);
+
 	sdhci_get_of_property(pdev);
 
 	if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
@@ -687,6 +728,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_add_host;
 
+	pm_runtime_put(&pdev->dev);
 	return 0;
 
 err_add_host:
@@ -695,6 +737,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 unreg_clk:
 	sdhci_arasan_unregister_sdclk(&pdev->dev);
 clk_disable_all:
+	pm_runtime_disable(&pdev->dev);
+	pm_runtime_set_suspended(&pdev->dev);
+	pm_runtime_put_noidle(&pdev->dev);
 	clk_disable_unprepare(clk_xin);
 clk_dis_ahb:
 	clk_disable_unprepare(sdhci_arasan->clk_ahb);
@@ -723,6 +768,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
 
 	clk_disable_unprepare(clk_ahb);
 
+	pm_runtime_disable(&pdev->dev);
 	return ret;
 }
 
-- 
2.7.4


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

* [PATCH 2/2] mmc: arasan: Add polling card detect
  2017-04-20  5:44 [PATCH 1/2] mmc: arasan: adapt to runtime pm Shubhrajyoti Datta
@ 2017-04-20  5:44 ` Shubhrajyoti Datta
  2017-04-25 10:31   ` Adrian Hunter
  2017-05-15  9:28   ` Ulf Hansson
  2017-04-25 10:17 ` [PATCH 1/2] mmc: arasan: adapt to runtime pm Adrian Hunter
  1 sibling, 2 replies; 8+ messages in thread
From: Shubhrajyoti Datta @ 2017-04-20  5:44 UTC (permalink / raw)
  To: linux-mmc
  Cc: ulf.hansson, adrian.hunter, michal.simek, shubhrajyoti.datta,
	Shubhrajyoti Datta

Add MMC_CAP_NEEDS_POLL flag for card detect if
no gpio is passed otherwise use gpio as card detect.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
 drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
index 812e75a..7e02190 100644
--- a/drivers/mmc/host/sdhci-of-arasan.c
+++ b/drivers/mmc/host/sdhci-of-arasan.c
@@ -23,6 +23,8 @@
 #include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of_device.h>
+#include <linux/mmc/host.h>
+#include <linux/mmc/slot-gpio.h>
 #include <linux/phy/phy.h>
 #include <linux/pm_runtime.h>
 #include <linux/regmap.h>
@@ -728,6 +730,11 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_add_host;
 
+	if (mmc_card_is_removable(host->mmc) &&
+	    mmc_gpio_get_cd(host->mmc) < 0) {
+		host->mmc->caps |= MMC_CAP_NEEDS_POLL;
+	}
+
 	pm_runtime_put(&pdev->dev);
 	return 0;
 
-- 
2.7.4


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

* Re: [PATCH 1/2] mmc: arasan: adapt to runtime pm
  2017-04-20  5:44 [PATCH 1/2] mmc: arasan: adapt to runtime pm Shubhrajyoti Datta
  2017-04-20  5:44 ` [PATCH 2/2] mmc: arasan: Add polling card detect Shubhrajyoti Datta
@ 2017-04-25 10:17 ` Adrian Hunter
  2017-04-25 10:50   ` Shubhrajyoti Datta
  1 sibling, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2017-04-25 10:17 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-mmc
  Cc: ulf.hansson, michal.simek, shubhrajyoti.datta

On 20/04/17 08:44, Shubhrajyoti Datta wrote:
> Currently the clock are enabled at probe and released at driver
> removal. This moves to enable before mmc read/ write and disables
> after it.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 50 ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 48 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 1cfd7f9..812e75a 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -24,6 +24,7 @@
>  #include <linux/module.h>
>  #include <linux/of_device.h>
>  #include <linux/phy/phy.h>
> +#include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
>  #include "sdhci-pltfm.h"
>  #include <linux/of.h>
> @@ -373,10 +374,44 @@ static int sdhci_arasan_resume(struct device *dev)
>  
>  	return sdhci_resume_host(host);
>  }
> +

Runtime PM is under CONFIG_PM not CONFIG_PM_SLEEP

> +static int sdhci_arasan_runtime_suspend(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct sdhci_host *host = platform_get_drvdata(pdev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
> +	int ret;
> +
> +	ret = sdhci_runtime_suspend_host(host);

Other drivers now have:

	if (host->tuning_mode != SDHCI_TUNING_MODE_3)
		mmc_retune_needed(host->mmc);

If you don't need re-tuning, maybe add a comment so we know.

> +
> +	clk_disable_unprepare(pltfm_host->clk);
> +	clk_disable_unprepare(sdhci_arasan->clk_ahb);
> +
> +	return ret;
> +}
> +
> +static int sdhci_arasan_runtime_resume(struct device *dev)
> +{
> +	struct platform_device *pdev = to_platform_device(dev);
> +	struct sdhci_host *host = platform_get_drvdata(pdev);
> +	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +	struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
> +
> +	clk_prepare_enable(pltfm_host->clk);
> +	clk_prepare_enable(sdhci_arasan->clk_ahb);
> +
> +	return sdhci_runtime_resume_host(host);
> +}
>  #endif /* ! CONFIG_PM_SLEEP */
>  
> -static SIMPLE_DEV_PM_OPS(sdhci_arasan_dev_pm_ops, sdhci_arasan_suspend,
> -			 sdhci_arasan_resume);
> +static const struct dev_pm_ops sdhci_arasan_dev_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(sdhci_arasan_suspend,
> +				sdhci_arasan_resume)
> +	SET_RUNTIME_PM_OPS(sdhci_arasan_runtime_suspend,
> +			   sdhci_arasan_runtime_resume,
> +			   NULL)
> +};
>  
>  static const struct of_device_id sdhci_arasan_of_match[] = {
>  	/* SoC-specific compatible strings w/ soc_ctl_map */
> @@ -637,6 +672,12 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>  		goto clk_dis_ahb;
>  	}
>  
> +	pm_runtime_get_noresume(&pdev->dev);
> +	pm_runtime_set_active(&pdev->dev);
> +	pm_runtime_enable(&pdev->dev);
> +	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
> +	pm_runtime_use_autosuspend(&pdev->dev);
> +
>  	sdhci_get_of_property(pdev);
>  
>  	if (of_property_read_bool(np, "xlnx,fails-without-test-cd"))
> @@ -687,6 +728,7 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_host;
>  
> +	pm_runtime_put(&pdev->dev);
>  	return 0;
>  
>  err_add_host:
> @@ -695,6 +737,9 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>  unreg_clk:
>  	sdhci_arasan_unregister_sdclk(&pdev->dev);
>  clk_disable_all:
> +	pm_runtime_disable(&pdev->dev);
> +	pm_runtime_set_suspended(&pdev->dev);
> +	pm_runtime_put_noidle(&pdev->dev);
>  	clk_disable_unprepare(clk_xin);
>  clk_dis_ahb:
>  	clk_disable_unprepare(sdhci_arasan->clk_ahb);
> @@ -723,6 +768,7 @@ static int sdhci_arasan_remove(struct platform_device *pdev)
>  
>  	clk_disable_unprepare(clk_ahb);
>  
> +	pm_runtime_disable(&pdev->dev);
>  	return ret;
>  }
>  
> 


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

* Re: [PATCH 2/2] mmc: arasan: Add polling card detect
  2017-04-20  5:44 ` [PATCH 2/2] mmc: arasan: Add polling card detect Shubhrajyoti Datta
@ 2017-04-25 10:31   ` Adrian Hunter
  2017-05-15  9:28   ` Ulf Hansson
  1 sibling, 0 replies; 8+ messages in thread
From: Adrian Hunter @ 2017-04-25 10:31 UTC (permalink / raw)
  To: Shubhrajyoti Datta, linux-mmc
  Cc: ulf.hansson, michal.simek, shubhrajyoti.datta

On 20/04/17 08:44, Shubhrajyoti Datta wrote:
> Add MMC_CAP_NEEDS_POLL flag for card detect if
> no gpio is passed otherwise use gpio as card detect.
> 
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>

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

> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 812e75a..7e02190 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -23,6 +23,8 @@
>  #include <linux/mfd/syscon.h>
>  #include <linux/module.h>
>  #include <linux/of_device.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/slot-gpio.h>
>  #include <linux/phy/phy.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
> @@ -728,6 +730,11 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_host;
>  
> +	if (mmc_card_is_removable(host->mmc) &&
> +	    mmc_gpio_get_cd(host->mmc) < 0) {
> +		host->mmc->caps |= MMC_CAP_NEEDS_POLL;
> +	}
> +
>  	pm_runtime_put(&pdev->dev);
>  	return 0;
>  
> 


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

* Re: [PATCH 1/2] mmc: arasan: adapt to runtime pm
  2017-04-25 10:17 ` [PATCH 1/2] mmc: arasan: adapt to runtime pm Adrian Hunter
@ 2017-04-25 10:50   ` Shubhrajyoti Datta
  2017-04-25 10:52     ` Adrian Hunter
  0 siblings, 1 reply; 8+ messages in thread
From: Shubhrajyoti Datta @ 2017-04-25 10:50 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Shubhrajyoti Datta, linux-mmc, ulf.hansson, Michal Simek

Hi Adrian,

Thanks for the review.

On Tue, Apr 25, 2017 at 3:47 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 20/04/17 08:44, Shubhrajyoti Datta wrote:
> > Currently the clock are enabled at probe and released at driver
> > removal. This moves to enable before mmc read/ write and disables
> > after it.
> >
> > Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> > ---
> >  drivers/mmc/host/sdhci-of-arasan.c | 50 ++++++++++++++++++++++++++++++++++++--
> >  1 file changed, 48 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> > index 1cfd7f9..812e75a 100644
> > --- a/drivers/mmc/host/sdhci-of-arasan.c
> > +++ b/drivers/mmc/host/sdhci-of-arasan.c
> > @@ -24,6 +24,7 @@
> >  #include <linux/module.h>
> >  #include <linux/of_device.h>
> >  #include <linux/phy/phy.h>
> > +#include <linux/pm_runtime.h>
> >  #include <linux/regmap.h>
> >  #include "sdhci-pltfm.h"
> >  #include <linux/of.h>
> > @@ -373,10 +374,44 @@ static int sdhci_arasan_resume(struct device *dev)
> >
> >       return sdhci_resume_host(host);
> >  }
> > +
>
> Runtime PM is under CONFIG_PM not CONFIG_PM_SLEEP

Will fix.

>
> > +static int sdhci_arasan_runtime_suspend(struct device *dev)
> > +{
> > +     struct platform_device *pdev = to_platform_device(dev);
> > +     struct sdhci_host *host = platform_get_drvdata(pdev);
> > +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> > +     struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
> > +     int ret;
> > +
> > +     ret = sdhci_runtime_suspend_host(host);
>
> Other drivers now have:
Can you point me to an example.

>
>         if (host->tuning_mode != SDHCI_TUNING_MODE_3)
>                 mmc_retune_needed(host->mmc);
>
> If you don't need re-tuning, maybe add a comment so we know.

I  didnt  I  understood this one.
I am calling sdhci_runtime_suspend_host  which has.

2907
2908 int sdhci_runtime_suspend_host(struct sdhci_host *host)
2909 {
2910         unsigned long flags;
2911
2912         mmc_retune_timer_stop(host->mmc);
2913         if (host->tuning_mode != SDHCI_TUNING_MODE_3)
2914                 mmc_retune_needed(host->mmc);


Am I missing something
>
> > +
> > +     clk_disable_unprepare(pltfm_host->clk);
> > +     clk_disable_unprepare(sdhci_arasan->clk_ahb);
> > +
> > +     return ret;

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

* Re: [PATCH 1/2] mmc: arasan: adapt to runtime pm
  2017-04-25 10:50   ` Shubhrajyoti Datta
@ 2017-04-25 10:52     ` Adrian Hunter
  2017-04-25 11:19       ` Shubhrajyoti Datta
  0 siblings, 1 reply; 8+ messages in thread
From: Adrian Hunter @ 2017-04-25 10:52 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: Shubhrajyoti Datta, linux-mmc, ulf.hansson, Michal Simek

On 25/04/17 13:50, Shubhrajyoti Datta wrote:
> Hi Adrian,
> 
> Thanks for the review.
> 
> On Tue, Apr 25, 2017 at 3:47 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>>
>> On 20/04/17 08:44, Shubhrajyoti Datta wrote:
>>> Currently the clock are enabled at probe and released at driver
>>> removal. This moves to enable before mmc read/ write and disables
>>> after it.
>>>
>>> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
>>> ---
>>>  drivers/mmc/host/sdhci-of-arasan.c | 50 ++++++++++++++++++++++++++++++++++++--
>>>  1 file changed, 48 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
>>> index 1cfd7f9..812e75a 100644
>>> --- a/drivers/mmc/host/sdhci-of-arasan.c
>>> +++ b/drivers/mmc/host/sdhci-of-arasan.c
>>> @@ -24,6 +24,7 @@
>>>  #include <linux/module.h>
>>>  #include <linux/of_device.h>
>>>  #include <linux/phy/phy.h>
>>> +#include <linux/pm_runtime.h>
>>>  #include <linux/regmap.h>
>>>  #include "sdhci-pltfm.h"
>>>  #include <linux/of.h>
>>> @@ -373,10 +374,44 @@ static int sdhci_arasan_resume(struct device *dev)
>>>
>>>       return sdhci_resume_host(host);
>>>  }
>>> +
>>
>> Runtime PM is under CONFIG_PM not CONFIG_PM_SLEEP
> 
> Will fix.
> 
>>
>>> +static int sdhci_arasan_runtime_suspend(struct device *dev)
>>> +{
>>> +     struct platform_device *pdev = to_platform_device(dev);
>>> +     struct sdhci_host *host = platform_get_drvdata(pdev);
>>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
>>> +     struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
>>> +     int ret;
>>> +
>>> +     ret = sdhci_runtime_suspend_host(host);
>>
>> Other drivers now have:
> Can you point me to an example.
> 
>>
>>         if (host->tuning_mode != SDHCI_TUNING_MODE_3)
>>                 mmc_retune_needed(host->mmc);
>>
>> If you don't need re-tuning, maybe add a comment so we know.
> 
> I  didnt  I  understood this one.
> I am calling sdhci_runtime_suspend_host  which has.
> 
> 2907
> 2908 int sdhci_runtime_suspend_host(struct sdhci_host *host)
> 2909 {
> 2910         unsigned long flags;
> 2911
> 2912         mmc_retune_timer_stop(host->mmc);
> 2913         if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> 2914                 mmc_retune_needed(host->mmc);
> 
> 
> Am I missing something

It has changed recently, so you need to look at the 'next' branch of Ulf's
mmc tree:

	git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git

>>
>>> +
>>> +     clk_disable_unprepare(pltfm_host->clk);
>>> +     clk_disable_unprepare(sdhci_arasan->clk_ahb);
>>> +
>>> +     return ret;
> 


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

* Re: [PATCH 1/2] mmc: arasan: adapt to runtime pm
  2017-04-25 10:52     ` Adrian Hunter
@ 2017-04-25 11:19       ` Shubhrajyoti Datta
  0 siblings, 0 replies; 8+ messages in thread
From: Shubhrajyoti Datta @ 2017-04-25 11:19 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: Shubhrajyoti Datta, linux-mmc, ulf.hansson, Michal Simek

On Tue, Apr 25, 2017 at 4:22 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
>
> On 25/04/17 13:50, Shubhrajyoti Datta wrote:
> > Hi Adrian,
> >
> > Thanks for the review.
> >
> > On Tue, Apr 25, 2017 at 3:47 PM, Adrian Hunter <adrian.hunter@intel.com> wrote:
> >>
> >> On 20/04/17 08:44, Shubhrajyoti Datta wrote:
> >>> Currently the clock are enabled at probe and released at driver
> >>> removal. This moves to enable before mmc read/ write and disables
> >>> after it.
> >>>
> >>> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> >>> ---
> >>>  drivers/mmc/host/sdhci-of-arasan.c | 50 ++++++++++++++++++++++++++++++++++++--
> >>>  1 file changed, 48 insertions(+), 2 deletions(-)
> >>>
> >>> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> >>> index 1cfd7f9..812e75a 100644
> >>> --- a/drivers/mmc/host/sdhci-of-arasan.c
> >>> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> >>> @@ -24,6 +24,7 @@
> >>>  #include <linux/module.h>
> >>>  #include <linux/of_device.h>
> >>>  #include <linux/phy/phy.h>
> >>> +#include <linux/pm_runtime.h>
> >>>  #include <linux/regmap.h>
> >>>  #include "sdhci-pltfm.h"
> >>>  #include <linux/of.h>
> >>> @@ -373,10 +374,44 @@ static int sdhci_arasan_resume(struct device *dev)
> >>>
> >>>       return sdhci_resume_host(host);
> >>>  }
> >>> +
> >>
> >> Runtime PM is under CONFIG_PM not CONFIG_PM_SLEEP
> >
> > Will fix.
> >
> >>
> >>> +static int sdhci_arasan_runtime_suspend(struct device *dev)
> >>> +{
> >>> +     struct platform_device *pdev = to_platform_device(dev);
> >>> +     struct sdhci_host *host = platform_get_drvdata(pdev);
> >>> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> >>> +     struct sdhci_arasan_data *sdhci_arasan = sdhci_pltfm_priv(pltfm_host);
> >>> +     int ret;
> >>> +
> >>> +     ret = sdhci_runtime_suspend_host(host);
> >>
> >> Other drivers now have:
> > Can you point me to an example.
> >
> >>
> >>         if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> >>                 mmc_retune_needed(host->mmc);
> >>
> >> If you don't need re-tuning, maybe add a comment so we know.
> >
> > I  didnt  I  understood this one.
> > I am calling sdhci_runtime_suspend_host  which has.
> >
> > 2907
> > 2908 int sdhci_runtime_suspend_host(struct sdhci_host *host)
> > 2909 {
> > 2910         unsigned long flags;
> > 2911
> > 2912         mmc_retune_timer_stop(host->mmc);
> > 2913         if (host->tuning_mode != SDHCI_TUNING_MODE_3)
> > 2914                 mmc_retune_needed(host->mmc);
> >
> >
> > Am I missing something
>
> It has changed recently, so you need to look at the 'next' branch of Ulf's
> mmc tree:
>
>         git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git

Thanks for the heads up will fix in the next version.
I didnt have the latest updates in my tree.

>
> >>
> >>> +
> >>> +     clk_disable_unprepare(pltfm_host->clk);
> >>> +     clk_disable_unprepare(sdhci_arasan->clk_ahb);
> >>> +
> >>> +     return ret;
> >
>

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

* Re: [PATCH 2/2] mmc: arasan: Add polling card detect
  2017-04-20  5:44 ` [PATCH 2/2] mmc: arasan: Add polling card detect Shubhrajyoti Datta
  2017-04-25 10:31   ` Adrian Hunter
@ 2017-05-15  9:28   ` Ulf Hansson
  1 sibling, 0 replies; 8+ messages in thread
From: Ulf Hansson @ 2017-05-15  9:28 UTC (permalink / raw)
  To: Shubhrajyoti Datta
  Cc: linux-mmc@vger.kernel.org, Adrian Hunter, Michal Simek,
	shubhrajyoti.datta

On 20 April 2017 at 07:44, Shubhrajyoti Datta
<shubhrajyoti.datta@xilinx.com> wrote:
> Add MMC_CAP_NEEDS_POLL flag for card detect if
> no gpio is passed otherwise use gpio as card detect.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>  drivers/mmc/host/sdhci-of-arasan.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mmc/host/sdhci-of-arasan.c b/drivers/mmc/host/sdhci-of-arasan.c
> index 812e75a..7e02190 100644
> --- a/drivers/mmc/host/sdhci-of-arasan.c
> +++ b/drivers/mmc/host/sdhci-of-arasan.c
> @@ -23,6 +23,8 @@
>  #include <linux/mfd/syscon.h>
>  #include <linux/module.h>
>  #include <linux/of_device.h>
> +#include <linux/mmc/host.h>
> +#include <linux/mmc/slot-gpio.h>
>  #include <linux/phy/phy.h>
>  #include <linux/pm_runtime.h>
>  #include <linux/regmap.h>
> @@ -728,6 +730,11 @@ static int sdhci_arasan_probe(struct platform_device *pdev)
>         if (ret)
>                 goto err_add_host;
>
> +       if (mmc_card_is_removable(host->mmc) &&
> +           mmc_gpio_get_cd(host->mmc) < 0) {
> +               host->mmc->caps |= MMC_CAP_NEEDS_POLL;
> +       }
> +
>         pm_runtime_put(&pdev->dev);
>         return 0;
>
> --
> 2.7.4
>

Why don't you use the "broken-cd" DT binding instead?

Kind regards
Uffe

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

end of thread, other threads:[~2017-05-15  9:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-20  5:44 [PATCH 1/2] mmc: arasan: adapt to runtime pm Shubhrajyoti Datta
2017-04-20  5:44 ` [PATCH 2/2] mmc: arasan: Add polling card detect Shubhrajyoti Datta
2017-04-25 10:31   ` Adrian Hunter
2017-05-15  9:28   ` Ulf Hansson
2017-04-25 10:17 ` [PATCH 1/2] mmc: arasan: adapt to runtime pm Adrian Hunter
2017-04-25 10:50   ` Shubhrajyoti Datta
2017-04-25 10:52     ` Adrian Hunter
2017-04-25 11:19       ` Shubhrajyoti Datta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox