36#define CMU_CTRL MMIO32(CMU_BASE + 0x000)
37#define CMU_HFCORECLKDIV MMIO32(CMU_BASE + 0x004)
38#define CMU_HFPERCLKDIV MMIO32(CMU_BASE + 0x008)
39#define CMU_HFRCOCTRL MMIO32(CMU_BASE + 0x00C)
40#define CMU_LFRCOCTRL MMIO32(CMU_BASE + 0x010)
41#define CMU_AUXHFRCOCTR MMIO32(CMU_BASE + 0x014)
42#define CMU_CALCTRL MMIO32(CMU_BASE + 0x018)
43#define CMU_CALCNT MMIO32(CMU_BASE + 0x01C)
44#define CMU_OSCENCMD MMIO32(CMU_BASE + 0x020)
45#define CMU_CMD MMIO32(CMU_BASE + 0x024)
46#define CMU_LFCLKSEL MMIO32(CMU_BASE + 0x028)
47#define CMU_STATUS MMIO32(CMU_BASE + 0x02C)
48#define CMU_IF MMIO32(CMU_BASE + 0x030)
49#define CMU_IFS MMIO32(CMU_BASE + 0x034)
50#define CMU_IFC MMIO32(CMU_BASE + 0x038)
51#define CMU_IEN MMIO32(CMU_BASE + 0x03C)
52#define CMU_HFCORECLKEN0 MMIO32(CMU_BASE + 0x040)
53#define CMU_HFPERCLKEN0 MMIO32(CMU_BASE + 0x044)
54#define CMU_SYNCBUSY MMIO32(CMU_BASE + 0x050)
55#define CMU_FREEZE MMIO32(CMU_BASE + 0x054)
56#define CMU_LFACLKEN0 MMIO32(CMU_BASE + 0x058)
57#define CMU_LFBCLKEN0 MMIO32(CMU_BASE + 0x060)
58#define CMU_LFCCLKEN0 MMIO32(CMU_BASE + 0x064)
59#define CMU_LFAPRESC0 MMIO32(CMU_BASE + 0x068)
60#define CMU_LFBPRESC0 MMIO32(CMU_BASE + 0x070)
61#define CMU_PCNTCTRL MMIO32(CMU_BASE + 0x078)
62#define CMU_ROUTE MMIO32(CMU_BASE + 0x080)
63#define CMU_LOCK MMIO32(CMU_BASE + 0x084)
64#define CMU_USBCRCTRL MMIO32(CMU_BASE + 0x0D0)
65#define CMU_USHFRCOCTRL MMIO32(CMU_BASE + 0x0D4)
66#define CMU_USHFRCOTUNE MMIO32(CMU_BASE + 0x0D8)
67#define CMU_USHFRCOCONF MMIO32(CMU_BASE + 0x0DC)
70#define CMU_CTRL_CLKOUTSEL1_SHIFT (23)
71#define CMU_CTRL_CLKOUTSEL1_MASK (0x7 << CMU_CTRL_CLKOUTSEL1_SHIFT)
72#define CMU_CTRL_CLKOUTSEL1(v) \
73 (((v) << CMU_CTRL_CLKOUTSEL1_SHIFT) & CMU_CTRL_CLKOUTSEL1_MASK)
74#define CMU_CTRL_CLKOUTSEL1_LFRCO CMU_CTRL_CLKOUTSEL1(0)
75#define CMU_CTRL_CLKOUTSEL1_LFXO CMU_CTRL_CLKOUTSEL1(1)
76#define CMU_CTRL_CLKOUTSEL1_HFCLK CMU_CTRL_CLKOUTSEL1(2)
77#define CMU_CTRL_CLKOUTSEL1_LFXOQ CMU_CTRL_CLKOUTSEL1(3)
78#define CMU_CTRL_CLKOUTSEL1_HFXOQ CMU_CTRL_CLKOUTSEL1(4)
79#define CMU_CTRL_CLKOUTSEL1_LFRCOQ CMU_CTRL_CLKOUTSEL1(5)
80#define CMU_CTRL_CLKOUTSEL1_HFRCOQ CMU_CTRL_CLKOUTSEL1(6)
81#define CMU_CTRL_CLKOUTSEL1_AUXHFRCOQ CMU_CTRL_CLKOUTSEL1(7)
82#define CMU_CTRL_CLKOUTSEL1_USHFRCO CMU_CTRL_CLKOUTSEL1(8)
84#define CMU_CTRL_CLKOUTSEL0_SHIFT (20)
85#define CMU_CTRL_CLKOUTSEL0_MASK (0x7 << CMU_CTRL_CLKOUTSEL0_SHIFT)
86#define CMU_CTRL_CLKOUTSEL0(v) \
87 (((v) << CMU_CTRL_CLKOUTSEL0_SHIFT) & CMU_CTRL_CLKOUTSEL0_MASK)
88#define CMU_CTRL_CLKOUTSEL0_HFRCO CMU_CTRL_CLKOUTSEL0(0)
89#define CMU_CTRL_CLKOUTSEL0_HFXO CMU_CTRL_CLKOUTSEL0(1)
90#define CMU_CTRL_CLKOUTSEL0_HFCLK2 CMU_CTRL_CLKOUTSEL0(2)
91#define CMU_CTRL_CLKOUTSEL0_HFCLK4 CMU_CTRL_CLKOUTSEL0(3)
92#define CMU_CTRL_CLKOUTSEL0_HFCLK8 CMU_CTRL_CLKOUTSEL0(4)
93#define CMU_CTRL_CLKOUTSEL0_HFCLK16 CMU_CTRL_CLKOUTSEL0(5)
94#define CMU_CTRL_CLKOUTSEL0_ULFRCO CMU_CTRL_CLKOUTSEL0(6)
95#define CMU_CTRL_CLKOUTSEL0_AUXHFRCO CMU_CTRL_CLKOUTSEL0(7)
97#define CMU_CTRL_LFXOTIMEOUT_SHIFT (18)
98#define CMU_CTRL_LFXOTIMEOUT_MASK (0x3 << CMU_CTRL_LFXOTIMEOUT_SHIFT)
99#define CMU_CTRL_LFXOTIMEOUT(v) \
100 (((v) << CMU_CTRL_LFXOTIMEOUT_SHIFT) & CMU_CTRL_LFXOTIMEOUT_MASK)
101#define CMU_CTRL_LFXOTIMEOUT_8CYCLES CMU_CTRL_LFXOTIMEOUT(0)
102#define CMU_CTRL_LFXOTIMEOUT_1KCYCLES CMU_CTRL_LFXOTIMEOUT(1)
103#define CMU_CTRL_LFXOTIMEOUT_16KCYCLES CMU_CTRL_LFXOTIMEOUT(2)
104#define CMU_CTRL_LFXOTIMEOUT_32KCYCLES CMU_CTRL_LFXOTIMEOUT(3)
106#define CMU_CTRL_LFXOBUFCUR (1 << 17)
108#define CMU_CTRL_HFCLKDIV_SHIFT (14)
109#define CMU_CTRL_HFCLKDIV_MASK (0x7 << CMU_CTRL_HFCLKDIV_SHIFT)
110#define CMU_CTRL_HFCLKDIV(v) \
111 (((v) << CMU_CTRL_HFCLKDIV_SHIFT) & CMU_CTRL_HFCLKDIV_MASK)
112#define CMU_CTRL_HFCLKDIV_NODIV CMU_CTRL_HFCLKDIV(0)
113#define CMU_CTRL_HFCLKDIV_DIV2 CMU_CTRL_HFCLKDIV(1)
114#define CMU_CTRL_HFCLKDIV_DIV3 CMU_CTRL_HFCLKDIV(2)
115#define CMU_CTRL_HFCLKDIV_DIV4 CMU_CTRL_HFCLKDIV(3)
116#define CMU_CTRL_HFCLKDIV_DIV5 CMU_CTRL_HFCLKDIV(4)
117#define CMU_CTRL_HFCLKDIV_DIV6 CMU_CTRL_HFCLKDIV(5)
118#define CMU_CTRL_HFCLKDIV_DIV7 CMU_CTRL_HFCLKDIV(6)
119#define CMU_CTRL_HFCLKDIV_DIV8 CMU_CTRL_HFCLKDIV(7)
121#define CMU_CTRL_LFXOBOOST (1 << 13)
123#define CMU_CTRL_LFXOMODE_SHIFT (11)
124#define CMU_CTRL_LFXOMODE_MASK (0x3 << CMU_CTRL_LFXOMODE_SHIFT)
125#define CMU_CTRL_LFXOMODE(v) \
126 (((v) << CMU_CTRL_LFXOMODE_SHIFT) & CMU_CTRL_LFXOMODE_MASK)
127#define CMU_CTRL_LFXOMODE_XTAL CMU_CTRL_LFXOMODE(0)
128#define CMU_CTRL_LFXOMODE_BUFEXTCLK CMU_CTRL_LFXOMODE(1)
129#define CMU_CTRL_LFXOMODE_DIGEXTCLK CMU_CTRL_LFXOMODE(2)
131#define CMU_CTRL_HFXOTIMEOUT_SHIFT (9)
132#define CMU_CTRL_HFXOTIMEOUT_MASK (0x3 << CMU_CTRL_HFXOTIMEOUT_SHIFT)
133#define CMU_CTRL_HFXOTIMEOUT(v) \
134 (((v) << CMU_CTRL_HFXOTIMEOUT_SHIFT) & CMU_CTRL_HFXOTIMEOUT_MASK)
135#define CMU_CTRL_HFXOTIMEOUT_8CYCLES CMU_CTRL_HFXOTIMEOUT(0)
136#define CMU_CTRL_HFXOTIMEOUT_256CYCLES CMU_CTRL_HFXOTIMEOUT(1)
137#define CMU_CTRL_HFXOTIMEOUT_1KCYCLES CMU_CTRL_HFXOTIMEOUT(2)
138#define CMU_CTRL_HFXOTIMEOUT_16KCYCLES CMU_CTRL_HFXOTIMEOUT(3)
140#define CMU_CTRL_HFXOGLITCHDETEN (1 << 7)
141#define CMU_CTRL_HFXOBUFCUR_MASK (0x3 << 5)
143#define CMU_CTRL_HFXOBOOST_SHIFT (2)
144#define CMU_CTRL_HFXOBOOST_MASK (0x3 << CMU_CTRL_HFXOBOOST_SHIFT)
145#define CMU_CTRL_HFXOBOOST(v) \
146 (((v) << CMU_CTRL_HFXOBOOST_SHIFT) & CMU_CTRL_HFXOBOOST_MASK)
147#define CMU_CTRL_HFXOBOOST_50PCENT CMU_CTRL_HFXOBOOST(0)
148#define CMU_CTRL_HFXOBOOST_70PCENT CMU_CTRL_HFXOBOOST(1)
149#define CMU_CTRL_HFXOBOOST_80PCENT CMU_CTRL_HFXOBOOST(2)
150#define CMU_CTRL_HFXOBOOST_100PCENT CMU_CTRL_HFXOBOOST(3)
152#define CMU_CTRL_HFXOMODE_SHIFT (0)
153#define CMU_CTRL_HFXOMODE_MASK (0x3 << CMU_CTRL_HFXOMODE_SHIFT)
154#define CMU_CTRL_HFXOMODE(v) \
155 (((v) << CMU_CTRL_HFXOMODE_SHIFT) & CMU_CTRL_HFXOMODE_MASK)
156#define CMU_CTRL_HFXOMODE_XTAL CMU_CTRL_HFXOMODE(0)
157#define CMU_CTRL_HFXOMODE_BUFEXTCLK CMU_CTRL_HFXOMODE(1)
158#define CMU_CTRL_HFXOMODE_DIGEXTCLK CMU_CTRL_HFXOMODE(2)
161#define CMU_HFCORECLKDIV_HFCORECLKLEDIV (1 << 8)
163#define CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT (0)
164#define CMU_HFCORECLKDIV_HFCORECLKDIV_MASK \
165 (0xF << CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT)
166#define CMU_HFCORECLKDIV_HFCORECLKDIV(v) \
167 (((v) << CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT) & \
168 CMU_HFCORECLKDIV_HFCORECLKDIV_MASK)
169#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK \
170 CMU_HFCORECLKDIV_HFCORECLKDIV(0)
171#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK2 \
172 CMU_HFCORECLKDIV_HFCORECLKDIV(1)
173#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK4 \
174 CMU_HFCORECLKDIV_HFCORECLKDIV(2)
175#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK8 \
176 CMU_HFCORECLKDIV_HFCORECLKDIV(3)
177#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK16 \
178 CMU_HFCORECLKDIV_HFCORECLKDIV(4)
179#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK32 \
180 CMU_HFCORECLKDIV_HFCORECLKDIV(5)
181#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK64 \
182 CMU_HFCORECLKDIV_HFCORECLKDIV(6)
183#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK128 \
184 CMU_HFCORECLKDIV_HFCORECLKDIV(7)
185#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK256 \
186 CMU_HFCORECLKDIV_HFCORECLKDIV(8)
187#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK512 \
188 CMU_HFCORECLKDIV_HFCORECLKDIV(9)
190#define CMU_HFCORECLKDIV_HFCORECLKDIV_NODIV \
191 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK
192#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV2 \
193 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK2
194#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV4 \
195 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK4
196#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV8 \
197 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK8
198#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV16 \
199 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK16
200#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV32 \
201 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK32
202#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV64 \
203 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK64
204#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV128 \
205 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK128
206#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV256 \
207 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK256
208#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV512 \
209 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK512
212#define CMU_HFPERCLKDIV_HFPERCLKEN (1 << 8)
214#define CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT (0)
215#define CMU_HFPERCLKDIV_HFPERCLKDIV_MASK \
216 (0xF << CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT)
217#define CMU_HFPERCLKDIV_HFPERCLKDIV(v) \
218 (((v) << CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT) & \
219 CMU_HFPERCLKDIV_HFPERCLKDIV_MASK)
220#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK CMU_HFPERCLKDIV_HFPERCLKDIV(0)
221#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK2 CMU_HFPERCLKDIV_HFPERCLKDIV(1)
222#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK4 CMU_HFPERCLKDIV_HFPERCLKDIV(2)
223#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK8 CMU_HFPERCLKDIV_HFPERCLKDIV(3)
224#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK16 CMU_HFPERCLKDIV_HFPERCLKDIV(4)
225#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK32 CMU_HFPERCLKDIV_HFPERCLKDIV(5)
226#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK64 CMU_HFPERCLKDIV_HFPERCLKDIV(6)
227#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK128 CMU_HFPERCLKDIV_HFPERCLKDIV(7)
228#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK256 CMU_HFPERCLKDIV_HFPERCLKDIV(8)
229#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK512 CMU_HFPERCLKDIV_HFPERCLKDIV(9)
232#define CMU_HFPERCLKDIV_HFPERCLKDIV_NODIV \
233 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK
234#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV2 \
235 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK2
236#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV4 \
237 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK4
238#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV8 \
239 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK8
240#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV16 \
241 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK16
242#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV32 \
243 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK32
244#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV64 \
245 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK64
246#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV128 \
247 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK128
248#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV256 \
249 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK256
250#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV512 \
251 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK512
254#define CMU_HFRCOCTRL_SUDELAY_SHIFT (12)
255#define CMU_HFRCOCTRL_SUDELAY_MASK (0x1F << CMU_HFRCOCTRL_SUDELAY_SHIFT)
256#define CMU_HFRCOCTRL_SUDELAY(v) \
257 ((((v) << CMU_HFRCOCTRL_SUDELAY_SHIFT) & CMU_HFRCOCTRL_SUDELAY_MASK))
259#define CMU_HFRCOCTRL_BAND_SHIFT (8)
260#define CMU_HFRCOCTRL_BAND_MASK (0x7 << CMU_HFRCOCTRL_BAND_SHIFT)
261#define CMU_HFRCOCTRL_BAND(v) \
262 (((v) << CMU_HFRCOCTRL_BAND_SHIFT) & CMU_HFRCOCTRL_BAND_MASK)
263#define CMU_HFRCOCTRL_BAND_1MHZ CMU_HFRCOCTRL_BAND(0)
264#define CMU_HFRCOCTRL_BAND_7MHZ CMU_HFRCOCTRL_BAND(1)
265#define CMU_HFRCOCTRL_BAND_11MHZ CMU_HFRCOCTRL_BAND(2)
266#define CMU_HFRCOCTRL_BAND_14MHZ CMU_HFRCOCTRL_BAND(3)
267#define CMU_HFRCOCTRL_BAND_21MHZ CMU_HFRCOCTRL_BAND(4)
269#define CMU_HFRCOCTRL_TUNING_SHIFT (0)
270#define CMU_HFRCOCTRL_TUNING_MASK (0xFF << CMU_HFRCOCTRL_TUNING_SHIFT)
271#define CMU_HFRCOCTRL_TUNING(v) \
272 (((v) << CMU_HFRCOCTRL_TUNING_SHIFT) & CMU_HFRCOCTRL_TUNING_MASK)
275#define CMU_LFRCOCTRL_TUNING_SHIFT (0)
276#define CMU_LFRCOCTRL_TUNING_MASK (0xFF << CMU_LFRCOCTRL_TUNING_SHIFT)
277#define CMU_LFRCOCTRL_TUNING(v) \
278 (((v) << CMU_LFRCOCTRL_TUNING_SHIFT) & CMU_LFRCOCTRL_TUNING_MASK)
281#define CMU_AUXHFRCOCTRL_BAND_SHIFT (8)
282#define CMU_AUXHFRCOCTRL_BAND_MASK (0x7 << CMU_AUXHFRCOCTRL_BAND_SHIFT)
283#define CMU_AUXHFRCOCTRL_BAND(v) \
284 (((v) << CMU_AUXHFRCOCTRL_BAND_SHIFT) & CMU_AUXHFRCOCTRL_BAND_MASK)
285#define CMU_AUXHFRCOCTRL_BAND_14MHZ CMU_AUXHFRCOCTRL_BAND(0)
286#define CMU_AUXHFRCOCTRL_BAND_11MHZ CMU_AUXHFRCOCTRL_BAND(1)
287#define CMU_AUXHFRCOCTRL_BAND_7MHZ CMU_AUXHFRCOCTRL_BAND(2)
288#define CMU_AUXHFRCOCTRL_BAND_1MHZ CMU_AUXHFRCOCTRL_BAND(3)
289#define CMU_AUXHFRCOCTRL_BAND_28MHZ CMU_AUXHFRCOCTRL_BAND(6)
290#define CMU_AUXHFRCOCTRL_BAND_21MHZ CMU_AUXHFRCOCTRL_BAND(7)
292#define CMU_AUXHFRCOCTRL_TUNING_SHIFT (0)
293#define CMU_AUXHFRCOCTRL_TUNING_MASK (0xFF << CMU_AUXHFRCOCTRL_TUNING_SHIFT)
294#define CMU_AUXHFRCOCTRL_TUNING(v) \
295 (((v) << CMU_AUXHFRCOCTRL_TUNING_SHIFT) & CMU_AUXHFRCOCTRL_TUNING_MASK)
298#define CMU_CALCTRL_CONT (1 << 6)
300#define CMU_CALCTRL_DOWNSEL_SHIFT (3)
301#define CMU_CALCTRL_DOWNSEL_MASK (0x7 << CMU_CALCTRL_DOWNSEL_SHIFT)
302#define CMU_CALCTRL_DOWNSEL(v) \
303 (((v) << CMU_CALCTRL_DOWNSEL_SHIFT) & CMU_CALCTRL_DOWNSEL_MASK)
304#define CMU_CALCTRL_DOWNSEL_HFCLK CMU_CALCTRL_DOWNSEL(0)
305#define CMU_CALCTRL_DOWNSEL_HFXO CMU_CALCTRL_DOWNSEL(1)
306#define CMU_CALCTRL_DOWNSEL_LFXO CMU_CALCTRL_DOWNSEL(2)
307#define CMU_CALCTRL_DOWNSEL_HFRCO CMU_CALCTRL_DOWNSEL(3)
308#define CMU_CALCTRL_DOWNSEL_LFRCO CMU_CALCTRL_DOWNSEL(4)
309#define CMU_CALCTRL_DOWNSEL_AUXHFRCO CMU_CALCTRL_DOWNSEL(5)
310#define CMU_CALCTRL_DOWNSEL_USHFRCO CMU_CALCTRL_DOWNSEL(6)
312#define CMU_CALCTRL_UPSEL_SHIFT (3)
313#define CMU_CALCTRL_UPSEL_MASK (0x7 << CMU_CALCTRL_UPSEL_SHIFT)
314#define CMU_CALCTRL_UPSEL(v) \
315 (((v) << CMU_CALCTRL_UPSEL_SHIFT) & CMU_CALCTRL_UPSEL_MASK)
316#define CMU_CALCTRL_UPSEL_HFXO CMU_CALCTRL_UPSEL(0)
317#define CMU_CALCTRL_UPSEL_LFXO CMU_CALCTRL_UPSEL(1)
318#define CMU_CALCTRL_UPSEL_HFRCO CMU_CALCTRL_UPSEL(2)
319#define CMU_CALCTRL_UPSEL_LFRCO CMU_CALCTRL_UPSEL(3)
320#define CMU_CALCTRL_UPSEL_AUXHFRCO CMU_CALCTRL_UPSEL(4)
321#define CMU_CALCTRL_UPSEL_USHFRCO CMU_CALCTRL_UPSEL(5)
324#define CMU_CALCNT_CALCNT_SHIFT (0)
325#define CMU_CALCNT_CALCNT_MASK (0xFFFFF << CMU_CALCNT_CALCNT_SHIFT)
326#define CMU_CALCNT_CALCNT(v) \
327 (((v) << CMU_CALCNT_CALCNT_SHIFT) & CMU_CALCNT_CALCNT_MASK)
331#define CMU_OSCENCMD_USHFRCODIS (1 << 11)
332#define CMU_OSCENCMD_USHFRCOEN (1 << 10)
333#define CMU_OSCENCMD_LFXODIS (1 << 9)
334#define CMU_OSCENCMD_LFXOEN (1 << 8)
335#define CMU_OSCENCMD_LFRCODIS (1 << 7)
336#define CMU_OSCENCMD_LFRCOEN (1 << 6)
337#define CMU_OSCENCMD_AUXHFRCODIS (1 << 5)
338#define CMU_OSCENCMD_AUXHFRCOEN (1 << 4)
339#define CMU_OSCENCMD_HFXODIS (1 << 3)
340#define CMU_OSCENCMD_HFXOEN (1 << 2)
341#define CMU_OSCENCMD_HFRCODIS (1 << 1)
342#define CMU_OSCENCMD_HFRCOEN (1 << 0)
345#define CMU_CMD_USBCCLKSEL_SHIFT (5)
346#define CMU_CMD_USBCCLKSEL_MASK (0x5 << CMU_CMD_USBCCLKSEL_SHIFT)
347#define CMU_CMD_USBCCLKSEL(v) \
348 (((v) << CMU_CMD_USBCCLKSEL_SHIFT) & CMU_CMD_USBCCLKSEL_MASK)
349#define CMU_CMD_USBCCLKSEL_LFXO CMU_CMD_USBCCLKSEL(2)
350#define CMU_CMD_USBCCLKSEL_LFRCO CMU_CMD_USBCCLKSEL(3)
351#define CMU_CMD_USBCCLKSEL_USHFRCO CMU_CMD_USBCCLKSEL(4)
353#define CMU_CMD_CALSTOP (1 << 4)
354#define CMU_CMD_CALSTART (1 << 3)
356#define CMU_CMD_HFCLKSEL_SHIFT (0)
357#define CMU_CMD_HFCLKSEL_MASK (0x7 << CMU_CMD_HFCLKSEL_SHIFT)
358#define CMU_CMD_HFCLKSEL(v) \
359 (((v) << CMU_CMD_HFCLKSEL_SHIFT) & CMU_CMD_HFCLKSEL_MASK)
360#define CMU_CMD_HFCLKSEL_HFRCO CMU_CMD_HFCLKSEL(1)
361#define CMU_CMD_HFCLKSEL_HFXO CMU_CMD_HFCLKSEL(2)
362#define CMU_CMD_HFCLKSEL_LFRCO CMU_CMD_HFCLKSEL(3)
363#define CMU_CMD_HFCLKSEL_LFXO CMU_CMD_HFCLKSEL(4)
364#define CMU_CMD_HFCLKSEL_USHFRCODIV2 CMU_CMD_HFCLKSEL(5)
368#define CMU_LFCLKSEL_LFBE (1 << 20)
370#define CMU_LFCLKSEL_LFAE (1 << 16)
373#define CMU_LFCLKSEL_LFC_SHIFT (4)
374#define CMU_LFCLKSEL_LFC_MASK (0x3 << CMU_LFCLKSEL_LFC_SHIFT)
375#define CMU_LFCLKSEL_LFC(v) \
376 (((v) << CMU_LFCLKSEL_LFC_SHIFT) & CMU_LFCLKSEL_LFC_MASK)
377#define CMU_LFCLKSEL_LFC_DISABLED CMU_LFCLKSEL_LFC(0)
378#define CMU_LFCLKSEL_LFC_LFRCO CMU_LFCLKSEL_LFC(1)
379#define CMU_LFCLKSEL_LFC_LFXO CMU_LFCLKSEL_LFC(2)
381#define CMU_LFCLKSEL_LFB_SHIFT (2)
382#define CMU_LFCLKSEL_LFB_MASK (0x3 << CMU_LFCLKSEL_LFB_SHIFT)
383#define CMU_LFCLKSEL_LFB(v) \
384 (((v) << CMU_LFCLKSEL_LFB_SHIFT) & CMU_LFCLKSEL_LFB_MASK)
386#define CMU_LFCLKSEL_LFA_SHIFT (0)
387#define CMU_LFCLKSEL_LFA_MASK (0x3 << CMU_LFCLKSEL_LFA_SHIFT)
388#define CMU_LFCLKSEL_LFA(v) \
389 (((v) << CMU_LFCLKSEL_LFA_SHIFT) & CMU_LFCLKSEL_LFA_MASK)
393#define CMU_STATUS_USHFRCODIV2SEL (1 << 26)
395#define CMU_STATUS_USHFRCOSUSPEND (1 << 23)
396#define CMU_STATUS_USHFRCORDY (1 << 22)
397#define CMU_STATUS_USHFRCOENS (1 << 21)
398#define CMU_STATUS_USBCHFCLKSYNC (1 << 20)
400#define CMU_STATUS_USBCUSHFRCOSEL (1 << 18)
401#define CMU_STATUS_USBCLFRCOSEL (1 << 17)
402#define CMU_STATUS_USBCLFXOSEL (1 << 16)
404#define CMU_STATUS_CALBSY (1 << 14)
405#define CMU_STATUS_LFXOSEL (1 << 13)
406#define CMU_STATUS_LFRCOSEL (1 << 12)
407#define CMU_STATUS_HFXOSEL (1 << 11)
408#define CMU_STATUS_HFRCOSEL (1 << 10)
409#define CMU_STATUS_LFXORDY (1 << 9)
410#define CMU_STATUS_LFXOENS (1 << 8)
411#define CMU_STATUS_LFRCORDY (1 << 7)
412#define CMU_STATUS_LFRCOENS (1 << 6)
413#define CMU_STATUS_AUXHFRCORDY (1 << 5)
414#define CMU_STATUS_AUXHFRCOENS (1 << 4)
415#define CMU_STATUS_HFXORDY (1 << 3)
416#define CMU_STATUS_HFXOENS (1 << 2)
417#define CMU_STATUS_HFRCORDY (1 << 1)
418#define CMU_STATUS_HFRCOENS (1 << 0)
422#define CMU_IF_USBCHFOSCSEL (1 << 9)
423#define CMU_IF_USHFRCORDY (1 << 8)
425#define CMU_IF_CALOF (1 << 6)
426#define CMU_IF_CALRDY (1 << 5)
427#define CMU_IF_AUXHFRCORDY (1 << 4)
428#define CMU_IF_LFXORDY (1 << 3)
429#define CMU_IF_LFRCORDY (1 << 2)
430#define CMU_IF_HFXORDY (1 << 1)
431#define CMU_IF_HFRCORDY (1 << 0)
435#define CMU_IFS_USBCHFOSCSEL (1 << 9)
436#define CMU_IFS_USHFRCORDY (1 << 8)
438#define CMU_IFS_CALOF (1 << 6)
439#define CMU_IFS_CALRDY (1 << 5)
440#define CMU_IFS_AUXHFRCORDY (1 << 4)
441#define CMU_IFS_LFXORDY (1 << 3)
442#define CMU_IFS_LFRCORDY (1 << 2)
443#define CMU_IFS_HFXORDY (1 << 1)
444#define CMU_IFS_HFRCORDY (1 << 0)
448#define CMU_IFC_USBCHFOSCSEL (1 << 9)
449#define CMU_IFC_USHFRCORDY (1 << 8)
451#define CMU_IFC_CALOF (1 << 6)
452#define CMU_IFC_CALRDY (1 << 5)
453#define CMU_IFC_AUXHFRCORDY (1 << 4)
454#define CMU_IFC_LFXORDY (1 << 3)
455#define CMU_IFC_LFRCORDY (1 << 2)
456#define CMU_IFC_HFXORDY (1 << 1)
457#define CMU_IFC_HFRCORDY (1 << 0)
461#define CMU_IEN_USBCHFOSCSEL (1 << 9)
462#define CMU_IEN_USHFRCORDY (1 << 8)
464#define CMU_IEN_CALOF (1 << 6)
465#define CMU_IEN_CALRDY (1 << 5)
466#define CMU_IEN_AUXHFRCORDY (1 << 4)
467#define CMU_IEN_LFXORDY (1 << 3)
468#define CMU_IEN_LFRCORDY (1 << 2)
469#define CMU_IEN_HFXORDY (1 << 1)
470#define CMU_IEN_HFRCORDY (1 << 0)
474#define CMU_HFCORECLKEN0_USB (1 << 4)
475#define CMU_HFCORECLKEN0_USBC (1 << 3)
476#define CMU_HFCORECLKEN0_LE (1 << 2)
477#define CMU_HFCORECLKEN0_DMA (1 << 1)
478#define CMU_HFCORECLKEN0_AES (1 << 0)
482#define CMU_HFPERCLKEN0_I2C0 (1 << 11)
483#define CMU_HFPERCLKEN0_ADC0 (1 << 10)
484#define CMU_HFPERCLKEN0_VCMP (1 << 9)
485#define CMU_HFPERCLKEN0_GPIO (1 << 8)
486#define CMU_HFPERCLKEN0_IDAC0 (1 << 7)
487#define CMU_HFPERCLKEN0_PRS (1 << 6)
488#define CMU_HFPERCLKEN0_ACMP0 (1 << 5)
489#define CMU_HFPERCLKEN0_USART1 (1 << 4)
490#define CMU_HFPERCLKEN0_USART0 (1 << 3)
491#define CMU_HFPERCLKEN0_TIMER2 (1 << 2)
492#define CMU_HFPERCLKEN0_TIMER1 (1 << 1)
493#define CMU_HFPERCLKEN0_TIMER0 (1 << 0)
497#define CMU_SYNCBUSY_LFCCLKEN0 (1 << 8)
499#define CMU_SYNCBUSY_LFBPRESC0 (1 << 6)
501#define CMU_SYNCBUSY_LFBCLKEN0 (1 << 4)
503#define CMU_SYNCBUSY_LFAPRESC0 (1 << 2)
505#define CMU_SYNCBUSY_LFACLKEN0 (1 << 0)
508#define CMU_FREEZE_REGFREEZE (1 << 0)
511#define CMU_LFACLKEN0_RTC (1 << 0)
514#define CMU_LFBCLKEN0_LEUART0 (1 << 0)
517#define CMU_LFCCLKEN0_USBLE (1 << 0)
520#define CMU_LFAPRESC0_RTC_SHIFT (0)
521#define CMU_LFAPRESC0_RTC_MASK (0xF << CMU_LFAPRESC0_RTC_SHIFT)
522#define CMU_LFAPRESC0_RTC(v) \
523 (((v) << CMU_LFAPRESC0_RTC_SHIFT) & CMU_LFAPRESC0_RTC_MASK)
524#define CMU_LFAPRESC0_RTC_DIV1 CMU_LFAPRESC0_RTC(0)
525#define CMU_LFAPRESC0_RTC_DIV2 CMU_LFAPRESC0_RTC(1)
526#define CMU_LFAPRESC0_RTC_DIV4 CMU_LFAPRESC0_RTC(2)
527#define CMU_LFAPRESC0_RTC_DIV8 CMU_LFAPRESC0_RTC(3)
528#define CMU_LFAPRESC0_RTC_DIV16 CMU_LFAPRESC0_RTC(4)
529#define CMU_LFAPRESC0_RTC_DIV32 CMU_LFAPRESC0_RTC(5)
530#define CMU_LFAPRESC0_RTC_DIV64 CMU_LFAPRESC0_RTC(6)
531#define CMU_LFAPRESC0_RTC_DIV128 CMU_LFAPRESC0_RTC(7)
532#define CMU_LFAPRESC0_RTC_DIV256 CMU_LFAPRESC0_RTC(8)
533#define CMU_LFAPRESC0_RTC_DIV512 CMU_LFAPRESC0_RTC(9)
534#define CMU_LFAPRESC0_RTC_DIV1024 CMU_LFAPRESC0_RTC(10)
535#define CMU_LFAPRESC0_RTC_DIV2048 CMU_LFAPRESC0_RTC(11)
536#define CMU_LFAPRESC0_RTC_DIV4096 CMU_LFAPRESC0_RTC(12)
537#define CMU_LFAPRESC0_RTC_DIV8192 CMU_LFAPRESC0_RTC(13)
538#define CMU_LFAPRESC0_RTC_DIV16384 CMU_LFAPRESC0_RTC(14)
539#define CMU_LFAPRESC0_RTC_DIV32768 CMU_LFAPRESC0_RTC(15)
540#define CMU_LFAPRESC0_RTC_NODIV CMU_LFAPRESC0_RTC_DIV1
543#define CMU_LFBPRESC0_LEUART0_SHIFT (0)
544#define CMU_LFBPRESC0_LEUART0_MASK (0x3 << CMU_LFBPRESC0_LEUART0_SHIFT)
545#define CMU_LFBPRESC0_LEUART0(v) \
546 (((v) << CMU_LFBPRESC0_LEUART0_SHIFT) & CMU_LFBPRESC0_LEUART0_MASK)
547#define CMU_LFBPRESC0_LEUART0_DIV1 CMU_LFBPRESC0_LEUART0(0)
548#define CMU_LFBPRESC0_LEUART0_DIV2 CMU_LFBPRESC0_LEUART0(1)
549#define CMU_LFBPRESC0_LEUART0_DIV4 CMU_LFBPRESC0_LEUART0(2)
550#define CMU_LFBPRESC0_LEUART0_DIV8 CMU_LFBPRESC0_LEUART0(3)
551#define CMU_LFBPRESC0_LEUART0_NODIV CMU_LFBPRESC0_LEUART0_DIV1
554#define CMU_PCNTCTRL_PCNT0CLKSEL (1 << 1)
555#define CMU_PCNTCTRL_PCNT0CLKEN (1 << 0)
558#define CMU_ROUTE_LOCATION_SHIFT (2)
559#define CMU_ROUTE_LOCATION_MASK (0x7 << CMU_ROUTE_LOCATION_SHIFT)
560#define CMU_ROUTE_LOCATION_LOCx(i) \
561 (((i) << CMU_ROUTE_LOCATION_SHIFT) & CMU_ROUTE_LOCATION_MASK)
562#define CMU_ROUTE_LOCATION_LOC0 CMU_ROUTE_LOCATION_LOCx(0)
563#define CMU_ROUTE_LOCATION_LOC1 CMU_ROUTE_LOCATION_LOCx(1)
564#define CMU_ROUTE_LOCATION_LOC2 CMU_ROUTE_LOCATION_LOCx(2)
565#define CMU_ROUTE_LOCATION_LOC3 CMU_ROUTE_LOCATION_LOCx(3)
567#define CMU_ROUTE_CLKOUT1PEN (1 << 1)
568#define CMU_ROUTE_CLKOUT0PEN (1 << 0)
571#define CMU_LOCK_LOCKKEY_SHIFT (0)
572#define CMU_LOCK_LOCKKEY_MASK (0xFFFF << CMU_LOCK_LOCKKEY_SHIFT)
573#define CMU_LOCK_LOCKKEY_UNLOCKED (0x0000 << CMU_LOCK_LOCKKEY_SHIFT)
574#define CMU_LOCK_LOCKKEY_LOCKED (0x0001 << CMU_LOCK_LOCKKEY_SHIFT)
575#define CMU_LOCK_LOCKKEY_LOCK (0x0000 << CMU_LOCK_LOCKKEY_SHIFT)
576#define CMU_LOCK_LOCKKEY_UNLOCK (0x580E << CMU_LOCK_LOCKKEY_SHIFT)
579#define CMU_USBCRCTRL_LSMODE (1 << 1)
580#define CMU_USBCRCTRL_EN (1 << 0)
584#define CMU_USHFRCOCTRL_TIMEOUT_MASK (0xff << 12)
586#define CMU_USHFRCOCTRL_SUSPEND (1 << 9)
587#define CMU_USHFRCOCTRL_DITHEN (1 << 8)
589#define CMU_USHFRCOCTRL_TUNING_MASK (0x7f << 0)
593#define CMU_USHFRCOTUNE_FINETUNING_MASK (0x3f << 0)
597#define CMU_USHFRCOTUNE_USHFRCODIV2DIS (1 << 4)
599#define CMU_USHFRCOCONF_BAND_MASK (0x7 << 0)
600#define CMU_USHFRCOCONF_BAND_48MHZ (0x1 << 0)
601#define CMU_USHFRCOCONF_BAND_24MHZ (0x3 << 0)
603#define _REG_BIT(base, bit) (((base) << 5) + (bit))
Dispatcher for the base address definitions, depending on the particular Gecko family.
void cmu_wait_for_usbclk_selected(enum cmu_osc osc)
Wait while USBCLK is not selected.
void cmu_osc_off(enum cmu_osc osc)
Turn off Oscillator.
enum cmu_osc cmu_get_hfclk_source(void)
Get HFCLK clock source.
void cmu_periph_clock_enable(enum cmu_periph_clken periph)
Enable Peripheral Clock in running mode.
void cmu_set_usbclk_source(enum cmu_osc osc)
Set USBCLK clock source.
bool cmu_get_lock_flag(void)
Get CMU register lock flag.
void cmu_periph_clock_disable(enum cmu_periph_clken periph)
Disable Peripheral Clock in running mode.
#define _REG_BIT(base, bit)
bool cmu_osc_ready_flag(enum cmu_osc osc)
Get Oscillator read flag.
void cmu_enable_lock(void)
Enable CMU registers lock.
void cmu_disable_lock(void)
Disable CMU registers lock.
void cmu_osc_on(enum cmu_osc osc)
Turn on Oscillator.
void cmu_set_hfclk_source(enum cmu_osc osc)
Set HFCLK clock source.
void cmu_wait_for_osc_ready(enum cmu_osc osc)
Wait while oscillator is not ready.
@ AUXHFRCO
Internal, 1-28Mhz.
@ USHFRCO
Internal, 48MHz.
@ HFRCO
Internal, 1 - 28Mhz.
@ LFRCO
Internal, 32.768kHz.
@ USHFRCODIV2
Internal, 24MHz.
@ LFXO
External, 32.768kHz.