xref: /freebsd/sys/dev/clk/rockchip/rk3399_pmucru.c (revision 77f222415832c58c2e307f74f1200941efe868d9)
1*77f22241SEmmanuel Vadot /*-
2*77f22241SEmmanuel Vadot  * SPDX-License-Identifier: BSD-2-Clause
3*77f22241SEmmanuel Vadot  *
4*77f22241SEmmanuel Vadot  * Copyright (c) 2018 Emmanuel Vadot <manu@freebsd.org>
5*77f22241SEmmanuel Vadot  * Copyright (c) 2018 Val Packett <val@packett.cool>
6*77f22241SEmmanuel Vadot  *
7*77f22241SEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
8*77f22241SEmmanuel Vadot  * modification, are permitted provided that the following conditions
9*77f22241SEmmanuel Vadot  * are met:
10*77f22241SEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
11*77f22241SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer.
12*77f22241SEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
13*77f22241SEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in the
14*77f22241SEmmanuel Vadot  *    documentation and/or other materials provided with the distribution.
15*77f22241SEmmanuel Vadot  *
16*77f22241SEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17*77f22241SEmmanuel Vadot  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18*77f22241SEmmanuel Vadot  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19*77f22241SEmmanuel Vadot  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20*77f22241SEmmanuel Vadot  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21*77f22241SEmmanuel Vadot  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22*77f22241SEmmanuel Vadot  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23*77f22241SEmmanuel Vadot  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24*77f22241SEmmanuel Vadot  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25*77f22241SEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26*77f22241SEmmanuel Vadot  * SUCH DAMAGE.
27*77f22241SEmmanuel Vadot  */
28*77f22241SEmmanuel Vadot 
29*77f22241SEmmanuel Vadot #include <sys/param.h>
30*77f22241SEmmanuel Vadot #include <sys/systm.h>
31*77f22241SEmmanuel Vadot #include <sys/bus.h>
32*77f22241SEmmanuel Vadot #include <sys/rman.h>
33*77f22241SEmmanuel Vadot #include <sys/kernel.h>
34*77f22241SEmmanuel Vadot #include <sys/module.h>
35*77f22241SEmmanuel Vadot #include <machine/bus.h>
36*77f22241SEmmanuel Vadot 
37*77f22241SEmmanuel Vadot #include <dev/fdt/simplebus.h>
38*77f22241SEmmanuel Vadot 
39*77f22241SEmmanuel Vadot #include <dev/ofw/ofw_bus.h>
40*77f22241SEmmanuel Vadot #include <dev/ofw/ofw_bus_subr.h>
41*77f22241SEmmanuel Vadot 
42*77f22241SEmmanuel Vadot #include <dev/extres/clk/clk_div.h>
43*77f22241SEmmanuel Vadot #include <dev/extres/clk/clk_fixed.h>
44*77f22241SEmmanuel Vadot #include <dev/extres/clk/clk_mux.h>
45*77f22241SEmmanuel Vadot 
46*77f22241SEmmanuel Vadot #include <dev/clk/rockchip/rk_cru.h>
47*77f22241SEmmanuel Vadot 
48*77f22241SEmmanuel Vadot #define	CRU_CLKSEL_CON(x)	(0x80 + (x) * 0x4)
49*77f22241SEmmanuel Vadot #define	CRU_CLKGATE_CON(x)	(0x100 + (x) * 0x4)
50*77f22241SEmmanuel Vadot 
51*77f22241SEmmanuel Vadot #define	PLL_PPLL		1
52*77f22241SEmmanuel Vadot #define	SCLK_32K_SUSPEND_PMU	2
53*77f22241SEmmanuel Vadot #define	SCLK_SPI3_PMU		3
54*77f22241SEmmanuel Vadot #define	SCLK_TIMER12_PMU	4
55*77f22241SEmmanuel Vadot #define	SCLK_TIMER13_PMU	5
56*77f22241SEmmanuel Vadot #define	SCLK_UART4_PMU		6
57*77f22241SEmmanuel Vadot #define	SCLK_PVTM_PMU		7
58*77f22241SEmmanuel Vadot #define	SCLK_WIFI_PMU		8
59*77f22241SEmmanuel Vadot #define	SCLK_I2C0_PMU		9
60*77f22241SEmmanuel Vadot #define	SCLK_I2C4_PMU		10
61*77f22241SEmmanuel Vadot #define	SCLK_I2C8_PMU		11
62*77f22241SEmmanuel Vadot 
63*77f22241SEmmanuel Vadot #define	PCLK_PMU_SRC		19
64*77f22241SEmmanuel Vadot #define	PCLK_PMU		20
65*77f22241SEmmanuel Vadot #define	PCLK_PMUGRF_PMU		21
66*77f22241SEmmanuel Vadot #define	PCLK_INTMEM1_PMU	22
67*77f22241SEmmanuel Vadot #define	PCLK_GPIO0_PMU		23
68*77f22241SEmmanuel Vadot #define	PCLK_GPIO1_PMU		24
69*77f22241SEmmanuel Vadot #define	PCLK_SGRF_PMU		25
70*77f22241SEmmanuel Vadot #define	PCLK_NOC_PMU		26
71*77f22241SEmmanuel Vadot #define	PCLK_I2C0_PMU		27
72*77f22241SEmmanuel Vadot #define	PCLK_I2C4_PMU		28
73*77f22241SEmmanuel Vadot #define	PCLK_I2C8_PMU		29
74*77f22241SEmmanuel Vadot #define	PCLK_RKPWM_PMU		30
75*77f22241SEmmanuel Vadot #define	PCLK_SPI3_PMU		31
76*77f22241SEmmanuel Vadot #define	PCLK_TIMER_PMU		32
77*77f22241SEmmanuel Vadot #define	PCLK_MAILBOX_PMU	33
78*77f22241SEmmanuel Vadot #define	PCLK_UART4_PMU		34
79*77f22241SEmmanuel Vadot #define	PCLK_WDT_M0_PMU		35
80*77f22241SEmmanuel Vadot 
81*77f22241SEmmanuel Vadot #define	FCLK_CM0S_SRC_PMU	44
82*77f22241SEmmanuel Vadot #define	FCLK_CM0S_PMU		45
83*77f22241SEmmanuel Vadot #define	SCLK_CM0S_PMU		46
84*77f22241SEmmanuel Vadot #define	HCLK_CM0S_PMU		47
85*77f22241SEmmanuel Vadot #define	DCLK_CM0S_PMU		48
86*77f22241SEmmanuel Vadot #define	PCLK_INTR_ARB_PMU	49
87*77f22241SEmmanuel Vadot #define	HCLK_NOC_PMU		50
88*77f22241SEmmanuel Vadot 
89*77f22241SEmmanuel Vadot /* GATES */
90*77f22241SEmmanuel Vadot static struct rk_cru_gate rk3399_pmu_gates[] = {
91*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKGATE_CON0 */
92*77f22241SEmmanuel Vadot 	/* 0 Reserved */
93*77f22241SEmmanuel Vadot 	/* 1 fclk_cm0s_pmu_ppll_src_en */
94*77f22241SEmmanuel Vadot 	GATE(SCLK_SPI3_PMU, "clk_spi3_pmu", "clk_spi3_c", 0, 2),
95*77f22241SEmmanuel Vadot 	GATE(SCLK_TIMER12_PMU, "clk_timer0_pmu", "clk_timer_sel", 0, 3),
96*77f22241SEmmanuel Vadot 	GATE(SCLK_TIMER13_PMU, "clk_timer1_pmu", "clk_timer_sel", 0, 4),
97*77f22241SEmmanuel Vadot 	GATE(SCLK_UART4_PMU, "clk_uart4_pmu", "clk_uart4_sel", 0, 5),
98*77f22241SEmmanuel Vadot 	GATE(0, "clk_uart4_frac", "clk_uart4_frac_frac", 0, 6),
99*77f22241SEmmanuel Vadot 	/* 7 clk_pvtm_pmu_en */
100*77f22241SEmmanuel Vadot 	GATE(SCLK_WIFI_PMU, "clk_wifi_pmu", "clk_wifi_sel", 0, 8),
101*77f22241SEmmanuel Vadot 	GATE(SCLK_I2C0_PMU, "clk_i2c0_src", "clk_i2c0_div", 0, 9),
102*77f22241SEmmanuel Vadot 	GATE(SCLK_I2C4_PMU, "clk_i2c4_src", "clk_i2c4_div", 0, 10),
103*77f22241SEmmanuel Vadot 	GATE(SCLK_I2C8_PMU, "clk_i2c8_src", "clk_i2c8_div", 0, 11),
104*77f22241SEmmanuel Vadot 	/* 12:15 Reserved */
105*77f22241SEmmanuel Vadot 
106*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKGATE_CON1 */
107*77f22241SEmmanuel Vadot 	GATE(PCLK_PMU, "pclk_pmu", "pclk_pmu_src", 1, 0),
108*77f22241SEmmanuel Vadot 	/* 1 pclk_pmugrf_en */
109*77f22241SEmmanuel Vadot 	/* 2 pclk_intmem1_en */
110*77f22241SEmmanuel Vadot 	GATE(PCLK_GPIO0_PMU, "pclk_gpio0_pmu", "pclk_pmu_src", 1, 3),
111*77f22241SEmmanuel Vadot 	GATE(PCLK_GPIO1_PMU, "pclk_gpio1_pmu", "pclk_pmu_src", 1, 4),
112*77f22241SEmmanuel Vadot 	/* 5 pclk_sgrf_en */
113*77f22241SEmmanuel Vadot 	/* 6 pclk_noc_pmu_en */
114*77f22241SEmmanuel Vadot 	GATE(PCLK_I2C0_PMU, "pclk_i2c0_pmu", "pclk_pmu_src", 1, 7),
115*77f22241SEmmanuel Vadot 	GATE(PCLK_I2C4_PMU, "pclk_i2c4_pmu", "pclk_pmu_src", 1, 8),
116*77f22241SEmmanuel Vadot 	GATE(PCLK_I2C8_PMU, "pclk_i2c8_pmu", "pclk_pmu_src", 1, 9),
117*77f22241SEmmanuel Vadot 	GATE(PCLK_RKPWM_PMU, "pclk_rkpwm_pmu", "pclk_pmu_src", 1, 10),
118*77f22241SEmmanuel Vadot 	GATE(PCLK_SPI3_PMU, "pclk_spi3_pmu", "pclk_pmu_src", 1, 11),
119*77f22241SEmmanuel Vadot 	GATE(PCLK_TIMER_PMU, "pclk_timer_pmu", "pclk_pmu_src", 1, 12),
120*77f22241SEmmanuel Vadot 	GATE(PCLK_MAILBOX_PMU, "pclk_mailbox_pmu", "pclk_pmu_src", 1, 13),
121*77f22241SEmmanuel Vadot 	/* 14 pclk_uartm0_en */
122*77f22241SEmmanuel Vadot 	/* 15 pclk_wdt_m0_pmu_en */
123*77f22241SEmmanuel Vadot 
124*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKGATE_CON2 */
125*77f22241SEmmanuel Vadot 	/* 0 fclk_cm0s_en */
126*77f22241SEmmanuel Vadot 	/* 1 sclk_cm0s_en */
127*77f22241SEmmanuel Vadot 	/* 2 hclk_cm0s_en */
128*77f22241SEmmanuel Vadot 	/* 3 dclk_cm0s_en */
129*77f22241SEmmanuel Vadot 	/* 4 Reserved */
130*77f22241SEmmanuel Vadot 	/* 5 hclk_noc_pmu_en */
131*77f22241SEmmanuel Vadot 	/* 6:15 Reserved */
132*77f22241SEmmanuel Vadot };
133*77f22241SEmmanuel Vadot 
134*77f22241SEmmanuel Vadot /*
135*77f22241SEmmanuel Vadot  * PLLs
136*77f22241SEmmanuel Vadot  */
137*77f22241SEmmanuel Vadot 
138*77f22241SEmmanuel Vadot static struct rk_clk_pll_rate rk3399_pll_rates[] = {
139*77f22241SEmmanuel Vadot 	{
140*77f22241SEmmanuel Vadot 		.freq = 2208000000,
141*77f22241SEmmanuel Vadot 		.refdiv = 1,
142*77f22241SEmmanuel Vadot 		.fbdiv = 92,
143*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
144*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
145*77f22241SEmmanuel Vadot 		.dsmpd = 1,
146*77f22241SEmmanuel Vadot 	},
147*77f22241SEmmanuel Vadot 	{
148*77f22241SEmmanuel Vadot 		.freq = 2184000000,
149*77f22241SEmmanuel Vadot 		.refdiv = 1,
150*77f22241SEmmanuel Vadot 		.fbdiv = 91,
151*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
152*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
153*77f22241SEmmanuel Vadot 		.dsmpd = 1,
154*77f22241SEmmanuel Vadot 	},
155*77f22241SEmmanuel Vadot 	{
156*77f22241SEmmanuel Vadot 		.freq = 2160000000,
157*77f22241SEmmanuel Vadot 		.refdiv = 1,
158*77f22241SEmmanuel Vadot 		.fbdiv = 90,
159*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
160*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
161*77f22241SEmmanuel Vadot 		.dsmpd = 1,
162*77f22241SEmmanuel Vadot 	},
163*77f22241SEmmanuel Vadot 	{
164*77f22241SEmmanuel Vadot 		.freq = 2136000000,
165*77f22241SEmmanuel Vadot 		.refdiv = 1,
166*77f22241SEmmanuel Vadot 		.fbdiv = 89,
167*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
168*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
169*77f22241SEmmanuel Vadot 		.dsmpd = 1,
170*77f22241SEmmanuel Vadot 	},
171*77f22241SEmmanuel Vadot 	{
172*77f22241SEmmanuel Vadot 		.freq = 2112000000,
173*77f22241SEmmanuel Vadot 		.refdiv = 1,
174*77f22241SEmmanuel Vadot 		.fbdiv = 88,
175*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
176*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
177*77f22241SEmmanuel Vadot 		.dsmpd = 1,
178*77f22241SEmmanuel Vadot 	},
179*77f22241SEmmanuel Vadot 	{
180*77f22241SEmmanuel Vadot 		.freq = 2088000000,
181*77f22241SEmmanuel Vadot 		.refdiv = 1,
182*77f22241SEmmanuel Vadot 		.fbdiv = 87,
183*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
184*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
185*77f22241SEmmanuel Vadot 		.dsmpd = 1,
186*77f22241SEmmanuel Vadot 	},
187*77f22241SEmmanuel Vadot 	{
188*77f22241SEmmanuel Vadot 		.freq = 2064000000,
189*77f22241SEmmanuel Vadot 		.refdiv = 1,
190*77f22241SEmmanuel Vadot 		.fbdiv = 86,
191*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
192*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
193*77f22241SEmmanuel Vadot 		.dsmpd = 1,
194*77f22241SEmmanuel Vadot 	},
195*77f22241SEmmanuel Vadot 	{
196*77f22241SEmmanuel Vadot 		.freq = 2040000000,
197*77f22241SEmmanuel Vadot 		.refdiv = 1,
198*77f22241SEmmanuel Vadot 		.fbdiv = 85,
199*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
200*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
201*77f22241SEmmanuel Vadot 		.dsmpd = 1,
202*77f22241SEmmanuel Vadot 	},
203*77f22241SEmmanuel Vadot 	{
204*77f22241SEmmanuel Vadot 		.freq = 2016000000,
205*77f22241SEmmanuel Vadot 		.refdiv = 1,
206*77f22241SEmmanuel Vadot 		.fbdiv = 84,
207*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
208*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
209*77f22241SEmmanuel Vadot 		.dsmpd = 1,
210*77f22241SEmmanuel Vadot 	},
211*77f22241SEmmanuel Vadot 	{
212*77f22241SEmmanuel Vadot 		.freq = 1992000000,
213*77f22241SEmmanuel Vadot 		.refdiv = 1,
214*77f22241SEmmanuel Vadot 		.fbdiv = 83,
215*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
216*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
217*77f22241SEmmanuel Vadot 		.dsmpd = 1,
218*77f22241SEmmanuel Vadot 	},
219*77f22241SEmmanuel Vadot 	{
220*77f22241SEmmanuel Vadot 		.freq = 1968000000,
221*77f22241SEmmanuel Vadot 		.refdiv = 1,
222*77f22241SEmmanuel Vadot 		.fbdiv = 82,
223*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
224*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
225*77f22241SEmmanuel Vadot 		.dsmpd = 1,
226*77f22241SEmmanuel Vadot 	},
227*77f22241SEmmanuel Vadot 	{
228*77f22241SEmmanuel Vadot 		.freq = 1944000000,
229*77f22241SEmmanuel Vadot 		.refdiv = 1,
230*77f22241SEmmanuel Vadot 		.fbdiv = 81,
231*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
232*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
233*77f22241SEmmanuel Vadot 		.dsmpd = 1,
234*77f22241SEmmanuel Vadot 	},
235*77f22241SEmmanuel Vadot 	{
236*77f22241SEmmanuel Vadot 		.freq = 1920000000,
237*77f22241SEmmanuel Vadot 		.refdiv = 1,
238*77f22241SEmmanuel Vadot 		.fbdiv = 80,
239*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
240*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
241*77f22241SEmmanuel Vadot 		.dsmpd = 1,
242*77f22241SEmmanuel Vadot 	},
243*77f22241SEmmanuel Vadot 	{
244*77f22241SEmmanuel Vadot 		.freq = 1896000000,
245*77f22241SEmmanuel Vadot 		.refdiv = 1,
246*77f22241SEmmanuel Vadot 		.fbdiv = 79,
247*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
248*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
249*77f22241SEmmanuel Vadot 		.dsmpd = 1,
250*77f22241SEmmanuel Vadot 	},
251*77f22241SEmmanuel Vadot 	{
252*77f22241SEmmanuel Vadot 		.freq = 1872000000,
253*77f22241SEmmanuel Vadot 		.refdiv = 1,
254*77f22241SEmmanuel Vadot 		.fbdiv = 78,
255*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
256*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
257*77f22241SEmmanuel Vadot 		.dsmpd = 1,
258*77f22241SEmmanuel Vadot 	},
259*77f22241SEmmanuel Vadot 	{
260*77f22241SEmmanuel Vadot 		.freq = 1848000000,
261*77f22241SEmmanuel Vadot 		.refdiv = 1,
262*77f22241SEmmanuel Vadot 		.fbdiv = 77,
263*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
264*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
265*77f22241SEmmanuel Vadot 		.dsmpd = 1,
266*77f22241SEmmanuel Vadot 	},
267*77f22241SEmmanuel Vadot 	{
268*77f22241SEmmanuel Vadot 		.freq = 1824000000,
269*77f22241SEmmanuel Vadot 		.refdiv = 1,
270*77f22241SEmmanuel Vadot 		.fbdiv = 76,
271*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
272*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
273*77f22241SEmmanuel Vadot 		.dsmpd = 1,
274*77f22241SEmmanuel Vadot 	},
275*77f22241SEmmanuel Vadot 	{
276*77f22241SEmmanuel Vadot 		.freq = 1800000000,
277*77f22241SEmmanuel Vadot 		.refdiv = 1,
278*77f22241SEmmanuel Vadot 		.fbdiv = 75,
279*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
280*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
281*77f22241SEmmanuel Vadot 		.dsmpd = 1,
282*77f22241SEmmanuel Vadot 	},
283*77f22241SEmmanuel Vadot 	{
284*77f22241SEmmanuel Vadot 		.freq = 1776000000,
285*77f22241SEmmanuel Vadot 		.refdiv = 1,
286*77f22241SEmmanuel Vadot 		.fbdiv = 74,
287*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
288*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
289*77f22241SEmmanuel Vadot 		.dsmpd = 1,
290*77f22241SEmmanuel Vadot 	},
291*77f22241SEmmanuel Vadot 	{
292*77f22241SEmmanuel Vadot 		.freq = 1752000000,
293*77f22241SEmmanuel Vadot 		.refdiv = 1,
294*77f22241SEmmanuel Vadot 		.fbdiv = 73,
295*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
296*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
297*77f22241SEmmanuel Vadot 		.dsmpd = 1,
298*77f22241SEmmanuel Vadot 	},
299*77f22241SEmmanuel Vadot 	{
300*77f22241SEmmanuel Vadot 		.freq = 1728000000,
301*77f22241SEmmanuel Vadot 		.refdiv = 1,
302*77f22241SEmmanuel Vadot 		.fbdiv = 72,
303*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
304*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
305*77f22241SEmmanuel Vadot 		.dsmpd = 1,
306*77f22241SEmmanuel Vadot 	},
307*77f22241SEmmanuel Vadot 	{
308*77f22241SEmmanuel Vadot 		.freq = 1704000000,
309*77f22241SEmmanuel Vadot 		.refdiv = 1,
310*77f22241SEmmanuel Vadot 		.fbdiv = 71,
311*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
312*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
313*77f22241SEmmanuel Vadot 		.dsmpd = 1,
314*77f22241SEmmanuel Vadot 	},
315*77f22241SEmmanuel Vadot 	{
316*77f22241SEmmanuel Vadot 		.freq = 1680000000,
317*77f22241SEmmanuel Vadot 		.refdiv = 1,
318*77f22241SEmmanuel Vadot 		.fbdiv = 70,
319*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
320*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
321*77f22241SEmmanuel Vadot 		.dsmpd = 1,
322*77f22241SEmmanuel Vadot 	},
323*77f22241SEmmanuel Vadot 	{
324*77f22241SEmmanuel Vadot 		.freq = 1656000000,
325*77f22241SEmmanuel Vadot 		.refdiv = 1,
326*77f22241SEmmanuel Vadot 		.fbdiv = 69,
327*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
328*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
329*77f22241SEmmanuel Vadot 		.dsmpd = 1,
330*77f22241SEmmanuel Vadot 	},
331*77f22241SEmmanuel Vadot 	{
332*77f22241SEmmanuel Vadot 		.freq = 1632000000,
333*77f22241SEmmanuel Vadot 		.refdiv = 1,
334*77f22241SEmmanuel Vadot 		.fbdiv = 68,
335*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
336*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
337*77f22241SEmmanuel Vadot 		.dsmpd = 1,
338*77f22241SEmmanuel Vadot 	},
339*77f22241SEmmanuel Vadot 	{
340*77f22241SEmmanuel Vadot 		.freq = 1608000000,
341*77f22241SEmmanuel Vadot 		.refdiv = 1,
342*77f22241SEmmanuel Vadot 		.fbdiv = 67,
343*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
344*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
345*77f22241SEmmanuel Vadot 		.dsmpd = 1,
346*77f22241SEmmanuel Vadot 	},
347*77f22241SEmmanuel Vadot 	{
348*77f22241SEmmanuel Vadot 		.freq = 1600000000,
349*77f22241SEmmanuel Vadot 		.refdiv = 3,
350*77f22241SEmmanuel Vadot 		.fbdiv = 200,
351*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
352*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
353*77f22241SEmmanuel Vadot 		.dsmpd = 1,
354*77f22241SEmmanuel Vadot 	},
355*77f22241SEmmanuel Vadot 	{
356*77f22241SEmmanuel Vadot 		.freq = 1584000000,
357*77f22241SEmmanuel Vadot 		.refdiv = 1,
358*77f22241SEmmanuel Vadot 		.fbdiv = 66,
359*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
360*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
361*77f22241SEmmanuel Vadot 		.dsmpd = 1,
362*77f22241SEmmanuel Vadot 	},
363*77f22241SEmmanuel Vadot 	{
364*77f22241SEmmanuel Vadot 		.freq = 1560000000,
365*77f22241SEmmanuel Vadot 		.refdiv = 1,
366*77f22241SEmmanuel Vadot 		.fbdiv = 65,
367*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
368*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
369*77f22241SEmmanuel Vadot 		.dsmpd = 1,
370*77f22241SEmmanuel Vadot 	},
371*77f22241SEmmanuel Vadot 	{
372*77f22241SEmmanuel Vadot 		.freq = 1536000000,
373*77f22241SEmmanuel Vadot 		.refdiv = 1,
374*77f22241SEmmanuel Vadot 		.fbdiv = 64,
375*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
376*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
377*77f22241SEmmanuel Vadot 		.dsmpd = 1,
378*77f22241SEmmanuel Vadot 	},
379*77f22241SEmmanuel Vadot 	{
380*77f22241SEmmanuel Vadot 		.freq = 1512000000,
381*77f22241SEmmanuel Vadot 		.refdiv = 1,
382*77f22241SEmmanuel Vadot 		.fbdiv = 63,
383*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
384*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
385*77f22241SEmmanuel Vadot 		.dsmpd = 1,
386*77f22241SEmmanuel Vadot 	},
387*77f22241SEmmanuel Vadot 	{
388*77f22241SEmmanuel Vadot 		.freq = 1488000000,
389*77f22241SEmmanuel Vadot 		.refdiv = 1,
390*77f22241SEmmanuel Vadot 		.fbdiv = 62,
391*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
392*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
393*77f22241SEmmanuel Vadot 		.dsmpd = 1,
394*77f22241SEmmanuel Vadot 	},
395*77f22241SEmmanuel Vadot 	{
396*77f22241SEmmanuel Vadot 		.freq = 1464000000,
397*77f22241SEmmanuel Vadot 		.refdiv = 1,
398*77f22241SEmmanuel Vadot 		.fbdiv = 61,
399*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
400*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
401*77f22241SEmmanuel Vadot 		.dsmpd = 1,
402*77f22241SEmmanuel Vadot 	},
403*77f22241SEmmanuel Vadot 	{
404*77f22241SEmmanuel Vadot 		.freq = 1440000000,
405*77f22241SEmmanuel Vadot 		.refdiv = 1,
406*77f22241SEmmanuel Vadot 		.fbdiv = 60,
407*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
408*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
409*77f22241SEmmanuel Vadot 		.dsmpd = 1,
410*77f22241SEmmanuel Vadot 	},
411*77f22241SEmmanuel Vadot 	{
412*77f22241SEmmanuel Vadot 		.freq = 1416000000,
413*77f22241SEmmanuel Vadot 		.refdiv = 1,
414*77f22241SEmmanuel Vadot 		.fbdiv = 59,
415*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
416*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
417*77f22241SEmmanuel Vadot 		.dsmpd = 1,
418*77f22241SEmmanuel Vadot 	},
419*77f22241SEmmanuel Vadot 	{
420*77f22241SEmmanuel Vadot 		.freq = 1392000000,
421*77f22241SEmmanuel Vadot 		.refdiv = 1,
422*77f22241SEmmanuel Vadot 		.fbdiv = 58,
423*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
424*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
425*77f22241SEmmanuel Vadot 		.dsmpd = 1,
426*77f22241SEmmanuel Vadot 	},
427*77f22241SEmmanuel Vadot 	{
428*77f22241SEmmanuel Vadot 		.freq = 1368000000,
429*77f22241SEmmanuel Vadot 		.refdiv = 1,
430*77f22241SEmmanuel Vadot 		.fbdiv = 57,
431*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
432*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
433*77f22241SEmmanuel Vadot 		.dsmpd = 1,
434*77f22241SEmmanuel Vadot 	},
435*77f22241SEmmanuel Vadot 	{
436*77f22241SEmmanuel Vadot 		.freq = 1344000000,
437*77f22241SEmmanuel Vadot 		.refdiv = 1,
438*77f22241SEmmanuel Vadot 		.fbdiv = 56,
439*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
440*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
441*77f22241SEmmanuel Vadot 		.dsmpd = 1,
442*77f22241SEmmanuel Vadot 	},
443*77f22241SEmmanuel Vadot 	{
444*77f22241SEmmanuel Vadot 		.freq = 1320000000,
445*77f22241SEmmanuel Vadot 		.refdiv = 1,
446*77f22241SEmmanuel Vadot 		.fbdiv = 55,
447*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
448*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
449*77f22241SEmmanuel Vadot 		.dsmpd = 1,
450*77f22241SEmmanuel Vadot 	},
451*77f22241SEmmanuel Vadot 	{
452*77f22241SEmmanuel Vadot 		.freq = 1296000000,
453*77f22241SEmmanuel Vadot 		.refdiv = 1,
454*77f22241SEmmanuel Vadot 		.fbdiv = 54,
455*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
456*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
457*77f22241SEmmanuel Vadot 		.dsmpd = 1,
458*77f22241SEmmanuel Vadot 	},
459*77f22241SEmmanuel Vadot 	{
460*77f22241SEmmanuel Vadot 		.freq = 1272000000,
461*77f22241SEmmanuel Vadot 		.refdiv = 1,
462*77f22241SEmmanuel Vadot 		.fbdiv = 53,
463*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
464*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
465*77f22241SEmmanuel Vadot 		.dsmpd = 1,
466*77f22241SEmmanuel Vadot 	},
467*77f22241SEmmanuel Vadot 	{
468*77f22241SEmmanuel Vadot 		.freq = 1248000000,
469*77f22241SEmmanuel Vadot 		.refdiv = 1,
470*77f22241SEmmanuel Vadot 		.fbdiv = 52,
471*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
472*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
473*77f22241SEmmanuel Vadot 		.dsmpd = 1,
474*77f22241SEmmanuel Vadot 	},
475*77f22241SEmmanuel Vadot 	{
476*77f22241SEmmanuel Vadot 		.freq = 1200000000,
477*77f22241SEmmanuel Vadot 		.refdiv = 1,
478*77f22241SEmmanuel Vadot 		.fbdiv = 50,
479*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
480*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
481*77f22241SEmmanuel Vadot 		.dsmpd = 1,
482*77f22241SEmmanuel Vadot 	},
483*77f22241SEmmanuel Vadot 	{
484*77f22241SEmmanuel Vadot 		.freq = 1188000000,
485*77f22241SEmmanuel Vadot 		.refdiv = 2,
486*77f22241SEmmanuel Vadot 		.fbdiv = 99,
487*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
488*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
489*77f22241SEmmanuel Vadot 		.dsmpd = 1,
490*77f22241SEmmanuel Vadot 	},
491*77f22241SEmmanuel Vadot 	{
492*77f22241SEmmanuel Vadot 		.freq = 1104000000,
493*77f22241SEmmanuel Vadot 		.refdiv = 1,
494*77f22241SEmmanuel Vadot 		.fbdiv = 46,
495*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
496*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
497*77f22241SEmmanuel Vadot 		.dsmpd = 1,
498*77f22241SEmmanuel Vadot 	},
499*77f22241SEmmanuel Vadot 	{
500*77f22241SEmmanuel Vadot 		.freq = 1100000000,
501*77f22241SEmmanuel Vadot 		.refdiv = 12,
502*77f22241SEmmanuel Vadot 		.fbdiv = 550,
503*77f22241SEmmanuel Vadot 		.postdiv1 = 1,
504*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
505*77f22241SEmmanuel Vadot 		.dsmpd = 1,
506*77f22241SEmmanuel Vadot 	},
507*77f22241SEmmanuel Vadot 	{
508*77f22241SEmmanuel Vadot 		.freq = 1008000000,
509*77f22241SEmmanuel Vadot 		.refdiv = 1,
510*77f22241SEmmanuel Vadot 		.fbdiv = 84,
511*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
512*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
513*77f22241SEmmanuel Vadot 		.dsmpd = 1,
514*77f22241SEmmanuel Vadot 	},
515*77f22241SEmmanuel Vadot 	{
516*77f22241SEmmanuel Vadot 		.freq = 1000000000,
517*77f22241SEmmanuel Vadot 		.refdiv = 1,
518*77f22241SEmmanuel Vadot 		.fbdiv = 125,
519*77f22241SEmmanuel Vadot 		.postdiv1 = 3,
520*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
521*77f22241SEmmanuel Vadot 		.dsmpd = 1,
522*77f22241SEmmanuel Vadot 	},
523*77f22241SEmmanuel Vadot 	{
524*77f22241SEmmanuel Vadot 		.freq = 984000000,
525*77f22241SEmmanuel Vadot 		.refdiv = 1,
526*77f22241SEmmanuel Vadot 		.fbdiv = 82,
527*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
528*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
529*77f22241SEmmanuel Vadot 		.dsmpd = 1,
530*77f22241SEmmanuel Vadot 	},
531*77f22241SEmmanuel Vadot 	{
532*77f22241SEmmanuel Vadot 		.freq = 960000000,
533*77f22241SEmmanuel Vadot 		.refdiv = 1,
534*77f22241SEmmanuel Vadot 		.fbdiv = 80,
535*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
536*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
537*77f22241SEmmanuel Vadot 		.dsmpd = 1,
538*77f22241SEmmanuel Vadot 	},
539*77f22241SEmmanuel Vadot 	{
540*77f22241SEmmanuel Vadot 		.freq = 936000000,
541*77f22241SEmmanuel Vadot 		.refdiv = 1,
542*77f22241SEmmanuel Vadot 		.fbdiv = 78,
543*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
544*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
545*77f22241SEmmanuel Vadot 		.dsmpd = 1,
546*77f22241SEmmanuel Vadot 	},
547*77f22241SEmmanuel Vadot 	{
548*77f22241SEmmanuel Vadot 		.freq = 912000000,
549*77f22241SEmmanuel Vadot 		.refdiv = 1,
550*77f22241SEmmanuel Vadot 		.fbdiv = 76,
551*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
552*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
553*77f22241SEmmanuel Vadot 		.dsmpd = 1,
554*77f22241SEmmanuel Vadot 	},
555*77f22241SEmmanuel Vadot 	{
556*77f22241SEmmanuel Vadot 		.freq = 900000000,
557*77f22241SEmmanuel Vadot 		.refdiv = 4,
558*77f22241SEmmanuel Vadot 		.fbdiv = 300,
559*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
560*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
561*77f22241SEmmanuel Vadot 		.dsmpd = 1,
562*77f22241SEmmanuel Vadot 	},
563*77f22241SEmmanuel Vadot 	{
564*77f22241SEmmanuel Vadot 		.freq = 888000000,
565*77f22241SEmmanuel Vadot 		.refdiv = 1,
566*77f22241SEmmanuel Vadot 		.fbdiv = 74,
567*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
568*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
569*77f22241SEmmanuel Vadot 		.dsmpd = 1,
570*77f22241SEmmanuel Vadot 	},
571*77f22241SEmmanuel Vadot 	{
572*77f22241SEmmanuel Vadot 		.freq = 864000000,
573*77f22241SEmmanuel Vadot 		.refdiv = 1,
574*77f22241SEmmanuel Vadot 		.fbdiv = 72,
575*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
576*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
577*77f22241SEmmanuel Vadot 		.dsmpd = 1,
578*77f22241SEmmanuel Vadot 	},
579*77f22241SEmmanuel Vadot 	{
580*77f22241SEmmanuel Vadot 		.freq = 840000000,
581*77f22241SEmmanuel Vadot 		.refdiv = 1,
582*77f22241SEmmanuel Vadot 		.fbdiv = 70,
583*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
584*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
585*77f22241SEmmanuel Vadot 		.dsmpd = 1,
586*77f22241SEmmanuel Vadot 	},
587*77f22241SEmmanuel Vadot 	{
588*77f22241SEmmanuel Vadot 		.freq = 816000000,
589*77f22241SEmmanuel Vadot 		.refdiv = 1,
590*77f22241SEmmanuel Vadot 		.fbdiv = 68,
591*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
592*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
593*77f22241SEmmanuel Vadot 		.dsmpd = 1,
594*77f22241SEmmanuel Vadot 	},
595*77f22241SEmmanuel Vadot 	{
596*77f22241SEmmanuel Vadot 		.freq = 800000000,
597*77f22241SEmmanuel Vadot 		.refdiv = 1,
598*77f22241SEmmanuel Vadot 		.fbdiv = 100,
599*77f22241SEmmanuel Vadot 		.postdiv1 = 3,
600*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
601*77f22241SEmmanuel Vadot 		.dsmpd = 1,
602*77f22241SEmmanuel Vadot 	},
603*77f22241SEmmanuel Vadot 	{
604*77f22241SEmmanuel Vadot 		.freq = 700000000,
605*77f22241SEmmanuel Vadot 		.refdiv = 6,
606*77f22241SEmmanuel Vadot 		.fbdiv = 350,
607*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
608*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
609*77f22241SEmmanuel Vadot 		.dsmpd = 1,
610*77f22241SEmmanuel Vadot 	},
611*77f22241SEmmanuel Vadot 	{
612*77f22241SEmmanuel Vadot 		.freq = 696000000,
613*77f22241SEmmanuel Vadot 		.refdiv = 1,
614*77f22241SEmmanuel Vadot 		.fbdiv = 58,
615*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
616*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
617*77f22241SEmmanuel Vadot 		.dsmpd = 1,
618*77f22241SEmmanuel Vadot 	},
619*77f22241SEmmanuel Vadot 	{
620*77f22241SEmmanuel Vadot 		.freq = 676000000,
621*77f22241SEmmanuel Vadot 		.refdiv = 3,
622*77f22241SEmmanuel Vadot 		.fbdiv = 169,
623*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
624*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
625*77f22241SEmmanuel Vadot 		.dsmpd = 1,
626*77f22241SEmmanuel Vadot 	},
627*77f22241SEmmanuel Vadot 	{
628*77f22241SEmmanuel Vadot 		.freq = 600000000,
629*77f22241SEmmanuel Vadot 		.refdiv = 1,
630*77f22241SEmmanuel Vadot 		.fbdiv = 75,
631*77f22241SEmmanuel Vadot 		.postdiv1 = 3,
632*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
633*77f22241SEmmanuel Vadot 		.dsmpd = 1,
634*77f22241SEmmanuel Vadot 	},
635*77f22241SEmmanuel Vadot 	{
636*77f22241SEmmanuel Vadot 		.freq = 594000000,
637*77f22241SEmmanuel Vadot 		.refdiv = 1,
638*77f22241SEmmanuel Vadot 		.fbdiv = 99,
639*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
640*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
641*77f22241SEmmanuel Vadot 		.dsmpd = 1,
642*77f22241SEmmanuel Vadot 	},
643*77f22241SEmmanuel Vadot 	{
644*77f22241SEmmanuel Vadot 		.freq = 533250000,
645*77f22241SEmmanuel Vadot 		.refdiv = 8,
646*77f22241SEmmanuel Vadot 		.fbdiv = 711,
647*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
648*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
649*77f22241SEmmanuel Vadot 		.dsmpd = 1,
650*77f22241SEmmanuel Vadot 	},
651*77f22241SEmmanuel Vadot 	{
652*77f22241SEmmanuel Vadot 		.freq = 504000000,
653*77f22241SEmmanuel Vadot 		.refdiv = 1,
654*77f22241SEmmanuel Vadot 		.fbdiv = 63,
655*77f22241SEmmanuel Vadot 		.postdiv1 = 3,
656*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
657*77f22241SEmmanuel Vadot 		.dsmpd = 1,
658*77f22241SEmmanuel Vadot 	},
659*77f22241SEmmanuel Vadot 	{
660*77f22241SEmmanuel Vadot 		.freq = 500000000,
661*77f22241SEmmanuel Vadot 		.refdiv = 6,
662*77f22241SEmmanuel Vadot 		.fbdiv = 250,
663*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
664*77f22241SEmmanuel Vadot 		.postdiv2 = 1,
665*77f22241SEmmanuel Vadot 		.dsmpd = 1,
666*77f22241SEmmanuel Vadot 	},
667*77f22241SEmmanuel Vadot 	{
668*77f22241SEmmanuel Vadot 		.freq = 408000000,
669*77f22241SEmmanuel Vadot 		.refdiv = 1,
670*77f22241SEmmanuel Vadot 		.fbdiv = 68,
671*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
672*77f22241SEmmanuel Vadot 		.postdiv2 = 2,
673*77f22241SEmmanuel Vadot 		.dsmpd = 1,
674*77f22241SEmmanuel Vadot 	},
675*77f22241SEmmanuel Vadot 	{
676*77f22241SEmmanuel Vadot 		.freq = 312000000,
677*77f22241SEmmanuel Vadot 		.refdiv = 1,
678*77f22241SEmmanuel Vadot 		.fbdiv = 52,
679*77f22241SEmmanuel Vadot 		.postdiv1 = 2,
680*77f22241SEmmanuel Vadot 		.postdiv2 = 2,
681*77f22241SEmmanuel Vadot 		.dsmpd = 1,
682*77f22241SEmmanuel Vadot 	},
683*77f22241SEmmanuel Vadot 	{
684*77f22241SEmmanuel Vadot 		.freq = 297000000,
685*77f22241SEmmanuel Vadot 		.refdiv = 1,
686*77f22241SEmmanuel Vadot 		.fbdiv = 99,
687*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
688*77f22241SEmmanuel Vadot 		.postdiv2 = 2,
689*77f22241SEmmanuel Vadot 		.dsmpd = 1,
690*77f22241SEmmanuel Vadot 	},
691*77f22241SEmmanuel Vadot 	{
692*77f22241SEmmanuel Vadot 		.freq = 216000000,
693*77f22241SEmmanuel Vadot 		.refdiv = 1,
694*77f22241SEmmanuel Vadot 		.fbdiv = 72,
695*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
696*77f22241SEmmanuel Vadot 		.postdiv2 = 2,
697*77f22241SEmmanuel Vadot 		.dsmpd = 1,
698*77f22241SEmmanuel Vadot 	},
699*77f22241SEmmanuel Vadot 	{
700*77f22241SEmmanuel Vadot 		.freq = 148500000,
701*77f22241SEmmanuel Vadot 		.refdiv = 1,
702*77f22241SEmmanuel Vadot 		.fbdiv = 99,
703*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
704*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
705*77f22241SEmmanuel Vadot 		.dsmpd = 1,
706*77f22241SEmmanuel Vadot 	},
707*77f22241SEmmanuel Vadot 	{
708*77f22241SEmmanuel Vadot 		.freq = 106500000,
709*77f22241SEmmanuel Vadot 		.refdiv = 1,
710*77f22241SEmmanuel Vadot 		.fbdiv = 71,
711*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
712*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
713*77f22241SEmmanuel Vadot 		.dsmpd = 1,
714*77f22241SEmmanuel Vadot 	},
715*77f22241SEmmanuel Vadot 	{
716*77f22241SEmmanuel Vadot 		.freq = 96000000,
717*77f22241SEmmanuel Vadot 		.refdiv = 1,
718*77f22241SEmmanuel Vadot 		.fbdiv = 64,
719*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
720*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
721*77f22241SEmmanuel Vadot 		.dsmpd = 1,
722*77f22241SEmmanuel Vadot 	},
723*77f22241SEmmanuel Vadot 	{
724*77f22241SEmmanuel Vadot 		.freq = 74250000,
725*77f22241SEmmanuel Vadot 		.refdiv = 2,
726*77f22241SEmmanuel Vadot 		.fbdiv = 99,
727*77f22241SEmmanuel Vadot 		.postdiv1 = 4,
728*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
729*77f22241SEmmanuel Vadot 		.dsmpd = 1,
730*77f22241SEmmanuel Vadot 	},
731*77f22241SEmmanuel Vadot 	{
732*77f22241SEmmanuel Vadot 		.freq = 65000000,
733*77f22241SEmmanuel Vadot 		.refdiv = 1,
734*77f22241SEmmanuel Vadot 		.fbdiv = 65,
735*77f22241SEmmanuel Vadot 		.postdiv1 = 6,
736*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
737*77f22241SEmmanuel Vadot 		.dsmpd = 1,
738*77f22241SEmmanuel Vadot 	},
739*77f22241SEmmanuel Vadot 	{
740*77f22241SEmmanuel Vadot 		.freq = 54000000,
741*77f22241SEmmanuel Vadot 		.refdiv = 1,
742*77f22241SEmmanuel Vadot 		.fbdiv = 54,
743*77f22241SEmmanuel Vadot 		.postdiv1 = 6,
744*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
745*77f22241SEmmanuel Vadot 		.dsmpd = 1,
746*77f22241SEmmanuel Vadot 	},
747*77f22241SEmmanuel Vadot 	{
748*77f22241SEmmanuel Vadot 		.freq = 27000000,
749*77f22241SEmmanuel Vadot 		.refdiv = 1,
750*77f22241SEmmanuel Vadot 		.fbdiv = 27,
751*77f22241SEmmanuel Vadot 		.postdiv1 = 6,
752*77f22241SEmmanuel Vadot 		.postdiv2 = 4,
753*77f22241SEmmanuel Vadot 		.dsmpd = 1,
754*77f22241SEmmanuel Vadot 	},
755*77f22241SEmmanuel Vadot 	{},
756*77f22241SEmmanuel Vadot };
757*77f22241SEmmanuel Vadot 
758*77f22241SEmmanuel Vadot PLIST(xin24m_p) = {"xin24m"};
759*77f22241SEmmanuel Vadot PLIST(xin24m_xin32k_p) = {"xin24m", "xin32k"};
760*77f22241SEmmanuel Vadot PLIST(xin24m_ppll_p) = {"xin24m", "ppll"};
761*77f22241SEmmanuel Vadot PLIST(uart4_p) = {"clk_uart4_c", "clk_uart4_frac", "xin24m"};
762*77f22241SEmmanuel Vadot PLIST(wifi_p) = {"clk_wifi_c", "clk_wifi_frac"};
763*77f22241SEmmanuel Vadot 
764*77f22241SEmmanuel Vadot static struct rk_clk_pll_def ppll = {
765*77f22241SEmmanuel Vadot 	.clkdef = {
766*77f22241SEmmanuel Vadot 		.id = PLL_PPLL,
767*77f22241SEmmanuel Vadot 		.name = "ppll",
768*77f22241SEmmanuel Vadot 		.parent_names = xin24m_p,
769*77f22241SEmmanuel Vadot 		.parent_cnt = nitems(xin24m_p),
770*77f22241SEmmanuel Vadot 	},
771*77f22241SEmmanuel Vadot 	.base_offset = 0x00,
772*77f22241SEmmanuel Vadot 
773*77f22241SEmmanuel Vadot 	.rates = rk3399_pll_rates,
774*77f22241SEmmanuel Vadot };
775*77f22241SEmmanuel Vadot 
776*77f22241SEmmanuel Vadot static struct rk_clk rk3399_pmu_clks[] = {
777*77f22241SEmmanuel Vadot 	/* Linked clocks */
778*77f22241SEmmanuel Vadot 	LINK("xin32k"),
779*77f22241SEmmanuel Vadot 
780*77f22241SEmmanuel Vadot 	{
781*77f22241SEmmanuel Vadot 		.type = RK3399_CLK_PLL,
782*77f22241SEmmanuel Vadot 		.clk.pll = &ppll
783*77f22241SEmmanuel Vadot 	},
784*77f22241SEmmanuel Vadot 
785*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKSEL_CON0 */
786*77f22241SEmmanuel Vadot 	CDIV(PCLK_PMU_SRC, "pclk_pmu_src", "ppll", 0, 0, 0, 5),
787*77f22241SEmmanuel Vadot 	/* 5:7 Reserved */
788*77f22241SEmmanuel Vadot 	/* 8:12 cm0s_div */
789*77f22241SEmmanuel Vadot 	/* 13:14 Reserved */
790*77f22241SEmmanuel Vadot 	/* 15 cm0s_clk_pll_sel */
791*77f22241SEmmanuel Vadot 
792*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKSEL_CON1 */
793*77f22241SEmmanuel Vadot 	COMP(0, "clk_spi3_c", xin24m_ppll_p, 0, 1, 0, 7, 7, 1),
794*77f22241SEmmanuel Vadot 	COMP(0, "clk_wifi_c", xin24m_ppll_p, 0, 1, 8, 5, 13, 1),
795*77f22241SEmmanuel Vadot 	MUX(0, "clk_wifi_sel", wifi_p, 0, 1, 14, 1),
796*77f22241SEmmanuel Vadot 	MUX(0, "clk_timer_sel", xin24m_xin32k_p, 0, 1, 15, 1),
797*77f22241SEmmanuel Vadot 
798*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKSEL_CON2 */
799*77f22241SEmmanuel Vadot 	CDIV(0, "clk_i2c0_div", "ppll", 0, 2, 0, 7),
800*77f22241SEmmanuel Vadot 	/* 7 Reserved */
801*77f22241SEmmanuel Vadot 	CDIV(0, "clk_i2c8_div", "ppll", 0, 2, 8, 7),
802*77f22241SEmmanuel Vadot 	/* 15 Reserved */
803*77f22241SEmmanuel Vadot 
804*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKSEL_CON3 */
805*77f22241SEmmanuel Vadot 	CDIV(0, "clk_i2c4_div", "ppll", 0, 3, 0, 7),
806*77f22241SEmmanuel Vadot 	/* 7:15 Reserved */
807*77f22241SEmmanuel Vadot 
808*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKSEL_CON4 */
809*77f22241SEmmanuel Vadot 	/* 0:9 clk_32k_suspend_div */
810*77f22241SEmmanuel Vadot 	/* 10:14 Reserved */
811*77f22241SEmmanuel Vadot 	/* 15 clk_32k_suspend_sel */
812*77f22241SEmmanuel Vadot 
813*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKSEL_CON5 */
814*77f22241SEmmanuel Vadot 	COMP(0, "clk_uart4_c", xin24m_ppll_p, 0, 5, 0, 7, 10, 1),
815*77f22241SEmmanuel Vadot 	/* 7 Reserved */
816*77f22241SEmmanuel Vadot 	MUX(0, "clk_uart4_sel", uart4_p, 0, 5, 8, 2),
817*77f22241SEmmanuel Vadot 	/* 11:15 Reserved */
818*77f22241SEmmanuel Vadot 
819*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKFRAC_CON0 / PMUCRU_CLKSEL_CON6 */
820*77f22241SEmmanuel Vadot 	FRACT(0, "clk_uart4_frac_frac", "clk_uart4_sel", 0, 6),
821*77f22241SEmmanuel Vadot 
822*77f22241SEmmanuel Vadot 	/* PMUCRU_CLKFRAC_CON1 / PMUCRU_CLKSEL_CON7 */
823*77f22241SEmmanuel Vadot 	FRACT(0, "clk_wifi_frac", "clk_wifi_c", 0, 7),
824*77f22241SEmmanuel Vadot };
825*77f22241SEmmanuel Vadot 
826*77f22241SEmmanuel Vadot static int
827*77f22241SEmmanuel Vadot rk3399_pmucru_probe(device_t dev)
828*77f22241SEmmanuel Vadot {
829*77f22241SEmmanuel Vadot 
830*77f22241SEmmanuel Vadot 	if (!ofw_bus_status_okay(dev))
831*77f22241SEmmanuel Vadot 		return (ENXIO);
832*77f22241SEmmanuel Vadot 
833*77f22241SEmmanuel Vadot 	if (ofw_bus_is_compatible(dev, "rockchip,rk3399-pmucru")) {
834*77f22241SEmmanuel Vadot 		device_set_desc(dev, "Rockchip RK3399 PMU Clock and Reset Unit");
835*77f22241SEmmanuel Vadot 		return (BUS_PROBE_DEFAULT);
836*77f22241SEmmanuel Vadot 	}
837*77f22241SEmmanuel Vadot 
838*77f22241SEmmanuel Vadot 	return (ENXIO);
839*77f22241SEmmanuel Vadot }
840*77f22241SEmmanuel Vadot 
841*77f22241SEmmanuel Vadot static int
842*77f22241SEmmanuel Vadot rk3399_pmucru_attach(device_t dev)
843*77f22241SEmmanuel Vadot {
844*77f22241SEmmanuel Vadot 	struct rk_cru_softc *sc;
845*77f22241SEmmanuel Vadot 
846*77f22241SEmmanuel Vadot 	sc = device_get_softc(dev);
847*77f22241SEmmanuel Vadot 	sc->dev = dev;
848*77f22241SEmmanuel Vadot 
849*77f22241SEmmanuel Vadot 	sc->gates = rk3399_pmu_gates;
850*77f22241SEmmanuel Vadot 	sc->ngates = nitems(rk3399_pmu_gates);
851*77f22241SEmmanuel Vadot 
852*77f22241SEmmanuel Vadot 	sc->clks = rk3399_pmu_clks;
853*77f22241SEmmanuel Vadot 	sc->nclks = nitems(rk3399_pmu_clks);
854*77f22241SEmmanuel Vadot 
855*77f22241SEmmanuel Vadot 	sc->reset_offset = 0x110;
856*77f22241SEmmanuel Vadot 	sc->reset_num = 30;
857*77f22241SEmmanuel Vadot 
858*77f22241SEmmanuel Vadot 	return (rk_cru_attach(dev));
859*77f22241SEmmanuel Vadot }
860*77f22241SEmmanuel Vadot 
861*77f22241SEmmanuel Vadot static device_method_t rk3399_pmucru_methods[] = {
862*77f22241SEmmanuel Vadot 	/* Device interface */
863*77f22241SEmmanuel Vadot 	DEVMETHOD(device_probe,		rk3399_pmucru_probe),
864*77f22241SEmmanuel Vadot 	DEVMETHOD(device_attach,	rk3399_pmucru_attach),
865*77f22241SEmmanuel Vadot 
866*77f22241SEmmanuel Vadot 	DEVMETHOD_END
867*77f22241SEmmanuel Vadot };
868*77f22241SEmmanuel Vadot 
869*77f22241SEmmanuel Vadot DEFINE_CLASS_1(rk3399_pmucru, rk3399_pmucru_driver, rk3399_pmucru_methods,
870*77f22241SEmmanuel Vadot   sizeof(struct rk_cru_softc), rk_cru_driver);
871*77f22241SEmmanuel Vadot 
872*77f22241SEmmanuel Vadot EARLY_DRIVER_MODULE(rk3399_pmucru, simplebus, rk3399_pmucru_driver, 0, 0,
873*77f22241SEmmanuel Vadot     BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE);
874