From d2273c02dfd7d13f4cfac8f90e6fa57eca02bb80 Mon Sep 17 00:00:00 2001 From: Hubert Guan Date: Wed, 9 Oct 2024 23:52:12 -0700 Subject: [PATCH] include: zephyr: dt-bindings: clock: Define STM32_CLOCK macro Define new macro for reading and writing convenience. Signed-off-by: Hubert Guan --- include/zephyr/dt-bindings/clock/stm32_common_clocks.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/zephyr/dt-bindings/clock/stm32_common_clocks.h b/include/zephyr/dt-bindings/clock/stm32_common_clocks.h index 721904cce77..3aece1bb775 100644 --- a/include/zephyr/dt-bindings/clock/stm32_common_clocks.h +++ b/include/zephyr/dt-bindings/clock/stm32_common_clocks.h @@ -45,4 +45,13 @@ (((mask) & STM32_MCO_CFGR_MASK_MASK) << STM32_MCO_CFGR_MASK_SHIFT) | \ (((val) & STM32_MCO_CFGR_VAL_MASK) << STM32_MCO_CFGR_VAL_SHIFT)) +/** + * Pack RCC clock register offset and bit in two 32-bit values + * as expected for the Device Tree `clocks` property on STM32. + * + * @param bus STM32 bus name (expands to STM32_CLOCK_BUS_{bus}) + * @param bit Clock bit + */ +#define STM32_CLOCK(bus, bit) (STM32_CLOCK_BUS_##bus) (1 << bit) + #endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_STM32_COMMON_CLOCKS_H_ */