Patch "clk: bcm-2835: Remove rounding up the dividers" has been added to the 5.10-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: bcm-2835: Remove rounding up the dividers

to the 5.10-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-bcm-2835-remove-rounding-up-the-dividers.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 281b0bce10bf3ebdd2e1453cd070d63757b3ddb7
Author: Maxime Ripard <maxime@xxxxxxxxxx>
Date:   Wed Sep 22 14:54:16 2021 +0200

    clk: bcm-2835: Remove rounding up the dividers
    
    [ Upstream commit 8ca011ef4af48a7af7b15afd8a4a44039dd04cea ]
    
    The driver, once it found a divider, tries to round it up by increasing
    the least significant bit of the fractional part by one when the
    round_up argument is set and there's a remainder.
    
    However, since it increases the divider it will actually reduce the
    clock rate below what we were asking for, leading to issues with
    clk_set_min_rate() that will complain that our rounded clock rate is
    below the minimum of the rate.
    
    Since the dividers are fairly precise already, let's remove that part so
    that we can have clk_set_min_rate() working.
    
    This is effectively a revert of 9c95b32ca093 ("clk: bcm2835: add a round
    up ability to the clock divisor").
    
    Fixes: 9c95b32ca093 ("clk: bcm2835: add a round up ability to the clock divisor")
    Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
    Acked-by: Stephen Boyd <sboyd@xxxxxxxxxx>
    Reviewed-by: Nicolas Saenz Julienne <nsaenz@xxxxxxxxxx>
    Tested-by: Nicolas Saenz Julienne <nsaenz@xxxxxxxxxx> # boot and basic functionality
    Tested-by: Michael Stapelberg <michael@xxxxxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210922125419.4125779-3-maxime@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index a919ee9c3fcb8..178886823b90c 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -933,8 +933,7 @@ static int bcm2835_clock_is_on(struct clk_hw *hw)
 
 static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
 				    unsigned long rate,
-				    unsigned long parent_rate,
-				    bool round_up)
+				    unsigned long parent_rate)
 {
 	struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
 	const struct bcm2835_clock_data *data = clock->data;
@@ -946,10 +945,6 @@ static u32 bcm2835_clock_choose_div(struct clk_hw *hw,
 
 	rem = do_div(temp, rate);
 	div = temp;
-
-	/* Round up and mask off the unused bits */
-	if (round_up && ((div & unused_frac_mask) != 0 || rem != 0))
-		div += unused_frac_mask + 1;
 	div &= ~unused_frac_mask;
 
 	/* different clamping limits apply for a mash clock */
@@ -1080,7 +1075,7 @@ static int bcm2835_clock_set_rate(struct clk_hw *hw,
 	struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
 	struct bcm2835_cprman *cprman = clock->cprman;
 	const struct bcm2835_clock_data *data = clock->data;
-	u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate, false);
+	u32 div = bcm2835_clock_choose_div(hw, rate, parent_rate);
 	u32 ctl;
 
 	spin_lock(&cprman->regs_lock);
@@ -1131,7 +1126,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw,
 
 	if (!(BIT(parent_idx) & data->set_rate_parent)) {
 		*prate = clk_hw_get_rate(parent);
-		*div = bcm2835_clock_choose_div(hw, rate, *prate, true);
+		*div = bcm2835_clock_choose_div(hw, rate, *prate);
 
 		*avgrate = bcm2835_clock_rate_from_divisor(clock, *prate, *div);
 



[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