1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright 2020 Foundries Ltd
4  */
5 
6 #ifndef __IMX8M_CRM_H
7 #define __IMX8M_CRM_H
8 
9 /* CCGRx Registers (Clock Gating) */
10 #define CCM_CCGR0		0x4000
11 #define CCM_CCGRx_OFFSET	0x10
12 #define CCM_CCGRx(idx)		(((idx) * CCM_CCGRx_OFFSET) + CCM_CCGR0)
13 #define CCM_CCGRx_SET(idx)	(CCM_CCGRx(idx) + 0x4)
14 #define CCM_CCGRx_CLR(idx)	(CCM_CCGRx(idx) + 0x8)
15 #define CCM_CCGRx_TOG(idx)	(CCM_CCGRx(idx) + 0xC)
16 
17 #define BS_CCM_CCGRx_SETTING(idx)	((idx) * 4)
18 #define BM_CCM_CCGRx_SETTING(idx)	\
19 			SHIFT_U32(0x3, BS_CCM_CCGRx_SETTING(idx))
20 #define CCM_CCGRx_DISABLE(idx)		\
21 			SHIFT_U32(0, BS_CCM_CCGRx_SETTING(idx))
22 #define CCM_CCGRx_RUN(idx)		\
23 			BIT32(BS_CCM_CCGRx_SETTING(idx))
24 #define CCM_CCGRx_RUN_WAIT(idx)		\
25 			SHIFT_U32(0x2, BS_CCM_CCGRx_SETTING(idx))
26 #define CCM_CCGRx_ALWAYS_ON(idx)	\
27 			SHIFT_U32(0x3, BS_CCM_CCGRx_SETTING(idx))
28 
29 #define CCM_CCRG_I2C1		23
30 #define CCM_CCRG_I2C2		24
31 #define CCM_CCRG_I2C3		25
32 #define CCM_CCRG_I2C4		26
33 #define CCM_CCRG_OCOTP		34
34 
35 #endif  /* __IMX8M_CRM_H */
36