mbox series

[0/2] mmc: tmio: improve how runtime PM is enabled

Message ID 20190109223452.11184-1-niklas.soderlund+renesas@ragnatech.se (mailing list archive)
Headers show
Series mmc: tmio: improve how runtime PM is enabled | expand

Message

Niklas Söderlund Jan. 9, 2019, 10:34 p.m. UTC
Hi,

This series aims to address a issue reported by Geert [1]. It's tested 
on Renesas Gen2 and Gen3 boards and the issue reported by Geert is 
fixed. The changes to timo_mmc and uniphier-sd drivers are only compile 
tested, Yamada-san would it be possible for you to test?

With correct accounting for runtime PM the Renesas boards no longer 
switch of the clocks when suspending. I'm not sure if this is the 
intended design or nor as in tmio_mmc_host_probe() we have:

  /*
   * On Gen2+, eMMC with NONREMOVABLE currently fails because native
   * hotplug gets disabled. It seems RuntimePM related yet we need further
   * research. Since we are planning a PM overhaul anyway, let's enforce
   * for now the device being active by enabling native hotplug always.
   */
  if (pdata->flags & TMIO_MMC_MIN_RCAR2)
          _host->native_hotplug = true;

  /*   
   * While using internal tmio hardware logic for card detection, we need
   * to ensure it stays powered for it to work.
   */
  if (_host->native_hotplug)
          pm_runtime_get_noresume(&pdev->dev);

For posterity the matching output with this series applied as in Geerts 
report, the output is the same both after boot and a suspend-resume 
cycle.

grep sd /sys/kernel/debug/clk/clk_summary
             .sdsrc                   3        3        0   798720000          0     0  50000
                sd3                   1        1        0    12480000          0     0  50000
                   sdif3              3        3        0    12480000          0     0  50000
                sd2                   1        1        0   199680000          0     0  50000
                   sdif2              3        3        0   199680000          0     0  50000
                sd1                   0        0        0   199680000          0     0  50000
                   sdif1              0        0        0   199680000          0     0  50000
                sd0                   1        1        0    12480000          0     0  50000
                   sdif0              3        3        0    12480000          0     0  50000

1. https://www.spinics.net/lists/linux-mmc/msg44431.html

Niklas Söderlund (2):
  mmc: tmio: undo PM autosuspend when removing the host
  mmc: tmio: move runtime PM enablement to the driver implementations

 drivers/mmc/host/renesas_sdhi_core.c | 6 ++++++
 drivers/mmc/host/tmio_mmc.c          | 5 +++++
 drivers/mmc/host/tmio_mmc_core.c     | 3 +--
 drivers/mmc/host/uniphier-sd.c       | 3 +++
 4 files changed, 15 insertions(+), 2 deletions(-)

Comments

Wolfram Sang Jan. 10, 2019, 10:37 a.m. UTC | #1
Hi Niklas,

thanks for this work!

> This series aims to address a issue reported by Geert [1]. It's tested 
> on Renesas Gen2 and Gen3 boards and the issue reported by Geert is 
> fixed.

Great news!

> With correct accounting for runtime PM the Renesas boards no longer 
> switch of the clocks when suspending. I'm not sure if this is the 

You mean runtime-suspending here?

> intended design or nor as in tmio_mmc_host_probe() we have:
> 
>   /*
>    * On Gen2+, eMMC with NONREMOVABLE currently fails because native
>    * hotplug gets disabled. It seems RuntimePM related yet we need further
>    * research. Since we are planning a PM overhaul anyway, let's enforce
>    * for now the device being active by enabling native hotplug always.
>    */
>   if (pdata->flags & TMIO_MMC_MIN_RCAR2)
>           _host->native_hotplug = true;

Can you test if we still need this? With the above block removed, it should

a) fail to probe eMMC on Gen3 without your series

b) hopefully probe eMMC on Gen3 with your series

Thanks,

   Wolfram
Niklas Söderlund April 10, 2019, 9:21 p.m. UTC | #2
On 2019-01-10 11:37:36 +0100, Wolfram Sang wrote:
> Hi Niklas,
> 
> thanks for this work!
> 
> > This series aims to address a issue reported by Geert [1]. It's tested 
> > on Renesas Gen2 and Gen3 boards and the issue reported by Geert is 
> > fixed.
> 
> Great news!
> 
> > With correct accounting for runtime PM the Renesas boards no longer 
> > switch of the clocks when suspending. I'm not sure if this is the 
> 
> You mean runtime-suspending here?
> 
> > intended design or nor as in tmio_mmc_host_probe() we have:
> > 
> >   /*
> >    * On Gen2+, eMMC with NONREMOVABLE currently fails because native
> >    * hotplug gets disabled. It seems RuntimePM related yet we need further
> >    * research. Since we are planning a PM overhaul anyway, let's enforce
> >    * for now the device being active by enabling native hotplug always.
> >    */
> >   if (pdata->flags & TMIO_MMC_MIN_RCAR2)
> >           _host->native_hotplug = true;
> 
> Can you test if we still need this? With the above block removed, it should
> 
> a) fail to probe eMMC on Gen3 without your series
> 
> b) hopefully probe eMMC on Gen3 with your series

I can remove the above section and the driver still probes fine on gen3.  
But if I remove this and keep the 2/2 of this series the clock imbalance 
when suspending/resumeing appears in a new form.

After boot (both cases):

# grep -iE "sd|mmc" /sys/kernel/debug/clk/clk_summary
             .sdsrc                   3        3        0   798720000          0     0  50000
                sd3                   1        1        0    12480000          0     0  50000
                   sdif3              3        3        0    12480000          0     0  50000
                sd2                   1        1        0   199680000          0     0  50000
                   sdif2              3        3        0   199680000          0     0  50000
                sd1                   0        0        0   199680000          0     0  50000
                   sdif1              0        0        0   199680000          0     0  50000
                sd0                   1        1        0    12480000          0     0  50000
                   sdif0              3        3        0    12480000          0     0  50000

After resume with the section removed and 2/2:

# grep -iE "sd|mmc" /sys/kernel/debug/clk/clk_summary
             .sdsrc                   3        3        0   798720000          0     0  50000
                sd3                   1        1        0    12480000          0     0  50000
                   sdif3              3        3        0    12480000          0     0  50000
                sd2                   1        1        0   199680000          0     0  50000
                   sdif2              1        2        0   199680000          0     0  50000
                sd1                   0        0        0   199680000          0     0  50000
                   sdif1              0        0        0   199680000          0     0  50000
                sd0                   1        1        0    12480000          0     0  50000
                   sdif0              3        3        0    12480000          0     0  50000

With this section intact and 2/2:

# grep -iE "sd|mmc" /sys/kernel/debug/clk/clk_summary
             .sdsrc                   3        3        0   798720000          0     0  50000
                sd3                   1        1        0    12480000          0     0  50000
                   sdif3              3        3        0    12480000          0     0  50000
                sd2                   1        1        0   199680000          0     0  50000
                   sdif2              3        3        0   199680000          0     0  50000
                sd1                   0        0        0   199680000          0     0  50000
                   sdif1              0        0        0   199680000          0     0  50000
                sd0                   1        1        0    12480000          0     0  50000
                   sdif0              3        3        0    12480000          0     0  50000