]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mfd: stm32-timers: Avoid clearing auto reload register
authorFabrice Gasnier <fabrice.gasnier@foss.st.com>
Wed, 3 Mar 2021 17:51:35 +0000 (18:51 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:49:58 +0000 (10:49 +0200)
commit817f96200cb8b7874d4032a62a4bd3b6e043eee7
tree105711f1ffe30dc23b93287b75f4c7758071290b
parented2737c4c4e8d7409713f71b3b4298560bf6f55b
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@foss.st.com>
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mfd/stm32-timers.c