blob: e601b484fbd2fd354f45b21a3eb14bdd7bd9cd0b [file] [log] [blame]
Yann Gautier125ed8d2022-03-10 11:33:13 +01001/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */
2/*
Gabriel Fernandeza15dde82022-08-16 16:15:49 +02003 * Copyright (C) 2017-2024, STMicroelectronics - All Rights Reserved
Yann Gautier125ed8d2022-03-10 11:33:13 +01004 */
5
6#ifndef _DT_BINDINGS_CLOCK_STM32MP15_CLKSRC_H_
7#define _DT_BINDINGS_CLOCK_STM32MP15_CLKSRC_H_
8
Gabriel Fernandeza15dde82022-08-16 16:15:49 +02009#include <lib/utils_def.h>
10
11#define CMD_DIV 0
12#define CMD_MUX 1
13#define CMD_CLK 2
14
15#define CMD_ADDR_BIT BIT(31)
16
17#define CMD_SHIFT 26
18#define CMD_MASK GENMASK_32(31, 26)
19#define CMD_DATA_MASK GENMASK_32(25, 0)
20
21#define DIV_ID_SHIFT 8
22#define DIV_ID_MASK GENMASK_32(15, 8)
23
24#define DIV_DIVN_SHIFT 0
25#define DIV_DIVN_MASK GENMASK_32(7, 0)
26
27#define MUX_ID_SHIFT 4
28#define MUX_ID_MASK GENMASK_32(11, 4)
29
30#define MUX_SEL_SHIFT 0
31#define MUX_SEL_MASK GENMASK_32(3, 0)
32
33#define CLK_ID_MASK GENMASK_32(19, 11)
34#define CLK_ID_SHIFT 11
35#define CLK_ON_MASK 0x00000400
36#define CLK_ON_SHIFT 10
37#define CLK_DIV_MASK GENMASK_32(9, 4)
38#define CLK_DIV_SHIFT 4
39#define CLK_SEL_MASK GENMASK_32(3, 0)
40#define CLK_SEL_SHIFT 0
41
42#define DIV(div_id, div) ((CMD_DIV << CMD_SHIFT) |\
43 ((div_id) << DIV_ID_SHIFT) |\
44 (div))
45
46#define CLKSRC(mux_id, sel) ((CMD_MUX << CMD_SHIFT) |\
47 ((mux_id) << MUX_ID_SHIFT) |\
48 (sel))
49
50/* CLK output is enable */
51#define CLK_SRC(clk_id, sel) ((CMD_CLK << CMD_SHIFT) |\
52 ((clk_id) << CLK_ID_SHIFT) |\
53 (sel) | CLK_ON_MASK)
54
55#define CLK_DISABLED(clk_id) ((CMD_CLK << CMD_SHIFT) |\
56 ((clk_id) << CLK_ID_SHIFT))
57
58#define CLK_ADDR_SHIFT 16
59#define CLK_ADDR_MASK GENMASK_32(30, 16)
60#define CLK_ADDR_VAL_MASK GENMASK_32(15, 0)
61
62#define DIV_PLL1DIVP 0
63#define DIV_PLL2DIVP 1
64#define DIV_PLL2DIVQ 2
65#define DIV_PLL2DIVR 3
66#define DIV_PLL3DIVP 4
67#define DIV_PLL3DIVQ 5
68#define DIV_PLL3DIVR 6
69#define DIV_PLL4DIVP 7
70#define DIV_PLL4DIVQ 8
71#define DIV_PLL4DIVR 9
72#define DIV_MPU 10
73#define DIV_AXI 11
74#define DIV_MCU 12
75#define DIV_APB1 13
76#define DIV_APB2 14
77#define DIV_APB3 15
78#define DIV_APB4 16
79#define DIV_APB5 17
80#define DIV_RTC 19
81#define DIV_MCO1 20
82#define DIV_MCO2 21
83#define DIV_HSI 22
84#define DIV_TRACE 23
85#define DIV_ETHPTP 24
86#define DIV_NB 25
87
88#define MUX_MPU 0
89#define MUX_AXI 1
90#define MUX_MCU 2
91#define MUX_PLL12 3
92#define MUX_PLL3 4
93#define MUX_PLL4 5
94#define MUX_CKPER 6
95#define MUX_RTC 7
96#define MUX_SDMMC12 8
97#define MUX_SDMMC3 9
98#define MUX_FMC 10
99#define MUX_QSPI 11
100#define MUX_RNG1 12
101#define MUX_RNG2 13
102#define MUX_USBPHY 14
103#define MUX_USBO 15
104#define MUX_STGEN 16
105#define MUX_SPDIF 17
106#define MUX_SPI2S1 18
107#define MUX_SPI2S23 19
108#define MUX_SPI45 20
109#define MUX_SPI6 21
110#define MUX_CEC 22
111#define MUX_I2C12 23
112#define MUX_I2C35 24
113#define MUX_I2C46 25
114#define MUX_LPTIM1 26
115#define MUX_LPTIM23 27
116#define MUX_LPTIM45 28
117#define MUX_UART1 29
118#define MUX_UART24 30
119#define MUX_UART35 31
120#define MUX_UART6 32
121#define MUX_UART78 33
122#define MUX_SAI1 34
123#define MUX_SAI2 35
124#define MUX_SAI3 36
125#define MUX_SAI4 37
126#define MUX_DSI 38
127#define MUX_FDCAN 39
128#define MUX_ADC 40
129#define MUX_ETH 41
130#define MUX_MCO1 42
131#define MUX_MCO2 43
132#define MUX_NB 44
133
Yann Gautier125ed8d2022-03-10 11:33:13 +0100134/* PLL output is enable when x=1, with x=p,q or r */
135#define PQR(p, q, r) (((p) & 1) | (((q) & 1) << 1) | (((r) & 1) << 2))
136
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200137/* st,clksrc: clock sources */
138#define CLK_MPU_HSI CLKSRC(MUX_MPU, 0)
139#define CLK_MPU_HSE CLKSRC(MUX_MPU, 1)
140#define CLK_MPU_PLL1P CLKSRC(MUX_MPU, 2)
141#define CLK_MPU_PLL1P_DIV CLKSRC(MUX_MPU, 3)
142
143#define CLK_AXI_HSI CLKSRC(MUX_AXI, 0)
144#define CLK_AXI_HSE CLKSRC(MUX_AXI, 1)
145#define CLK_AXI_PLL2P CLKSRC(MUX_AXI, 2)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100146
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200147#define CLK_MCU_HSI CLKSRC(MUX_MCU, 0)
148#define CLK_MCU_HSE CLKSRC(MUX_MCU, 1)
149#define CLK_MCU_CSI CLKSRC(MUX_MCU, 2)
150#define CLK_MCU_PLL3P CLKSRC(MUX_MCU, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100151
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200152#define CLK_PLL12_HSI CLKSRC(MUX_PLL12, 0)
153#define CLK_PLL12_HSE CLKSRC(MUX_PLL12, 1)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100154
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200155#define CLK_PLL3_HSI CLKSRC(MUX_PLL3, 0)
156#define CLK_PLL3_HSE CLKSRC(MUX_PLL3, 1)
157#define CLK_PLL3_CSI CLKSRC(MUX_PLL3, 2)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100158
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200159#define CLK_PLL4_HSI CLKSRC(MUX_PLL4, 0)
160#define CLK_PLL4_HSE CLKSRC(MUX_PLL4, 1)
161#define CLK_PLL4_CSI CLKSRC(MUX_PLL4, 2)
162#define CLK_PLL4_I2SCKIN CLKSRC(MUX_PLL4, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100163
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200164#define CLK_RTC_DISABLED CLK_DISABLED(RTC)
165#define CLK_RTC_LSE CLK_SRC(RTC, 1)
166#define CLK_RTC_LSI CLK_SRC(RTC, 2)
167#define CLK_RTC_HSE CLK_SRC(RTC, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100168
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200169/* Register addresses of MCO1 & MCO2 */
170#define MCO1 0x800
171#define MCO2 0x804
Yann Gautier125ed8d2022-03-10 11:33:13 +0100172
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200173#define MCO_OFF 0
174#define MCO_ON 1
175#define MCO_STATUS_SHIFT 12
Yann Gautier125ed8d2022-03-10 11:33:13 +0100176
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200177#define MCO_ON_CFG(addr, sel) (CMD_ADDR_BIT |\
178 ((addr) << CLK_ADDR_SHIFT) |\
179 (MCO_ON << MCO_STATUS_SHIFT) |\
180 (sel))
Yann Gautier125ed8d2022-03-10 11:33:13 +0100181
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200182#define MCO_OFF_CFG(addr) (CMD_ADDR_BIT |\
183 ((addr) << CLK_ADDR_SHIFT) |\
184 (MCO_OFF << MCO_STATUS_SHIFT))
Yann Gautier125ed8d2022-03-10 11:33:13 +0100185
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200186#define CLK_MCO1_HSI MCO_ON_CFG(MCO1, 0)
187#define CLK_MCO1_HSE MCO_ON_CFG(MCO1, 1)
188#define CLK_MCO1_CSI MCO_ON_CFG(MCO1, 2)
189#define CLK_MCO1_LSI MCO_ON_CFG(MCO1, 3)
190#define CLK_MCO1_LSE MCO_ON_CFG(MCO1, 4)
191#define CLK_MCO1_DISABLED MCO_OFF_CFG(MCO1)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100192
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200193#define CLK_MCO2_MPU MCO_ON_CFG(MCO2, 0)
194#define CLK_MCO2_AXI MCO_ON_CFG(MCO2, 1)
195#define CLK_MCO2_MCU MCO_ON_CFG(MCO2, 2)
196#define CLK_MCO2_PLL4 MCO_ON_CFG(MCO2, 3)
197#define CLK_MCO2_HSE MCO_ON_CFG(MCO2, 4)
198#define CLK_MCO2_HSI MCO_ON_CFG(MCO2, 5)
199#define CLK_MCO2_DISABLED MCO_OFF_CFG(MCO2)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100200
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200201#define CLK_I2C12_PCLK1 CLKSRC(MUX_I2C12, 0)
202#define CLK_I2C12_PLL4R CLKSRC(MUX_I2C12, 1)
203#define CLK_I2C12_HSI CLKSRC(MUX_I2C12, 2)
204#define CLK_I2C12_CSI CLKSRC(MUX_I2C12, 3)
205#define CLK_I2C12_DISABLED CLKSRC(MUX_I2C12, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100206
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200207#define CLK_I2C35_PCLK1 CLKSRC(MUX_I2C35, 0)
208#define CLK_I2C35_PLL4R CLKSRC(MUX_I2C35, 1)
209#define CLK_I2C35_HSI CLKSRC(MUX_I2C35, 2)
210#define CLK_I2C35_CSI CLKSRC(MUX_I2C35, 3)
211#define CLK_I2C35_DISABLED CLKSRC(MUX_I2C35, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100212
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200213#define CLK_I2C46_PCLK5 CLKSRC(MUX_I2C46, 0)
214#define CLK_I2C46_PLL3Q CLKSRC(MUX_I2C46, 1)
215#define CLK_I2C46_HSI CLKSRC(MUX_I2C46, 2)
216#define CLK_I2C46_CSI CLKSRC(MUX_I2C46, 3)
217#define CLK_I2C46_DISABLED CLKSRC(MUX_I2C46, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100218
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200219#define CLK_SAI1_PLL4Q CLKSRC(MUX_SAI1, 0)
220#define CLK_SAI1_PLL3Q CLKSRC(MUX_SAI1, 1)
221#define CLK_SAI1_I2SCKIN CLKSRC(MUX_SAI1, 2)
222#define CLK_SAI1_CKPER CLKSRC(MUX_SAI1, 3)
223#define CLK_SAI1_PLL3R CLKSRC(MUX_SAI1, 4)
224#define CLK_SAI1_DISABLED CLKSRC(MUX_SAI1, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100225
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200226#define CLK_SAI2_PLL4Q CLKSRC(MUX_SAI2, 0)
227#define CLK_SAI2_PLL3Q CLKSRC(MUX_SAI2, 1)
228#define CLK_SAI2_I2SCKIN CLKSRC(MUX_SAI2, 2)
229#define CLK_SAI2_CKPER CLKSRC(MUX_SAI2, 3)
230#define CLK_SAI2_SPDIF CLKSRC(MUX_SAI2, 4)
231#define CLK_SAI2_PLL3R CLKSRC(MUX_SAI2, 5)
232#define CLK_SAI2_DISABLED CLKSRC(MUX_SAI2, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100233
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200234#define CLK_SAI3_PLL4Q CLKSRC(MUX_SAI3, 0)
235#define CLK_SAI3_PLL3Q CLKSRC(MUX_SAI3, 1)
236#define CLK_SAI3_I2SCKIN CLKSRC(MUX_SAI3, 2)
237#define CLK_SAI3_CKPER CLKSRC(MUX_SAI3, 3)
238#define CLK_SAI3_PLL3R CLKSRC(MUX_SAI3, 4)
239#define CLK_SAI3_DISABLED CLKSRC(MUX_SAI3, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100240
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200241#define CLK_SAI4_PLL4Q CLKSRC(MUX_SAI4, 0)
242#define CLK_SAI4_PLL3Q CLKSRC(MUX_SAI4, 1)
243#define CLK_SAI4_I2SCKIN CLKSRC(MUX_SAI4, 2)
244#define CLK_SAI4_CKPER CLKSRC(MUX_SAI4, 3)
245#define CLK_SAI4_PLL3R CLKSRC(MUX_SAI4, 4)
246#define CLK_SAI4_DISABLED CLKSRC(MUX_SAI4, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100247
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200248#define CLK_SPI2S1_PLL4P CLKSRC(MUX_SPI2S1, 0)
249#define CLK_SPI2S1_PLL3Q CLKSRC(MUX_SPI2S1, 1)
250#define CLK_SPI2S1_I2SCKIN CLKSRC(MUX_SPI2S1, 2)
251#define CLK_SPI2S1_CKPER CLKSRC(MUX_SPI2S1, 3)
252#define CLK_SPI2S1_PLL3R CLKSRC(MUX_SPI2S1, 4)
253#define CLK_SPI2S1_DISABLED CLKSRC(MUX_SPI2S1, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100254
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200255#define CLK_SPI2S23_PLL4P CLKSRC(MUX_SPI2S23, 0)
256#define CLK_SPI2S23_PLL3Q CLKSRC(MUX_SPI2S23, 1)
257#define CLK_SPI2S23_I2SCKIN CLKSRC(MUX_SPI2S23, 2)
258#define CLK_SPI2S23_CKPER CLKSRC(MUX_SPI2S23, 3)
259#define CLK_SPI2S23_PLL3R CLKSRC(MUX_SPI2S23, 4)
260#define CLK_SPI2S23_DISABLED CLKSRC(MUX_SPI2S23, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100261
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200262#define CLK_SPI45_PCLK2 CLKSRC(MUX_SPI45, 0)
263#define CLK_SPI45_PLL4Q CLKSRC(MUX_SPI45, 1)
264#define CLK_SPI45_HSI CLKSRC(MUX_SPI45, 2)
265#define CLK_SPI45_CSI CLKSRC(MUX_SPI45, 3)
266#define CLK_SPI45_HSE CLKSRC(MUX_SPI45, 4)
267#define CLK_SPI45_DISABLED CLKSRC(MUX_SPI45, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100268
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200269#define CLK_SPI6_PCLK5 CLKSRC(MUX_SPI6, 0)
270#define CLK_SPI6_PLL4Q CLKSRC(MUX_SPI6, 1)
271#define CLK_SPI6_HSI CLKSRC(MUX_SPI6, 2)
272#define CLK_SPI6_CSI CLKSRC(MUX_SPI6, 3)
273#define CLK_SPI6_HSE CLKSRC(MUX_SPI6, 4)
274#define CLK_SPI6_PLL3Q CLKSRC(MUX_SPI6, 5)
275#define CLK_SPI6_DISABLED CLKSRC(MUX_SPI6, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100276
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200277#define CLK_UART6_PCLK2 CLKSRC(MUX_UART6, 0)
278#define CLK_UART6_PLL4Q CLKSRC(MUX_UART6, 1)
279#define CLK_UART6_HSI CLKSRC(MUX_UART6, 2)
280#define CLK_UART6_CSI CLKSRC(MUX_UART6, 3)
281#define CLK_UART6_HSE CLKSRC(MUX_UART6, 4)
282#define CLK_UART6_DISABLED CLKSRC(MUX_UART6, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100283
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200284#define CLK_UART24_PCLK1 CLKSRC(MUX_UART24, 0)
285#define CLK_UART24_PLL4Q CLKSRC(MUX_UART24, 1)
286#define CLK_UART24_HSI CLKSRC(MUX_UART24, 2)
287#define CLK_UART24_CSI CLKSRC(MUX_UART24, 3)
288#define CLK_UART24_HSE CLKSRC(MUX_UART24, 4)
289#define CLK_UART24_DISABLED CLKSRC(MUX_UART24, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100290
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200291#define CLK_UART35_PCLK1 CLKSRC(MUX_UART35, 0)
292#define CLK_UART35_PLL4Q CLKSRC(MUX_UART35, 1)
293#define CLK_UART35_HSI CLKSRC(MUX_UART35, 2)
294#define CLK_UART35_CSI CLKSRC(MUX_UART35, 3)
295#define CLK_UART35_HSE CLKSRC(MUX_UART35, 4)
296#define CLK_UART35_DISABLED CLKSRC(MUX_UART35, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100297
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200298#define CLK_UART78_PCLK1 CLKSRC(MUX_UART78, 0)
299#define CLK_UART78_PLL4Q CLKSRC(MUX_UART78, 1)
300#define CLK_UART78_HSI CLKSRC(MUX_UART78, 2)
301#define CLK_UART78_CSI CLKSRC(MUX_UART78, 3)
302#define CLK_UART78_HSE CLKSRC(MUX_UART78, 4)
303#define CLK_UART78_DISABLED CLKSRC(MUX_UART78, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100304
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200305#define CLK_UART1_PCLK5 CLKSRC(MUX_UART1, 0)
306#define CLK_UART1_PLL3Q CLKSRC(MUX_UART1, 1)
307#define CLK_UART1_HSI CLKSRC(MUX_UART1, 2)
308#define CLK_UART1_CSI CLKSRC(MUX_UART1, 3)
309#define CLK_UART1_PLL4Q CLKSRC(MUX_UART1, 4)
310#define CLK_UART1_HSE CLKSRC(MUX_UART1, 5)
311#define CLK_UART1_DISABLED CLKSRC(MUX_UART1, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100312
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200313#define CLK_SDMMC12_HCLK6 CLKSRC(MUX_SDMMC12, 0)
314#define CLK_SDMMC12_PLL3R CLKSRC(MUX_SDMMC12, 1)
315#define CLK_SDMMC12_PLL4P CLKSRC(MUX_SDMMC12, 2)
316#define CLK_SDMMC12_HSI CLKSRC(MUX_SDMMC12, 3)
317#define CLK_SDMMC12_DISABLED CLKSRC(MUX_SDMMC12, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100318
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200319#define CLK_SDMMC3_HCLK2 CLKSRC(MUX_SDMMC3, 0)
320#define CLK_SDMMC3_PLL3R CLKSRC(MUX_SDMMC3, 1)
321#define CLK_SDMMC3_PLL4P CLKSRC(MUX_SDMMC3, 2)
322#define CLK_SDMMC3_HSI CLKSRC(MUX_SDMMC3, 3)
323#define CLK_SDMMC3_DISABLED CLKSRC(MUX_SDMMC3, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100324
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200325#define CLK_ETH_PLL4P CLKSRC(MUX_ETH, 0)
326#define CLK_ETH_PLL3Q CLKSRC(MUX_ETH, 1)
327#define CLK_ETH_DISABLED CLKSRC(MUX_ETH, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100328
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200329#define CLK_QSPI_ACLK CLKSRC(MUX_QSPI, 0)
330#define CLK_QSPI_PLL3R CLKSRC(MUX_QSPI, 1)
331#define CLK_QSPI_PLL4P CLKSRC(MUX_QSPI, 2)
332#define CLK_QSPI_CKPER CLKSRC(MUX_QSPI, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100333
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200334#define CLK_FMC_ACLK CLKSRC(MUX_FMC, 0)
335#define CLK_FMC_PLL3R CLKSRC(MUX_FMC, 1)
336#define CLK_FMC_PLL4P CLKSRC(MUX_FMC, 2)
337#define CLK_FMC_CKPER CLKSRC(MUX_FMC, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100338
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200339#define CLK_FDCAN_HSE CLKSRC(MUX_FDCAN, 0)
340#define CLK_FDCAN_PLL3Q CLKSRC(MUX_FDCAN, 1)
341#define CLK_FDCAN_PLL4Q CLKSRC(MUX_FDCAN, 2)
342#define CLK_FDCAN_PLL4R CLKSRC(MUX_FDCAN, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100343
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200344#define CLK_SPDIF_PLL4P CLKSRC(MUX_SPDIF, 0)
345#define CLK_SPDIF_PLL3Q CLKSRC(MUX_SPDIF, 1)
346#define CLK_SPDIF_HSI CLKSRC(MUX_SPDIF, 2)
347#define CLK_SPDIF_DISABLED CLKSRC(MUX_SPDIF, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100348
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200349#define CLK_CEC_LSE CLKSRC(MUX_CEC, 0)
350#define CLK_CEC_LSI CLKSRC(MUX_CEC, 1)
351#define CLK_CEC_CSI_DIV122 CLKSRC(MUX_CEC, 2)
352#define CLK_CEC_DISABLED CLKSRC(MUX_CEC, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100353
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200354#define CLK_USBPHY_HSE CLKSRC(MUX_USBPHY, 0)
355#define CLK_USBPHY_PLL4R CLKSRC(MUX_USBPHY, 1)
356#define CLK_USBPHY_HSE_DIV2 CLKSRC(MUX_USBPHY, 2)
357#define CLK_USBPHY_DISABLED CLKSRC(MUX_USBPHY, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100358
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200359#define CLK_USBO_PLL4R CLKSRC(MUX_USBO, 0)
360#define CLK_USBO_USBPHY CLKSRC(MUX_USBO, 1)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100361
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200362#define CLK_RNG1_CSI CLKSRC(MUX_RNG1, 0)
363#define CLK_RNG1_PLL4R CLKSRC(MUX_RNG1, 1)
364#define CLK_RNG1_LSE CLKSRC(MUX_RNG1, 2)
365#define CLK_RNG1_LSI CLKSRC(MUX_RNG1, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100366
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200367#define CLK_RNG2_CSI CLKSRC(MUX_RNG2, 0)
368#define CLK_RNG2_PLL4R CLKSRC(MUX_RNG2, 1)
369#define CLK_RNG2_LSE CLKSRC(MUX_RNG2, 2)
370#define CLK_RNG2_LSI CLKSRC(MUX_RNG2, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100371
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200372#define CLK_CKPER_HSI CLKSRC(MUX_CKPER, 0)
373#define CLK_CKPER_CSI CLKSRC(MUX_CKPER, 1)
374#define CLK_CKPER_HSE CLKSRC(MUX_CKPER, 2)
375#define CLK_CKPER_DISABLED CLKSRC(MUX_CKPER, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100376
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200377#define CLK_STGEN_HSI CLKSRC(MUX_STGEN, 0)
378#define CLK_STGEN_HSE CLKSRC(MUX_STGEN, 1)
379#define CLK_STGEN_DISABLED CLKSRC(MUX_STGEN, 3)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100380
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200381#define CLK_DSI_DSIPLL CLKSRC(MUX_DSI, 0)
382#define CLK_DSI_PLL4P CLKSRC(MUX_DSI, 1)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100383
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200384#define CLK_ADC_PLL4R CLKSRC(MUX_ADC, 0)
385#define CLK_ADC_CKPER CLKSRC(MUX_ADC, 1)
386#define CLK_ADC_PLL3Q CLKSRC(MUX_ADC, 2)
387#define CLK_ADC_DISABLED CLKSRC(MUX_ADC, 3)
388
389#define CLK_LPTIM45_PCLK3 CLKSRC(MUX_LPTIM45, 0)
390#define CLK_LPTIM45_PLL4P CLKSRC(MUX_LPTIM45, 1)
391#define CLK_LPTIM45_PLL3Q CLKSRC(MUX_LPTIM45, 2)
392#define CLK_LPTIM45_LSE CLKSRC(MUX_LPTIM45, 3)
393#define CLK_LPTIM45_LSI CLKSRC(MUX_LPTIM45, 4)
394#define CLK_LPTIM45_CKPER CLKSRC(MUX_LPTIM45, 5)
395#define CLK_LPTIM45_DISABLED CLKSRC(MUX_LPTIM45, 7)
396
397#define CLK_LPTIM23_PCLK3 CLKSRC(MUX_LPTIM23, 0)
398#define CLK_LPTIM23_PLL4Q CLKSRC(MUX_LPTIM23, 1)
399#define CLK_LPTIM23_CKPER CLKSRC(MUX_LPTIM23, 2)
400#define CLK_LPTIM23_LSE CLKSRC(MUX_LPTIM23, 3)
401#define CLK_LPTIM23_LSI CLKSRC(MUX_LPTIM23, 4)
402#define CLK_LPTIM23_DISABLED CLKSRC(MUX_LPTIM23, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100403
Gabriel Fernandeza15dde82022-08-16 16:15:49 +0200404#define CLK_LPTIM1_PCLK1 CLKSRC(MUX_LPTIM1, 0)
405#define CLK_LPTIM1_PLL4P CLKSRC(MUX_LPTIM1, 1)
406#define CLK_LPTIM1_PLL3Q CLKSRC(MUX_LPTIM1, 2)
407#define CLK_LPTIM1_LSE CLKSRC(MUX_LPTIM1, 3)
408#define CLK_LPTIM1_LSI CLKSRC(MUX_LPTIM1, 4)
409#define CLK_LPTIM1_CKPER CLKSRC(MUX_LPTIM1, 5)
410#define CLK_LPTIM1_DISABLED CLKSRC(MUX_LPTIM1, 7)
Yann Gautier125ed8d2022-03-10 11:33:13 +0100411
412/* define for st,pll /csg */
413#define SSCG_MODE_CENTER_SPREAD 0
414#define SSCG_MODE_DOWN_SPREAD 1
415
416/* define for st,drive */
417#define LSEDRV_LOWEST 0
418#define LSEDRV_MEDIUM_LOW 1
419#define LSEDRV_MEDIUM_HIGH 2
420#define LSEDRV_HIGHEST 3
421
422#endif