public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] clk: qcom: clk-alpha-pll: Fix pll post div mask when width is not set
@ 2024-09-25 18:33 Barnabás Czémán
  2024-09-25 21:28 ` Dmitry Baryshkov
  0 siblings, 1 reply; 4+ messages in thread
From: Barnabás Czémán @ 2024-09-25 18:33 UTC (permalink / raw)
  To: Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Satya Priya Kakitapalli, Konrad Dybcio, Abhishek Sahu
  Cc: linux-arm-msm, linux-clk, linux-kernel, Stephen Boyd,
	Barnabás Czémán

Many qcom clock drivers do not have .width set. In that case value of
(p)->width - 1 will be negative which breaks clock tree. Fix this
by checking if width is zero, and pass 3 to GENMASK if that's the case.

Fixes: 1c3541145cbf ("clk: qcom: support for 2 bit PLL post divider")
Fixes: 2c4553e6c485 ("clk: qcom: clk-alpha-pll: Fix the pll post div mask")
Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
---
Changes in v2:
- Pass 3 to GENMASK instead of 0.
- Add more Fixes tag for reference root cause.
- Link to v1: https://lore.kernel.org/r/20240925-fix-postdiv-mask-v1-1-f70ba55f415e@mainlining.org
---
 drivers/clk/qcom/clk-alpha-pll.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c
index f9105443d7dbb104e3cb091e59f43df25999f8b3..be9bee6ab65f6e08d5ae764d94a92e395e227fbc 100644
--- a/drivers/clk/qcom/clk-alpha-pll.c
+++ b/drivers/clk/qcom/clk-alpha-pll.c
@@ -40,7 +40,7 @@
 
 #define PLL_USER_CTL(p)		((p)->offset + (p)->regs[PLL_OFF_USER_CTL])
 # define PLL_POST_DIV_SHIFT	8
-# define PLL_POST_DIV_MASK(p)	GENMASK((p)->width - 1, 0)
+# define PLL_POST_DIV_MASK(p)	GENMASK((p)->width ? (p)->width - 1 : 3, 0)
 # define PLL_ALPHA_MSB		BIT(15)
 # define PLL_ALPHA_EN		BIT(24)
 # define PLL_ALPHA_MODE		BIT(25)

---
base-commit: 62f92d634458a1e308bb699986b9147a6d670457
change-id: 20240925-fix-postdiv-mask-ba47ecd23ea3

Best regards,
-- 
Barnabás Czémán <barnabas.czeman@mainlining.org>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] clk: qcom: clk-alpha-pll: Fix pll post div mask when width is not set
  2024-09-25 18:33 [PATCH v2] clk: qcom: clk-alpha-pll: Fix pll post div mask when width is not set Barnabás Czémán
@ 2024-09-25 21:28 ` Dmitry Baryshkov
  2024-09-28 17:05   ` barnabas.czeman
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitry Baryshkov @ 2024-09-25 21:28 UTC (permalink / raw)
  To: Barnabás Czémán
  Cc: Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Satya Priya Kakitapalli, Konrad Dybcio, Abhishek Sahu,
	linux-arm-msm, linux-clk, linux-kernel, Stephen Boyd

On Wed, Sep 25, 2024 at 08:33:20PM GMT, Barnabás Czémán wrote:
> Many qcom clock drivers do not have .width set. In that case value of
> (p)->width - 1 will be negative which breaks clock tree. Fix this
> by checking if width is zero, and pass 3 to GENMASK if that's the case.
> 
> Fixes: 1c3541145cbf ("clk: qcom: support for 2 bit PLL post divider")
> Fixes: 2c4553e6c485 ("clk: qcom: clk-alpha-pll: Fix the pll post div mask")

I think one Fixes tag should be enough.

Nevertheless,

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
> ---
> Changes in v2:
> - Pass 3 to GENMASK instead of 0.
> - Add more Fixes tag for reference root cause.
> - Link to v1: https://lore.kernel.org/r/20240925-fix-postdiv-mask-v1-1-f70ba55f415e@mainlining.org
> ---
>  drivers/clk/qcom/clk-alpha-pll.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] clk: qcom: clk-alpha-pll: Fix pll post div mask when width is not set
  2024-09-25 21:28 ` Dmitry Baryshkov
