Commit graph

21 commits

Author SHA1 Message Date
Marcin Niestroj 227462eda9 drivers: counter: stm32: move reset_dt_spec from data to config
Move 'reset' member, which is const, from driver data to driver config.
This allows to reduce flash usage by few bytes.

Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
2024-03-11 17:55:17 +00:00
Abderrahmane Jarmouni c3835e0cdf drivers: counter: ll_stm32_timer: F1X changes
Use "const LL_TIM_OC_GetCompareCH" & "const LL_TIM_IsEnabledIT_CCx" with
STM32F1X series, following changes in stm32cube:stm32f1xx:drivers:
include:stm32f1xx_ll_tim.h

Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
2023-12-06 12:10:08 +00:00
Sean Nyekjaer f21526c5c9 drivers: counter: stm32: void return value from reset_line_toggle_dt
Suggested-by: Francois Ramu <francois.ramu@st.com>
Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-20 10:57:12 +00:00
Erwan Gouriou 32efdf9239 drivers: counter: stm32: Review use const TIM_TypeDef on few series
A recent Cube update moved C0/L1/WBA to use const TIM_TypeDef
Align counter driver implementation.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-20 09:20:57 +00:00
Erwan Gouriou feef931fbb drivers: counter: stm32: Use const TIM_TypeDef on stm32f2 series
A recent factorisation moved F2 to non const TIM_TypeDef.
This is an error, move it back to const TIM_TypeDef.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-19 14:31:31 +00:00
Erwan Gouriou 829fa5e70a drivers: counter: stm32wba: Avoid warning at build
STM32WBA LL API defines non const TIM_TypeDef.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-07-12 11:48:10 +02:00
Sean Nyekjaer f1d91a24ac drivers: counter: stm32: read clock divider register for stm32mp1 boards
Since clocks aren't declared in the devicetree for the stm32mp1
co-processor. Read the resulting clock divider here instead.

Signed-off-by: Sean Nyekjaer <sean@geanix.com>
2023-07-06 09:44:01 +00:00
Francois Ramu a77851b73e drivers: counter: stm32 timer counter driver LL prototype
Adapt the stm32 counter-timer driver to the stm32_ll function
prototype. Some stm32 families have
LL_TIM_OC_GetCompareCHx(TIM_TypeDef some others have
LL_TIM_OC_GetCompareCHx(const TIM_TypeDef.
This will fix compilation warning.
Adds the macro for stm32L0 16bit timers.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-04-24 13:32:29 +02:00
Pieter De Gendt 6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
TOKITA Hiroshi 429b05a79a drivers: counter: stm32_timer: remove counter_stm32_is_bit_mask() function
Remove implementation of counter_stm32_is_bit_mask() and
Use IS_BIT_MASK() macro.

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
2023-01-10 09:23:14 +01:00
Patryk Duda 227ac76828 drivers: counter: Reset timer using RCC before initialization
In multi-image environment, after jump to the image we can have running
timer with interrupts enabled. If interrupt is triggered, the asserts
in the driver can cause a crash.

This patch also adds 'resets' property for all timer nodes.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-09 09:43:36 -08:00
Patryk Duda a9ed11ab8d drivers: counter: Add __fallthrough in STM32 counter driver
STM32 counter driver uses switch statement in which cases don't end
with break or return intentionally.

Affected switches in counter driver check status of all timer channels
(maximum 4 channels), but the number of channels is not determined
during compilation. In switch, we jump to channel with highest number
and then check other channels with lower numbers.

Compiler can warn about it, so this patch adds information that it was
intentional.

Signed-off-by: Patryk Duda <pdk@semihalf.com>
2022-12-07 14:26:42 +00:00
Pawel Czarnecki 6cc8f31310 drivers: counter: add missing includes
Add missing irq.h, spinlock.h and kernel.h headers

Signed-off-by: Pawel Czarnecki <pczarnecki@antmicro.com>
2022-10-13 00:07:37 +09:00
TLIG Dhaou 402ebb3df0 drivers: counter: Patch for the stm32 counter
Fix the TIM_Typedef types.

Signed-off-by: TLIG Dhaou <dhaou.tlig-ext@st.com>
2022-08-23 20:08:35 +02:00
Henrik Brix Andersen e885ead428 drivers: counter: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Gerard Marull-Paretas c4550bc931 drivers: counter: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas 159c2ed574 drivers: counter: ll_stm32_timer: use instance based macros
Replace usage of DT_DRV_INST with instance based macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-17 17:30:06 +01:00
Gerard Marull-Paretas 3e9d8da9ec drivers: use DT_INST_PARENT
Replace usages of DT_PARENT(DT_DRV_INST(idx)) with more idiomatic
DT_INST_PARENT(idx).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-12-16 11:10:01 -06:00
Kent Hall ba37d5935e drivers: counter: Counter API implementation for STM32F4 Series (TIMER).
- Shim for counter API using LL_TIM driver.
- Supports all general-purpose (TIMx) timers.

Signed-off-by: Kent Hall <kjh2166@columbia.edu>
2021-12-11 14:20:17 -05:00