xref: /openbmc/qemu/include/hw/misc/imx6_ccm.h (revision 3d9569b8)
1 /*
2  * IMX6 Clock Control Module
3  *
4  * Copyright (C) 2012 NICTA
5  * Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
6  *
7  * This work is licensed under the terms of the GNU GPL, version 2 or later.
8  * See the COPYING file in the top-level directory.
9  */
10 
11 #ifndef IMX6_CCM_H
12 #define IMX6_CCM_H
13 
14 #include "hw/misc/imx_ccm.h"
15 #include "qemu/bitops.h"
16 
17 #define CCM_CCR 0
18 #define CCM_CCDR 1
19 #define CCM_CSR 2
20 #define CCM_CCSR 3
21 #define CCM_CACRR 4
22 #define CCM_CBCDR 5
23 #define CCM_CBCMR 6
24 #define CCM_CSCMR1 7
25 #define CCM_CSCMR2 8
26 #define CCM_CSCDR1 9
27 #define CCM_CS1CDR 10
28 #define CCM_CS2CDR 11
29 #define CCM_CDCDR 12
30 #define CCM_CHSCCDR 13
31 #define CCM_CSCDR2 14
32 #define CCM_CSCDR3 15
33 #define CCM_CDHIPR 18
34 #define CCM_CTOR 20
35 #define CCM_CLPCR 21
36 #define CCM_CISR 22
37 #define CCM_CIMR 23
38 #define CCM_CCOSR 24
39 #define CCM_CGPR 25
40 #define CCM_CCGR0 26
41 #define CCM_CCGR1 27
42 #define CCM_CCGR2 28
43 #define CCM_CCGR3 29
44 #define CCM_CCGR4 30
45 #define CCM_CCGR5 31
46 #define CCM_CCGR6 32
47 #define CCM_CMEOR 34
48 #define CCM_MAX 35
49 
50 #define CCM_ANALOG_PLL_ARM 0
51 #define CCM_ANALOG_PLL_ARM_SET 1
52 #define CCM_ANALOG_PLL_ARM_CLR 2
53 #define CCM_ANALOG_PLL_ARM_TOG 3
54 #define CCM_ANALOG_PLL_USB1 4
55 #define CCM_ANALOG_PLL_USB1_SET 5
56 #define CCM_ANALOG_PLL_USB1_CLR 6
57 #define CCM_ANALOG_PLL_USB1_TOG 7
58 #define CCM_ANALOG_PLL_USB2 8
59 #define CCM_ANALOG_PLL_USB2_SET 9
60 #define CCM_ANALOG_PLL_USB2_CLR 10
61 #define CCM_ANALOG_PLL_USB2_TOG 11
62 #define CCM_ANALOG_PLL_SYS 12
63 #define CCM_ANALOG_PLL_SYS_SET 13
64 #define CCM_ANALOG_PLL_SYS_CLR 14
65 #define CCM_ANALOG_PLL_SYS_TOG 15
66 #define CCM_ANALOG_PLL_SYS_SS 16
67 #define CCM_ANALOG_PLL_SYS_NUM 20
68 #define CCM_ANALOG_PLL_SYS_DENOM 24
69 #define CCM_ANALOG_PLL_AUDIO 28
70 #define CCM_ANALOG_PLL_AUDIO_SET 29
71 #define CCM_ANALOG_PLL_AUDIO_CLR 30
72 #define CCM_ANALOG_PLL_AUDIO_TOG 31
73 #define CCM_ANALOG_PLL_AUDIO_NUM 32
74 #define CCM_ANALOG_PLL_AUDIO_DENOM 36
75 #define CCM_ANALOG_PLL_VIDEO 40
76 #define CCM_ANALOG_PLL_VIDEO_SET 41
77 #define CCM_ANALOG_PLL_VIDEO_CLR 42
78 #define CCM_ANALOG_PLL_VIDEO_TOG 44
79 #define CCM_ANALOG_PLL_VIDEO_NUM 46
80 #define CCM_ANALOG_PLL_VIDEO_DENOM 48
81 #define CCM_ANALOG_PLL_MLB 52
82 #define CCM_ANALOG_PLL_MLB_SET 53
83 #define CCM_ANALOG_PLL_MLB_CLR 54
84 #define CCM_ANALOG_PLL_MLB_TOG 55
85 #define CCM_ANALOG_PLL_ENET 56
86 #define CCM_ANALOG_PLL_ENET_SET 57
87 #define CCM_ANALOG_PLL_ENET_CLR 58
88 #define CCM_ANALOG_PLL_ENET_TOG 59
89 #define CCM_ANALOG_PFD_480 60
90 #define CCM_ANALOG_PFD_480_SET 61
91 #define CCM_ANALOG_PFD_480_CLR 62
92 #define CCM_ANALOG_PFD_480_TOG 63
93 #define CCM_ANALOG_PFD_528 64
94 #define CCM_ANALOG_PFD_528_SET 65
95 #define CCM_ANALOG_PFD_528_CLR 66
96 #define CCM_ANALOG_PFD_528_TOG 67
97 
98 /* PMU registers */
99 #define PMU_REG_1P1 68
100 #define PMU_REG_3P0 72
101 #define PMU_REG_2P5 76
102 #define PMU_REG_CORE 80
103 
104 #define CCM_ANALOG_MISC0 84
105 #define PMU_MISC0 84
106 #define CCM_ANALOG_MISC0_SET 85
107 #define CCM_ANALOG_MISC0_CLR 86
108 #define CCM_ANALOG_MISC0_TOG 87
109 
110 #define PMU_MISC1 88
111 #define PMU_MISC1_SET 89
112 #define PMU_MISC1_CLR 90
113 #define PMU_MISC1_TOG 91
114 
115 #define CCM_ANALOG_MISC2 92
116 #define PMU_MISC2 92
117 #define CCM_ANALOG_MISC2_SET 93
118 #define CCM_ANALOG_MISC2_CLR 94
119 #define CCM_ANALOG_MISC2_TOG 95
120 
121 #define USB_ANALOG_USB1_VBUS_DETECT 104
122 #define USB_ANALOG_USB1_VBUS_DETECT_SET 105
123 #define USB_ANALOG_USB1_VBUS_DETECT_CLR 106
124 #define USB_ANALOG_USB1_VBUS_DETECT_TOG 107
125 #define USB_ANALOG_USB1_CHRG_DETECT 108
126 #define USB_ANALOG_USB1_CHRG_DETECT_SET 109
127 #define USB_ANALOG_USB1_CHRG_DETECT_CLR 110
128 #define USB_ANALOG_USB1_CHRG_DETECT_TOG 111
129 #define USB_ANALOG_USB1_VBUS_DETECT_STAT 112
130 #define USB_ANALOG_USB1_CHRG_DETECT_STAT 116
131 #define USB_ANALOG_USB1_MISC 124
132 #define USB_ANALOG_USB1_MISC_SET 125
133 #define USB_ANALOG_USB1_MISC_CLR 126
134 #define USB_ANALOG_USB1_MISC_TOG 127
135 #define USB_ANALOG_USB2_VBUS_DETECT 128
136 #define USB_ANALOG_USB2_VBUS_DETECT_SET 129
137 #define USB_ANALOG_USB2_VBUS_DETECT_CLR 130
138 #define USB_ANALOG_USB2_VBUS_DETECT_TOG 131
139 #define USB_ANALOG_USB2_CHRG_DETECT 132
140 #define USB_ANALOG_USB2_CHRG_DETECT_SET 133
141 #define USB_ANALOG_USB2_CHRG_DETECT_CLR 134
142 #define USB_ANALOG_USB2_CHRG_DETECT_TOG 135
143 #define USB_ANALOG_USB2_VBUS_DETECT_STAT 136
144 #define USB_ANALOG_USB2_CHRG_DETECT_STAT 140
145 #define USB_ANALOG_USB2_MISC 148
146 #define USB_ANALOG_USB2_MISC_SET 149
147 #define USB_ANALOG_USB2_MISC_CLR 150
148 #define USB_ANALOG_USB2_MISC_TOG 151
149 #define USB_ANALOG_DIGPROG 152
150 #define CCM_ANALOG_MAX 153
151 
152 /* CCM_CBCMR */
153 #define PRE_PERIPH_CLK_SEL_SHIFT  (18)
154 #define PRE_PERIPH_CLK_SEL_LENGTH (2)
155 
156 /* CCM_CBCDR */
157 #define AHB_PODF_SHIFT           (10)
158 #define AHB_PODF_LENGTH          (3)
159 #define IPG_PODF_SHIFT           (8)
160 #define IPG_PODF_LENGTH          (2)
161 
162 /* CCM_CSCMR1 */
163 #define PERCLK_PODF_SHIFT        (0)
164 #define PERCLK_PODF_LENGTH       (6)
165 
166 /* CCM_ANALOG_PFD_528 */
167 #define PFD0_FRAC_SHIFT          (0)
168 #define PFD0_FRAC_LENGTH         (6)
169 #define PFD2_FRAC_SHIFT          (16)
170 #define PFD2_FRAC_LENGTH         (6)
171 
172 /* CCM_ANALOG_PLL_SYS */
173 #define DIV_SELECT_SHIFT         (0)
174 #define DIV_SELECT_LENGTH        (1)
175 
176 #define CCM_ANALOG_PLL_LOCK      (1 << 31);
177 
178 #define EXTRACT(value, name) extract32(value, name##_SHIFT, name##_LENGTH)
179 
180 #define TYPE_IMX6_CCM "imx6.ccm"
181 #define IMX6_CCM(obj) OBJECT_CHECK(IMX6CCMState, (obj), TYPE_IMX6_CCM)
182 
183 typedef struct IMX6CCMState {
184     /* <private> */
185     IMXCCMState parent_obj;
186 
187     /* <public> */
188     MemoryRegion container;
189     MemoryRegion ioccm;
190     MemoryRegion ioanalog;
191 
192     uint32_t ccm[CCM_MAX];
193     uint32_t analog[CCM_ANALOG_MAX];
194 
195 } IMX6CCMState;
196 
197 #endif /* IMX6_CCM_H */
198