@ 2024-09-28 17:05   ` barnabas.czeman
  2024-10-06 17:18     ` Dmitry Baryshkov
  0 siblings, 1 reply; 4+ messages in thread
From: barnabas.czeman @ 2024-09-28 17:05 UTC (permalink / raw)
  To: Dmitry Baryshkov
  Cc: Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Satya Priya Kakitapalli, Konrad Dybcio, Abhishek Sahu,
	linux-arm-msm, linux-clk, linux-kernel, Stephen Boyd

On 2024-09-25 23:28, Dmitry Baryshkov wrote:
> On Wed, Sep 25, 2024 at 08:33:20PM GMT, Barnabás Czémán wrote:
>> Many qcom clock drivers do not have .width set. In that case value of
>> (p)->width - 1 will be negative which breaks clock tree. Fix this
>> by checking if width is zero, and pass 3 to GENMASK if that's the 
>> case.
>> 
>> Fixes: 1c3541145cbf ("clk: qcom: support for 2 bit PLL post divider")
>> Fixes: 2c4553e6c485 ("clk: qcom: clk-alpha-pll: Fix the pll post div 
>> mask")
> 
> I think one Fixes tag should be enough.
Should I send a v3 remove one of them or not needed?
> 
> Nevertheless,
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
>> Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
>> ---
>> Changes in v2:
>> - Pass 3 to GENMASK instead of 0.
>> - Add more Fixes tag for reference root cause.
>> - Link to v1: 
>> https://lore.kernel.org/r/20240925-fix-postdiv-mask-v1-1-f70ba55f415e@mainlining.org
>> ---
>>  drivers/clk/qcom/clk-alpha-pll.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] clk: qcom: clk-alpha-pll: Fix pll post div mask when width is not set
  2024-09-28 17:05   ` barnabas.czeman
@ 2024-10-06 17:18     ` Dmitry Baryshkov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2024-10-06 17:18 UTC (permalink / raw)
  To: barnabas.czeman
  Cc: Bjorn Andersson, Michael Turquette, Stephen Boyd,
	Satya Priya Kakitapalli, Konrad Dybcio, Abhishek Sahu,
	linux-arm-msm, linux-clk, linux-kernel, Stephen Boyd

On Sat, Sep 28, 2024 at 07:05:39PM GMT, barnabas.czeman@mainlining.org wrote:
> On 2024-09-25 23:28, Dmitry Baryshkov wrote:
> > On Wed, Sep 25, 2024 at 08:33:20PM GMT, Barnabás Czémán wrote:
> > > Many qcom clock drivers do not have .width set. In that case value of
> > > (p)->width - 1 will be negative which breaks clock tree. Fix this
> > > by checking if width is zero, and pass 3 to GENMASK if that's the
> > > case.
> > > 
> > > Fixes: 1c3541145cbf ("clk: qcom: support for 2 bit PLL post divider")
> > > Fixes: 2c4553e6c485 ("clk: qcom: clk-alpha-pll: Fix the pll post div
> > > mask")
> > 
> > I think one Fixes tag should be enough.
> Should I send a v3 remove one of them or not needed?

Judging by the lack of the response, please resend, dropping the extra
tag.

> > 
> > Nevertheless,
> > 
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> > 
> > > Signed-off-by: Barnabás Czémán <barnabas.czeman@mainlining.org>
> > > ---
> > > Changes in v2:
> > > - Pass 3 to GENMASK instead of 0.
> > > - Add more Fixes tag for reference root cause.
> > > - Link to v1: https://lore.kernel.org/r/20240925-fix-postdiv-mask-v1-1-f70ba55f415e@mainlining.org
> > > ---
> > >  drivers/clk/qcom/clk-alpha-pll.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-10-06 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25 18:33 [PATCH v2] clk: qcom: clk-alpha-pll: Fix pll post div mask when width is not set Barnabás Czémán
2024-09-25 21:28 ` Dmitry Baryshkov
2024-09-28 17:05   ` barnabas.czeman
2024-10-06 17:18     ` Dmitry Baryshkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox