[v1,1/2] clk: tegra: divider: Fix missing check for enable-bit on rate's recalculation
diff mbox series

Message ID 20190715173527.5719-1-digetx@gmail.com
State New
Headers show
Series
  • [v1,1/2] clk: tegra: divider: Fix missing check for enable-bit on rate's recalculation
Related show

Commit Message

Dmitry Osipenko July 15, 2019, 5:35 p.m. UTC
Unset "enable" bit means that divider is in bypass mode, hence it doesn't
have any effect in that case.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/clk/tegra/clk-divider.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Stephen Boyd July 17, 2019, 8:08 p.m. UTC | #1
Quoting Dmitry Osipenko (2019-07-15 10:35:26)
> Unset "enable" bit means that divider is in bypass mode, hence it doesn't
> have any effect in that case.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>

Any Fixes tags for these patches?
Dmitry Osipenko July 17, 2019, 9:33 p.m. UTC | #2
17.07.2019 23:08, Stephen Boyd пишет:
> Quoting Dmitry Osipenko (2019-07-15 10:35:26)
>> Unset "enable" bit means that divider is in bypass mode, hence it doesn't
>> have any effect in that case.
>>
>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> 
> Any Fixes tags for these patches?

I'm not aware of any actual bugs that this change fixes. Probably better
to just s/Fix/Add/ in the commit's title?
Stephen Boyd July 22, 2019, 9:55 p.m. UTC | #3
Quoting Dmitry Osipenko (2019-07-17 14:33:36)
> 17.07.2019 23:08, Stephen Boyd пишет:
> > Quoting Dmitry Osipenko (2019-07-15 10:35:26)
> >> Unset "enable" bit means that divider is in bypass mode, hence it doesn't
> >> have any effect in that case.
> >>
> >> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> > 
> > Any Fixes tags for these patches?
> 
> I'm not aware of any actual bugs that this change fixes. Probably better
> to just s/Fix/Add/ in the commit's title?

Sounds fine to me.
Dmitry Osipenko July 23, 2019, 12:13 a.m. UTC | #4
23.07.2019 0:55, Stephen Boyd пишет:
> Quoting Dmitry Osipenko (2019-07-17 14:33:36)
>> 17.07.2019 23:08, Stephen Boyd пишет:
>>> Quoting Dmitry Osipenko (2019-07-15 10:35:26)
>>>> Unset "enable" bit means that divider is in bypass mode, hence it doesn't
>>>> have any effect in that case.
>>>>
>>>> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
>>>
>>> Any Fixes tags for these patches?
>>
>> I'm not aware of any actual bugs that this change fixes. Probably better
>> to just s/Fix/Add/ in the commit's title?
> 
> Sounds fine to me.
> 

Okay, I'll re-spin these patches.

Patch
diff mbox series

diff --git a/drivers/clk/tegra/clk-divider.c b/drivers/clk/tegra/clk-divider.c
index e76731fb7d69..f33c19045386 100644
--- a/drivers/clk/tegra/clk-divider.c
+++ b/drivers/clk/tegra/clk-divider.c
@@ -40,8 +40,13 @@  static unsigned long clk_frac_div_recalc_rate(struct clk_hw *hw,
 	int div, mul;
 	u64 rate = parent_rate;
 
-	reg = readl_relaxed(divider->reg) >> divider->shift;
-	div = reg & div_mask(divider);
+	reg = readl_relaxed(divider->reg);
+
+	if ((divider->flags & TEGRA_DIVIDER_UART) &&
+	    !(reg & PERIPH_CLK_UART_DIV_ENB))
+		return rate;
+
+	div = (reg >> divider->shift) & div_mask(divider);
 
 	mul = get_mul(divider);
 	div += mul;