Skip to content

Commit 025fd7e

Browse files
committed
drivers: clk: stm32_ll_h7: Add stm32_clock_control_get_status function
Add stm32_clock_control_get_status() function needed by flash_stm32_xspi driver for handling XiP. Signed-off-by: Thomas Decker <[email protected]>
1 parent 70eb6e5 commit 025fd7e

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

drivers/clock_control/clock_stm32_ll_h7.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,10 +680,36 @@ static int stm32_clock_control_get_subsys_rate(const struct device *clock,
680680
return 0;
681681
}
682682

683+
static enum clock_control_status stm32_clock_control_get_status(const struct device *dev,
684+
clock_control_subsys_t sub_system)
685+
{
686+
struct stm32_pclken *pclken = (struct stm32_pclken *)sub_system;
687+
688+
ARG_UNUSED(dev);
689+
690+
if (IN_RANGE(pclken->bus, STM32_PERIPH_BUS_MIN, STM32_PERIPH_BUS_MAX) == true) {
691+
/* Gated clocks */
692+
if ((sys_read32(DT_REG_ADDR(DT_NODELABEL(rcc)) + pclken->bus) & pclken->enr)
693+
== pclken->enr) {
694+
return CLOCK_CONTROL_STATUS_ON;
695+
} else {
696+
return CLOCK_CONTROL_STATUS_OFF;
697+
}
698+
} else {
699+
/* Domain clock sources */
700+
if (enabled_clock(pclken->bus) == 0) {
701+
return CLOCK_CONTROL_STATUS_ON;
702+
} else {
703+
return CLOCK_CONTROL_STATUS_OFF;
704+
}
705+
}
706+
}
707+
683708
static DEVICE_API(clock_control, stm32_clock_control_api) = {
684709
.on = stm32_clock_control_on,
685710
.off = stm32_clock_control_off,
686711
.get_rate = stm32_clock_control_get_subsys_rate,
712+
.get_status = stm32_clock_control_get_status,
687713
.configure = stm32_clock_control_configure,
688714
};
689715

0 commit comments

Comments
 (0)