* [PATCH v2] counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe
@ 2023-04-13 21:23 Uwe Kleine-König
2023-04-17 21:33 ` William Breathitt Gray
0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2023-04-13 21:23 UTC (permalink / raw)
To: Maxime Coquelin, Alexandre Torgue, William Breathitt Gray,
Fabrice Gasnier
Cc: Olivier Moysan, linux-iio, Lee Jones, linux-kernel,
Thierry Reding, kernel, linux-stm32, linux-arm-kernel
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>
---
Changes since (implicit) v1 sent with Message-Id:
20230412153709.3557323-1-u.kleine-koenig@pengutronix.de .
- Only reset TIM_TISEL as suggested by Fabrice
- Add Fabrice's Review tag
drivers/counter/stm32-timer-cnt.c | 3 +++
include/linux/mfd/stm32-timers.h | 1 +
2 files changed, 4 insertions(+)
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)
diff --git a/include/linux/mfd/stm32-timers.h b/include/linux/mfd/stm32-timers.h
index 5f5c43fd69dd..1b94325febb3 100644
--- a/include/linux/mfd/stm32-timers.h
+++ b/include/linux/mfd/stm32-timers.h
@@ -31,6 +31,7 @@
#define TIM_BDTR 0x44 /* Break and Dead-Time Reg */
#define TIM_DCR 0x48 /* DMA control register */
#define TIM_DMAR 0x4C /* DMA register for transfer */
+#define TIM_TISEL 0x68 /* Input Selection */
#define TIM_CR1_CEN BIT(0) /* Counter Enable */
#define TIM_CR1_DIR BIT(4) /* Counter Direction */
base-commit: fe15c26ee26efa11741a7b632e9f23b01aca4cc6
--
2.39.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe
2023-04-13 21:23 [PATCH v2] counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe Uwe Kleine-König
@ 2023-04-17 21:33 ` William Breathitt Gray
0 siblings, 0 replies; 2+ messages in thread
From: William Breathitt Gray @ 2023-04-17 21:33 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Maxime Coquelin, Alexandre Torgue, William Breathitt Gray,
Fabrice Gasnier, Olivier Moysan, linux-iio, Lee Jones,
linux-kernel, Thierry Reding, kernel, linux-stm32,
linux-arm-kernel
[-- Attachment #1.1: Type: text/plain, Size: 637 bytes --]
On Thu, Apr 13, 2023 at 11:23:39PM +0200, Uwe Kleine-König wrote:
> 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>
Applied to the counter-next branch of the Counter tree. I made a minor
fix to Fabrice's Reviewed-by tag line for the missing closing chevron.
Thanks,
William Breathitt Gray
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-17 21:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-13 21:23 [PATCH v2] counter: stm32-timer-cnt: Reset TIM_TISEL to its default value in probe Uwe Kleine-König
2023-04-17 21:33 ` William Breathitt Gray
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).