* [RESEND PATCH] amba: Allow pclk to be controlled by power domain @ 2019-01-31 2:01 Bjorn Andersson 2019-01-31 10:32 ` Sai Prakash Ranjan 2019-02-05 14:58 ` Ulf Hansson 0 siblings, 2 replies; 5+ messages in thread From: Bjorn Andersson @ 2019-01-31 2:01 UTC (permalink / raw) To: Russell King, Greg Kroah-Hartman, Ulf Hansson Cc: linux-kernel, linux-arm-msm, Sai Prakash Ranjan 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; + else + return PTR_ERR(pcdev->pclk); + } ret = clk_prepare_enable(pcdev->pclk); if (ret) -- 2.18.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH] amba: Allow pclk to be controlled by power domain 2019-01-31 2:01 [RESEND PATCH] amba: Allow pclk to be controlled by power domain Bjorn Andersson @ 2019-01-31 10:32 ` Sai Prakash Ranjan 2019-02-05 14:58 ` Ulf Hansson 1 sibling, 0 replies; 5+ messages in thread From: Sai Prakash Ranjan @ 2019-01-31 10:32 UTC (permalink / raw) To: Bjorn Andersson, Russell King, Greg Kroah-Hartman, Ulf Hansson Cc: linux-kernel, linux-arm-msm On 1/31/2019 7:31 AM, Bjorn Andersson 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; > + else > + return PTR_ERR(pcdev->pclk); > + } > > ret = clk_prepare_enable(pcdev->pclk); > if (ret) > Thanks. Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org> -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH] amba: Allow pclk to be controlled by power domain 2019-01-31 2:01 [RESEND PATCH] amba: Allow pclk to be controlled by power domain Bjorn Andersson 2019-01-31 10:32 ` Sai Prakash Ranjan @ 2019-02-05 14:58 ` Ulf Hansson 2019-02-19 6:43 ` Bjorn Andersson 1 sibling, 1 reply; 5+ messages in thread From: Ulf Hansson @ 2019-02-05 14:58 UTC (permalink / raw) To: Bjorn Andersson Cc: Russell King, Greg Kroah-Hartman, Linux Kernel Mailing List, linux-arm-msm, Sai Prakash Ranjan 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 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH] amba: Allow pclk to be controlled by power domain 2019-02-05 14:58 ` Ulf Hansson @ 2019-02-19 6:43 ` Bjorn Andersson 2019-02-21 7:55 ` Ulf Hansson 0 siblings, 1 reply; 5+ messages in thread From: Bjorn Andersson @ 2019-02-19 6:43 UTC (permalink / raw) To: Ulf Hansson Cc: Russell King, Greg Kroah-Hartman, Linux Kernel Mailing List, linux-arm-msm, Sai Prakash Ranjan On Tue 05 Feb 06:58 PST 2019, Ulf Hansson wrote: > 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. Can you please elaborate on what you want me to match on? As an example you can find the patch depending on this here: https://lore.kernel.org/lkml/60ebf1617f0285c89e921bf3839cba6906d493c9.1548419933.git.saiprakash.ranjan@codeaurora.org/ > 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. > The purpose of this check was to extend the current requirement of a clock to require either a clock or a power domain, rather than just making the clock optional - which would be the result if this part is omitted. Regards, Bjorn > > + else > > + return PTR_ERR(pcdev->pclk); > > + } > > > > ret = clk_prepare_enable(pcdev->pclk); > > if (ret) > > -- > > 2.18.0 > > > > Kind regards > Uffe ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RESEND PATCH] amba: Allow pclk to be controlled by power domain 2019-02-19 6:43 ` Bjorn Andersson @ 2019-02-21 7:55 ` Ulf Hansson 0 siblings, 0 replies; 5+ messages in thread From: Ulf Hansson @ 2019-02-21 7:55 UTC (permalink / raw) To: Bjorn Andersson Cc: Russell King, Greg Kroah-Hartman, Linux Kernel Mailing List, linux-arm-msm, Sai Prakash Ranjan On Tue, 19 Feb 2019 at 07:43, Bjorn Andersson <bjorn.andersson@linaro.org> wrote: > > On Tue 05 Feb 06:58 PST 2019, Ulf Hansson wrote: > > > 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. > > Can you please elaborate on what you want me to match on? > > As an example you can find the patch depending on this here: > https://lore.kernel.org/lkml/60ebf1617f0285c89e921bf3839cba6906d493c9.1548419933.git.saiprakash.ranjan@codeaurora.org/ I would extend the compatible with a "soc-id" prefix and match on that. If that doesn't work, I guess we need check for the soc family/id, thus use soc_device_match(). > > > 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. > > > > The purpose of this check was to extend the current requirement of a > clock to require either a clock or a power domain, rather than just > making the clock optional - which would be the result if this part is > omitted. Well, that would break the current requirement for everybody else, which is that the clock is required and the PM domain is optional. [...] Kind regards Uffe ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-21 7:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-01-31 2:01 [RESEND PATCH] amba: Allow pclk to be controlled by power domain Bjorn Andersson 2019-01-31 10:32 ` Sai Prakash Ranjan 2019-02-05 14:58 ` Ulf Hansson 2019-02-19 6:43 ` Bjorn Andersson 2019-02-21 7:55 ` Ulf Hansson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).