lkml.org 
[lkml]   [2019]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RESEND PATCH] amba: Allow pclk to be controlled by power domain
On Thu, 31 Jan 2019 at 03:01, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On the Qualcomm SDM845 platform the apb_pclk is controlled as part of
> the QDSS power/clock domain. Handle this by allowing amba to operate
> without direct apb_pclk control, when a powerdomain is attached and no
> clock is described.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>
> Resending this separate from the series it was originally part of.
>
> drivers/amba/bus.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index 41b706403ef7..3e13050c6d59 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -219,8 +219,13 @@ static int amba_get_enable_pclk(struct amba_device *pcdev)
> int ret;
>
> pcdev->pclk = clk_get(&pcdev->dev, "apb_pclk");
> - if (IS_ERR(pcdev->pclk))
> - return PTR_ERR(pcdev->pclk);
> + if (IS_ERR(pcdev->pclk)) {
> + /* Continue with no clock specified, but pm_domain attached */
> + if (PTR_ERR(pcdev->pclk) == -ENOENT && pcdev->dev.pm_domain)
> + pcdev->pclk = NULL;

This looks fragile to me.

I would prefer to make a do match with DT, to check whether the clock
is needed or not. Moreover, there should be no reason to check for the
->dev.pm_domain, because, if there was an error while doing the
attach, that should already have been reported/propagated.

> + else
> + return PTR_ERR(pcdev->pclk);
> + }
>
> ret = clk_prepare_enable(pcdev->pclk);
> if (ret)
> --
> 2.18.0
>

Kind regards
Uffe

\
 
 \ /
  Last update: 2019-02-05 15:59    [W:0.072 / U:50.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site