Skip to contentSkip to conversation

mmc: tmio: Make sure the PM domain is 'started' while probing

PATCH In review Ulf Hansson 3 participants 8 messages May 19, 2020 – May 25, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mmc: tmio: Make sure the PM domain is 'started' while probing

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

---
 drivers/mmc/host/renesas_sdhi_core.c | 3 +++
 drivers/mmc/host/tmio_mmc_core.c     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +3 -0
index ff72b381a6b3..dcba9ad35dd1 100644
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mfd/tmio.h>
@@ -905,6 +906,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	/* All SDHI have SDIO status bits which must be 1 */
 	mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
 
+	dev_pm_domain_start(&pdev->dev);
+
 	ret = renesas_sdhi_clk_enable(host);
 	if (ret)
 		goto efree;
drivers/mmc/host/tmio_mmc_core.c +0 -2
index ba301fb7656b..d7fde57c78c1 100644
@@ -39,7 +39,6 @@
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/platform_device.h>
-#include <linux/pm_domain.h>
 #include <linux/pm_qos.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
@@ -1192,7 +1191,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
 	/* See if we also get DMA */
 	tmio_mmc_request_dma(_host, pdata);
 
-	dev_pm_domain_start(&pdev->dev);
 	pm_runtime_get_noresume(&pdev->dev);
 	pm_runtime_set_active(&pdev->dev);
 	pm_runtime_set_autosuspend_delay(&pdev->dev, 50);
Signature · 1 line
2.20.1
maintainer Reviewed-by Tested-by on v1 2/2
#1 lore raw
Quoted 7 lines · Ulf Hansson

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

Quoted 7 lines

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

Rebind works on my Salvator-XS board (M3-N) and my Lager board (H2). No other issues found when booting and accessing SD cards or eMMC.

Thanks, Ulf!

#2 lore raw
Quoted 17 lines · Wolfram Sang
Quoted 7 lines · Ulf Hansson

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

Quoted 7 lines

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

Quoted 8 lines

Rebind works on my Salvator-XS board (M3-N) and my Lager board (H2). No other issues found when booting and accessing SD cards or eMMC.

Thanks, Ulf!

Applied for next!

Kind regards
Uffe

#3 lore raw
In reply to Ulf Hansson

Hi Ulf,

Quoted 32 lines · Ulf Hansson

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

---
 drivers/mmc/host/renesas_sdhi_core.c | 3 +++
 drivers/mmc/host/tmio_mmc_core.c     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +1 -0
index ff72b381a6b3..dcba9ad35dd1 100644
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mfd/tmio.h>

drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 910

Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +2 -0
@@ -905,6 +906,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
        /* All SDHI have SDIO status bits which must be 1 */
        mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
 
+       dev_pm_domain_start(&pdev->dev);
+

I have debug prints at the top of genpd_stop_dev():

    pr_info("==== %s/%s: stop\n", genpd->name, dev_name(dev));

and genpd_start_dev():

    pr_info("==== %s/%s: start\n", genpd->name, dev_name(dev));

On Koelsch (R-Car M2-W), the three SDHI devices are started twice:

    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start

The first time, the probe is deferred, because the regulator needed in tmio_mmc_init_ocr() hasn't been instantiated yet. The SDHI device is detached from the PM domain, but not stopped. Interestingly, I see no clock imbalances afterwards.

On R-Car Gen3, R-Mobile A1, and RZ/A systems, they are started once, as expected.

On R-Mobile APE6 and SH-Mobile AG5, one device is stopped and started again:

    PM: ==== a3sp/ee100000.sd: start
    PM: ==== a3sp/ee120000.sd: start
    PM: ==== a3sp/ee120000.sd: stop
    PM: ==== a3sp/ee120000.sd: start

But here no probe deferral is involved.
Just Runtime PM kicking in, I guess.

Quoted 16 lines
drivers/mmc/host/renesas_sdhi_core.c +0 -0
        ret = renesas_sdhi_clk_enable(host);
        if (ret)
                goto efree;
drivers/mmc/host/tmio_mmc_core.c +0 -1
index ba301fb7656b..d7fde57c78c1 100644
@@ -39,7 +39,6 @@
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/platform_device.h>
-#include <linux/pm_domain.h>
 #include <linux/pm_qos.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>

drivers/mmc/host/tmio_mmc_core.c int tmio_mmc_host_probe(struct tmio_mmc_host *_host) · line 1195

