mbox series

[v3,0/4] sdhci-xenon ACPI support

Message ID 20201202185118.29076-1-mw@semihalf.com
Headers show
Series sdhci-xenon ACPI support | expand

Message

Marcin Wojtas Dec. 2, 2020, 6:51 p.m. UTC
Hi,

The third version of the sdhci-xenon ACPI support
addresses a comment regarding clk_disable_unprepare
dependency on DT.

The MacchiatoBin firmware for testing can be obtained from:
https://drive.google.com/file/d/1Y8BhyaCrksQgT_GPfpqqiYHpQ41kP8Kp

Changelog:
v2->v3
  * Call clk_disable_unprepare unconditionally.
  * Add Adrian's Acked-by to all patches.

v1->v2
  * Split single commit to 4
  * Use device_match_data and dedicated ACPI ID's per controller
    variant


Marcin Wojtas (4):
  mmc: sdhci-xenon: use match data for controllers variants
  mmc: sdhci-xenon: switch to device_* API
  mmc: sdhci-xenon: use clk only with DT
  mmc: sdhci-xenon: introduce ACPI support

 drivers/mmc/host/sdhci-xenon.h     |  12 ++-
 drivers/mmc/host/sdhci-xenon-phy.c |  40 ++++----
 drivers/mmc/host/sdhci-xenon.c     | 101 +++++++++++++-------
 3 files changed, 97 insertions(+), 56 deletions(-)

Comments

Ulf Hansson Dec. 4, 2020, 1:51 p.m. UTC | #1
On Wed, 2 Dec 2020 at 19:51, Marcin Wojtas <mw@semihalf.com> wrote:
>

> As a preparation for supporting ACPI, modify the driver

> to use the clk framework only when booting with DT -

> otherwise rely on the configuration done by firmware.

> For that purpose introduce also a custom SDHCI get_max_clock

> callback.

>

> Signed-off-by: Marcin Wojtas <mw@semihalf.com>

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

> ---

>  drivers/mmc/host/sdhci-xenon.c | 61 ++++++++++++--------

>  1 file changed, 38 insertions(+), 23 deletions(-)

>

> diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c


[...]

> @@ -637,10 +650,12 @@ static int xenon_runtime_resume(struct device *dev)

>         struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);

>         int ret;

>

> -       ret = clk_prepare_enable(pltfm_host->clk);

> -       if (ret) {

> -               dev_err(dev, "can't enable mainck\n");

> -               return ret;

> +       if (dev->of_node) {


I didn't notice this in the earlier version, my apologies, but there
is no need for this check.

clk_prepare_enable() should cope fine with a NULL argument - and you
only reach this path, if the clock was successfully fetched during the
probe or that it was left to stay NULL for non-DT case.

> +               ret = clk_prepare_enable(pltfm_host->clk);

> +               if (ret) {

> +                       dev_err(dev, "can't enable mainck\n");

> +                       return ret;

> +               }

>         }

>

>         if (priv->restore_needed) {

> --

> 2.29.0

>


Kind regards
Uffe
Marcin Wojtas Dec. 4, 2020, 5:19 p.m. UTC | #2
pt., 4 gru 2020 o 14:51 Ulf Hansson <ulf.hansson@linaro.org> napisaƂ(a):
>

> On Wed, 2 Dec 2020 at 19:51, Marcin Wojtas <mw@semihalf.com> wrote:

> >

> > As a preparation for supporting ACPI, modify the driver

> > to use the clk framework only when booting with DT -

> > otherwise rely on the configuration done by firmware.

> > For that purpose introduce also a custom SDHCI get_max_clock

> > callback.

> >

> > Signed-off-by: Marcin Wojtas <mw@semihalf.com>

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

> > ---

> >  drivers/mmc/host/sdhci-xenon.c | 61 ++++++++++++--------

> >  1 file changed, 38 insertions(+), 23 deletions(-)

> >

> > diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c

>

> [...]

>

> > @@ -637,10 +650,12 @@ static int xenon_runtime_resume(struct device *dev)

> >         struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host);

> >         int ret;

> >

> > -       ret = clk_prepare_enable(pltfm_host->clk);

> > -       if (ret) {

> > -               dev_err(dev, "can't enable mainck\n");

> > -               return ret;

> > +       if (dev->of_node) {

>

> I didn't notice this in the earlier version, my apologies, but there

> is no need for this check.

>

> clk_prepare_enable() should cope fine with a NULL argument - and you

> only reach this path, if the clock was successfully fetched during the

> probe or that it was left to stay NULL for non-DT case.


You are right, thanks! I applied the change and resent v4.

Best regards,
Marcin

>

> > +               ret = clk_prepare_enable(pltfm_host->clk);

> > +               if (ret) {

> > +                       dev_err(dev, "can't enable mainck\n");

> > +                       return ret;

> > +               }

> >         }

> >

> >         if (priv->restore_needed) {

> > --

> > 2.29.0

> >

>

> Kind regards

> Uffe