From 7cbb1dd836f2ecd9c9d57b886f5ae511b9e9fef1 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 16 Dec 2024 11:39:47 +0100 Subject: [PATCH] include: drivers: clock_control stm32 bus clock index can exceed 256 For some stm32 devices, especially the stm32H7RS serie, the RCC register map is larger that 256 (example AHB1 is 0x138). The mask is extended to 0x1ff in the .bus of the clock info structure, using the GENMASK macro from STM32_CLOCK_DIV_SHIFT Signed-off-by: Francois Ramu --- include/zephyr/drivers/clock_control/stm32_clock_control.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/zephyr/drivers/clock_control/stm32_clock_control.h b/include/zephyr/drivers/clock_control/stm32_clock_control.h index 753aa0eafdbb10..a7974467d2e59c 100644 --- a/include/zephyr/drivers/clock_control/stm32_clock_control.h +++ b/include/zephyr/drivers/clock_control/stm32_clock_control.h @@ -444,7 +444,8 @@ struct stm32_pclken { #define STM32_CLOCK_INFO(clk_index, node_id) \ { \ .enr = DT_CLOCKS_CELL_BY_IDX(node_id, clk_index, bits), \ - .bus = DT_CLOCKS_CELL_BY_IDX(node_id, clk_index, bus) & 0xff, \ + .bus = DT_CLOCKS_CELL_BY_IDX(node_id, clk_index, bus) & \ + GENMASK(STM32_CLOCK_DIV_SHIFT - 1, 0), \ .div = DT_CLOCKS_CELL_BY_IDX(node_id, clk_index, bus) >> \ STM32_CLOCK_DIV_SHIFT, \ }