]> git.baikalelectronics.ru Git - kernel.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)
committerLee Jones <lee.jones@linaro.org>
Wed, 14 Apr 2021 15:06:26 +0000 (16:06 +0100)
commit7fc0ffd738f528cb689c6eb5c4dca6accad0537b
treeb40567d1beb9ffc9bdbc800e15f52e0de9c57bcb
parent5cd5ce37b2e8d025fde06944c8a74e21ac3e3792
mfd: stm32-timers: Avoid clearing auto reload register

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: 9af1023c6efc ("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>
drivers/mfd/stm32-timers.c