Patch "clk: axi-clkgen: Correctly handle nocount bit in recalc_rate()" has been added to the 4.15-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
clk: axi-clkgen: Correctly handle nocount bit in recalc_rate()
to the 4.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch
and it can be found in the queue-4.15 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Thu Mar 22 14:03:40 CET 2018
From: Lars-Peter Clausen <[email protected]>
Date: Tue, 5 Sep 2017 11:32:40 +0200
Subject: clk: axi-clkgen: Correctly handle nocount bit in recalc_rate()
From: Lars-Peter Clausen <[email protected]>
[ Upstream commit 063578dc5f407f67d149133818efabe457daafda ]
If the nocount bit is set the divider is bypassed and the settings for the divider count should be ignored and a divider value of 1 should be assumed. Handle this correctly in the driver recalc_rate() callback.
While the driver sets up the part so that the read back dividers values yield the correct result the power-on reset settings of the part might not reflect this and hence calling e.g. clk_get_rate() without prior calls to clk_set_rate() will yield the wrong result.
--- drivers/clk/clk-axi-clkgen.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-)
drivers/clk/clk-axi-clkgen.c +24 -5
@@ -40,6 +40,10 @@#define MMCM_REG_FILTER1 0x4e#define MMCM_REG_FILTER2 0x4f +#define MMCM_CLKOUT_NOCOUNT BIT(6) + +#define MMCM_CLK_DIV_NOCOUNT BIT(12) +struct axi_clkgen {void __iomem *base;struct clk_hw clk_hw;
@@ -315,12 +319,27 @@ static unsigned long axi_clkgen_recalc_runsigned int reg;unsigned long long tmp; -axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLKOUT0_1 , ®); - dout = (reg &0x3f ) + ((reg >>6 ) &0x3f ); +axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLKOUT0_2 , ®); +if (reg &MMCM_CLKOUT_NOCOUNT ) { + dout =1 ; + }else { +axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLKOUT0_1 , ®); + dout = (reg &0x3f ) + ((reg >>6 ) &0x3f ); + } +axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLK_DIV , ®); - d = (reg &0x3f ) + ((reg >>6 ) &0x3f ); -axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLK_FB1 , ®); - m = (reg &0x3f ) + ((reg >>6 ) &0x3f ); +if (reg &MMCM_CLK_DIV_NOCOUNT ) + d =1 ; +else + d = (reg &0x3f ) + ((reg >>6 ) &0x3f ); + +axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLK_FB2 , ®); +if (reg &MMCM_CLKOUT_NOCOUNT ) { + m =1 ; + }else { +axi_clkgen_mmcm_read (axi_clkgen,MMCM_REG_CLK_FB1 , ®); + m = (reg &0x3f ) + ((reg >>6 ) &0x3f ); + }if (d ==0 || dout ==0 )return 0 ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.15/clk-axi-clkgen-correctly-handle-nocount-bit-in-recalc_rate.patch