Message ID | 20211110191610.5664-21-wsa+renesas@sang-engineering.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | clk/mmc: renesas_sdhi: refactor SDnH to be a separate clock | expand |
On Wed, 10 Nov 2021 at 20:16, Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > > If there is a SDnH clock provided in DT, let's use it instead of relying > on the fallback. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Kind regards Uffe > --- > > Changes since RFC v1: > * added tag from Geert > * use dev_err_probe() > > drivers/mmc/host/renesas_sdhi_core.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c > index 230182de5e88..db053fba5330 100644 > --- a/drivers/mmc/host/renesas_sdhi_core.c > +++ b/drivers/mmc/host/renesas_sdhi_core.c > @@ -919,6 +919,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, > if (IS_ERR(priv->clk)) > return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), "cannot get clock"); > > + priv->clkh = devm_clk_get_optional(&pdev->dev, "clkh"); > + if (IS_ERR(priv->clkh)) > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkh), "cannot get clkh"); > + > /* > * Some controllers provide a 2nd clock just to run the internal card > * detection logic. Unfortunately, the existing driver architecture does > @@ -957,7 +961,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, > dma_priv->dma_buswidth = of_data->dma_buswidth; > host->bus_shift = of_data->bus_shift; > /* Fallback for old DTs */ > - if (of_data->sdhi_flags & SDHI_FLAG_NEED_CLKH_FALLBACK) > + if (!priv->clkh && of_data->sdhi_flags & SDHI_FLAG_NEED_CLKH_FALLBACK) > priv->clkh = clk_get_parent(clk_get_parent(priv->clk)); > > } > -- > 2.30.2 >
CC clk On Wed, Nov 10, 2021 at 8:16 PM Wolfram Sang <wsa+renesas@sang-engineering.com> wrote: > If there is a SDnH clock provided in DT, let's use it instead of relying > on the fallback. > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> i.e. will queue in renesas-clk-for-v5.17. > --- a/drivers/mmc/host/renesas_sdhi_core.c > +++ b/drivers/mmc/host/renesas_sdhi_core.c > @@ -919,6 +919,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, > if (IS_ERR(priv->clk)) > return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), "cannot get clock"); > > + priv->clkh = devm_clk_get_optional(&pdev->dev, "clkh"); > + if (IS_ERR(priv->clkh)) > + return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkh), "cannot get clkh"); > + > /* > * Some controllers provide a 2nd clock just to run the internal card > * detection logic. Unfortunately, the existing driver architecture does > @@ -957,7 +961,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, > dma_priv->dma_buswidth = of_data->dma_buswidth; > host->bus_shift = of_data->bus_shift; > /* Fallback for old DTs */ > - if (of_data->sdhi_flags & SDHI_FLAG_NEED_CLKH_FALLBACK) > + if (!priv->clkh && of_data->sdhi_flags & SDHI_FLAG_NEED_CLKH_FALLBACK) > priv->clkh = clk_get_parent(clk_get_parent(priv->clk)); > > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org 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
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 230182de5e88..db053fba5330 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -919,6 +919,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->clk)) return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), "cannot get clock"); + priv->clkh = devm_clk_get_optional(&pdev->dev, "clkh"); + if (IS_ERR(priv->clkh)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkh), "cannot get clkh"); + /* * Some controllers provide a 2nd clock just to run the internal card * detection logic. Unfortunately, the existing driver architecture does @@ -957,7 +961,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, dma_priv->dma_buswidth = of_data->dma_buswidth; host->bus_shift = of_data->bus_shift; /* Fallback for old DTs */ - if (of_data->sdhi_flags & SDHI_FLAG_NEED_CLKH_FALLBACK) + if (!priv->clkh && of_data->sdhi_flags & SDHI_FLAG_NEED_CLKH_FALLBACK) priv->clkh = clk_get_parent(clk_get_parent(priv->clk)); }