aboutsummaryrefslogtreecommitdiff
path: root/drivers/counter
diff options
context:
space:
mode:
authorGravatar Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 2023-04-13 23:23:39 +0200
committerGravatar William Breathitt Gray <william.gray@linaro.org> 2023-05-09 19:17:17 -0400
commit5272145d5cccd7cb73a8ce4b0b90c1c6b37a6a66 (patch)
tree5410018281f01bfb91052ed9c16834e5b8926d94 /drivers/counter
parentcounter: 104-quad-8: Remove reference in Kconfig to 25-bit counter value (diff)
downloadlinux-5272145d5cccd7cb73a8ce4b0b90c1c6b37a6a66.tar.gz
linux-5272145d5cccd7cb73a8ce4b0b90c1c6b37a6a66.tar.bz2
linux-5272145d5cccd7cb73a8ce4b0b90c1c6b37a6a66.zip
counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe
The driver assumes that the input selection register (TIM_TISEL) is at its reset default value. Usually this is the case, but the bootloader might have modified it. This bases on a similar patch submitted by Olivier Moysan for pwm-stm32. Reviewed-by: Fabrice Gasnier <fabrice.gasnier@foss.st.com> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230413212339.3611722-1-u.kleine-koenig@pengutronix.de/ Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Diffstat (limited to 'drivers/counter')
-rw-r--r--drivers/counter/stm32-timer-cnt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 9bf20a5d6bda..6206d2dc3d47 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -342,6 +342,9 @@ static int stm32_timer_cnt_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, priv);
+ /* Reset input selector to its default input */
+ regmap_write(priv->regmap, TIM_TISEL, 0x0);
+
/* Register Counter device */
ret = devm_counter_add(dev, counter);
if (ret < 0)