Quoted 4 lines
drivers/mmc/host/tmio_mmc_core.c +0 -1
@@ -1192,7 +1191,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
        /* See if we also get DMA */
        tmio_mmc_request_dma(_host, pdata);
 
-       dev_pm_domain_start(&pdev->dev);

Before, the issue on probe deferral didn't happen, as the device was only started after the regulator was found.

drivers/mmc/host/tmio_mmc_core.c int tmio_mmc_host_probe(struct tmio_mmc_host *_host) · line 1196

Quoted 3 lines
drivers/mmc/host/tmio_mmc_core.c +0 -0
        pm_runtime_get_noresume(&pdev->dev);
        pm_runtime_set_active(&pdev->dev);
        pm_runtime_set_autosuspend_delay(&pdev->dev, 50);

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#4 lore raw
Quoted 60 lines · Geert Uytterhoeven

Hi Ulf,

Quoted 32 lines · Ulf Hansson

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

---
 drivers/mmc/host/renesas_sdhi_core.c | 3 +++
 drivers/mmc/host/tmio_mmc_core.c     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +1 -0
index ff72b381a6b3..dcba9ad35dd1 100644
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mfd/tmio.h>

drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 910

Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +2 -0
@@ -905,6 +906,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
        /* All SDHI have SDIO status bits which must be 1 */
        mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
 
+       dev_pm_domain_start(&pdev->dev);
+

I have debug prints at the top of genpd_stop_dev():

    pr_info("==== %s/%s: stop\n", genpd->name, dev_name(dev));

and genpd_start_dev():

    pr_info("==== %s/%s: start\n", genpd->name, dev_name(dev));

On Koelsch (R-Car M2-W), the three SDHI devices are started twice:

    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
Quoted 4 lines

The first time, the probe is deferred, because the regulator needed in tmio_mmc_init_ocr() hasn't been instantiated yet. The SDHI device is detached from the PM domain, but not stopped. Interestingly, I see no clock imbalances afterwards.

That's because genpd's->detach_dev() callback is invoked at the "deferred probe" case. In your case this ends up calling pm_clk_destroy(). Thus the clock gets disabled and unprepared correctly.

Quoted 7 lines

On R-Car Gen3, R-Mobile A1, and RZ/A systems, they are started once, as expected.

On R-Mobile APE6 and SH-Mobile AG5, one device is stopped and started again:

Quoted 7 lines
    PM: ==== a3sp/ee100000.sd: start
    PM: ==== a3sp/ee120000.sd: start
    PM: ==== a3sp/ee120000.sd: stop
    PM: ==== a3sp/ee120000.sd: start

But here no probe deferral is involved.
Just Runtime PM kicking in, I guess.

Yep, and that's okay, right?

Quoted 20 lines
Quoted 20 lines
drivers/mmc/host/renesas_sdhi_core.c +0 -0
        ret = renesas_sdhi_clk_enable(host);
        if (ret)
                goto efree;
drivers/mmc/host/tmio_mmc_core.c +0 -1
index ba301fb7656b..d7fde57c78c1 100644
@@ -39,7 +39,6 @@
 #include <linux/module.h>
 #include <linux/pagemap.h>
 #include <linux/platform_device.h>
-#include <linux/pm_domain.h>
 #include <linux/pm_qos.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
@@ -1192,7 +1191,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
        /* See if we also get DMA */
        tmio_mmc_request_dma(_host, pdata);
 
Quoted 4 lines

drivers/mmc/host/tmio_mmc_core.c int tmio_mmc_host_probe(struct tmio_mmc_host *_host) · line 1195

Quoted 1 line
drivers/mmc/host/tmio_mmc_core.c +0 -1
-       dev_pm_domain_start(&pdev->dev);

Before, the issue on probe deferral didn't happen, as the device was only started after the regulator was found.

I am not sure there is an issue or did I miss something?

Quoted 8 lines

drivers/mmc/host/tmio_mmc_core.c int tmio_mmc_host_probe(struct tmio_mmc_host *_host) · line 1196

Quoted 4 lines
drivers/mmc/host/tmio_mmc_core.c +0 -0
        pm_runtime_get_noresume(&pdev->dev);
        pm_runtime_set_active(&pdev->dev);
        pm_runtime_set_autosuspend_delay(&pdev->dev, 50);

Gr{oetje,eeting}s,

Geert

Thanks a lot for testing and sharing results! Very much appreciated!

Kind regards
Uffe

#5 lore raw

Hi Ulf,

