Patch "clk: imx: fracn-gppll: fix pll power up" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    clk: imx: fracn-gppll: fix pll power up

to the 6.1-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-imx-fracn-gppll-fix-pll-power-up.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 030bdee3e0de6d6be772f12b375dd55ca9a19b53
Author: Peng Fan <peng.fan@xxxxxxx>
Date:   Sun Oct 27 20:00:09 2024 +0800

    clk: imx: fracn-gppll: fix pll power up
    
    [ Upstream commit ff4279618f0aec350b0fb41b2b35841324fbd96e ]
    
    To i.MX93 which features dual Cortex-A55 cores and DSU, when using
    writel_relaxed to write value to PLL registers, the value might be
    buffered. To make sure the value has been written into the hardware,
    using readl to read back the register could achieve the goal.
    
    current PLL power up flow can be simplified as below:
      1. writel_relaxed to set the PLL POWERUP bit;
      2. readl_poll_timeout to check the PLL lock bit:
         a). timeout = ktime_add_us(ktime_get(), timeout_us);
         b). readl the pll the lock reg;
         c). check if the pll lock bit ready
         d). check if timeout
    
    But in some corner cases, both the write in step 1 and read in
    step 2 will be blocked by other bus transaction in the SoC for a
    long time, saying the value into real hardware is just before step b).
    That means the timeout counting has begins for quite sometime since
    step a), but value still not written into real hardware until bus
    released just at a point before step b).
    
    Then there maybe chances that the pll lock bit is not ready
    when readl done but the timeout happens. readl_poll_timeout will
    err return due to timeout. To avoid such unexpected failure,
    read back the reg to make sure the write has been done in HW
    reg.
    
    So use readl after writel_relaxed to fix the issue.
    
    Since we are here, to avoid udelay to run before writel_relaxed, use
    readl before udelay.
    
    Fixes: 1b26cb8a77a4 ("clk: imx: support fracn gppll")
    Co-developed-by: Jacky Bai <ping.bai@xxxxxxx>
    Signed-off-by: Jacky Bai <ping.bai@xxxxxxx>
    Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
    Reviewed-by: Abel Vesa <abel.vesa@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20241027-imx-clk-v1-v3-3-89152574d1d7@xxxxxxx
    Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/imx/clk-fracn-gppll.c b/drivers/clk/imx/clk-fracn-gppll.c
index 281fc62ecd3d5..5f2296bb67a65 100644
--- a/drivers/clk/imx/clk-fracn-gppll.c
+++ b/drivers/clk/imx/clk-fracn-gppll.c
@@ -250,9 +250,11 @@ static int clk_fracn_gppll_set_rate(struct clk_hw *hw, unsigned long drate,
 	pll_div = FIELD_PREP(PLL_RDIV_MASK, rate->rdiv) | rate->odiv |
 		FIELD_PREP(PLL_MFI_MASK, rate->mfi);
 	writel_relaxed(pll_div, pll->base + PLL_DIV);
+	readl(pll->base + PLL_DIV);
 	if (pll->flags & CLK_FRACN_GPPLL_FRACN) {
 		writel_relaxed(rate->mfd, pll->base + PLL_DENOMINATOR);
 		writel_relaxed(FIELD_PREP(PLL_MFN_MASK, rate->mfn), pll->base + PLL_NUMERATOR);
+		readl(pll->base + PLL_NUMERATOR);
 	}
 
 	/* Wait for 5us according to fracn mode pll doc */
@@ -261,6 +263,7 @@ static int clk_fracn_gppll_set_rate(struct clk_hw *hw, unsigned long drate,
 	/* Enable Powerup */
 	tmp |= POWERUP_MASK;
 	writel_relaxed(tmp, pll->base + PLL_CTRL);
+	readl(pll->base + PLL_CTRL);
 
 	/* Wait Lock */
 	ret = clk_fracn_gppll_wait_lock(pll);
@@ -298,6 +301,7 @@ static int clk_fracn_gppll_prepare(struct clk_hw *hw)
 
 	val |= POWERUP_MASK;
 	writel_relaxed(val, pll->base + PLL_CTRL);
+	readl(pll->base + PLL_CTRL);
 
 	ret = clk_fracn_gppll_wait_lock(pll);
 	if (ret)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux