1 /*
2  * Copyright 2023 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef SM_CLOCK_H_
8 #define SM_CLOCK_H_
9 
10 #include "fsl_common.h"
11 #include "scmi_clock.h"
12 #include "sm_platform.h"
13 
14 /*******************************************************************************
15  * Definitions
16  ******************************************************************************/
17 #define SM_CLOCK_RATE_MASK 0xFFFFFFFFU
18 
19 typedef struct
20 {
21     uint32_t channel;    /* channel id: SCMI_A2P, SCMI_NOTIRY, SCMI_P2A, */
22     uint32_t rateu;
23     uint32_t ratel;
24     uint32_t clk_id;     /* clock device id */
25     uint32_t pclk_id;    /* parent clock device id */
26     uint32_t div;        /* clock divider */
27     uint32_t attributes; /* clock attributes */
28     uint32_t oem_config_val;
29     uint32_t flags;
30 } sm_clock_t;
31 
32 /*******************************************************************************
33  * API
34  ******************************************************************************/
35 #if defined(__cplusplus)
36 extern "C" {
37 #endif /*__cplusplus */
38 
39 void SM_CLOCK_SetRootClock(sm_clock_t *sm_clk);
40 void SM_CLOCK_SetPllClock(sm_clock_t *sm_clk);
41 void SM_CLOCK_EnableRootClock(sm_clock_t *sm_clk);
42 
43 uint64_t SM_CLOCK_GetIpFreq(sm_clock_t *sm_clk);
44 uint64_t SM_CLOCK_GetSourceFreq(sm_clock_t *sm_clk);
45 
46 #if defined(__cplusplus)
47 }
48 #endif /*__cplusplus */
49 
50 /*! @} */
51 
52 #endif /* SM_CLOCK_H_ */
53