Quoted 63 lines · Ulf Hansson
Quoted 57 lines · Geert Uytterhoeven
Quoted 32 lines · Ulf Hansson

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

---
 drivers/mmc/host/renesas_sdhi_core.c | 3 +++
 drivers/mmc/host/tmio_mmc_core.c     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +1 -0
index ff72b381a6b3..dcba9ad35dd1 100644
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mfd/tmio.h>

drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 910

Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +2 -0
@@ -905,6 +906,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
        /* All SDHI have SDIO status bits which must be 1 */
        mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
 
+       dev_pm_domain_start(&pdev->dev);
+

I have debug prints at the top of genpd_stop_dev():

    pr_info("==== %s/%s: stop\n", genpd->name, dev_name(dev));

and genpd_start_dev():

    pr_info("==== %s/%s: start\n", genpd->name, dev_name(dev));

On Koelsch (R-Car M2-W), the three SDHI devices are started twice:

    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
Quoted 4 lines

The first time, the probe is deferred, because the regulator needed in tmio_mmc_init_ocr() hasn't been instantiated yet. The SDHI device is detached from the PM domain, but not stopped. Interestingly, I see no clock imbalances afterwards.

Quoted 4 lines

That's because genpd's->detach_dev() callback is invoked at the "deferred probe" case. In your case this ends up calling pm_clk_destroy(). Thus the clock gets disabled and unprepared correctly.

Indeed, I had just arrived at the same conclusion.
While genpd doesn't have reference counting on start/stop, pm_clk does have pce_status to track state, so when needed, __pm_clk_remove() disables the clock before its destruction.

Quoted 11 lines
Quoted 11 lines

On R-Car Gen3, R-Mobile A1, and RZ/A systems, they are started once, as expected.

On R-Mobile APE6 and SH-Mobile AG5, one device is stopped and started again:

    PM: ==== a3sp/ee100000.sd: start
    PM: ==== a3sp/ee120000.sd: start
    PM: ==== a3sp/ee120000.sd: stop
    PM: ==== a3sp/ee120000.sd: start
Quoted 4 lines
Quoted 2 lines

But here no probe deferral is involved.
Just Runtime PM kicking in, I guess.

Yep, and that's okay, right?

Correct.

Quoted 10 lines
Quoted 8 lines

drivers/mmc/host/renesas_sdhi_core.c int tmio_mmc_host_probe(struct tmio_mmc_host *_host) · line 1195

Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +0 -1
@@ -1192,7 +1191,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
        /* See if we also get DMA */
        tmio_mmc_request_dma(_host, pdata);
 
-       dev_pm_domain_start(&pdev->dev);

Before, the issue on probe deferral didn't happen, as the device was only started after the regulator was found.

I am not sure there is an issue or did I miss something?

No, it's just a bit strange to see an imbalance in start/stop.

Note that this does mean that all PM domain providers that do not rely on pm_clk, but have their own start/stop methods, need to be aware of this quirk, and should take care of reference counting themselves. Fortunately there seems to be only one:
drivers/soc/ti/ti_sci_pm_domains.c.
Unfortunately it doesn't do reference counting, so if that PM domain driver is ever used with a driver that calls dev_pm_domain_start(), mysterious things may happen...

Quoted 1 line

Thanks a lot for testing and sharing results! Very much appreciated!

So I guess I can provide my

for this one, too, finally.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#6 lore raw
Quoted 108 lines · Geert Uytterhoeven

Hi Ulf,

Quoted 63 lines · Ulf Hansson
Quoted 57 lines · Geert Uytterhoeven
Quoted 32 lines · Ulf Hansson

If the tmio device is attached to a genpd (PM domain), that genpd may have ->start|stop() callback assigned to it. To make sure the device is accessible during ->probe(), genpd's ->start() callback must be invoked, which is currently managed by tmio_mmc_host_probe(). However, it's likely that may be too late for some cases, as registers may be read and written way before that point.

To fix the behaviour, let's move the call to dev_pm_domain_start() from tmio_mmc_host_probe() into those clients that needs it. From discussions at linux-mmc mailing list, it turned out that it should be sufficient to do this for the SDHI renesas variants, hence the call is move to renesas_sdhi_probe().

---
 drivers/mmc/host/renesas_sdhi_core.c | 3 +++
 drivers/mmc/host/tmio_mmc_core.c     | 2 --
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/renesas_sdhi_core.c +1 -0
index ff72b381a6b3..dcba9ad35dd1 100644
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/pm_domain.h>
 #include <linux/mmc/host.h>
 #include <linux/mmc/slot-gpio.h>
 #include <linux/mfd/tmio.h>

