Patch "mfd: stm32-timers: Avoid clearing auto reload register" 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

    mfd: stm32-timers: Avoid clearing auto reload register

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:
     mfd-stm32-timers-avoid-clearing-auto-reload-register.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 921cd0eb31254d23e1421e6066895b8822002c17
Author: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx>
Date:   Wed Mar 3 18:51:35 2021 +0100

    mfd: stm32-timers: Avoid clearing auto reload register
    
    [ Upstream commit 4917e498c6894ba077867aff78f82cffd5ffbb5c ]
    
    The ARR register is cleared unconditionally upon probing, after the maximum
    value has been read. This initial condition is rather not intuitive, when
    considering the counter child driver. It rather expects the maximum value
    by default:
    - The counter interface shows a zero value by default for 'ceiling'
      attribute.
    - Enabling the counter without any prior configuration makes it doesn't
      count.
    
    The reset value of ARR register is the maximum. So Choice here
    is to backup it, and restore it then, instead of clearing its value.
    It also fixes the initial condition seen by the counter driver.
    
    Fixes: d0f949e220fd ("mfd: Add STM32 Timers driver")
    Signed-off-by: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx>
    Acked-by: William Breathitt Gray <vilhelm.gray@xxxxxxxxx>
    Signed-off-by: Lee Jones <lee.jones@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mfd/stm32-timers.c b/drivers/mfd/stm32-timers.c
index add603359124..44ed2fce0319 100644
--- a/drivers/mfd/stm32-timers.c
+++ b/drivers/mfd/stm32-timers.c
@@ -158,13 +158,18 @@ static const struct regmap_config stm32_timers_regmap_cfg = {
 
 static void stm32_timers_get_arr_size(struct stm32_timers *ddata)
 {
+	u32 arr;
+
+	/* Backup ARR to restore it after getting the maximum value */
+	regmap_read(ddata->regmap, TIM_ARR, &arr);
+
 	/*
 	 * Only the available bits will be written so when readback
 	 * we get the maximum value of auto reload register
 	 */
 	regmap_write(ddata->regmap, TIM_ARR, ~0L);
 	regmap_read(ddata->regmap, TIM_ARR, &ddata->max_arr);
-	regmap_write(ddata->regmap, TIM_ARR, 0x0);
+	regmap_write(ddata->regmap, TIM_ARR, arr);
 }
 
 static int stm32_timers_dma_probe(struct device *dev,



[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