2 * IMX6 Clock Control Module
4 * Copyright (C) 2012 NICTA
5 * Updated by Jean-Christophe Dubois <jcd@tribudubois.net>
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.
14 #include "hw/misc/imx_ccm.h"
15 #include "qemu/bitops.h"
30 #define CCM_CHSCCDR 13
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
99 #define PMU_REG_1P1 68
100 #define PMU_REG_3P0 72
101 #define PMU_REG_2P5 76
102 #define PMU_REG_CORE 80
104 #define CCM_ANALOG_MISC0 84
106 #define CCM_ANALOG_MISC0_SET 85
107 #define CCM_ANALOG_MISC0_CLR 86
108 #define CCM_ANALOG_MISC0_TOG 87
111 #define PMU_MISC1_SET 89
112 #define PMU_MISC1_CLR 90
113 #define PMU_MISC1_TOG 91
115 #define CCM_ANALOG_MISC2 92
117 #define CCM_ANALOG_MISC2_SET 93
118 #define CCM_ANALOG_MISC2_CLR 94
119 #define CCM_ANALOG_MISC2_TOG 95
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
153 #define PRE_PERIPH_CLK_SEL_SHIFT (18)
154 #define PRE_PERIPH_CLK_SEL_LENGTH (2)
157 #define AHB_PODF_SHIFT (10)
158 #define AHB_PODF_LENGTH (3)
159 #define IPG_PODF_SHIFT (8)
160 #define IPG_PODF_LENGTH (2)
163 #define PERCLK_PODF_SHIFT (0)
164 #define PERCLK_PODF_LENGTH (6)
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)
172 /* CCM_ANALOG_PLL_SYS */
173 #define DIV_SELECT_SHIFT (0)
174 #define DIV_SELECT_LENGTH (1)
176 #define CCM_ANALOG_PLL_LOCK (1 << 31);
178 #define EXTRACT(value, name) extract32(value, name##_SHIFT, name##_LENGTH)
180 #define TYPE_IMX6_CCM "imx6.ccm"
181 #define IMX6_CCM(obj) OBJECT_CHECK(IMX6CCMState, (obj), TYPE_IMX6_CCM)
183 typedef struct IMX6CCMState
{
185 IMXCCMState parent_obj
;
188 MemoryRegion container
;
190 MemoryRegion ioanalog
;
192 uint32_t ccm
[CCM_MAX
];
193 uint32_t analog
[CCM_ANALOG_MAX
];
197 #endif /* IMX6_CCM_H */