drivers/mmc/host/renesas_sdhi_core.c int renesas_sdhi_probe(struct platform_device *pdev, · line 910

Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +2 -0
@@ -905,6 +906,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
        /* All SDHI have SDIO status bits which must be 1 */
        mmc_data->flags |= TMIO_MMC_SDIO_STATUS_SETBITS;
 
+       dev_pm_domain_start(&pdev->dev);
+

I have debug prints at the top of genpd_stop_dev():

    pr_info("==== %s/%s: stop\n", genpd->name, dev_name(dev));

and genpd_start_dev():

    pr_info("==== %s/%s: start\n", genpd->name, dev_name(dev));

On Koelsch (R-Car M2-W), the three SDHI devices are started twice:

    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
    PM: ==== always-on/ee100000.sd: start
    PM: ==== always-on/ee140000.sd: start
    PM: ==== always-on/ee160000.sd: start
Quoted 4 lines

The first time, the probe is deferred, because the regulator needed in tmio_mmc_init_ocr() hasn't been instantiated yet. The SDHI device is detached from the PM domain, but not stopped. Interestingly, I see no clock imbalances afterwards.

Quoted 4 lines

That's because genpd's->detach_dev() callback is invoked at the "deferred probe" case. In your case this ends up calling pm_clk_destroy(). Thus the clock gets disabled and unprepared correctly.

Indeed, I had just arrived at the same conclusion.
While genpd doesn't have reference counting on start/stop, pm_clk does have pce_status to track state, so when needed, __pm_clk_remove() disables the clock before its destruction.

Quoted 11 lines
Quoted 11 lines

On R-Car Gen3, R-Mobile A1, and RZ/A systems, they are started once, as expected.

On R-Mobile APE6 and SH-Mobile AG5, one device is stopped and started again:

    PM: ==== a3sp/ee100000.sd: start
    PM: ==== a3sp/ee120000.sd: start
    PM: ==== a3sp/ee120000.sd: stop
    PM: ==== a3sp/ee120000.sd: start
Quoted 4 lines
Quoted 2 lines

But here no probe deferral is involved.
Just Runtime PM kicking in, I guess.

Yep, and that's okay, right?

Correct.

Quoted 10 lines
Quoted 8 lines

drivers/mmc/host/renesas_sdhi_core.c int tmio_mmc_host_probe(struct tmio_mmc_host *_host) · line 1195

Quoted 5 lines
drivers/mmc/host/renesas_sdhi_core.c +0 -1
@@ -1192,7 +1191,6 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
        /* See if we also get DMA */
        tmio_mmc_request_dma(_host, pdata);
 
-       dev_pm_domain_start(&pdev->dev);

Before, the issue on probe deferral didn't happen, as the device was only started after the regulator was found.

I am not sure there is an issue or did I miss something?

No, it's just a bit strange to see an imbalance in start/stop.

Quoted 8 lines

Note that this does mean that all PM domain providers that do not rely on pm_clk, but have their own start/stop methods, need to be aware of this quirk, and should take care of reference counting themselves. Fortunately there seems to be only one:
drivers/soc/ti/ti_sci_pm_domains.c.
Unfortunately it doesn't do reference counting, so if that PM domain driver is ever used with a driver that calls dev_pm_domain_start(), mysterious things may happen...

Good point. Perhaps we should document this somewhere.

Quoted 6 lines
Quoted 2 lines

Thanks a lot for testing and sharing results! Very much appreciated!

So I guess I can provide my

for this one, too, finally.

Great, thanks! I have added your tag for the other renesas sdhi patch as well.

Kind regards
Uffe

maintainer
#7 lore raw
Quoted 11 lines
Quoted 9 lines

Note that this does mean that all PM domain providers that do not rely on pm_clk, but have their own start/stop methods, need to be aware of this quirk, and should take care of reference counting themselves. Fortunately there seems to be only one:
drivers/soc/ti/ti_sci_pm_domains.c.
Unfortunately it doesn't do reference counting, so if that PM domain driver is ever used with a driver that calls dev_pm_domain_start(), mysterious things may happen...

Good point. Perhaps we should document this somewhere.

I haven't understood all of the details, but Geert's description sounds like we definately should document this. Anyone up for it? Otherwise I'll dig more into it...