From: Uwe Kleine-König Date: Thu, 13 Apr 2023 21:23:39 +0000 (+0200) Subject: counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe X-Git-Tag: v6.5-rc1~77^2~60^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5272145d5cccd7cb73a8ce4b0b90c1c6b37a6a66;p=thirdparty%2Flinux.git 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 Signed-off-by: Uwe Kleine-König Link: https://lore.kernel.org/r/20230413212339.3611722-1-u.kleine-koenig@pengutronix.de/ Signed-off-by: William Breathitt Gray --- diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c index 9bf20a5d6bda8..6206d2dc3d470 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)