Skip to content

Commit a7b9637

Browse files
bjarki-andreasentmon-nordic
authored andcommitted
[nrf fromtree] drivers: clock_control: nrf: add support for HFCLK24M
Add support for the HFCLK24M clock to the clock_control_nrf device driver. Signed-off-by: Bjarki Arge Andreasen <[email protected]> (cherry picked from commit bb31960) Signed-off-by: Tomasz Moń <[email protected]>
1 parent 5449144 commit a7b9637

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

drivers/clock_control/clock_control_nrf.c

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,18 @@ static void hfclk_stop(void)
329329
nrfx_clock_hfclk_stop();
330330
}
331331

332+
#if NRF_CLOCK_HAS_HFCLK24M
333+
static void hfclk24m_start(void)
334+
{
335+
nrfx_clock_start(NRF_CLOCK_DOMAIN_HFCLK24M);
336+
}
337+
338+
static void hfclk24m_stop(void)
339+
{
340+
nrfx_clock_stop(NRF_CLOCK_DOMAIN_HFCLK24M);
341+
}
342+
#endif
343+
332344
#if NRF_CLOCK_HAS_HFCLK192M
333345
static void hfclk192m_start(void)
334346
{
@@ -714,7 +726,11 @@ static void clock_event_handler(nrfx_clock_evt_type_t event)
714726
break;
715727
}
716728
#endif
717-
729+
#if NRF_CLOCK_HAS_HFCLK24M
730+
case NRFX_CLOCK_EVT_HFCLK24M_STARTED:
731+
clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK24M);
732+
break;
733+
#endif
718734
#if NRF_CLOCK_HAS_HFCLK192M
719735
case NRFX_CLOCK_EVT_HFCLK192M_STARTED:
720736
clkstarted_handle(dev, CLOCK_CONTROL_NRF_TYPE_HFCLK192M);
@@ -843,6 +859,13 @@ static const struct nrf_clock_control_config config = {
843859
.stop = lfclk_stop,
844860
IF_ENABLED(CONFIG_LOG, (.name = "lfclk",))
845861
},
862+
#if NRF_CLOCK_HAS_HFCLK24M
863+
[CLOCK_CONTROL_NRF_TYPE_HFCLK24M] = {
864+
.start = hfclk24m_start,
865+
.stop = hfclk24m_stop,
866+
IF_ENABLED(CONFIG_LOG, (.name = "hfclk24m",))
867+
},
868+
#endif
846869
#if NRF_CLOCK_HAS_HFCLK192M
847870
[CLOCK_CONTROL_NRF_TYPE_HFCLK192M] = {
848871
.start = hfclk192m_start,

include/zephyr/drivers/clock_control/nrf_clock_control.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ extern "C" {
2727
enum clock_control_nrf_type {
2828
CLOCK_CONTROL_NRF_TYPE_HFCLK,
2929
CLOCK_CONTROL_NRF_TYPE_LFCLK,
30+
#if NRF_CLOCK_HAS_HFCLK24M
31+
CLOCK_CONTROL_NRF_TYPE_HFCLK24M,
32+
#endif
3033
#if NRF_CLOCK_HAS_HFCLK192M
3134
CLOCK_CONTROL_NRF_TYPE_HFCLK192M,
3235
#endif
@@ -43,6 +46,8 @@ enum clock_control_nrf_type {
4346
((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK)
4447
#define CLOCK_CONTROL_NRF_SUBSYS_LF \
4548
((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_LFCLK)
49+
#define CLOCK_CONTROL_NRF_SUBSYS_HF24M \
50+
((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK24M)
4651
#define CLOCK_CONTROL_NRF_SUBSYS_HF192M \
4752
((clock_control_subsys_t)CLOCK_CONTROL_NRF_TYPE_HFCLK192M)
4853
#define CLOCK_CONTROL_NRF_SUBSYS_HFAUDIO \

0 commit comments

Comments
 (0)