29#define CMU_CTRL MMIO32(CMU_BASE + 0x000)
30#define CMU_HFCORECLKDIV MMIO32(CMU_BASE + 0x004)
31#define CMU_HFPERCLKDIV MMIO32(CMU_BASE + 0x008)
32#define CMU_HFRCOCTRL MMIO32(CMU_BASE + 0x00C)
33#define CMU_LFRCOCTRL MMIO32(CMU_BASE + 0x010)
34#define CMU_AUXHFRCOCTRL MMIO32(CMU_BASE + 0x014)
35#define CMU_CALCTRL MMIO32(CMU_BASE + 0x018)
36#define CMU_CALCNT MMIO32(CMU_BASE + 0x01C)
37#define CMU_OSCENCMD MMIO32(CMU_BASE + 0x020)
38#define CMU_CMD MMIO32(CMU_BASE + 0x024)
39#define CMU_LFCLKSEL MMIO32(CMU_BASE + 0x028)
40#define CMU_STATUS MMIO32(CMU_BASE + 0x02C)
41#define CMU_IF MMIO32(CMU_BASE + 0x030)
42#define CMU_IFS MMIO32(CMU_BASE + 0x034)
43#define CMU_IFC MMIO32(CMU_BASE + 0x038)
44#define CMU_IEN MMIO32(CMU_BASE + 0x03C)
45#define CMU_HFCORECLKEN0 MMIO32(CMU_BASE + 0x040)
46#define CMU_HFPERCLKEN0 MMIO32(CMU_BASE + 0x044)
47#define CMU_SYNCBUSY MMIO32(CMU_BASE + 0x050)
48#define CMU_FREEZE MMIO32(CMU_BASE + 0x054)
49#define CMU_LFACLKEN0 MMIO32(CMU_BASE + 0x058)
50#define CMU_LFBCLKEN0 MMIO32(CMU_BASE + 0x060)
51#define CMU_LFAPRESC0 MMIO32(CMU_BASE + 0x068)
52#define CMU_LFBPRESC0 MMIO32(CMU_BASE + 0x070)
53#define CMU_PCNTCTRL MMIO32(CMU_BASE + 0x078)
54#define CMU_LCDCTRL MMIO32(CMU_BASE + 0x07C)
55#define CMU_ROUTE MMIO32(CMU_BASE + 0x080)
56#define CMU_LOCK MMIO32(CMU_BASE + 0x084)
59#define CMU_CTRL_HFLE (1 << 30)
60#define CMU_CTRL_DBGCLK (1 << 28)
63#define CMU_CTRL_CLKOUTSEL1_SHIFT (23)
64#define CMU_CTRL_CLKOUTSEL1_MASK (0x7 << CMU_CTRL_CLKOUTSEL1_SHIFT)
65#define CMU_CTRL_CLKOUTSEL1(v) \
66 (((v) << CMU_CTRL_CLKOUTSEL1_SHIFT) & CMU_CTRL_CLKOUTSEL1_MASK)
67#define CMU_CTRL_CLKOUTSEL1_LFRCO 0
68#define CMU_CTRL_CLKOUTSEL1_LFXO 1
69#define CMU_CTRL_CLKOUTSEL1_HFCLK 2
70#define CMU_CTRL_CLKOUTSEL1_LFXOQ 3
71#define CMU_CTRL_CLKOUTSEL1_HFXOQ 4
72#define CMU_CTRL_CLKOUTSEL1_LFRCOQ 5
73#define CMU_CTRL_CLKOUTSEL1_HFRCOQ 6
74#define CMU_CTRL_CLKOUTSEL1_AUXHFRCOQ 7
76#define CMU_CTRL_CLKOUTSEL0_SHIFT (23)
77#define CMU_CTRL_CLKOUTSEL0_MASK (0x7 << CMU_CTRL_CLKOUTSEL0_SHIFT)
78#define CMU_CTRL_CLKOUTSEL0(v) \
79 (((v) << CMU_CTRL_CLKOUTSEL0_SHIFT) & CMU_CTRL_CLKOUTSEL0_MASK)
80#define CMU_CTRL_CLKOUTSEL0_HFRCO 0
81#define CMU_CTRL_CLKOUTSEL0_HFXO 1
82#define CMU_CTRL_CLKOUTSEL0_HFCLK2 2
83#define CMU_CTRL_CLKOUTSEL0_HFCLK4 3
84#define CMU_CTRL_CLKOUTSEL0_HFCLK8 4
85#define CMU_CTRL_CLKOUTSEL0_HFCLK16 5
86#define CMU_CTRL_CLKOUTSEL0_ULFRCO 6
87#define CMU_CTRL_CLKOUTSEL0_AUXHFRCO 7
89#define CMU_CTRL_LFXOTIMEOUT_SHIFT (18)
90#define CMU_CTRL_LFXOTIMEOUT_MASK (0x3 << CMU_CTRL_LFXOTIMEOUT_SHIFT)
91#define CMU_CTRL_LFXOTIMEOUT(v) \
92 (((v) << CMU_CTRL_LFXOTIMEOUT_SHIFT) & CMU_CTRL_LFXOTIMEOUT_MASK)
93#define CMU_CTRL_LFXOTIMEOUT_8CYCLES 0
94#define CMU_CTRL_LFXOTIMEOUT_1KCYCLES 1
95#define CMU_CTRL_LFXOTIMEOUT_16KCYCLES 2
96#define CMU_CTRL_LFXOTIMEOUT_32KCYCLES 3
98#define CMU_CTRL_LFXOBUFCUR (1 << 17)
100#define CMU_CTRL_HFCLKDIV_SHIFT (14)
101#define CMU_CTRL_HFCLKDIV_MASK (0x7 << CMU_CTRL_HFCLKDIV_SHIFT)
102#define CMU_CTRL_HFCLKDIV(v) \
103 (((v) << CMU_CTRL_HFCLKDIV_SHIFT) & CMU_CTRL_HFCLKDIV_MASK)
104#define CMU_CTRL_HFCLKDIV_NODIV 0
105#define CMU_CTRL_HFCLKDIV_DIV2 1
106#define CMU_CTRL_HFCLKDIV_DIV3 2
107#define CMU_CTRL_HFCLKDIV_DIV4 3
108#define CMU_CTRL_HFCLKDIV_DIV5 4
109#define CMU_CTRL_HFCLKDIV_DIV6 5
110#define CMU_CTRL_HFCLKDIV_DIV7 6
111#define CMU_CTRL_HFCLKDIV_DIV8 7
113#define CMU_CTRL_LFXOBOOST (1 << 13)
115#define CMU_CTRL_LFXOMODE_SHIFT (11)
116#define CMU_CTRL_LFXOMODE_MASK (0x3 << CMU_CTRL_LFXOMODE_SHIFT)
117#define CMU_CTRL_LFXOMODE(v) \
118 (((v) << CMU_CTRL_LFXOMODE_SHIFT) & CMU_CTRL_LFXOMODE_MASK)
119#define CMU_CTRL_LFXOMODE_XTAL 0
120#define CMU_CTRL_LFXOMODE_BUFEXTCLK 1
121#define CMU_CTRL_LFXOMODE_DIGEXTCLK 2
123#define CMU_CTRL_HFXOTIMEOUT_SHIFT (9)
124#define CMU_CTRL_HFXOTIMEOUT_MASK (0x3 << CMU_CTRL_HFXOTIMEOUT_SHIFT)
125#define CMU_CTRL_HFXOTIMEOUT(v) \
126 (((v) << CMU_CTRL_HFXOTIMEOUT_SHIFT) & CMU_CTRL_HFXOTIMEOUT_MASK)
127#define CMU_CTRL_HFXOTIMEOUT_8CYCLES 0
128#define CMU_CTRL_HFXOTIMEOUT_256CYCLES 1
129#define CMU_CTRL_HFXOTIMEOUT_1KCYCLES 2
130#define CMU_CTRL_HFXOTIMEOUT_16KCYCLES 3
132#define CMU_CTRL_HFXOGLITCHDETEN (1 << 7)
134#define CMU_CTRL_HFXOBUFCUR_SHIFT (5)
135#define CMU_CTRL_HFXOBUFCUR_MASK (0x3 << CMU_CTRL_HFXOBUFCUR_SHIFT)
136#define CMU_CTRL_HFXOBUFCUR(v) \
137 (((v) << CMU_CTRL_HFXOBUFCUR_SHIFT) & CMU_CTRL_HFXOBUFCUR_MASK)
138#define CMU_CTRL_HFXOBUFCUR_BOOSTUPTO32MHZ 1
139#define CMU_CTRL_HFXOBUFCUR_BOOSTABOVE32MHZ 3
141#define CMU_CTRL_HFXOBOOST_SHIFT (2)
142#define CMU_CTRL_HFXOBOOST_MASK (0x3 << CMU_CTRL_HFXOBOOST_SHIFT)
143#define CMU_CTRL_HFXOBOOST(v) \
144 (((v) << CMU_CTRL_HFXOBOOST_SHIFT) & CMU_CTRL_HFXOBOOST_MASK)
145#define CMU_CTRL_HFXOBOOST_50PCENT 0
146#define CMU_CTRL_HFXOBOOST_70PCENT 1
147#define CMU_CTRL_HFXOBOOST_80PCENT 2
148#define CMU_CTRL_HFXOBOOST_100PCENT 3
150#define CMU_CTRL_HFXOMODE_SHIFT (0)
151#define CMU_CTRL_HFXOMODE_MASK (0x3 << CMU_CTRL_HFXOMODE_SHIFT)
152#define CMU_CTRL_HFXOMODE(v) \
153 (((v) << CMU_CTRL_HFXOMODE_SHIFT) & CMU_CTRL_HFXOMODE_MASK)
154#define CMU_CTRL_HFXOMODE_XTAL 0
155#define CMU_CTRL_HFXOMODE_BUFEXTCLK 1
156#define CMU_CTRL_HFXOMODE_DIGEXTCLK 2
159#define CMU_HFCORECLKDIV_HFCORECLKLEDIV (1 << 8)
161#define CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT (0)
162#define CMU_HFCORECLKDIV_HFCORECLKDIV_MASK \
163 (0xF << CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT)
164#define CMU_HFCORECLKDIV_HFCORECLKDIV(v) \
165 (((v) << CMU_HFCORECLKDIV_HFCORECLKDIV_SHIFT) & \
166 CMU_HFCORECLKDIV_HFCORECLKDIV_MASK)
167#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK \
168 CMU_HFCORECLKDIV_HFCORECLKDIV(0)
169#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK2 \
170 CMU_HFCORECLKDIV_HFCORECLKDIV(1)
171#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK4 \
172 CMU_HFCORECLKDIV_HFCORECLKDIV(2)
173#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK8 \
174 CMU_HFCORECLKDIV_HFCORECLKDIV(3)
175#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK16 \
176 CMU_HFCORECLKDIV_HFCORECLKDIV(4)
177#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK32 \
178 CMU_HFCORECLKDIV_HFCORECLKDIV(5)
179#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK64 \
180 CMU_HFCORECLKDIV_HFCORECLKDIV(6)
181#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK128 \
182 CMU_HFCORECLKDIV_HFCORECLKDIV(7)
183#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK256 \
184 CMU_HFCORECLKDIV_HFCORECLKDIV(8)
185#define CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK512 \
186 CMU_HFCORECLKDIV_HFCORECLKDIV(9)
188#define CMU_HFCORECLKDIV_HFCORECLKDIV_NODIV \
189 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK
190#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV2 \
191 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK2
192#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV4 \
193 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK4
194#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV8 \
195 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK8
196#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV16 \
197 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK16
198#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV32 \
199 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK32
200#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV64 \
201 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK64
202#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV128 \
203 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK128
204#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV256 \
205 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK256
206#define CMU_HFCORECLKDIV_HFCORECLKDIV_DIV512 \
207 CMU_HFCORECLKDIV_HFCORECLKDIV_HFCLK512
210#define CMU_HFPERCLKDIV_HFPERCLKEN (1 << 8)
212#define CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT (0)
213#define CMU_HFPERCLKDIV_HFPERCLKDIV_MASK \
214 (0xF << CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT)
215#define CMU_HFPERCLKDIV_HFPERCLKDIV(v) \
216 (((v) << CMU_HFPERCLKDIV_HFPERCLKDIV_SHIFT) & \
217 CMU_HFPERCLKDIV_HFPERCLKDIV_MASK)
218#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK CMU_HFPERCLKDIV_HFPERCLKDIV(0)
219#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK2 CMU_HFPERCLKDIV_HFPERCLKDIV(1)
220#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK4 CMU_HFPERCLKDIV_HFPERCLKDIV(2)
221#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK8 CMU_HFPERCLKDIV_HFPERCLKDIV(3)
222#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK16 CMU_HFPERCLKDIV_HFPERCLKDIV(4)
223#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK32 CMU_HFPERCLKDIV_HFPERCLKDIV(5)
224#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK64 CMU_HFPERCLKDIV_HFPERCLKDIV(6)
225#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK128 CMU_HFPERCLKDIV_HFPERCLKDIV(7)
226#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK256 CMU_HFPERCLKDIV_HFPERCLKDIV(8)
227#define CMU_HFPERCLKDIV_HFPERCLKHFCLK_HFCLK512 CMU_HFPERCLKDIV_HFPERCLKDIV(9)
230#define CMU_HFPERCLKDIV_HFPERCLKDIV_NODIV \
231 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK
232#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV2 \
233 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK2
234#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV4 \
235 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK4
236#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV8 \
237 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK8
238#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV16 \
239 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK16
240#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV32 \
241 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK32
242#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV64 \
243 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK64
244#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV128 \
245 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK128
246#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV256 \
247 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK256
248#define CMU_HFPERCLKDIV_HFPERCLKDIV_DIV512 \
249 CMU_HFPERCLKDIV_HFPERCLKDIV_HFCLK512
252#define CMU_HFRCOCTRL_SUDELAY_SHIFT (12)
253#define CMU_HFRCOCTRL_SUDELAY_MASK (0x1F << CMU_HFRCOCTRL_SUDELAY_SHIFT)
254#define CMU_HFRCOCTRL_SUDELAY(v) \
255 ((((v) << CMU_HFRCOCTRL_SUDELAY_SHIFT) & CMU_HFRCOCTRL_SUDELAY_MASK))
257#define CMU_HFRCOCTRL_BAND_SHIFT (8)
258#define CMU_HFRCOCTRL_BAND_MASK (0x7 << CMU_HFRCOCTRL_BAND_SHIFT)
259#define CMU_HFRCOCTRL_BAND(v) \
260 (((v) << CMU_HFRCOCTRL_BAND_SHIFT) & CMU_HFRCOCTRL_BAND_MASK)
261#define CMU_HFRCOCTRL_BAND_1MHZ 0
262#define CMU_HFRCOCTRL_BAND_7MHZ 1
263#define CMU_HFRCOCTRL_BAND_11MHZ 2
264#define CMU_HFRCOCTRL_BAND_14MHZ 3
265#define CMU_HFRCOCTRL_BAND_21MHZ 4
266#define CMU_HFRCOCTRL_BAND_28MHZ 5
268#define CMU_HFRCOCTRL_TUNING_SHIFT (0)
269#define CMU_HFRCOCTRL_TUNING_MASK (0xFF << CMU_HFRCOCTRL_TUNING_SHIFT)
270#define CMU_HFRCOCTRL_TUNING(v) \
271 (((v) << CMU_HFRCOCTRL_TUNING_SHIFT) & CMU_HFRCOCTRL_TUNING_MASK)
274#define CMU_LFRCOCTRL_TUNING_SHIFT (0)
275#define CMU_LFRCOCTRL_TUNING_MASK (0xFF << CMU_LFRCOCTRL_TUNING_SHIFT)
276#define CMU_LFRCOCTRL_TUNING(v) \
277 (((v) << CMU_LFRCOCTRL_TUNING_SHIFT) & CMU_LFRCOCTRL_TUNING_MASK)
280#define CMU_AUXHFRCOCTRL_BAND_SHIFT (8)
281#define CMU_AUXHFRCOCTRL_BAND_MASK (0x7 << CMU_AUXHFRCOCTRL_BAND_SHIFT)
282#define CMU_AUXHFRCOCTRL_BAND(v) \
283 (((v) << CMU_AUXHFRCOCTRL_BAND_SHIFT) & CMU_AUXHFRCOCTRL_BAND_MASK)
284#define CMU_AUXHFRCOCTRL_BAND_1MHZ 0
285#define CMU_AUXHFRCOCTRL_BAND_7MHZ 1
286#define CMU_AUXHFRCOCTRL_BAND_11MHZ 2
287#define CMU_AUXHFRCOCTRL_BAND_14MHZ 3
288#define CMU_AUXHFRCOCTRL_BAND_28MHZ 4
289#define CMU_AUXHFRCOCTRL_BAND_21MHZ 5
291#define CMU_AUXHFRCOCTRL_TUNING_SHIFT (0)
292#define CMU_AUXHFRCOCTRL_TUNING_MASK (0xFF << CMU_AUXHFRCOCTRL_TUNING_SHIFT)
293#define CMU_AUXHFRCOCTRL_TUNING(v) \
294 (((v) << CMU_AUXHFRCOCTRL_TUNING_SHIFT) & CMU_AUXHFRCOCTRL_TUNING_MASK)
297#define CMU_CALCTRL_CONT (1 << 6)
299#define CMU_CALCTRL_DOWNSEL_SHIFT (3)
300#define CMU_CALCTRL_DOWNSEL_MASK (0x7 << CMU_CALCTRL_DOWNSEL_SHIFT)
301#define CMU_CALCTRL_DOWNSEL(v) \
302 (((v) << CMU_CALCTRL_DOWNSEL_SHIFT) & CMU_CALCTRL_DOWNSEL_MASK)
303#define CMU_CALCTRL_DOWNSEL_HFCLK 0
304#define CMU_CALCTRL_DOWNSEL_HFXO 1
305#define CMU_CALCTRL_DOWNSEL_LFXO 2
306#define CMU_CALCTRL_DOWNSEL_HFRCO 3
307#define CMU_CALCTRL_DOWNSEL_LFRCO 4
308#define CMU_CALCTRL_DOWNSEL_AUXHFRCO 5
310#define CMU_CALCTRL_UPSEL_SHIFT (3)
311#define CMU_CALCTRL_UPSEL_MASK (0x7 << CMU_CALCTRL_UPSEL_SHIFT)
312#define CMU_CALCTRL_UPSEL(v) \
313 (((v) << CMU_CALCTRL_UPSEL_SHIFT) & CMU_CALCTRL_UPSEL_MASK)
314#define CMU_CALCTRL_UPSEL_HFXO 0
315#define CMU_CALCTRL_UPSEL_LFXO 1
316#define CMU_CALCTRL_UPSEL_HFRCO 2
317#define CMU_CALCTRL_UPSEL_LFRCO 3
318#define CMU_CALCTRL_UPSEL_AUXHFRCO 4
321#define CMU_CALCNT_CALCNT_SHIFT (0)
322#define CMU_CALCNT_CALCNT_MASK (0xFFFFF << CMU_CALCNT_CALCNT_SHIFT)
323#define CMU_CALCNT_CALCNT(v) \
324 (((v) << CMU_CALCNT_CALCNT_SHIFT) & CMU_CALCNT_CALCNT_MASK)
327#define CMU_OSCENCMD_LFXODIS (1 << 9)
328#define CMU_OSCENCMD_LFXOEN (1 << 8)
329#define CMU_OSCENCMD_LFRCODIS (1 << 7)
330#define CMU_OSCENCMD_LFRCOEN (1 << 6)
331#define CMU_OSCENCMD_AUXHFRCODIS (1 << 5)
332#define CMU_OSCENCMD_AUXHFRCOEN (1 << 4)
333#define CMU_OSCENCMD_HFXODIS (1 << 3)
334#define CMU_OSCENCMD_HFXOEN (1 << 2)
335#define CMU_OSCENCMD_HFRCODIS (1 << 1)
336#define CMU_OSCENCMD_HFRCOEN (1 << 0)
339#define CMU_CMD_USBCCLKSEL_SHIFT (5)
340#define CMU_CMD_USBCCLKSEL_MASK (0x3 << CMU_CMD_USBCCLKSEL_SHIFT)
341#define CMU_CMD_USBCCLKSEL(v) \
342 (((v) << CMU_CMD_USBCCLKSEL_SHIFT) & CMU_CMD_USBCCLKSEL_MASK)
343#define CMU_CMD_USBCCLKSEL_HFCLKNODIV 1
344#define CMU_CMD_USBCCLKSEL_LFXO 2
345#define CMU_CMD_USBCCLKSEL_LFRCO 3
347#define CMU_CMD_CALSTOP (1 << 4)
348#define CMU_CMD_CALSTART (1 << 3)
350#define CMU_CMD_HFCLKSEL_SHIFT (0)
351#define CMU_CMD_HFCLKSEL_MASK (0x7 << CMU_CMD_HFCLKSEL_SHIFT)
352#define CMU_CMD_HFCLKSEL(v) \
353 (((v) << CMU_CMD_HFCLKSEL_SHIFT) & CMU_CMD_HFCLKSEL_MASK)
354#define CMU_CMD_HFCLKSEL_HFRCO 1
355#define CMU_CMD_HFCLKSEL_HFXO 2
356#define CMU_CMD_HFCLKSEL_LFRCO 3
357#define CMU_CMD_HFCLKSEL_LFXO 4
360#define CMU_LFCLKSEL_LFBE (1 << 20)
361#define CMU_LFCLKSEL_LFAE (1 << 16)
363#define CMU_LFCLKSEL_LFB_SHIFT (2)
364#define CMU_LFCLKSEL_LFB_MASK (0x3 << CMU_LFCLKSEL_LFB_MASK)
365#define CMU_LFCLKSEL_LFB(v) \
366 (((v) << CMU_LFCLKSEL_LFB_MASK) & CMU_LFCLKSEL_LFB_MASK)
368#define CMU_LFCLKSEL_LFA_SHIFT (0)
369#define CMU_LFCLKSEL_LFA_MASK (0x3 << CMU_LFCLKSEL_LFA_MASK)
370#define CMU_LFCLKSEL_LFA(v) \
371 (((v) << CMU_LFCLKSEL_LFA_MASK) & CMU_LFCLKSEL_LFA_MASK)
374#define CMU_STATUS_USBCLFRCOSEL (1 << 17)
375#define CMU_STATUS_USBCLFXOSEL (1 << 16)
376#define CMU_STATUS_USBCHFCLKSEL (1 << 15)
377#define CMU_STATUS_CALBSY (1 << 14)
378#define CMU_STATUS_LFXOSEL (1 << 13)
379#define CMU_STATUS_LFRCOSEL (1 << 12)
380#define CMU_STATUS_HFXOSEL (1 << 11)
381#define CMU_STATUS_HFRCOSEL (1 << 10)
382#define CMU_STATUS_LFXORDY (1 << 9)
383#define CMU_STATUS_LFXOENS (1 << 8)
384#define CMU_STATUS_LFRCORDY (1 << 7)
385#define CMU_STATUS_LFRCOENS (1 << 6)
386#define CMU_STATUS_AUXHFRCORDY (1 << 5)
387#define CMU_STATUS_AUXHFRCOENS (1 << 4)
388#define CMU_STATUS_HFXORDY (1 << 3)
389#define CMU_STATUS_HFXOENS (1 << 2)
390#define CMU_STATUS_HFRCORDY (1 << 1)
391#define CMU_STATUS_HFRCOENS (1 << 0)
394#define CMU_IF_USBCHFCLKSEL (1 << 7)
395#define CMU_IF_CALOF (1 << 6)
396#define CMU_IF_CALRDY (1 << 5)
397#define CMU_IF_AUXHFRCORDY (1 << 4)
398#define CMU_IF_LFXORDY (1 << 3)
399#define CMU_IF_LFRCORDY (1 << 2)
400#define CMU_IF_HFXORDY (1 << 1)
401#define CMU_IF_HFRCORDY (1 << 0)
404#define CMU_IFS_USBCHFCLKSEL (1 << 7)
405#define CMU_IFS_CALOF (1 << 6)
406#define CMU_IFS_CALRDY (1 << 5)
407#define CMU_IFS_AUXHFRCORDY (1 << 4)
408#define CMU_IFS_LFXORDY (1 << 3)
409#define CMU_IFS_LFRCORDY (1 << 2)
410#define CMU_IFS_HFXORDY (1 << 1)
411#define CMU_IFS_HFRCORDY (1 << 0)
414#define CMU_IFC_USBCHFCLKSEL (1 << 7)
415#define CMU_IFC_CALOF (1 << 6)
416#define CMU_IFC_CALRDY (1 << 5)
417#define CMU_IFC_AUXHFRCORDY (1 << 4)
418#define CMU_IFC_LFXORDY (1 << 3)
419#define CMU_IFC_LFRCORDY (1 << 2)
420#define CMU_IFC_HFXORDY (1 << 1)
421#define CMU_IFC_HFRCORDY (1 << 0)
424#define CMU_IEN_USBCHFCLKSEL (1 << 7)
425#define CMU_IEN_CALOF (1 << 6)
426#define CMU_IEN_CALRDY (1 << 5)
427#define CMU_IEN_AUXHFRCORDY (1 << 4)
428#define CMU_IEN_LFXORDY (1 << 3)
429#define CMU_IEN_LFRCORDY (1 << 2)
430#define CMU_IEN_HFXORDY (1 << 1)
431#define CMU_IEN_HFRCORDY (1 << 0)
434#define CMU_HFCORECLKEN0_EBI (1 << 5)
435#define CMU_HFCORECLKEN0_LE (1 << 4)
436#define CMU_HFCORECLKEN0_USB (1 << 3)
437#define CMU_HFCORECLKEN0_USBC (1 << 2)
438#define CMU_HFCORECLKEN0_AES (1 << 1)
439#define CMU_HFCORECLKEN0_DMA (1 << 0)
442#define CMU_HFPERCLKEN0_DAC0 (1 << 17)
443#define CMU_HFPERCLKEN0_ADC0 (1 << 16)
444#define CMU_HFPERCLKEN0_PRS (1 << 15)
445#define CMU_HFPERCLKEN0_VCMP (1 << 14)
446#define CMU_HFPERCLKEN0_GPIO (1 << 13)
447#define CMU_HFPERCLKEN0_I2C1 (1 << 12)
448#define CMU_HFPERCLKEN0_I2C0 (1 << 11)
449#define CMU_HFPERCLKEN0_ACMP1 (1 << 10)
450#define CMU_HFPERCLKEN0_ACMP0 (1 << 9)
451#define CMU_HFPERCLKEN0_TIMER3 (1 << 8)
452#define CMU_HFPERCLKEN0_TIMER2 (1 << 7)
453#define CMU_HFPERCLKEN0_TIMER1 (1 << 6)
454#define CMU_HFPERCLKEN0_TIMER0 (1 << 5)
455#define CMU_HFPERCLKEN0_UART1 (1 << 4)
456#define CMU_HFPERCLKEN0_UART0 (1 << 3)
457#define CMU_HFPERCLKEN0_USART2 (1 << 2)
458#define CMU_HFPERCLKEN0_USART1 (1 << 1)
459#define CMU_HFPERCLKEN0_USART0 (1 << 0)
462#define CMU_SYNCBUSY_LFBPRESC0 (1 << 6)
463#define CMU_SYNCBUSY_LFBCLKEN0 (1 << 4)
464#define CMU_SYNCBUSY_LFAPRESC0 (1 << 2)
465#define CMU_SYNCBUSY_LFACLKEN0 (1 << 0)
468#define CMU_FREEZE_REGFREEZE (1 << 0)
471#define CMU_LFACLKEN0_LCD (1 << 3)
472#define CMU_LFACLKEN0_LETIMER0 (1 << 2)
473#define CMU_LFACLKEN0_RTC (1 << 1)
474#define CMU_LFACLKEN0_LESENSE (1 << 0)
477#define CMU_LFBCLKEN0_LEUART1 (1 << 1)
478#define CMU_LFBCLKEN0_LEUART0 (1 << 0)
481#define CMU_LFAPRESC0_LCD_SHIFT (12)
482#define CMU_LFAPRESC0_LCD_MASK (0x3 << CMU_LFAPRESC0_LCD_SHIFT)
483#define CMU_LFAPRESC0_LCD(v) \
484 (((v) << CMU_LFAPRESC0_LCD_SHIFT) & CMU_LFAPRESC0_LCD_MASK)
485#define CMU_LFAPRESC0_LCD_DIV16 0
486#define CMU_LFAPRESC0_LCD_DIV32 1
487#define CMU_LFAPRESC0_LCD_DIV64 2
488#define CMU_LFAPRESC0_LCD_DIV128 3
490#define CMU_LFAPRESC0_LETIMER0_SHIFT (8)
491#define CMU_LFAPRESC0_LETIMER0_MASK (0xF << CMU_LFAPRESC0_LETIMER0_SHIFT)
492#define CMU_LFAPRESC0_LETIMER0(v) \
493 (((v) << CMU_LFAPRESC0_LETIMER0_SHIFT) & CMU_LFAPRESC0_LETIMER0_MASK)
494#define CMU_LFAPRESC0_LETIMER0_DIV1 0
495#define CMU_LFAPRESC0_LETIMER0_DIV2 1
496#define CMU_LFAPRESC0_LETIMER0_DIV4 2
497#define CMU_LFAPRESC0_LETIMER0_DIV8 3
498#define CMU_LFAPRESC0_LETIMER0_DIV16 4
499#define CMU_LFAPRESC0_LETIMER0_DIV32 5
500#define CMU_LFAPRESC0_LETIMER0_DIV64 6
501#define CMU_LFAPRESC0_LETIMER0_DIV128 7
502#define CMU_LFAPRESC0_LETIMER0_DIV256 8
503#define CMU_LFAPRESC0_LETIMER0_DIV512 9
504#define CMU_LFAPRESC0_LETIMER0_DIV1024 10
505#define CMU_LFAPRESC0_LETIMER0_DIV2048 11
506#define CMU_LFAPRESC0_LETIMER0_DIV4096 12
507#define CMU_LFAPRESC0_LETIMER0_DIV8192 13
508#define CMU_LFAPRESC0_LETIMER0_DIV16384 14
509#define CMU_LFAPRESC0_LETIMER0_DIV32768 15
510#define CMU_LFAPRESC0_LETIMER0_NODIV CMU_LFAPRESC0_LETIMER0_DIV1
512#define CMU_LFAPRESC0_RTC_SHIFT (4)
513#define CMU_LFAPRESC0_RTC_MASK (0xF << CMU_LFAPRESC0_RTC_SHIFT)
514#define CMU_LFAPRESC0_RTC(v) \
515 (((v) << CMU_LFAPRESC0_RTC_SHIFT) & CMU_LFAPRESC0_RTC_MASK)
516#define CMU_LFAPRESC0_RTC_DIV1 0
517#define CMU_LFAPRESC0_RTC_DIV2 1
518#define CMU_LFAPRESC0_RTC_DIV4 2
519#define CMU_LFAPRESC0_RTC_DIV8 3
520#define CMU_LFAPRESC0_RTC_DIV16 4
521#define CMU_LFAPRESC0_RTC_DIV32 5
522#define CMU_LFAPRESC0_RTC_DIV64 6
523#define CMU_LFAPRESC0_RTC_DIV128 7
524#define CMU_LFAPRESC0_RTC_DIV256 8
525#define CMU_LFAPRESC0_RTC_DIV512 9
526#define CMU_LFAPRESC0_RTC_DIV1024 10
527#define CMU_LFAPRESC0_RTC_DIV2048 11
528#define CMU_LFAPRESC0_RTC_DIV4096 12
529#define CMU_LFAPRESC0_RTC_DIV8192 13
530#define CMU_LFAPRESC0_RTC_DIV16384 14
531#define CMU_LFAPRESC0_RTC_DIV32768 15
532#define CMU_LFAPRESC0_RTC_NODIV CMU_LFAPRESC0_RTC_DIV1
534#define CMU_LFAPRESC0_LESENSE_SHIFT (12)
535#define CMU_LFAPRESC0_LESENSE_MASK (0x3 << CMU_LFAPRESC0_LESENSE_SHIFT)
536#define CMU_LFAPRESC0_LESENSE(v) \
537 (((v) << CMU_LFAPRESC0_LESENSE_SHIFT) & CMU_LFAPRESC0_LESENSE_MASK)
538#define CMU_LFAPRESC0_LESENSE_DIV1 0
539#define CMU_LFAPRESC0_LESENSE_DIV2 1
540#define CMU_LFAPRESC0_LESENSE_DIV4 2
541#define CMU_LFAPRESC0_LESENSE_DIV8 3
542#define CMU_LFAPRESC0_LESENSE_NODIV CMU_LFAPRESC0_LESENSE_DIV1
545#define CMU_LFBPRESC0_LEUART1_SHIFT (4)
546#define CMU_LFBPRESC0_LEUART1_MASK (0x3 << CMU_LFBPRESC0_LEUART1_SHIFT)
547#define CMU_LFBPRESC0_LEUART1(v) \
548 (((v) << CMU_LFBPRESC0_LEUART1_SHIFT) & CMU_LFBPRESC0_LEUART1_MASK)
549#define CMU_LFBPRESC0_LEUART1_DIV1 0
550#define CMU_LFBPRESC0_LEUART1_DIV2 1
551#define CMU_LFBPRESC0_LEUART1_DIV4 2
552#define CMU_LFBPRESC0_LEUART1_DIV8 3
553#define CMU_LFBPRESC0_LEUART1_NODIV CMU_LFBPRESC0_LEUART1_DIV1
555#define CMU_LFBPRESC0_LEUART0_SHIFT (0)
556#define CMU_LFBPRESC0_LEUART0_MASK (0x3 << CMU_LFBPRESC0_LEUART0_SHIFT)
557#define CMU_LFBPRESC0_LEUART0(v) \
558 (((v) << CMU_LFBPRESC0_LEUART0_SHIFT) & CMU_LFBPRESC0_LEUART0_MASK)
559#define CMU_LFBPRESC0_LEUART0_DIV1 0
560#define CMU_LFBPRESC0_LEUART0_DIV2 1
561#define CMU_LFBPRESC0_LEUART0_DIV4 2
562#define CMU_LFBPRESC0_LEUART0_DIV8 3
563#define CMU_LFBPRESC0_LEUART0_NODIV CMU_LFBPRESC0_LEUART0_DIV1
566#define CMU_PCNTCTRL_PCNT2CLKSE (1 << 5)
567#define CMU_PCNTCTRL_PCNT2CLKEN (1 << 4)
568#define CMU_PCNTCTRL_PCNT1CLKSEL (1 << 3)
569#define CMU_PCNTCTRL_PCNT1CLKEN (1 << 2)
570#define CMU_PCNTCTRL_PCNT0CLKSEL (1 << 1)
571#define CMU_PCNTCTRL_PCNT0CLKEN (1 << 0)
574#define CMU_LCDCTRL_VBFDIV_SHIFT (4)
575#define CMU_LCDCTRL_VBFDIV_MASK (0xF << CMU_LCDCTRL_VBFDIV_SHIFT)
576#define CMU_LCDCTRL_VBFDIV(v) \
577 (((v) << CMU_LCDCTRL_VBFDIV_SHIFT) & CMU_LCDCTRL_VBFDIV_MASK)
578#define CMU_LCDCTRL_VBFDIV_DIV1 0
579#define CMU_LCDCTRL_VBFDIV_DIV2 1
580#define CMU_LCDCTRL_VBFDIV_DIV4 2
581#define CMU_LCDCTRL_VBFDIV_DIV8 3
582#define CMU_LCDCTRL_VBFDIV_DIV16 4
583#define CMU_LCDCTRL_VBFDIV_DIV32 5
584#define CMU_LCDCTRL_VBFDIV_DIV64 6
585#define CMU_LCDCTRL_VBFDIV_DIV128 7
586#define CMU_LCDCTRL_VBFDIV_NODIV CMU_LCDCTRL_VBFDIV_DIV1
588#define CMU_LCDCTRL_VBOOSTEN (1 << 3)
590#define CMU_LCDCTRL_FDIV_SHIFT (0)
591#define CMU_LCDCTRL_FDIV_MASK (0x3 << CMU_LCDCTRL_FDIV_SHIFT)
592#define CMU_LCDCTRL_FDIV(v) \
593 (((v) & CMU_LCDCTRL_FDIV_MASK) << CMU_LCDCTRL_FDIV_SHIFT)
596#define CMU_ROUTE_LOCATION_SHIFT (2)
597#define CMU_ROUTE_LOCATION_MASK (0x7 << CMU_ROUTE_LOCATION_SHIFT)
598#define CMU_ROUTE_LOCATION_LOCx(i) \
599 (((i) << CMU_ROUTE_LOCATION_SHIFT) & CMU_ROUTE_LOCATION_MASK)
600#define CMU_ROUTE_LOCATION_LOC0 0
601#define CMU_ROUTE_LOCATION_LOC1 1
602#define CMU_ROUTE_LOCATION_LOC2 2
604#define CMU_ROUTE_CLKOUT1PEN (1 << 1)
605#define CMU_ROUTE_CLKOUT0PEN (1 << 0)
608#define CMU_LOCK_LOCKKEY_SHIFT (0)
609#define CMU_LOCK_LOCKKEY_MASK (0xFFFF << CMU_LOCK_LOCKKEY_SHIFT)
610#define CMU_LOCK_LOCKKEY_UNLOCKED (0x0000 << CMU_LOCK_LOCKKEY_SHIFT)
611#define CMU_LOCK_LOCKKEY_LOCKED (0x0001 << CMU_LOCK_LOCKKEY_SHIFT)
612#define CMU_LOCK_LOCKKEY_LOCK (0x0000 << CMU_LOCK_LOCKKEY_SHIFT)
613#define CMU_LOCK_LOCKKEY_UNLOCK (0x580E << CMU_LOCK_LOCKKEY_SHIFT)
615#define _REG_BIT(base, bit) (((base) << 5) + (bit))
Dispatcher for the base address definitions, depending on the particular Gecko family.
void cmu_osc_off(enum cmu_osc osc)
Turn off Oscillator.
enum cmu_osc cmu_get_hfclk_source(void)
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)
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)
void cmu_clock_setup_in_hfxo_out_48mhz(void)
HFXO output 48Mhz and core running at 48Mhz.
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 till oscillator is not ready.
@ AUXHFRCO
Internal, 1-28Mhz.
@ HFRCO
Internal, 1 - 28Mhz.
@ LFRCO
Internal, 32.768kHz.
@ LFXO
External, 32.768kHz.