1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2019-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef MOD_JUNO_CDCEL937_H
9 #define MOD_JUNO_CDCEL937_H
10 
11 #include "juno_clock.h"
12 
13 #include <mod_clock.h>
14 
15 #include <fwk_id.h>
16 #include <fwk_module_idx.h>
17 
18 #include <stdint.h>
19 
20 /*!
21  * \addtogroup GroupModules Modules
22  * \{
23  */
24 
25 /*!
26  * \defgroup GroupJUNOCDCEL937 JUNO CDCEL937
27  *
28  * \{
29  */
30 
31 /*! Define whether the output Y1 is used */
32 #define USE_OUTPUT_Y1   0
33 
34 /*! Output type */
35 enum mod_juno_cdcel937_output_id {
36     MOD_JUNO_CDCEL937_OUTPUT_ID_Y1 = 1, /* Output indices start from 1 */
37     MOD_JUNO_CDCEL937_OUTPUT_ID_Y2,
38     MOD_JUNO_CDCEL937_OUTPUT_ID_Y3,
39     MOD_JUNO_CDCEL937_OUTPUT_ID_Y4,
40     MOD_JUNO_CDCEL937_OUTPUT_ID_Y5,
41     MOD_JUNO_CDCEL937_OUTPUT_ID_Y6,
42     MOD_JUNO_CDCEL937_OUTPUT_ID_Y7,
43     MOD_JUNO_CDCEL937_OUTPUT_TYPE_COUNT,
44 };
45 
46 /*!
47  * \brief Juno CDCEL937 device configuration
48  */
49 struct mod_juno_cdcel937_dev_config {
50     /*! Address of the I2C target device */
51     uint8_t target_address;
52 
53     /*! Crystal oscillator input in MHz */
54     uint32_t xin_mhz;
55 
56     /*! Identifier of the clock HAL */
57     fwk_id_t clock_hal_id;
58 
59     /*! Identifier of the clock driver input API */
60     fwk_id_t clock_api_id;
61 
62     /*!
63      * The slowest rate the PLL can be set to. Note that this may be
64      * higher than the hardware-imposed limit.
65      */
66     uint64_t min_rate;
67 
68     /*!
69      * The fastest rate the PLL can be set to. Note that this may be
70      * lower than the hardware-imposed limit.
71      */
72     uint64_t max_rate;
73 
74     /*!
75      * The maximum precision that can be used when setting the PLL rate. This
76      * may be lower than the hardware-imposed limit.
77      */
78     uint64_t min_step;
79 
80     /*! Rate type */
81     enum mod_clock_rate_type rate_type;
82 
83     /*! Output type */
84     enum mod_juno_cdcel937_output_id output_id;
85 
86     /*! Lookup table */
87     struct juno_clock_lookup *lookup_table;
88 
89     /*! Number of entries */
90     unsigned int lookup_table_count;
91 };
92 
93 /*! Juno CDCEL937 module config */
94 struct mod_juno_cdcel937_config {
95     /*! Identifier of the I2C HAL */
96     fwk_id_t i2c_hal_id;
97 };
98 
99 /*! API indices */
100 enum mod_juno_cdcel937_api_idx {
101     MOD_JUNO_CDCEL937_API_IDX_CLOCK_DRIVER,
102     MOD_JUNO_CDCEL937_API_IDX_HDLCD_DRIVER,
103     MOD_JUNO_CDCEL937_API_COUNT,
104 };
105 
106 /*! Driver API Identifier */
107 static const fwk_id_t mod_juno_cdcel937_api_id_clock_driver =
108     FWK_ID_API_INIT(FWK_MODULE_IDX_JUNO_CDCEL937,
109         MOD_JUNO_CDCEL937_API_IDX_CLOCK_DRIVER);
110 
111 static const fwk_id_t mod_juno_cdcel937_api_id_hdlcd_driver =
112     FWK_ID_API_INIT(FWK_MODULE_IDX_JUNO_CDCEL937,
113         MOD_JUNO_CDCEL937_API_IDX_HDLCD_DRIVER);
114 
115 /*!
116  * \}
117  */
118 
119 /*!
120  * \}
121  */
122 
123 #endif /* MOD_JUNO_CDCEL937_H */
124