xref: /openbmc/linux/drivers/clk/meson/gxbb.c (revision a70c6e06)
1738f66d3SMichael Turquette /*
21f501d63SPaul Gortmaker  * AmLogic S905 / GXBB Clock Controller Driver
31f501d63SPaul Gortmaker  *
4738f66d3SMichael Turquette  * Copyright (c) 2016 AmLogic, Inc.
5738f66d3SMichael Turquette  * Michael Turquette <mturquette@baylibre.com>
6738f66d3SMichael Turquette  *
7738f66d3SMichael Turquette  * This program is free software; you can redistribute it and/or modify it
8738f66d3SMichael Turquette  * under the terms and conditions of the GNU General Public License,
9738f66d3SMichael Turquette  * version 2, as published by the Free Software Foundation.
10738f66d3SMichael Turquette  *
11738f66d3SMichael Turquette  * This program is distributed in the hope it will be useful, but WITHOUT
12738f66d3SMichael Turquette  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13738f66d3SMichael Turquette  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14738f66d3SMichael Turquette  * more details.
15738f66d3SMichael Turquette  *
16738f66d3SMichael Turquette  * You should have received a copy of the GNU General Public License along with
17738f66d3SMichael Turquette  * this program.  If not, see <http://www.gnu.org/licenses/>.
18738f66d3SMichael Turquette  */
19738f66d3SMichael Turquette 
20738f66d3SMichael Turquette #include <linux/clk.h>
21738f66d3SMichael Turquette #include <linux/clk-provider.h>
22738f66d3SMichael Turquette #include <linux/of_address.h>
230d48fc55SNeil Armstrong #include <linux/of_device.h>
24738f66d3SMichael Turquette #include <linux/platform_device.h>
251f501d63SPaul Gortmaker #include <linux/init.h>
26738f66d3SMichael Turquette 
27738f66d3SMichael Turquette #include "clkc.h"
28738f66d3SMichael Turquette #include "gxbb.h"
29738f66d3SMichael Turquette 
30738f66d3SMichael Turquette static DEFINE_SPINLOCK(clk_lock);
31738f66d3SMichael Turquette 
32738f66d3SMichael Turquette static const struct pll_rate_table sys_pll_rate_table[] = {
33738f66d3SMichael Turquette 	PLL_RATE(24000000, 56, 1, 2),
34738f66d3SMichael Turquette 	PLL_RATE(48000000, 64, 1, 2),
35738f66d3SMichael Turquette 	PLL_RATE(72000000, 72, 1, 2),
36738f66d3SMichael Turquette 	PLL_RATE(96000000, 64, 1, 2),
37738f66d3SMichael Turquette 	PLL_RATE(120000000, 80, 1, 2),
38738f66d3SMichael Turquette 	PLL_RATE(144000000, 96, 1, 2),
39738f66d3SMichael Turquette 	PLL_RATE(168000000, 56, 1, 1),
40738f66d3SMichael Turquette 	PLL_RATE(192000000, 64, 1, 1),
41738f66d3SMichael Turquette 	PLL_RATE(216000000, 72, 1, 1),
42738f66d3SMichael Turquette 	PLL_RATE(240000000, 80, 1, 1),
43738f66d3SMichael Turquette 	PLL_RATE(264000000, 88, 1, 1),
44738f66d3SMichael Turquette 	PLL_RATE(288000000, 96, 1, 1),
45738f66d3SMichael Turquette 	PLL_RATE(312000000, 52, 1, 2),
46738f66d3SMichael Turquette 	PLL_RATE(336000000, 56, 1, 2),
47738f66d3SMichael Turquette 	PLL_RATE(360000000, 60, 1, 2),
48738f66d3SMichael Turquette 	PLL_RATE(384000000, 64, 1, 2),
49738f66d3SMichael Turquette 	PLL_RATE(408000000, 68, 1, 2),
50738f66d3SMichael Turquette 	PLL_RATE(432000000, 72, 1, 2),
51738f66d3SMichael Turquette 	PLL_RATE(456000000, 76, 1, 2),
52738f66d3SMichael Turquette 	PLL_RATE(480000000, 80, 1, 2),
53738f66d3SMichael Turquette 	PLL_RATE(504000000, 84, 1, 2),
54738f66d3SMichael Turquette 	PLL_RATE(528000000, 88, 1, 2),
55738f66d3SMichael Turquette 	PLL_RATE(552000000, 92, 1, 2),
56738f66d3SMichael Turquette 	PLL_RATE(576000000, 96, 1, 2),
57738f66d3SMichael Turquette 	PLL_RATE(600000000, 50, 1, 1),
58738f66d3SMichael Turquette 	PLL_RATE(624000000, 52, 1, 1),
59738f66d3SMichael Turquette 	PLL_RATE(648000000, 54, 1, 1),
60738f66d3SMichael Turquette 	PLL_RATE(672000000, 56, 1, 1),
61738f66d3SMichael Turquette 	PLL_RATE(696000000, 58, 1, 1),
62738f66d3SMichael Turquette 	PLL_RATE(720000000, 60, 1, 1),
63738f66d3SMichael Turquette 	PLL_RATE(744000000, 62, 1, 1),
64738f66d3SMichael Turquette 	PLL_RATE(768000000, 64, 1, 1),
65738f66d3SMichael Turquette 	PLL_RATE(792000000, 66, 1, 1),
66738f66d3SMichael Turquette 	PLL_RATE(816000000, 68, 1, 1),
67738f66d3SMichael Turquette 	PLL_RATE(840000000, 70, 1, 1),
68738f66d3SMichael Turquette 	PLL_RATE(864000000, 72, 1, 1),
69738f66d3SMichael Turquette 	PLL_RATE(888000000, 74, 1, 1),
70738f66d3SMichael Turquette 	PLL_RATE(912000000, 76, 1, 1),
71738f66d3SMichael Turquette 	PLL_RATE(936000000, 78, 1, 1),
72738f66d3SMichael Turquette 	PLL_RATE(960000000, 80, 1, 1),
73738f66d3SMichael Turquette 	PLL_RATE(984000000, 82, 1, 1),
74738f66d3SMichael Turquette 	PLL_RATE(1008000000, 84, 1, 1),
75738f66d3SMichael Turquette 	PLL_RATE(1032000000, 86, 1, 1),
76738f66d3SMichael Turquette 	PLL_RATE(1056000000, 88, 1, 1),
77738f66d3SMichael Turquette 	PLL_RATE(1080000000, 90, 1, 1),
78738f66d3SMichael Turquette 	PLL_RATE(1104000000, 92, 1, 1),
79738f66d3SMichael Turquette 	PLL_RATE(1128000000, 94, 1, 1),
80738f66d3SMichael Turquette 	PLL_RATE(1152000000, 96, 1, 1),
81738f66d3SMichael Turquette 	PLL_RATE(1176000000, 98, 1, 1),
82738f66d3SMichael Turquette 	PLL_RATE(1200000000, 50, 1, 0),
83738f66d3SMichael Turquette 	PLL_RATE(1224000000, 51, 1, 0),
84738f66d3SMichael Turquette 	PLL_RATE(1248000000, 52, 1, 0),
85738f66d3SMichael Turquette 	PLL_RATE(1272000000, 53, 1, 0),
86738f66d3SMichael Turquette 	PLL_RATE(1296000000, 54, 1, 0),
87738f66d3SMichael Turquette 	PLL_RATE(1320000000, 55, 1, 0),
88738f66d3SMichael Turquette 	PLL_RATE(1344000000, 56, 1, 0),
89738f66d3SMichael Turquette 	PLL_RATE(1368000000, 57, 1, 0),
90738f66d3SMichael Turquette 	PLL_RATE(1392000000, 58, 1, 0),
91738f66d3SMichael Turquette 	PLL_RATE(1416000000, 59, 1, 0),
92738f66d3SMichael Turquette 	PLL_RATE(1440000000, 60, 1, 0),
93738f66d3SMichael Turquette 	PLL_RATE(1464000000, 61, 1, 0),
94738f66d3SMichael Turquette 	PLL_RATE(1488000000, 62, 1, 0),
95738f66d3SMichael Turquette 	PLL_RATE(1512000000, 63, 1, 0),
96738f66d3SMichael Turquette 	PLL_RATE(1536000000, 64, 1, 0),
97738f66d3SMichael Turquette 	PLL_RATE(1560000000, 65, 1, 0),
98738f66d3SMichael Turquette 	PLL_RATE(1584000000, 66, 1, 0),
99738f66d3SMichael Turquette 	PLL_RATE(1608000000, 67, 1, 0),
100738f66d3SMichael Turquette 	PLL_RATE(1632000000, 68, 1, 0),
101738f66d3SMichael Turquette 	PLL_RATE(1656000000, 68, 1, 0),
102738f66d3SMichael Turquette 	PLL_RATE(1680000000, 68, 1, 0),
103738f66d3SMichael Turquette 	PLL_RATE(1704000000, 68, 1, 0),
104738f66d3SMichael Turquette 	PLL_RATE(1728000000, 69, 1, 0),
105738f66d3SMichael Turquette 	PLL_RATE(1752000000, 69, 1, 0),
106738f66d3SMichael Turquette 	PLL_RATE(1776000000, 69, 1, 0),
107738f66d3SMichael Turquette 	PLL_RATE(1800000000, 69, 1, 0),
108738f66d3SMichael Turquette 	PLL_RATE(1824000000, 70, 1, 0),
109738f66d3SMichael Turquette 	PLL_RATE(1848000000, 70, 1, 0),
110738f66d3SMichael Turquette 	PLL_RATE(1872000000, 70, 1, 0),
111738f66d3SMichael Turquette 	PLL_RATE(1896000000, 70, 1, 0),
112738f66d3SMichael Turquette 	PLL_RATE(1920000000, 71, 1, 0),
113738f66d3SMichael Turquette 	PLL_RATE(1944000000, 71, 1, 0),
114738f66d3SMichael Turquette 	PLL_RATE(1968000000, 71, 1, 0),
115738f66d3SMichael Turquette 	PLL_RATE(1992000000, 71, 1, 0),
116738f66d3SMichael Turquette 	PLL_RATE(2016000000, 72, 1, 0),
117738f66d3SMichael Turquette 	PLL_RATE(2040000000, 72, 1, 0),
118738f66d3SMichael Turquette 	PLL_RATE(2064000000, 72, 1, 0),
119738f66d3SMichael Turquette 	PLL_RATE(2088000000, 72, 1, 0),
120738f66d3SMichael Turquette 	PLL_RATE(2112000000, 73, 1, 0),
121738f66d3SMichael Turquette 	{ /* sentinel */ },
122738f66d3SMichael Turquette };
123738f66d3SMichael Turquette 
1240d48fc55SNeil Armstrong static const struct pll_rate_table gxbb_gp0_pll_rate_table[] = {
125738f66d3SMichael Turquette 	PLL_RATE(96000000, 32, 1, 3),
126738f66d3SMichael Turquette 	PLL_RATE(99000000, 33, 1, 3),
127738f66d3SMichael Turquette 	PLL_RATE(102000000, 34, 1, 3),
128738f66d3SMichael Turquette 	PLL_RATE(105000000, 35, 1, 3),
129738f66d3SMichael Turquette 	PLL_RATE(108000000, 36, 1, 3),
130738f66d3SMichael Turquette 	PLL_RATE(111000000, 37, 1, 3),
131738f66d3SMichael Turquette 	PLL_RATE(114000000, 38, 1, 3),
132738f66d3SMichael Turquette 	PLL_RATE(117000000, 39, 1, 3),
133738f66d3SMichael Turquette 	PLL_RATE(120000000, 40, 1, 3),
134738f66d3SMichael Turquette 	PLL_RATE(123000000, 41, 1, 3),
135738f66d3SMichael Turquette 	PLL_RATE(126000000, 42, 1, 3),
136738f66d3SMichael Turquette 	PLL_RATE(129000000, 43, 1, 3),
137738f66d3SMichael Turquette 	PLL_RATE(132000000, 44, 1, 3),
138738f66d3SMichael Turquette 	PLL_RATE(135000000, 45, 1, 3),
139738f66d3SMichael Turquette 	PLL_RATE(138000000, 46, 1, 3),
140738f66d3SMichael Turquette 	PLL_RATE(141000000, 47, 1, 3),
141738f66d3SMichael Turquette 	PLL_RATE(144000000, 48, 1, 3),
142738f66d3SMichael Turquette 	PLL_RATE(147000000, 49, 1, 3),
143738f66d3SMichael Turquette 	PLL_RATE(150000000, 50, 1, 3),
144738f66d3SMichael Turquette 	PLL_RATE(153000000, 51, 1, 3),
145738f66d3SMichael Turquette 	PLL_RATE(156000000, 52, 1, 3),
146738f66d3SMichael Turquette 	PLL_RATE(159000000, 53, 1, 3),
147738f66d3SMichael Turquette 	PLL_RATE(162000000, 54, 1, 3),
148738f66d3SMichael Turquette 	PLL_RATE(165000000, 55, 1, 3),
149738f66d3SMichael Turquette 	PLL_RATE(168000000, 56, 1, 3),
150738f66d3SMichael Turquette 	PLL_RATE(171000000, 57, 1, 3),
151738f66d3SMichael Turquette 	PLL_RATE(174000000, 58, 1, 3),
152738f66d3SMichael Turquette 	PLL_RATE(177000000, 59, 1, 3),
153738f66d3SMichael Turquette 	PLL_RATE(180000000, 60, 1, 3),
154738f66d3SMichael Turquette 	PLL_RATE(183000000, 61, 1, 3),
155738f66d3SMichael Turquette 	PLL_RATE(186000000, 62, 1, 3),
156738f66d3SMichael Turquette 	PLL_RATE(192000000, 32, 1, 2),
157738f66d3SMichael Turquette 	PLL_RATE(198000000, 33, 1, 2),
158738f66d3SMichael Turquette 	PLL_RATE(204000000, 34, 1, 2),
159738f66d3SMichael Turquette 	PLL_RATE(210000000, 35, 1, 2),
160738f66d3SMichael Turquette 	PLL_RATE(216000000, 36, 1, 2),
161738f66d3SMichael Turquette 	PLL_RATE(222000000, 37, 1, 2),
162738f66d3SMichael Turquette 	PLL_RATE(228000000, 38, 1, 2),
163738f66d3SMichael Turquette 	PLL_RATE(234000000, 39, 1, 2),
164738f66d3SMichael Turquette 	PLL_RATE(240000000, 40, 1, 2),
165738f66d3SMichael Turquette 	PLL_RATE(246000000, 41, 1, 2),
166738f66d3SMichael Turquette 	PLL_RATE(252000000, 42, 1, 2),
167738f66d3SMichael Turquette 	PLL_RATE(258000000, 43, 1, 2),
168738f66d3SMichael Turquette 	PLL_RATE(264000000, 44, 1, 2),
169738f66d3SMichael Turquette 	PLL_RATE(270000000, 45, 1, 2),
170738f66d3SMichael Turquette 	PLL_RATE(276000000, 46, 1, 2),
171738f66d3SMichael Turquette 	PLL_RATE(282000000, 47, 1, 2),
172738f66d3SMichael Turquette 	PLL_RATE(288000000, 48, 1, 2),
173738f66d3SMichael Turquette 	PLL_RATE(294000000, 49, 1, 2),
174738f66d3SMichael Turquette 	PLL_RATE(300000000, 50, 1, 2),
175738f66d3SMichael Turquette 	PLL_RATE(306000000, 51, 1, 2),
176738f66d3SMichael Turquette 	PLL_RATE(312000000, 52, 1, 2),
177738f66d3SMichael Turquette 	PLL_RATE(318000000, 53, 1, 2),
178738f66d3SMichael Turquette 	PLL_RATE(324000000, 54, 1, 2),
179738f66d3SMichael Turquette 	PLL_RATE(330000000, 55, 1, 2),
180738f66d3SMichael Turquette 	PLL_RATE(336000000, 56, 1, 2),
181738f66d3SMichael Turquette 	PLL_RATE(342000000, 57, 1, 2),
182738f66d3SMichael Turquette 	PLL_RATE(348000000, 58, 1, 2),
183738f66d3SMichael Turquette 	PLL_RATE(354000000, 59, 1, 2),
184738f66d3SMichael Turquette 	PLL_RATE(360000000, 60, 1, 2),
185738f66d3SMichael Turquette 	PLL_RATE(366000000, 61, 1, 2),
186738f66d3SMichael Turquette 	PLL_RATE(372000000, 62, 1, 2),
187738f66d3SMichael Turquette 	PLL_RATE(384000000, 32, 1, 1),
188738f66d3SMichael Turquette 	PLL_RATE(396000000, 33, 1, 1),
189738f66d3SMichael Turquette 	PLL_RATE(408000000, 34, 1, 1),
190738f66d3SMichael Turquette 	PLL_RATE(420000000, 35, 1, 1),
191738f66d3SMichael Turquette 	PLL_RATE(432000000, 36, 1, 1),
192738f66d3SMichael Turquette 	PLL_RATE(444000000, 37, 1, 1),
193738f66d3SMichael Turquette 	PLL_RATE(456000000, 38, 1, 1),
194738f66d3SMichael Turquette 	PLL_RATE(468000000, 39, 1, 1),
195738f66d3SMichael Turquette 	PLL_RATE(480000000, 40, 1, 1),
196738f66d3SMichael Turquette 	PLL_RATE(492000000, 41, 1, 1),
197738f66d3SMichael Turquette 	PLL_RATE(504000000, 42, 1, 1),
198738f66d3SMichael Turquette 	PLL_RATE(516000000, 43, 1, 1),
199738f66d3SMichael Turquette 	PLL_RATE(528000000, 44, 1, 1),
200738f66d3SMichael Turquette 	PLL_RATE(540000000, 45, 1, 1),
201738f66d3SMichael Turquette 	PLL_RATE(552000000, 46, 1, 1),
202738f66d3SMichael Turquette 	PLL_RATE(564000000, 47, 1, 1),
203738f66d3SMichael Turquette 	PLL_RATE(576000000, 48, 1, 1),
204738f66d3SMichael Turquette 	PLL_RATE(588000000, 49, 1, 1),
205738f66d3SMichael Turquette 	PLL_RATE(600000000, 50, 1, 1),
206738f66d3SMichael Turquette 	PLL_RATE(612000000, 51, 1, 1),
207738f66d3SMichael Turquette 	PLL_RATE(624000000, 52, 1, 1),
208738f66d3SMichael Turquette 	PLL_RATE(636000000, 53, 1, 1),
209738f66d3SMichael Turquette 	PLL_RATE(648000000, 54, 1, 1),
210738f66d3SMichael Turquette 	PLL_RATE(660000000, 55, 1, 1),
211738f66d3SMichael Turquette 	PLL_RATE(672000000, 56, 1, 1),
212738f66d3SMichael Turquette 	PLL_RATE(684000000, 57, 1, 1),
213738f66d3SMichael Turquette 	PLL_RATE(696000000, 58, 1, 1),
214738f66d3SMichael Turquette 	PLL_RATE(708000000, 59, 1, 1),
215738f66d3SMichael Turquette 	PLL_RATE(720000000, 60, 1, 1),
216738f66d3SMichael Turquette 	PLL_RATE(732000000, 61, 1, 1),
217738f66d3SMichael Turquette 	PLL_RATE(744000000, 62, 1, 1),
218738f66d3SMichael Turquette 	PLL_RATE(768000000, 32, 1, 0),
219738f66d3SMichael Turquette 	PLL_RATE(792000000, 33, 1, 0),
220738f66d3SMichael Turquette 	PLL_RATE(816000000, 34, 1, 0),
221738f66d3SMichael Turquette 	PLL_RATE(840000000, 35, 1, 0),
222738f66d3SMichael Turquette 	PLL_RATE(864000000, 36, 1, 0),
223738f66d3SMichael Turquette 	PLL_RATE(888000000, 37, 1, 0),
224738f66d3SMichael Turquette 	PLL_RATE(912000000, 38, 1, 0),
225738f66d3SMichael Turquette 	PLL_RATE(936000000, 39, 1, 0),
226738f66d3SMichael Turquette 	PLL_RATE(960000000, 40, 1, 0),
227738f66d3SMichael Turquette 	PLL_RATE(984000000, 41, 1, 0),
228738f66d3SMichael Turquette 	PLL_RATE(1008000000, 42, 1, 0),
229738f66d3SMichael Turquette 	PLL_RATE(1032000000, 43, 1, 0),
230738f66d3SMichael Turquette 	PLL_RATE(1056000000, 44, 1, 0),
231738f66d3SMichael Turquette 	PLL_RATE(1080000000, 45, 1, 0),
232738f66d3SMichael Turquette 	PLL_RATE(1104000000, 46, 1, 0),
233738f66d3SMichael Turquette 	PLL_RATE(1128000000, 47, 1, 0),
234738f66d3SMichael Turquette 	PLL_RATE(1152000000, 48, 1, 0),
235738f66d3SMichael Turquette 	PLL_RATE(1176000000, 49, 1, 0),
236738f66d3SMichael Turquette 	PLL_RATE(1200000000, 50, 1, 0),
237738f66d3SMichael Turquette 	PLL_RATE(1224000000, 51, 1, 0),
238738f66d3SMichael Turquette 	PLL_RATE(1248000000, 52, 1, 0),
239738f66d3SMichael Turquette 	PLL_RATE(1272000000, 53, 1, 0),
240738f66d3SMichael Turquette 	PLL_RATE(1296000000, 54, 1, 0),
241738f66d3SMichael Turquette 	PLL_RATE(1320000000, 55, 1, 0),
242738f66d3SMichael Turquette 	PLL_RATE(1344000000, 56, 1, 0),
243738f66d3SMichael Turquette 	PLL_RATE(1368000000, 57, 1, 0),
244738f66d3SMichael Turquette 	PLL_RATE(1392000000, 58, 1, 0),
245738f66d3SMichael Turquette 	PLL_RATE(1416000000, 59, 1, 0),
246738f66d3SMichael Turquette 	PLL_RATE(1440000000, 60, 1, 0),
247738f66d3SMichael Turquette 	PLL_RATE(1464000000, 61, 1, 0),
248738f66d3SMichael Turquette 	PLL_RATE(1488000000, 62, 1, 0),
249738f66d3SMichael Turquette 	{ /* sentinel */ },
250738f66d3SMichael Turquette };
251738f66d3SMichael Turquette 
2520d48fc55SNeil Armstrong static const struct pll_rate_table gxl_gp0_pll_rate_table[] = {
2530d48fc55SNeil Armstrong 	PLL_RATE(504000000, 42, 1, 1),
2540d48fc55SNeil Armstrong 	PLL_RATE(516000000, 43, 1, 1),
2550d48fc55SNeil Armstrong 	PLL_RATE(528000000, 44, 1, 1),
2560d48fc55SNeil Armstrong 	PLL_RATE(540000000, 45, 1, 1),
2570d48fc55SNeil Armstrong 	PLL_RATE(552000000, 46, 1, 1),
2580d48fc55SNeil Armstrong 	PLL_RATE(564000000, 47, 1, 1),
2590d48fc55SNeil Armstrong 	PLL_RATE(576000000, 48, 1, 1),
2600d48fc55SNeil Armstrong 	PLL_RATE(588000000, 49, 1, 1),
2610d48fc55SNeil Armstrong 	PLL_RATE(600000000, 50, 1, 1),
2620d48fc55SNeil Armstrong 	PLL_RATE(612000000, 51, 1, 1),
2630d48fc55SNeil Armstrong 	PLL_RATE(624000000, 52, 1, 1),
2640d48fc55SNeil Armstrong 	PLL_RATE(636000000, 53, 1, 1),
2650d48fc55SNeil Armstrong 	PLL_RATE(648000000, 54, 1, 1),
2660d48fc55SNeil Armstrong 	PLL_RATE(660000000, 55, 1, 1),
2670d48fc55SNeil Armstrong 	PLL_RATE(672000000, 56, 1, 1),
2680d48fc55SNeil Armstrong 	PLL_RATE(684000000, 57, 1, 1),
2690d48fc55SNeil Armstrong 	PLL_RATE(696000000, 58, 1, 1),
2700d48fc55SNeil Armstrong 	PLL_RATE(708000000, 59, 1, 1),
2710d48fc55SNeil Armstrong 	PLL_RATE(720000000, 60, 1, 1),
2720d48fc55SNeil Armstrong 	PLL_RATE(732000000, 61, 1, 1),
2730d48fc55SNeil Armstrong 	PLL_RATE(744000000, 62, 1, 1),
2740d48fc55SNeil Armstrong 	PLL_RATE(756000000, 63, 1, 1),
2750d48fc55SNeil Armstrong 	PLL_RATE(768000000, 64, 1, 1),
2760d48fc55SNeil Armstrong 	PLL_RATE(780000000, 65, 1, 1),
2770d48fc55SNeil Armstrong 	PLL_RATE(792000000, 66, 1, 1),
2780d48fc55SNeil Armstrong 	{ /* sentinel */ },
2790d48fc55SNeil Armstrong };
2800d48fc55SNeil Armstrong 
281738f66d3SMichael Turquette static const struct clk_div_table cpu_div_table[] = {
282738f66d3SMichael Turquette 	{ .val = 1, .div = 1 },
283738f66d3SMichael Turquette 	{ .val = 2, .div = 2 },
284738f66d3SMichael Turquette 	{ .val = 3, .div = 3 },
285738f66d3SMichael Turquette 	{ .val = 2, .div = 4 },
286738f66d3SMichael Turquette 	{ .val = 3, .div = 6 },
287738f66d3SMichael Turquette 	{ .val = 4, .div = 8 },
288738f66d3SMichael Turquette 	{ .val = 5, .div = 10 },
289738f66d3SMichael Turquette 	{ .val = 6, .div = 12 },
290738f66d3SMichael Turquette 	{ .val = 7, .div = 14 },
291738f66d3SMichael Turquette 	{ .val = 8, .div = 16 },
292738f66d3SMichael Turquette 	{ /* sentinel */ },
293738f66d3SMichael Turquette };
294738f66d3SMichael Turquette 
295738f66d3SMichael Turquette static struct meson_clk_pll gxbb_fixed_pll = {
296738f66d3SMichael Turquette 	.m = {
297738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL,
298738f66d3SMichael Turquette 		.shift   = 0,
299738f66d3SMichael Turquette 		.width   = 9,
300738f66d3SMichael Turquette 	},
301738f66d3SMichael Turquette 	.n = {
302738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL,
303738f66d3SMichael Turquette 		.shift   = 9,
304738f66d3SMichael Turquette 		.width   = 5,
305738f66d3SMichael Turquette 	},
306738f66d3SMichael Turquette 	.od = {
307738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL,
308738f66d3SMichael Turquette 		.shift   = 16,
309738f66d3SMichael Turquette 		.width   = 2,
310738f66d3SMichael Turquette 	},
311738f66d3SMichael Turquette 	.lock = &clk_lock,
312738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
313738f66d3SMichael Turquette 		.name = "fixed_pll",
314738f66d3SMichael Turquette 		.ops = &meson_clk_pll_ro_ops,
315738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "xtal" },
316738f66d3SMichael Turquette 		.num_parents = 1,
317738f66d3SMichael Turquette 		.flags = CLK_GET_RATE_NOCACHE,
318738f66d3SMichael Turquette 	},
319738f66d3SMichael Turquette };
320738f66d3SMichael Turquette 
321738f66d3SMichael Turquette static struct meson_clk_pll gxbb_hdmi_pll = {
322738f66d3SMichael Turquette 	.m = {
323738f66d3SMichael Turquette 		.reg_off = HHI_HDMI_PLL_CNTL,
324738f66d3SMichael Turquette 		.shift   = 0,
325738f66d3SMichael Turquette 		.width   = 9,
326738f66d3SMichael Turquette 	},
327738f66d3SMichael Turquette 	.n = {
328738f66d3SMichael Turquette 		.reg_off = HHI_HDMI_PLL_CNTL,
329738f66d3SMichael Turquette 		.shift   = 9,
330738f66d3SMichael Turquette 		.width   = 5,
331738f66d3SMichael Turquette 	},
332738f66d3SMichael Turquette 	.frac = {
333738f66d3SMichael Turquette 		.reg_off = HHI_HDMI_PLL_CNTL2,
334738f66d3SMichael Turquette 		.shift   = 0,
335738f66d3SMichael Turquette 		.width   = 12,
336738f66d3SMichael Turquette 	},
337738f66d3SMichael Turquette 	.od = {
338738f66d3SMichael Turquette 		.reg_off = HHI_HDMI_PLL_CNTL2,
339738f66d3SMichael Turquette 		.shift   = 16,
340738f66d3SMichael Turquette 		.width   = 2,
341738f66d3SMichael Turquette 	},
342738f66d3SMichael Turquette 	.od2 = {
343738f66d3SMichael Turquette 		.reg_off = HHI_HDMI_PLL_CNTL2,
344738f66d3SMichael Turquette 		.shift   = 22,
345738f66d3SMichael Turquette 		.width   = 2,
346738f66d3SMichael Turquette 	},
347738f66d3SMichael Turquette 	.lock = &clk_lock,
348738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
349738f66d3SMichael Turquette 		.name = "hdmi_pll",
350738f66d3SMichael Turquette 		.ops = &meson_clk_pll_ro_ops,
351738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "xtal" },
352738f66d3SMichael Turquette 		.num_parents = 1,
353738f66d3SMichael Turquette 		.flags = CLK_GET_RATE_NOCACHE,
354738f66d3SMichael Turquette 	},
355738f66d3SMichael Turquette };
356738f66d3SMichael Turquette 
357738f66d3SMichael Turquette static struct meson_clk_pll gxbb_sys_pll = {
358738f66d3SMichael Turquette 	.m = {
359738f66d3SMichael Turquette 		.reg_off = HHI_SYS_PLL_CNTL,
360738f66d3SMichael Turquette 		.shift   = 0,
361738f66d3SMichael Turquette 		.width   = 9,
362738f66d3SMichael Turquette 	},
363738f66d3SMichael Turquette 	.n = {
364738f66d3SMichael Turquette 		.reg_off = HHI_SYS_PLL_CNTL,
365738f66d3SMichael Turquette 		.shift   = 9,
366738f66d3SMichael Turquette 		.width   = 5,
367738f66d3SMichael Turquette 	},
368738f66d3SMichael Turquette 	.od = {
369738f66d3SMichael Turquette 		.reg_off = HHI_SYS_PLL_CNTL,
370738f66d3SMichael Turquette 		.shift   = 10,
371738f66d3SMichael Turquette 		.width   = 2,
372738f66d3SMichael Turquette 	},
373738f66d3SMichael Turquette 	.rate_table = sys_pll_rate_table,
374738f66d3SMichael Turquette 	.rate_count = ARRAY_SIZE(sys_pll_rate_table),
375738f66d3SMichael Turquette 	.lock = &clk_lock,
376738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
377738f66d3SMichael Turquette 		.name = "sys_pll",
378738f66d3SMichael Turquette 		.ops = &meson_clk_pll_ro_ops,
379738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "xtal" },
380738f66d3SMichael Turquette 		.num_parents = 1,
381738f66d3SMichael Turquette 		.flags = CLK_GET_RATE_NOCACHE,
382738f66d3SMichael Turquette 	},
383738f66d3SMichael Turquette };
384738f66d3SMichael Turquette 
385e194401cSNeil Armstrong struct pll_params_table gxbb_gp0_params_table[] = {
386e194401cSNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL, 0x6a000228),
387e194401cSNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL2, 0x69c80000),
388e194401cSNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL3, 0x0a5590c4),
389e194401cSNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL4, 0x0000500d),
390e194401cSNeil Armstrong };
391e194401cSNeil Armstrong 
392738f66d3SMichael Turquette static struct meson_clk_pll gxbb_gp0_pll = {
393738f66d3SMichael Turquette 	.m = {
394738f66d3SMichael Turquette 		.reg_off = HHI_GP0_PLL_CNTL,
395738f66d3SMichael Turquette 		.shift   = 0,
396738f66d3SMichael Turquette 		.width   = 9,
397738f66d3SMichael Turquette 	},
398738f66d3SMichael Turquette 	.n = {
399738f66d3SMichael Turquette 		.reg_off = HHI_GP0_PLL_CNTL,
400738f66d3SMichael Turquette 		.shift   = 9,
401738f66d3SMichael Turquette 		.width   = 5,
402738f66d3SMichael Turquette 	},
403738f66d3SMichael Turquette 	.od = {
404738f66d3SMichael Turquette 		.reg_off = HHI_GP0_PLL_CNTL,
405738f66d3SMichael Turquette 		.shift   = 16,
406738f66d3SMichael Turquette 		.width   = 2,
407738f66d3SMichael Turquette 	},
408e194401cSNeil Armstrong 	.params = {
409e194401cSNeil Armstrong 		.params_table = gxbb_gp0_params_table,
410e194401cSNeil Armstrong 		.params_count =	ARRAY_SIZE(gxbb_gp0_params_table),
411e194401cSNeil Armstrong 		.no_init_reset = true,
412e194401cSNeil Armstrong 		.clear_reset_for_lock = true,
413e194401cSNeil Armstrong 	},
4140d48fc55SNeil Armstrong 	.rate_table = gxbb_gp0_pll_rate_table,
4150d48fc55SNeil Armstrong 	.rate_count = ARRAY_SIZE(gxbb_gp0_pll_rate_table),
4160d48fc55SNeil Armstrong 	.lock = &clk_lock,
4170d48fc55SNeil Armstrong 	.hw.init = &(struct clk_init_data){
4180d48fc55SNeil Armstrong 		.name = "gp0_pll",
4190d48fc55SNeil Armstrong 		.ops = &meson_clk_pll_ops,
4200d48fc55SNeil Armstrong 		.parent_names = (const char *[]){ "xtal" },
4210d48fc55SNeil Armstrong 		.num_parents = 1,
4220d48fc55SNeil Armstrong 		.flags = CLK_GET_RATE_NOCACHE,
4230d48fc55SNeil Armstrong 	},
4240d48fc55SNeil Armstrong };
4250d48fc55SNeil Armstrong 
4260d48fc55SNeil Armstrong struct pll_params_table gxl_gp0_params_table[] = {
4270d48fc55SNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL, 0x40010250),
4280d48fc55SNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL1, 0xc084a000),
4290d48fc55SNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL2, 0xb75020be),
4300d48fc55SNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL3, 0x0a59a288),
4310d48fc55SNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL4, 0xc000004d),
4320d48fc55SNeil Armstrong 	PLL_PARAM(HHI_GP0_PLL_CNTL5, 0x00078000),
4330d48fc55SNeil Armstrong };
4340d48fc55SNeil Armstrong 
4350d48fc55SNeil Armstrong static struct meson_clk_pll gxl_gp0_pll = {
4360d48fc55SNeil Armstrong 	.m = {
4370d48fc55SNeil Armstrong 		.reg_off = HHI_GP0_PLL_CNTL,
4380d48fc55SNeil Armstrong 		.shift   = 0,
4390d48fc55SNeil Armstrong 		.width   = 9,
4400d48fc55SNeil Armstrong 	},
4410d48fc55SNeil Armstrong 	.n = {
4420d48fc55SNeil Armstrong 		.reg_off = HHI_GP0_PLL_CNTL,
4430d48fc55SNeil Armstrong 		.shift   = 9,
4440d48fc55SNeil Armstrong 		.width   = 5,
4450d48fc55SNeil Armstrong 	},
4460d48fc55SNeil Armstrong 	.od = {
4470d48fc55SNeil Armstrong 		.reg_off = HHI_GP0_PLL_CNTL,
4480d48fc55SNeil Armstrong 		.shift   = 16,
4490d48fc55SNeil Armstrong 		.width   = 2,
4500d48fc55SNeil Armstrong 	},
4510d48fc55SNeil Armstrong 	.params = {
4520d48fc55SNeil Armstrong 		.params_table = gxl_gp0_params_table,
4530d48fc55SNeil Armstrong 		.params_count =	ARRAY_SIZE(gxl_gp0_params_table),
4540d48fc55SNeil Armstrong 		.no_init_reset = true,
4550d48fc55SNeil Armstrong 		.reset_lock_loop = true,
4560d48fc55SNeil Armstrong 	},
4570d48fc55SNeil Armstrong 	.rate_table = gxl_gp0_pll_rate_table,
4580d48fc55SNeil Armstrong 	.rate_count = ARRAY_SIZE(gxl_gp0_pll_rate_table),
459738f66d3SMichael Turquette 	.lock = &clk_lock,
460738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
461738f66d3SMichael Turquette 		.name = "gp0_pll",
462738f66d3SMichael Turquette 		.ops = &meson_clk_pll_ops,
463738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "xtal" },
464738f66d3SMichael Turquette 		.num_parents = 1,
465738f66d3SMichael Turquette 		.flags = CLK_GET_RATE_NOCACHE,
466738f66d3SMichael Turquette 	},
467738f66d3SMichael Turquette };
468738f66d3SMichael Turquette 
469738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div2 = {
470738f66d3SMichael Turquette 	.mult = 1,
471738f66d3SMichael Turquette 	.div = 2,
472738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
473738f66d3SMichael Turquette 		.name = "fclk_div2",
474738f66d3SMichael Turquette 		.ops = &clk_fixed_factor_ops,
475738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
476738f66d3SMichael Turquette 		.num_parents = 1,
477738f66d3SMichael Turquette 	},
478738f66d3SMichael Turquette };
479738f66d3SMichael Turquette 
480738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div3 = {
481738f66d3SMichael Turquette 	.mult = 1,
482738f66d3SMichael Turquette 	.div = 3,
483738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
484738f66d3SMichael Turquette 		.name = "fclk_div3",
485738f66d3SMichael Turquette 		.ops = &clk_fixed_factor_ops,
486738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
487738f66d3SMichael Turquette 		.num_parents = 1,
488738f66d3SMichael Turquette 	},
489738f66d3SMichael Turquette };
490738f66d3SMichael Turquette 
491738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div4 = {
492738f66d3SMichael Turquette 	.mult = 1,
493738f66d3SMichael Turquette 	.div = 4,
494738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
495738f66d3SMichael Turquette 		.name = "fclk_div4",
496738f66d3SMichael Turquette 		.ops = &clk_fixed_factor_ops,
497738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
498738f66d3SMichael Turquette 		.num_parents = 1,
499738f66d3SMichael Turquette 	},
500738f66d3SMichael Turquette };
501738f66d3SMichael Turquette 
502738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div5 = {
503738f66d3SMichael Turquette 	.mult = 1,
504738f66d3SMichael Turquette 	.div = 5,
505738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
506738f66d3SMichael Turquette 		.name = "fclk_div5",
507738f66d3SMichael Turquette 		.ops = &clk_fixed_factor_ops,
508738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
509738f66d3SMichael Turquette 		.num_parents = 1,
510738f66d3SMichael Turquette 	},
511738f66d3SMichael Turquette };
512738f66d3SMichael Turquette 
513738f66d3SMichael Turquette static struct clk_fixed_factor gxbb_fclk_div7 = {
514738f66d3SMichael Turquette 	.mult = 1,
515738f66d3SMichael Turquette 	.div = 7,
516738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
517738f66d3SMichael Turquette 		.name = "fclk_div7",
518738f66d3SMichael Turquette 		.ops = &clk_fixed_factor_ops,
519738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
520738f66d3SMichael Turquette 		.num_parents = 1,
521738f66d3SMichael Turquette 	},
522738f66d3SMichael Turquette };
523738f66d3SMichael Turquette 
524738f66d3SMichael Turquette static struct meson_clk_mpll gxbb_mpll0 = {
525738f66d3SMichael Turquette 	.sdm = {
526738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL7,
527738f66d3SMichael Turquette 		.shift   = 0,
528738f66d3SMichael Turquette 		.width   = 14,
529738f66d3SMichael Turquette 	},
530007e6e5cSJerome Brunet 	.sdm_en = {
531007e6e5cSJerome Brunet 		.reg_off = HHI_MPLL_CNTL7,
532007e6e5cSJerome Brunet 		.shift   = 15,
533007e6e5cSJerome Brunet 		.width	 = 1,
534007e6e5cSJerome Brunet 	},
535738f66d3SMichael Turquette 	.n2 = {
536738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL7,
537738f66d3SMichael Turquette 		.shift   = 16,
538738f66d3SMichael Turquette 		.width   = 9,
539738f66d3SMichael Turquette 	},
540007e6e5cSJerome Brunet 	.en = {
541007e6e5cSJerome Brunet 		.reg_off = HHI_MPLL_CNTL7,
542007e6e5cSJerome Brunet 		.shift   = 14,
543007e6e5cSJerome Brunet 		.width	 = 1,
544007e6e5cSJerome Brunet 	},
545738f66d3SMichael Turquette 	.lock = &clk_lock,
546738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
547738f66d3SMichael Turquette 		.name = "mpll0",
54805b43aa2SJerome Brunet 		.ops = &meson_clk_mpll_ops,
549738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
550738f66d3SMichael Turquette 		.num_parents = 1,
551738f66d3SMichael Turquette 	},
552738f66d3SMichael Turquette };
553738f66d3SMichael Turquette 
554738f66d3SMichael Turquette static struct meson_clk_mpll gxbb_mpll1 = {
555738f66d3SMichael Turquette 	.sdm = {
556738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL8,
557738f66d3SMichael Turquette 		.shift   = 0,
558738f66d3SMichael Turquette 		.width   = 14,
559738f66d3SMichael Turquette 	},
560007e6e5cSJerome Brunet 	.sdm_en = {
561007e6e5cSJerome Brunet 		.reg_off = HHI_MPLL_CNTL8,
562007e6e5cSJerome Brunet 		.shift   = 15,
563007e6e5cSJerome Brunet 		.width	 = 1,
564007e6e5cSJerome Brunet 	},
565738f66d3SMichael Turquette 	.n2 = {
566738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL8,
567738f66d3SMichael Turquette 		.shift   = 16,
568738f66d3SMichael Turquette 		.width   = 9,
569738f66d3SMichael Turquette 	},
570007e6e5cSJerome Brunet 	.en = {
571007e6e5cSJerome Brunet 		.reg_off = HHI_MPLL_CNTL8,
572007e6e5cSJerome Brunet 		.shift   = 14,
573007e6e5cSJerome Brunet 		.width	 = 1,
574007e6e5cSJerome Brunet 	},
575738f66d3SMichael Turquette 	.lock = &clk_lock,
576738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
577738f66d3SMichael Turquette 		.name = "mpll1",
57805b43aa2SJerome Brunet 		.ops = &meson_clk_mpll_ops,
579738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
580738f66d3SMichael Turquette 		.num_parents = 1,
581738f66d3SMichael Turquette 	},
582738f66d3SMichael Turquette };
583738f66d3SMichael Turquette 
584738f66d3SMichael Turquette static struct meson_clk_mpll gxbb_mpll2 = {
585738f66d3SMichael Turquette 	.sdm = {
586738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL9,
587738f66d3SMichael Turquette 		.shift   = 0,
588738f66d3SMichael Turquette 		.width   = 14,
589738f66d3SMichael Turquette 	},
590007e6e5cSJerome Brunet 	.sdm_en = {
591007e6e5cSJerome Brunet 		.reg_off = HHI_MPLL_CNTL9,
592007e6e5cSJerome Brunet 		.shift   = 15,
593007e6e5cSJerome Brunet 		.width	 = 1,
594007e6e5cSJerome Brunet 	},
595738f66d3SMichael Turquette 	.n2 = {
596738f66d3SMichael Turquette 		.reg_off = HHI_MPLL_CNTL9,
597738f66d3SMichael Turquette 		.shift   = 16,
598738f66d3SMichael Turquette 		.width   = 9,
599738f66d3SMichael Turquette 	},
600007e6e5cSJerome Brunet 	.en = {
601007e6e5cSJerome Brunet 		.reg_off = HHI_MPLL_CNTL9,
602007e6e5cSJerome Brunet 		.shift   = 14,
603007e6e5cSJerome Brunet 		.width	 = 1,
604007e6e5cSJerome Brunet 	},
605738f66d3SMichael Turquette 	.lock = &clk_lock,
606738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
607738f66d3SMichael Turquette 		.name = "mpll2",
60805b43aa2SJerome Brunet 		.ops = &meson_clk_mpll_ops,
609738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fixed_pll" },
610738f66d3SMichael Turquette 		.num_parents = 1,
611738f66d3SMichael Turquette 	},
612738f66d3SMichael Turquette };
613738f66d3SMichael Turquette 
614738f66d3SMichael Turquette /*
615738f66d3SMichael Turquette  * FIXME cpu clocks and the legacy composite clocks (e.g. clk81) are both PLL
616738f66d3SMichael Turquette  * post-dividers and should be modeled with their respective PLLs via the
617738f66d3SMichael Turquette  * forthcoming coordinated clock rates feature
618738f66d3SMichael Turquette  */
619738f66d3SMichael Turquette static struct meson_clk_cpu gxbb_cpu_clk = {
620738f66d3SMichael Turquette 	.reg_off = HHI_SYS_CPU_CLK_CNTL1,
621738f66d3SMichael Turquette 	.div_table = cpu_div_table,
622738f66d3SMichael Turquette 	.clk_nb.notifier_call = meson_clk_cpu_notifier_cb,
623738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
624738f66d3SMichael Turquette 		.name = "cpu_clk",
625738f66d3SMichael Turquette 		.ops = &meson_clk_cpu_ops,
626738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "sys_pll" },
627738f66d3SMichael Turquette 		.num_parents = 1,
628738f66d3SMichael Turquette 	},
629738f66d3SMichael Turquette };
630738f66d3SMichael Turquette 
631738f66d3SMichael Turquette static u32 mux_table_clk81[]	= { 6, 5, 7 };
632738f66d3SMichael Turquette 
633738f66d3SMichael Turquette static struct clk_mux gxbb_mpeg_clk_sel = {
634738f66d3SMichael Turquette 	.reg = (void *)HHI_MPEG_CLK_CNTL,
635738f66d3SMichael Turquette 	.mask = 0x7,
636738f66d3SMichael Turquette 	.shift = 12,
637738f66d3SMichael Turquette 	.flags = CLK_MUX_READ_ONLY,
638738f66d3SMichael Turquette 	.table = mux_table_clk81,
639738f66d3SMichael Turquette 	.lock = &clk_lock,
640738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
641738f66d3SMichael Turquette 		.name = "mpeg_clk_sel",
642738f66d3SMichael Turquette 		.ops = &clk_mux_ro_ops,
643738f66d3SMichael Turquette 		/*
644738f66d3SMichael Turquette 		 * FIXME bits 14:12 selects from 8 possible parents:
645738f66d3SMichael Turquette 		 * xtal, 1'b0 (wtf), fclk_div7, mpll_clkout1, mpll_clkout2,
646738f66d3SMichael Turquette 		 * fclk_div4, fclk_div3, fclk_div5
647738f66d3SMichael Turquette 		 */
648738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "fclk_div3", "fclk_div4",
649738f66d3SMichael Turquette 			"fclk_div5" },
650738f66d3SMichael Turquette 		.num_parents = 3,
651738f66d3SMichael Turquette 		.flags = (CLK_SET_RATE_NO_REPARENT | CLK_IGNORE_UNUSED),
652738f66d3SMichael Turquette 	},
653738f66d3SMichael Turquette };
654738f66d3SMichael Turquette 
655738f66d3SMichael Turquette static struct clk_divider gxbb_mpeg_clk_div = {
656738f66d3SMichael Turquette 	.reg = (void *)HHI_MPEG_CLK_CNTL,
657738f66d3SMichael Turquette 	.shift = 0,
658738f66d3SMichael Turquette 	.width = 7,
659738f66d3SMichael Turquette 	.lock = &clk_lock,
660738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
661738f66d3SMichael Turquette 		.name = "mpeg_clk_div",
662738f66d3SMichael Turquette 		.ops = &clk_divider_ops,
663738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "mpeg_clk_sel" },
664738f66d3SMichael Turquette 		.num_parents = 1,
665738f66d3SMichael Turquette 		.flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED),
666738f66d3SMichael Turquette 	},
667738f66d3SMichael Turquette };
668738f66d3SMichael Turquette 
669738f66d3SMichael Turquette /* the mother of dragons^W gates */
670738f66d3SMichael Turquette static struct clk_gate gxbb_clk81 = {
671738f66d3SMichael Turquette 	.reg = (void *)HHI_MPEG_CLK_CNTL,
672738f66d3SMichael Turquette 	.bit_idx = 7,
673738f66d3SMichael Turquette 	.lock = &clk_lock,
674738f66d3SMichael Turquette 	.hw.init = &(struct clk_init_data){
675738f66d3SMichael Turquette 		.name = "clk81",
676738f66d3SMichael Turquette 		.ops = &clk_gate_ops,
677738f66d3SMichael Turquette 		.parent_names = (const char *[]){ "mpeg_clk_div" },
678738f66d3SMichael Turquette 		.num_parents = 1,
679738f66d3SMichael Turquette 		.flags = (CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED | CLK_IS_CRITICAL),
680738f66d3SMichael Turquette 	},
681738f66d3SMichael Turquette };
682738f66d3SMichael Turquette 
68333d0fcdfSMartin Blumenstingl static struct clk_mux gxbb_sar_adc_clk_sel = {
68433d0fcdfSMartin Blumenstingl 	.reg = (void *)HHI_SAR_CLK_CNTL,
68533d0fcdfSMartin Blumenstingl 	.mask = 0x3,
68633d0fcdfSMartin Blumenstingl 	.shift = 9,
68733d0fcdfSMartin Blumenstingl 	.lock = &clk_lock,
68833d0fcdfSMartin Blumenstingl 	.hw.init = &(struct clk_init_data){
68933d0fcdfSMartin Blumenstingl 		.name = "sar_adc_clk_sel",
69033d0fcdfSMartin Blumenstingl 		.ops = &clk_mux_ops,
69133d0fcdfSMartin Blumenstingl 		/* NOTE: The datasheet doesn't list the parents for bit 10 */
69233d0fcdfSMartin Blumenstingl 		.parent_names = (const char *[]){ "xtal", "clk81", },
69333d0fcdfSMartin Blumenstingl 		.num_parents = 2,
69433d0fcdfSMartin Blumenstingl 	},
69533d0fcdfSMartin Blumenstingl };
69633d0fcdfSMartin Blumenstingl 
69733d0fcdfSMartin Blumenstingl static struct clk_divider gxbb_sar_adc_clk_div = {
69833d0fcdfSMartin Blumenstingl 	.reg = (void *)HHI_SAR_CLK_CNTL,
69933d0fcdfSMartin Blumenstingl 	.shift = 0,
70033d0fcdfSMartin Blumenstingl 	.width = 8,
70133d0fcdfSMartin Blumenstingl 	.lock = &clk_lock,
70233d0fcdfSMartin Blumenstingl 	.hw.init = &(struct clk_init_data){
70333d0fcdfSMartin Blumenstingl 		.name = "sar_adc_clk_div",
70433d0fcdfSMartin Blumenstingl 		.ops = &clk_divider_ops,
70533d0fcdfSMartin Blumenstingl 		.parent_names = (const char *[]){ "sar_adc_clk_sel" },
70633d0fcdfSMartin Blumenstingl 		.num_parents = 1,
70733d0fcdfSMartin Blumenstingl 	},
70833d0fcdfSMartin Blumenstingl };
70933d0fcdfSMartin Blumenstingl 
71033d0fcdfSMartin Blumenstingl static struct clk_gate gxbb_sar_adc_clk = {
71133d0fcdfSMartin Blumenstingl 	.reg = (void *)HHI_SAR_CLK_CNTL,
71233d0fcdfSMartin Blumenstingl 	.bit_idx = 8,
71333d0fcdfSMartin Blumenstingl 	.lock = &clk_lock,
71433d0fcdfSMartin Blumenstingl 	.hw.init = &(struct clk_init_data){
71533d0fcdfSMartin Blumenstingl 		.name = "sar_adc_clk",
71633d0fcdfSMartin Blumenstingl 		.ops = &clk_gate_ops,
71733d0fcdfSMartin Blumenstingl 		.parent_names = (const char *[]){ "sar_adc_clk_div" },
71833d0fcdfSMartin Blumenstingl 		.num_parents = 1,
71933d0fcdfSMartin Blumenstingl 		.flags = CLK_SET_RATE_PARENT,
72033d0fcdfSMartin Blumenstingl 	},
72133d0fcdfSMartin Blumenstingl };
72233d0fcdfSMartin Blumenstingl 
723fac9a55bSNeil Armstrong /*
724fac9a55bSNeil Armstrong  * The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
725fac9a55bSNeil Armstrong  * muxed by a glitch-free switch.
726fac9a55bSNeil Armstrong  */
727fac9a55bSNeil Armstrong 
728fac9a55bSNeil Armstrong static u32 mux_table_mali_0_1[] = {0, 1, 2, 3, 4, 5, 6, 7};
729fac9a55bSNeil Armstrong static const char *gxbb_mali_0_1_parent_names[] = {
730fac9a55bSNeil Armstrong 	"xtal", "gp0_pll", "mpll2", "mpll1", "fclk_div7",
731fac9a55bSNeil Armstrong 	"fclk_div4", "fclk_div3", "fclk_div5"
732fac9a55bSNeil Armstrong };
733fac9a55bSNeil Armstrong 
734fac9a55bSNeil Armstrong static struct clk_mux gxbb_mali_0_sel = {
735fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
736fac9a55bSNeil Armstrong 	.mask = 0x7,
737fac9a55bSNeil Armstrong 	.shift = 9,
738fac9a55bSNeil Armstrong 	.table = mux_table_mali_0_1,
739fac9a55bSNeil Armstrong 	.lock = &clk_lock,
740fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
741fac9a55bSNeil Armstrong 		.name = "mali_0_sel",
742fac9a55bSNeil Armstrong 		.ops = &clk_mux_ops,
743fac9a55bSNeil Armstrong 		/*
744fac9a55bSNeil Armstrong 		 * bits 10:9 selects from 8 possible parents:
745fac9a55bSNeil Armstrong 		 * xtal, gp0_pll, mpll2, mpll1, fclk_div7,
746fac9a55bSNeil Armstrong 		 * fclk_div4, fclk_div3, fclk_div5
747fac9a55bSNeil Armstrong 		 */
748fac9a55bSNeil Armstrong 		.parent_names = gxbb_mali_0_1_parent_names,
749fac9a55bSNeil Armstrong 		.num_parents = 8,
750fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_NO_REPARENT,
751fac9a55bSNeil Armstrong 	},
752fac9a55bSNeil Armstrong };
753fac9a55bSNeil Armstrong 
754fac9a55bSNeil Armstrong static struct clk_divider gxbb_mali_0_div = {
755fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
756fac9a55bSNeil Armstrong 	.shift = 0,
757fac9a55bSNeil Armstrong 	.width = 7,
758fac9a55bSNeil Armstrong 	.lock = &clk_lock,
759fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
760fac9a55bSNeil Armstrong 		.name = "mali_0_div",
761fac9a55bSNeil Armstrong 		.ops = &clk_divider_ops,
762fac9a55bSNeil Armstrong 		.parent_names = (const char *[]){ "mali_0_sel" },
763fac9a55bSNeil Armstrong 		.num_parents = 1,
764fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_NO_REPARENT,
765fac9a55bSNeil Armstrong 	},
766fac9a55bSNeil Armstrong };
767fac9a55bSNeil Armstrong 
768fac9a55bSNeil Armstrong static struct clk_gate gxbb_mali_0 = {
769fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
770fac9a55bSNeil Armstrong 	.bit_idx = 8,
771fac9a55bSNeil Armstrong 	.lock = &clk_lock,
772fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
773fac9a55bSNeil Armstrong 		.name = "mali_0",
774fac9a55bSNeil Armstrong 		.ops = &clk_gate_ops,
775fac9a55bSNeil Armstrong 		.parent_names = (const char *[]){ "mali_0_div" },
776fac9a55bSNeil Armstrong 		.num_parents = 1,
777fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_PARENT,
778fac9a55bSNeil Armstrong 	},
779fac9a55bSNeil Armstrong };
780fac9a55bSNeil Armstrong 
781fac9a55bSNeil Armstrong static struct clk_mux gxbb_mali_1_sel = {
782fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
783fac9a55bSNeil Armstrong 	.mask = 0x7,
784fac9a55bSNeil Armstrong 	.shift = 25,
785fac9a55bSNeil Armstrong 	.table = mux_table_mali_0_1,
786fac9a55bSNeil Armstrong 	.lock = &clk_lock,
787fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
788fac9a55bSNeil Armstrong 		.name = "mali_1_sel",
789fac9a55bSNeil Armstrong 		.ops = &clk_mux_ops,
790fac9a55bSNeil Armstrong 		/*
791fac9a55bSNeil Armstrong 		 * bits 10:9 selects from 8 possible parents:
792fac9a55bSNeil Armstrong 		 * xtal, gp0_pll, mpll2, mpll1, fclk_div7,
793fac9a55bSNeil Armstrong 		 * fclk_div4, fclk_div3, fclk_div5
794fac9a55bSNeil Armstrong 		 */
795fac9a55bSNeil Armstrong 		.parent_names = gxbb_mali_0_1_parent_names,
796fac9a55bSNeil Armstrong 		.num_parents = 8,
797fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_NO_REPARENT,
798fac9a55bSNeil Armstrong 	},
799fac9a55bSNeil Armstrong };
800fac9a55bSNeil Armstrong 
801fac9a55bSNeil Armstrong static struct clk_divider gxbb_mali_1_div = {
802fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
803fac9a55bSNeil Armstrong 	.shift = 16,
804fac9a55bSNeil Armstrong 	.width = 7,
805fac9a55bSNeil Armstrong 	.lock = &clk_lock,
806fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
807fac9a55bSNeil Armstrong 		.name = "mali_1_div",
808fac9a55bSNeil Armstrong 		.ops = &clk_divider_ops,
809fac9a55bSNeil Armstrong 		.parent_names = (const char *[]){ "mali_1_sel" },
810fac9a55bSNeil Armstrong 		.num_parents = 1,
811fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_NO_REPARENT,
812fac9a55bSNeil Armstrong 	},
813fac9a55bSNeil Armstrong };
814fac9a55bSNeil Armstrong 
815fac9a55bSNeil Armstrong static struct clk_gate gxbb_mali_1 = {
816fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
817fac9a55bSNeil Armstrong 	.bit_idx = 24,
818fac9a55bSNeil Armstrong 	.lock = &clk_lock,
819fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
820fac9a55bSNeil Armstrong 		.name = "mali_1",
821fac9a55bSNeil Armstrong 		.ops = &clk_gate_ops,
822fac9a55bSNeil Armstrong 		.parent_names = (const char *[]){ "mali_1_div" },
823fac9a55bSNeil Armstrong 		.num_parents = 1,
824fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_PARENT,
825fac9a55bSNeil Armstrong 	},
826fac9a55bSNeil Armstrong };
827fac9a55bSNeil Armstrong 
828fac9a55bSNeil Armstrong static u32 mux_table_mali[] = {0, 1};
829fac9a55bSNeil Armstrong static const char *gxbb_mali_parent_names[] = {
830fac9a55bSNeil Armstrong 	"mali_0", "mali_1"
831fac9a55bSNeil Armstrong };
832fac9a55bSNeil Armstrong 
833fac9a55bSNeil Armstrong static struct clk_mux gxbb_mali = {
834fac9a55bSNeil Armstrong 	.reg = (void *)HHI_MALI_CLK_CNTL,
835fac9a55bSNeil Armstrong 	.mask = 1,
836fac9a55bSNeil Armstrong 	.shift = 31,
837fac9a55bSNeil Armstrong 	.table = mux_table_mali,
838fac9a55bSNeil Armstrong 	.lock = &clk_lock,
839fac9a55bSNeil Armstrong 	.hw.init = &(struct clk_init_data){
840fac9a55bSNeil Armstrong 		.name = "mali",
841fac9a55bSNeil Armstrong 		.ops = &clk_mux_ops,
842fac9a55bSNeil Armstrong 		.parent_names = gxbb_mali_parent_names,
843fac9a55bSNeil Armstrong 		.num_parents = 2,
844fac9a55bSNeil Armstrong 		.flags = CLK_SET_RATE_NO_REPARENT,
845fac9a55bSNeil Armstrong 	},
846fac9a55bSNeil Armstrong };
847fac9a55bSNeil Armstrong 
848738f66d3SMichael Turquette /* Everything Else (EE) domain gates */
8497ba64d82SAlexander Müller static MESON_GATE(gxbb_ddr, HHI_GCLK_MPEG0, 0);
8507ba64d82SAlexander Müller static MESON_GATE(gxbb_dos, HHI_GCLK_MPEG0, 1);
8517ba64d82SAlexander Müller static MESON_GATE(gxbb_isa, HHI_GCLK_MPEG0, 5);
8527ba64d82SAlexander Müller static MESON_GATE(gxbb_pl301, HHI_GCLK_MPEG0, 6);
8537ba64d82SAlexander Müller static MESON_GATE(gxbb_periphs, HHI_GCLK_MPEG0, 7);
8547ba64d82SAlexander Müller static MESON_GATE(gxbb_spicc, HHI_GCLK_MPEG0, 8);
8557ba64d82SAlexander Müller static MESON_GATE(gxbb_i2c, HHI_GCLK_MPEG0, 9);
8567ba64d82SAlexander Müller static MESON_GATE(gxbb_sar_adc, HHI_GCLK_MPEG0, 10);
8577ba64d82SAlexander Müller static MESON_GATE(gxbb_smart_card, HHI_GCLK_MPEG0, 11);
8587ba64d82SAlexander Müller static MESON_GATE(gxbb_rng0, HHI_GCLK_MPEG0, 12);
8597ba64d82SAlexander Müller static MESON_GATE(gxbb_uart0, HHI_GCLK_MPEG0, 13);
8607ba64d82SAlexander Müller static MESON_GATE(gxbb_sdhc, HHI_GCLK_MPEG0, 14);
8617ba64d82SAlexander Müller static MESON_GATE(gxbb_stream, HHI_GCLK_MPEG0, 15);
8627ba64d82SAlexander Müller static MESON_GATE(gxbb_async_fifo, HHI_GCLK_MPEG0, 16);
8637ba64d82SAlexander Müller static MESON_GATE(gxbb_sdio, HHI_GCLK_MPEG0, 17);
8647ba64d82SAlexander Müller static MESON_GATE(gxbb_abuf, HHI_GCLK_MPEG0, 18);
8657ba64d82SAlexander Müller static MESON_GATE(gxbb_hiu_iface, HHI_GCLK_MPEG0, 19);
8667ba64d82SAlexander Müller static MESON_GATE(gxbb_assist_misc, HHI_GCLK_MPEG0, 23);
8677ba64d82SAlexander Müller static MESON_GATE(gxbb_emmc_a, HHI_GCLK_MPEG0, 24);
8687ba64d82SAlexander Müller static MESON_GATE(gxbb_emmc_b, HHI_GCLK_MPEG0, 25);
8697ba64d82SAlexander Müller static MESON_GATE(gxbb_emmc_c, HHI_GCLK_MPEG0, 26);
8707ba64d82SAlexander Müller static MESON_GATE(gxbb_spi, HHI_GCLK_MPEG0, 30);
871738f66d3SMichael Turquette 
8727ba64d82SAlexander Müller static MESON_GATE(gxbb_i2s_spdif, HHI_GCLK_MPEG1, 2);
8737ba64d82SAlexander Müller static MESON_GATE(gxbb_eth, HHI_GCLK_MPEG1, 3);
8747ba64d82SAlexander Müller static MESON_GATE(gxbb_demux, HHI_GCLK_MPEG1, 4);
8757ba64d82SAlexander Müller static MESON_GATE(gxbb_aiu_glue, HHI_GCLK_MPEG1, 6);
8767ba64d82SAlexander Müller static MESON_GATE(gxbb_iec958, HHI_GCLK_MPEG1, 7);
8777ba64d82SAlexander Müller static MESON_GATE(gxbb_i2s_out, HHI_GCLK_MPEG1, 8);
8787ba64d82SAlexander Müller static MESON_GATE(gxbb_amclk, HHI_GCLK_MPEG1, 9);
8797ba64d82SAlexander Müller static MESON_GATE(gxbb_aififo2, HHI_GCLK_MPEG1, 10);
8807ba64d82SAlexander Müller static MESON_GATE(gxbb_mixer, HHI_GCLK_MPEG1, 11);
8817ba64d82SAlexander Müller static MESON_GATE(gxbb_mixer_iface, HHI_GCLK_MPEG1, 12);
8827ba64d82SAlexander Müller static MESON_GATE(gxbb_adc, HHI_GCLK_MPEG1, 13);
8837ba64d82SAlexander Müller static MESON_GATE(gxbb_blkmv, HHI_GCLK_MPEG1, 14);
8847ba64d82SAlexander Müller static MESON_GATE(gxbb_aiu, HHI_GCLK_MPEG1, 15);
8857ba64d82SAlexander Müller static MESON_GATE(gxbb_uart1, HHI_GCLK_MPEG1, 16);
8867ba64d82SAlexander Müller static MESON_GATE(gxbb_g2d, HHI_GCLK_MPEG1, 20);
8877ba64d82SAlexander Müller static MESON_GATE(gxbb_usb0, HHI_GCLK_MPEG1, 21);
8887ba64d82SAlexander Müller static MESON_GATE(gxbb_usb1, HHI_GCLK_MPEG1, 22);
8897ba64d82SAlexander Müller static MESON_GATE(gxbb_reset, HHI_GCLK_MPEG1, 23);
8907ba64d82SAlexander Müller static MESON_GATE(gxbb_nand, HHI_GCLK_MPEG1, 24);
8917ba64d82SAlexander Müller static MESON_GATE(gxbb_dos_parser, HHI_GCLK_MPEG1, 25);
8927ba64d82SAlexander Müller static MESON_GATE(gxbb_usb, HHI_GCLK_MPEG1, 26);
8937ba64d82SAlexander Müller static MESON_GATE(gxbb_vdin1, HHI_GCLK_MPEG1, 28);
8947ba64d82SAlexander Müller static MESON_GATE(gxbb_ahb_arb0, HHI_GCLK_MPEG1, 29);
8957ba64d82SAlexander Müller static MESON_GATE(gxbb_efuse, HHI_GCLK_MPEG1, 30);
8967ba64d82SAlexander Müller static MESON_GATE(gxbb_boot_rom, HHI_GCLK_MPEG1, 31);
897738f66d3SMichael Turquette 
8987ba64d82SAlexander Müller static MESON_GATE(gxbb_ahb_data_bus, HHI_GCLK_MPEG2, 1);
8997ba64d82SAlexander Müller static MESON_GATE(gxbb_ahb_ctrl_bus, HHI_GCLK_MPEG2, 2);
9007ba64d82SAlexander Müller static MESON_GATE(gxbb_hdmi_intr_sync, HHI_GCLK_MPEG2, 3);
9017ba64d82SAlexander Müller static MESON_GATE(gxbb_hdmi_pclk, HHI_GCLK_MPEG2, 4);
9027ba64d82SAlexander Müller static MESON_GATE(gxbb_usb1_ddr_bridge, HHI_GCLK_MPEG2, 8);
9037ba64d82SAlexander Müller static MESON_GATE(gxbb_usb0_ddr_bridge, HHI_GCLK_MPEG2, 9);
9047ba64d82SAlexander Müller static MESON_GATE(gxbb_mmc_pclk, HHI_GCLK_MPEG2, 11);
9057ba64d82SAlexander Müller static MESON_GATE(gxbb_dvin, HHI_GCLK_MPEG2, 12);
9067ba64d82SAlexander Müller static MESON_GATE(gxbb_uart2, HHI_GCLK_MPEG2, 15);
9077ba64d82SAlexander Müller static MESON_GATE(gxbb_sana, HHI_GCLK_MPEG2, 22);
9087ba64d82SAlexander Müller static MESON_GATE(gxbb_vpu_intr, HHI_GCLK_MPEG2, 25);
9097ba64d82SAlexander Müller static MESON_GATE(gxbb_sec_ahb_ahb3_bridge, HHI_GCLK_MPEG2, 26);
9107ba64d82SAlexander Müller static MESON_GATE(gxbb_clk81_a53, HHI_GCLK_MPEG2, 29);
911738f66d3SMichael Turquette 
9127ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_venci0, HHI_GCLK_OTHER, 1);
9137ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_venci1, HHI_GCLK_OTHER, 2);
9147ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_vencp0, HHI_GCLK_OTHER, 3);
9157ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_vencp1, HHI_GCLK_OTHER, 4);
9167ba64d82SAlexander Müller static MESON_GATE(gxbb_gclk_venci_int0, HHI_GCLK_OTHER, 8);
9177ba64d82SAlexander Müller static MESON_GATE(gxbb_gclk_vencp_int, HHI_GCLK_OTHER, 9);
9187ba64d82SAlexander Müller static MESON_GATE(gxbb_dac_clk, HHI_GCLK_OTHER, 10);
9197ba64d82SAlexander Müller static MESON_GATE(gxbb_aoclk_gate, HHI_GCLK_OTHER, 14);
9207ba64d82SAlexander Müller static MESON_GATE(gxbb_iec958_gate, HHI_GCLK_OTHER, 16);
9217ba64d82SAlexander Müller static MESON_GATE(gxbb_enc480p, HHI_GCLK_OTHER, 20);
9227ba64d82SAlexander Müller static MESON_GATE(gxbb_rng1, HHI_GCLK_OTHER, 21);
9237ba64d82SAlexander Müller static MESON_GATE(gxbb_gclk_venci_int1, HHI_GCLK_OTHER, 22);
9247ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_venclmcc, HHI_GCLK_OTHER, 24);
9257ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk2_vencl, HHI_GCLK_OTHER, 25);
9267ba64d82SAlexander Müller static MESON_GATE(gxbb_vclk_other, HHI_GCLK_OTHER, 26);
9277ba64d82SAlexander Müller static MESON_GATE(gxbb_edp, HHI_GCLK_OTHER, 31);
928738f66d3SMichael Turquette 
929738f66d3SMichael Turquette /* Always On (AO) domain gates */
930738f66d3SMichael Turquette 
9317ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_media_cpu, HHI_GCLK_AO, 0);
9327ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_ahb_sram, HHI_GCLK_AO, 1);
9337ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_ahb_bus, HHI_GCLK_AO, 2);
9347ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_iface, HHI_GCLK_AO, 3);
9357ba64d82SAlexander Müller static MESON_GATE(gxbb_ao_i2c, HHI_GCLK_AO, 4);
936738f66d3SMichael Turquette 
937738f66d3SMichael Turquette /* Array of all clocks provided by this provider */
938738f66d3SMichael Turquette 
939738f66d3SMichael Turquette static struct clk_hw_onecell_data gxbb_hw_onecell_data = {
940738f66d3SMichael Turquette 	.hws = {
941738f66d3SMichael Turquette 		[CLKID_SYS_PLL]		    = &gxbb_sys_pll.hw,
942738f66d3SMichael Turquette 		[CLKID_CPUCLK]		    = &gxbb_cpu_clk.hw,
943738f66d3SMichael Turquette 		[CLKID_HDMI_PLL]	    = &gxbb_hdmi_pll.hw,
944738f66d3SMichael Turquette 		[CLKID_FIXED_PLL]	    = &gxbb_fixed_pll.hw,
945738f66d3SMichael Turquette 		[CLKID_FCLK_DIV2]	    = &gxbb_fclk_div2.hw,
946738f66d3SMichael Turquette 		[CLKID_FCLK_DIV3]	    = &gxbb_fclk_div3.hw,
947738f66d3SMichael Turquette 		[CLKID_FCLK_DIV4]	    = &gxbb_fclk_div4.hw,
948738f66d3SMichael Turquette 		[CLKID_FCLK_DIV5]	    = &gxbb_fclk_div5.hw,
949738f66d3SMichael Turquette 		[CLKID_FCLK_DIV7]	    = &gxbb_fclk_div7.hw,
950738f66d3SMichael Turquette 		[CLKID_GP0_PLL]		    = &gxbb_gp0_pll.hw,
951738f66d3SMichael Turquette 		[CLKID_MPEG_SEL]	    = &gxbb_mpeg_clk_sel.hw,
952738f66d3SMichael Turquette 		[CLKID_MPEG_DIV]	    = &gxbb_mpeg_clk_div.hw,
953738f66d3SMichael Turquette 		[CLKID_CLK81]		    = &gxbb_clk81.hw,
954738f66d3SMichael Turquette 		[CLKID_MPLL0]		    = &gxbb_mpll0.hw,
955738f66d3SMichael Turquette 		[CLKID_MPLL1]		    = &gxbb_mpll1.hw,
956738f66d3SMichael Turquette 		[CLKID_MPLL2]		    = &gxbb_mpll2.hw,
957738f66d3SMichael Turquette 		[CLKID_DDR]		    = &gxbb_ddr.hw,
958738f66d3SMichael Turquette 		[CLKID_DOS]		    = &gxbb_dos.hw,
959738f66d3SMichael Turquette 		[CLKID_ISA]		    = &gxbb_isa.hw,
960738f66d3SMichael Turquette 		[CLKID_PL301]		    = &gxbb_pl301.hw,
961738f66d3SMichael Turquette 		[CLKID_PERIPHS]		    = &gxbb_periphs.hw,
962738f66d3SMichael Turquette 		[CLKID_SPICC]		    = &gxbb_spicc.hw,
963738f66d3SMichael Turquette 		[CLKID_I2C]		    = &gxbb_i2c.hw,
964738f66d3SMichael Turquette 		[CLKID_SAR_ADC]		    = &gxbb_sar_adc.hw,
965738f66d3SMichael Turquette 		[CLKID_SMART_CARD]	    = &gxbb_smart_card.hw,
966738f66d3SMichael Turquette 		[CLKID_RNG0]		    = &gxbb_rng0.hw,
967738f66d3SMichael Turquette 		[CLKID_UART0]		    = &gxbb_uart0.hw,
968738f66d3SMichael Turquette 		[CLKID_SDHC]		    = &gxbb_sdhc.hw,
969738f66d3SMichael Turquette 		[CLKID_STREAM]		    = &gxbb_stream.hw,
970738f66d3SMichael Turquette 		[CLKID_ASYNC_FIFO]	    = &gxbb_async_fifo.hw,
971738f66d3SMichael Turquette 		[CLKID_SDIO]		    = &gxbb_sdio.hw,
972738f66d3SMichael Turquette 		[CLKID_ABUF]		    = &gxbb_abuf.hw,
973738f66d3SMichael Turquette 		[CLKID_HIU_IFACE]	    = &gxbb_hiu_iface.hw,
974738f66d3SMichael Turquette 		[CLKID_ASSIST_MISC]	    = &gxbb_assist_misc.hw,
975738f66d3SMichael Turquette 		[CLKID_SPI]		    = &gxbb_spi.hw,
976738f66d3SMichael Turquette 		[CLKID_I2S_SPDIF]	    = &gxbb_i2s_spdif.hw,
977738f66d3SMichael Turquette 		[CLKID_ETH]		    = &gxbb_eth.hw,
978738f66d3SMichael Turquette 		[CLKID_DEMUX]		    = &gxbb_demux.hw,
979738f66d3SMichael Turquette 		[CLKID_AIU_GLUE]	    = &gxbb_aiu_glue.hw,
980738f66d3SMichael Turquette 		[CLKID_IEC958]		    = &gxbb_iec958.hw,
981738f66d3SMichael Turquette 		[CLKID_I2S_OUT]		    = &gxbb_i2s_out.hw,
982738f66d3SMichael Turquette 		[CLKID_AMCLK]		    = &gxbb_amclk.hw,
983738f66d3SMichael Turquette 		[CLKID_AIFIFO2]		    = &gxbb_aififo2.hw,
984738f66d3SMichael Turquette 		[CLKID_MIXER]		    = &gxbb_mixer.hw,
985738f66d3SMichael Turquette 		[CLKID_MIXER_IFACE]	    = &gxbb_mixer_iface.hw,
986738f66d3SMichael Turquette 		[CLKID_ADC]		    = &gxbb_adc.hw,
987738f66d3SMichael Turquette 		[CLKID_BLKMV]		    = &gxbb_blkmv.hw,
988738f66d3SMichael Turquette 		[CLKID_AIU]		    = &gxbb_aiu.hw,
989738f66d3SMichael Turquette 		[CLKID_UART1]		    = &gxbb_uart1.hw,
990738f66d3SMichael Turquette 		[CLKID_G2D]		    = &gxbb_g2d.hw,
991738f66d3SMichael Turquette 		[CLKID_USB0]		    = &gxbb_usb0.hw,
992738f66d3SMichael Turquette 		[CLKID_USB1]		    = &gxbb_usb1.hw,
993738f66d3SMichael Turquette 		[CLKID_RESET]		    = &gxbb_reset.hw,
994738f66d3SMichael Turquette 		[CLKID_NAND]		    = &gxbb_nand.hw,
995738f66d3SMichael Turquette 		[CLKID_DOS_PARSER]	    = &gxbb_dos_parser.hw,
996738f66d3SMichael Turquette 		[CLKID_USB]		    = &gxbb_usb.hw,
997738f66d3SMichael Turquette 		[CLKID_VDIN1]		    = &gxbb_vdin1.hw,
998738f66d3SMichael Turquette 		[CLKID_AHB_ARB0]	    = &gxbb_ahb_arb0.hw,
999738f66d3SMichael Turquette 		[CLKID_EFUSE]		    = &gxbb_efuse.hw,
1000738f66d3SMichael Turquette 		[CLKID_BOOT_ROM]	    = &gxbb_boot_rom.hw,
1001738f66d3SMichael Turquette 		[CLKID_AHB_DATA_BUS]	    = &gxbb_ahb_data_bus.hw,
1002738f66d3SMichael Turquette 		[CLKID_AHB_CTRL_BUS]	    = &gxbb_ahb_ctrl_bus.hw,
1003738f66d3SMichael Turquette 		[CLKID_HDMI_INTR_SYNC]	    = &gxbb_hdmi_intr_sync.hw,
1004738f66d3SMichael Turquette 		[CLKID_HDMI_PCLK]	    = &gxbb_hdmi_pclk.hw,
1005738f66d3SMichael Turquette 		[CLKID_USB1_DDR_BRIDGE]	    = &gxbb_usb1_ddr_bridge.hw,
1006738f66d3SMichael Turquette 		[CLKID_USB0_DDR_BRIDGE]	    = &gxbb_usb0_ddr_bridge.hw,
1007738f66d3SMichael Turquette 		[CLKID_MMC_PCLK]	    = &gxbb_mmc_pclk.hw,
1008738f66d3SMichael Turquette 		[CLKID_DVIN]		    = &gxbb_dvin.hw,
1009738f66d3SMichael Turquette 		[CLKID_UART2]		    = &gxbb_uart2.hw,
1010738f66d3SMichael Turquette 		[CLKID_SANA]		    = &gxbb_sana.hw,
1011738f66d3SMichael Turquette 		[CLKID_VPU_INTR]	    = &gxbb_vpu_intr.hw,
1012738f66d3SMichael Turquette 		[CLKID_SEC_AHB_AHB3_BRIDGE] = &gxbb_sec_ahb_ahb3_bridge.hw,
1013738f66d3SMichael Turquette 		[CLKID_CLK81_A53]	    = &gxbb_clk81_a53.hw,
1014738f66d3SMichael Turquette 		[CLKID_VCLK2_VENCI0]	    = &gxbb_vclk2_venci0.hw,
1015738f66d3SMichael Turquette 		[CLKID_VCLK2_VENCI1]	    = &gxbb_vclk2_venci1.hw,
1016738f66d3SMichael Turquette 		[CLKID_VCLK2_VENCP0]	    = &gxbb_vclk2_vencp0.hw,
1017738f66d3SMichael Turquette 		[CLKID_VCLK2_VENCP1]	    = &gxbb_vclk2_vencp1.hw,
1018738f66d3SMichael Turquette 		[CLKID_GCLK_VENCI_INT0]	    = &gxbb_gclk_venci_int0.hw,
1019738f66d3SMichael Turquette 		[CLKID_GCLK_VENCI_INT]	    = &gxbb_gclk_vencp_int.hw,
1020738f66d3SMichael Turquette 		[CLKID_DAC_CLK]		    = &gxbb_dac_clk.hw,
1021738f66d3SMichael Turquette 		[CLKID_AOCLK_GATE]	    = &gxbb_aoclk_gate.hw,
1022738f66d3SMichael Turquette 		[CLKID_IEC958_GATE]	    = &gxbb_iec958_gate.hw,
1023738f66d3SMichael Turquette 		[CLKID_ENC480P]		    = &gxbb_enc480p.hw,
1024738f66d3SMichael Turquette 		[CLKID_RNG1]		    = &gxbb_rng1.hw,
1025738f66d3SMichael Turquette 		[CLKID_GCLK_VENCI_INT1]	    = &gxbb_gclk_venci_int1.hw,
1026738f66d3SMichael Turquette 		[CLKID_VCLK2_VENCLMCC]	    = &gxbb_vclk2_venclmcc.hw,
1027738f66d3SMichael Turquette 		[CLKID_VCLK2_VENCL]	    = &gxbb_vclk2_vencl.hw,
1028738f66d3SMichael Turquette 		[CLKID_VCLK_OTHER]	    = &gxbb_vclk_other.hw,
1029738f66d3SMichael Turquette 		[CLKID_EDP]		    = &gxbb_edp.hw,
1030738f66d3SMichael Turquette 		[CLKID_AO_MEDIA_CPU]	    = &gxbb_ao_media_cpu.hw,
1031738f66d3SMichael Turquette 		[CLKID_AO_AHB_SRAM]	    = &gxbb_ao_ahb_sram.hw,
1032738f66d3SMichael Turquette 		[CLKID_AO_AHB_BUS]	    = &gxbb_ao_ahb_bus.hw,
1033738f66d3SMichael Turquette 		[CLKID_AO_IFACE]	    = &gxbb_ao_iface.hw,
1034738f66d3SMichael Turquette 		[CLKID_AO_I2C]		    = &gxbb_ao_i2c.hw,
103533608dcdSKevin Hilman 		[CLKID_SD_EMMC_A]	    = &gxbb_emmc_a.hw,
103633608dcdSKevin Hilman 		[CLKID_SD_EMMC_B]	    = &gxbb_emmc_b.hw,
103733608dcdSKevin Hilman 		[CLKID_SD_EMMC_C]	    = &gxbb_emmc_c.hw,
103833d0fcdfSMartin Blumenstingl 		[CLKID_SAR_ADC_CLK]	    = &gxbb_sar_adc_clk.hw,
103933d0fcdfSMartin Blumenstingl 		[CLKID_SAR_ADC_SEL]	    = &gxbb_sar_adc_clk_sel.hw,
104033d0fcdfSMartin Blumenstingl 		[CLKID_SAR_ADC_DIV]	    = &gxbb_sar_adc_clk_div.hw,
1041fac9a55bSNeil Armstrong 		[CLKID_MALI_0_SEL]	    = &gxbb_mali_0_sel.hw,
1042fac9a55bSNeil Armstrong 		[CLKID_MALI_0_DIV]	    = &gxbb_mali_0_div.hw,
1043fac9a55bSNeil Armstrong 		[CLKID_MALI_0]		    = &gxbb_mali_0.hw,
1044fac9a55bSNeil Armstrong 		[CLKID_MALI_1_SEL]	    = &gxbb_mali_1_sel.hw,
1045fac9a55bSNeil Armstrong 		[CLKID_MALI_1_DIV]	    = &gxbb_mali_1_div.hw,
1046fac9a55bSNeil Armstrong 		[CLKID_MALI_1]		    = &gxbb_mali_1.hw,
1047fac9a55bSNeil Armstrong 		[CLKID_MALI]		    = &gxbb_mali.hw,
1048738f66d3SMichael Turquette 	},
1049738f66d3SMichael Turquette 	.num = NR_CLKS,
1050738f66d3SMichael Turquette };
1051738f66d3SMichael Turquette 
10520d48fc55SNeil Armstrong static struct clk_hw_onecell_data gxl_hw_onecell_data = {
10530d48fc55SNeil Armstrong 	.hws = {
10540d48fc55SNeil Armstrong 		[CLKID_SYS_PLL]		    = &gxbb_sys_pll.hw,
10550d48fc55SNeil Armstrong 		[CLKID_CPUCLK]		    = &gxbb_cpu_clk.hw,
10560d48fc55SNeil Armstrong 		[CLKID_HDMI_PLL]	    = &gxbb_hdmi_pll.hw,
10570d48fc55SNeil Armstrong 		[CLKID_FIXED_PLL]	    = &gxbb_fixed_pll.hw,
10580d48fc55SNeil Armstrong 		[CLKID_FCLK_DIV2]	    = &gxbb_fclk_div2.hw,
10590d48fc55SNeil Armstrong 		[CLKID_FCLK_DIV3]	    = &gxbb_fclk_div3.hw,
10600d48fc55SNeil Armstrong 		[CLKID_FCLK_DIV4]	    = &gxbb_fclk_div4.hw,
10610d48fc55SNeil Armstrong 		[CLKID_FCLK_DIV5]	    = &gxbb_fclk_div5.hw,
10620d48fc55SNeil Armstrong 		[CLKID_FCLK_DIV7]	    = &gxbb_fclk_div7.hw,
10630d48fc55SNeil Armstrong 		[CLKID_GP0_PLL]		    = &gxl_gp0_pll.hw,
10640d48fc55SNeil Armstrong 		[CLKID_MPEG_SEL]	    = &gxbb_mpeg_clk_sel.hw,
10650d48fc55SNeil Armstrong 		[CLKID_MPEG_DIV]	    = &gxbb_mpeg_clk_div.hw,
10660d48fc55SNeil Armstrong 		[CLKID_CLK81]		    = &gxbb_clk81.hw,
10670d48fc55SNeil Armstrong 		[CLKID_MPLL0]		    = &gxbb_mpll0.hw,
10680d48fc55SNeil Armstrong 		[CLKID_MPLL1]		    = &gxbb_mpll1.hw,
10690d48fc55SNeil Armstrong 		[CLKID_MPLL2]		    = &gxbb_mpll2.hw,
10700d48fc55SNeil Armstrong 		[CLKID_DDR]		    = &gxbb_ddr.hw,
10710d48fc55SNeil Armstrong 		[CLKID_DOS]		    = &gxbb_dos.hw,
10720d48fc55SNeil Armstrong 		[CLKID_ISA]		    = &gxbb_isa.hw,
10730d48fc55SNeil Armstrong 		[CLKID_PL301]		    = &gxbb_pl301.hw,
10740d48fc55SNeil Armstrong 		[CLKID_PERIPHS]		    = &gxbb_periphs.hw,
10750d48fc55SNeil Armstrong 		[CLKID_SPICC]		    = &gxbb_spicc.hw,
10760d48fc55SNeil Armstrong 		[CLKID_I2C]		    = &gxbb_i2c.hw,
10770d48fc55SNeil Armstrong 		[CLKID_SAR_ADC]		    = &gxbb_sar_adc.hw,
10780d48fc55SNeil Armstrong 		[CLKID_SMART_CARD]	    = &gxbb_smart_card.hw,
10790d48fc55SNeil Armstrong 		[CLKID_RNG0]		    = &gxbb_rng0.hw,
10800d48fc55SNeil Armstrong 		[CLKID_UART0]		    = &gxbb_uart0.hw,
10810d48fc55SNeil Armstrong 		[CLKID_SDHC]		    = &gxbb_sdhc.hw,
10820d48fc55SNeil Armstrong 		[CLKID_STREAM]		    = &gxbb_stream.hw,
10830d48fc55SNeil Armstrong 		[CLKID_ASYNC_FIFO]	    = &gxbb_async_fifo.hw,
10840d48fc55SNeil Armstrong 		[CLKID_SDIO]		    = &gxbb_sdio.hw,
10850d48fc55SNeil Armstrong 		[CLKID_ABUF]		    = &gxbb_abuf.hw,
10860d48fc55SNeil Armstrong 		[CLKID_HIU_IFACE]	    = &gxbb_hiu_iface.hw,
10870d48fc55SNeil Armstrong 		[CLKID_ASSIST_MISC]	    = &gxbb_assist_misc.hw,
10880d48fc55SNeil Armstrong 		[CLKID_SPI]		    = &gxbb_spi.hw,
10890d48fc55SNeil Armstrong 		[CLKID_I2S_SPDIF]	    = &gxbb_i2s_spdif.hw,
10900d48fc55SNeil Armstrong 		[CLKID_ETH]		    = &gxbb_eth.hw,
10910d48fc55SNeil Armstrong 		[CLKID_DEMUX]		    = &gxbb_demux.hw,
10920d48fc55SNeil Armstrong 		[CLKID_AIU_GLUE]	    = &gxbb_aiu_glue.hw,
10930d48fc55SNeil Armstrong 		[CLKID_IEC958]		    = &gxbb_iec958.hw,
10940d48fc55SNeil Armstrong 		[CLKID_I2S_OUT]		    = &gxbb_i2s_out.hw,
10950d48fc55SNeil Armstrong 		[CLKID_AMCLK]		    = &gxbb_amclk.hw,
10960d48fc55SNeil Armstrong 		[CLKID_AIFIFO2]		    = &gxbb_aififo2.hw,
10970d48fc55SNeil Armstrong 		[CLKID_MIXER]		    = &gxbb_mixer.hw,
10980d48fc55SNeil Armstrong 		[CLKID_MIXER_IFACE]	    = &gxbb_mixer_iface.hw,
10990d48fc55SNeil Armstrong 		[CLKID_ADC]		    = &gxbb_adc.hw,
11000d48fc55SNeil Armstrong 		[CLKID_BLKMV]		    = &gxbb_blkmv.hw,
11010d48fc55SNeil Armstrong 		[CLKID_AIU]		    = &gxbb_aiu.hw,
11020d48fc55SNeil Armstrong 		[CLKID_UART1]		    = &gxbb_uart1.hw,
11030d48fc55SNeil Armstrong 		[CLKID_G2D]		    = &gxbb_g2d.hw,
11040d48fc55SNeil Armstrong 		[CLKID_USB0]		    = &gxbb_usb0.hw,
11050d48fc55SNeil Armstrong 		[CLKID_USB1]		    = &gxbb_usb1.hw,
11060d48fc55SNeil Armstrong 		[CLKID_RESET]		    = &gxbb_reset.hw,
11070d48fc55SNeil Armstrong 		[CLKID_NAND]		    = &gxbb_nand.hw,
11080d48fc55SNeil Armstrong 		[CLKID_DOS_PARSER]	    = &gxbb_dos_parser.hw,
11090d48fc55SNeil Armstrong 		[CLKID_USB]		    = &gxbb_usb.hw,
11100d48fc55SNeil Armstrong 		[CLKID_VDIN1]		    = &gxbb_vdin1.hw,
11110d48fc55SNeil Armstrong 		[CLKID_AHB_ARB0]	    = &gxbb_ahb_arb0.hw,
11120d48fc55SNeil Armstrong 		[CLKID_EFUSE]		    = &gxbb_efuse.hw,
11130d48fc55SNeil Armstrong 		[CLKID_BOOT_ROM]	    = &gxbb_boot_rom.hw,
11140d48fc55SNeil Armstrong 		[CLKID_AHB_DATA_BUS]	    = &gxbb_ahb_data_bus.hw,
11150d48fc55SNeil Armstrong 		[CLKID_AHB_CTRL_BUS]	    = &gxbb_ahb_ctrl_bus.hw,
11160d48fc55SNeil Armstrong 		[CLKID_HDMI_INTR_SYNC]	    = &gxbb_hdmi_intr_sync.hw,
11170d48fc55SNeil Armstrong 		[CLKID_HDMI_PCLK]	    = &gxbb_hdmi_pclk.hw,
11180d48fc55SNeil Armstrong 		[CLKID_USB1_DDR_BRIDGE]	    = &gxbb_usb1_ddr_bridge.hw,
11190d48fc55SNeil Armstrong 		[CLKID_USB0_DDR_BRIDGE]	    = &gxbb_usb0_ddr_bridge.hw,
11200d48fc55SNeil Armstrong 		[CLKID_MMC_PCLK]	    = &gxbb_mmc_pclk.hw,
11210d48fc55SNeil Armstrong 		[CLKID_DVIN]		    = &gxbb_dvin.hw,
11220d48fc55SNeil Armstrong 		[CLKID_UART2]		    = &gxbb_uart2.hw,
11230d48fc55SNeil Armstrong 		[CLKID_SANA]		    = &gxbb_sana.hw,
11240d48fc55SNeil Armstrong 		[CLKID_VPU_INTR]	    = &gxbb_vpu_intr.hw,
11250d48fc55SNeil Armstrong 		[CLKID_SEC_AHB_AHB3_BRIDGE] = &gxbb_sec_ahb_ahb3_bridge.hw,
11260d48fc55SNeil Armstrong 		[CLKID_CLK81_A53]	    = &gxbb_clk81_a53.hw,
11270d48fc55SNeil Armstrong 		[CLKID_VCLK2_VENCI0]	    = &gxbb_vclk2_venci0.hw,
11280d48fc55SNeil Armstrong 		[CLKID_VCLK2_VENCI1]	    = &gxbb_vclk2_venci1.hw,
11290d48fc55SNeil Armstrong 		[CLKID_VCLK2_VENCP0]	    = &gxbb_vclk2_vencp0.hw,
11300d48fc55SNeil Armstrong 		[CLKID_VCLK2_VENCP1]	    = &gxbb_vclk2_vencp1.hw,
11310d48fc55SNeil Armstrong 		[CLKID_GCLK_VENCI_INT0]	    = &gxbb_gclk_venci_int0.hw,
11320d48fc55SNeil Armstrong 		[CLKID_GCLK_VENCI_INT]	    = &gxbb_gclk_vencp_int.hw,
11330d48fc55SNeil Armstrong 		[CLKID_DAC_CLK]		    = &gxbb_dac_clk.hw,
11340d48fc55SNeil Armstrong 		[CLKID_AOCLK_GATE]	    = &gxbb_aoclk_gate.hw,
11350d48fc55SNeil Armstrong 		[CLKID_IEC958_GATE]	    = &gxbb_iec958_gate.hw,
11360d48fc55SNeil Armstrong 		[CLKID_ENC480P]		    = &gxbb_enc480p.hw,
11370d48fc55SNeil Armstrong 		[CLKID_RNG1]		    = &gxbb_rng1.hw,
11380d48fc55SNeil Armstrong 		[CLKID_GCLK_VENCI_INT1]	    = &gxbb_gclk_venci_int1.hw,
11390d48fc55SNeil Armstrong 		[CLKID_VCLK2_VENCLMCC]	    = &gxbb_vclk2_venclmcc.hw,
11400d48fc55SNeil Armstrong 		[CLKID_VCLK2_VENCL]	    = &gxbb_vclk2_vencl.hw,
11410d48fc55SNeil Armstrong 		[CLKID_VCLK_OTHER]	    = &gxbb_vclk_other.hw,
11420d48fc55SNeil Armstrong 		[CLKID_EDP]		    = &gxbb_edp.hw,
11430d48fc55SNeil Armstrong 		[CLKID_AO_MEDIA_CPU]	    = &gxbb_ao_media_cpu.hw,
11440d48fc55SNeil Armstrong 		[CLKID_AO_AHB_SRAM]	    = &gxbb_ao_ahb_sram.hw,
11450d48fc55SNeil Armstrong 		[CLKID_AO_AHB_BUS]	    = &gxbb_ao_ahb_bus.hw,
11460d48fc55SNeil Armstrong 		[CLKID_AO_IFACE]	    = &gxbb_ao_iface.hw,
11470d48fc55SNeil Armstrong 		[CLKID_AO_I2C]		    = &gxbb_ao_i2c.hw,
11480d48fc55SNeil Armstrong 		[CLKID_SD_EMMC_A]	    = &gxbb_emmc_a.hw,
11490d48fc55SNeil Armstrong 		[CLKID_SD_EMMC_B]	    = &gxbb_emmc_b.hw,
11500d48fc55SNeil Armstrong 		[CLKID_SD_EMMC_C]	    = &gxbb_emmc_c.hw,
11510d48fc55SNeil Armstrong 		[CLKID_SAR_ADC_CLK]	    = &gxbb_sar_adc_clk.hw,
11520d48fc55SNeil Armstrong 		[CLKID_SAR_ADC_SEL]	    = &gxbb_sar_adc_clk_sel.hw,
11530d48fc55SNeil Armstrong 		[CLKID_SAR_ADC_DIV]	    = &gxbb_sar_adc_clk_div.hw,
11540d48fc55SNeil Armstrong 		[CLKID_MALI_0_SEL]	    = &gxbb_mali_0_sel.hw,
11550d48fc55SNeil Armstrong 		[CLKID_MALI_0_DIV]	    = &gxbb_mali_0_div.hw,
11560d48fc55SNeil Armstrong 		[CLKID_MALI_0]		    = &gxbb_mali_0.hw,
11570d48fc55SNeil Armstrong 		[CLKID_MALI_1_SEL]	    = &gxbb_mali_1_sel.hw,
11580d48fc55SNeil Armstrong 		[CLKID_MALI_1_DIV]	    = &gxbb_mali_1_div.hw,
11590d48fc55SNeil Armstrong 		[CLKID_MALI_1]		    = &gxbb_mali_1.hw,
11600d48fc55SNeil Armstrong 		[CLKID_MALI]		    = &gxbb_mali.hw,
11610d48fc55SNeil Armstrong 	},
11620d48fc55SNeil Armstrong 	.num = NR_CLKS,
11630d48fc55SNeil Armstrong };
11640d48fc55SNeil Armstrong 
1165738f66d3SMichael Turquette /* Convenience tables to populate base addresses in .probe */
1166738f66d3SMichael Turquette 
1167738f66d3SMichael Turquette static struct meson_clk_pll *const gxbb_clk_plls[] = {
1168738f66d3SMichael Turquette 	&gxbb_fixed_pll,
1169738f66d3SMichael Turquette 	&gxbb_hdmi_pll,
1170738f66d3SMichael Turquette 	&gxbb_sys_pll,
1171738f66d3SMichael Turquette 	&gxbb_gp0_pll,
1172738f66d3SMichael Turquette };
1173738f66d3SMichael Turquette 
11740d48fc55SNeil Armstrong static struct meson_clk_pll *const gxl_clk_plls[] = {
11750d48fc55SNeil Armstrong 	&gxbb_fixed_pll,
11760d48fc55SNeil Armstrong 	&gxbb_hdmi_pll,
11770d48fc55SNeil Armstrong 	&gxbb_sys_pll,
11780d48fc55SNeil Armstrong 	&gxl_gp0_pll,
11790d48fc55SNeil Armstrong };
11800d48fc55SNeil Armstrong 
1181738f66d3SMichael Turquette static struct meson_clk_mpll *const gxbb_clk_mplls[] = {
1182738f66d3SMichael Turquette 	&gxbb_mpll0,
1183738f66d3SMichael Turquette 	&gxbb_mpll1,
1184738f66d3SMichael Turquette 	&gxbb_mpll2,
1185738f66d3SMichael Turquette };
1186738f66d3SMichael Turquette 
1187f7e3a826SJerome Brunet static struct clk_gate *const gxbb_clk_gates[] = {
1188738f66d3SMichael Turquette 	&gxbb_clk81,
1189738f66d3SMichael Turquette 	&gxbb_ddr,
1190738f66d3SMichael Turquette 	&gxbb_dos,
1191738f66d3SMichael Turquette 	&gxbb_isa,
1192738f66d3SMichael Turquette 	&gxbb_pl301,
1193738f66d3SMichael Turquette 	&gxbb_periphs,
1194738f66d3SMichael Turquette 	&gxbb_spicc,
1195738f66d3SMichael Turquette 	&gxbb_i2c,
1196738f66d3SMichael Turquette 	&gxbb_sar_adc,
1197738f66d3SMichael Turquette 	&gxbb_smart_card,
1198738f66d3SMichael Turquette 	&gxbb_rng0,
1199738f66d3SMichael Turquette 	&gxbb_uart0,
1200738f66d3SMichael Turquette 	&gxbb_sdhc,
1201738f66d3SMichael Turquette 	&gxbb_stream,
1202738f66d3SMichael Turquette 	&gxbb_async_fifo,
1203738f66d3SMichael Turquette 	&gxbb_sdio,
1204738f66d3SMichael Turquette 	&gxbb_abuf,
1205738f66d3SMichael Turquette 	&gxbb_hiu_iface,
1206738f66d3SMichael Turquette 	&gxbb_assist_misc,
1207738f66d3SMichael Turquette 	&gxbb_spi,
1208738f66d3SMichael Turquette 	&gxbb_i2s_spdif,
1209738f66d3SMichael Turquette 	&gxbb_eth,
1210738f66d3SMichael Turquette 	&gxbb_demux,
1211738f66d3SMichael Turquette 	&gxbb_aiu_glue,
1212738f66d3SMichael Turquette 	&gxbb_iec958,
1213738f66d3SMichael Turquette 	&gxbb_i2s_out,
1214738f66d3SMichael Turquette 	&gxbb_amclk,
1215738f66d3SMichael Turquette 	&gxbb_aififo2,
1216738f66d3SMichael Turquette 	&gxbb_mixer,
1217738f66d3SMichael Turquette 	&gxbb_mixer_iface,
1218738f66d3SMichael Turquette 	&gxbb_adc,
1219738f66d3SMichael Turquette 	&gxbb_blkmv,
1220738f66d3SMichael Turquette 	&gxbb_aiu,
1221738f66d3SMichael Turquette 	&gxbb_uart1,
1222738f66d3SMichael Turquette 	&gxbb_g2d,
1223738f66d3SMichael Turquette 	&gxbb_usb0,
1224738f66d3SMichael Turquette 	&gxbb_usb1,
1225738f66d3SMichael Turquette 	&gxbb_reset,
1226738f66d3SMichael Turquette 	&gxbb_nand,
1227738f66d3SMichael Turquette 	&gxbb_dos_parser,
1228738f66d3SMichael Turquette 	&gxbb_usb,
1229738f66d3SMichael Turquette 	&gxbb_vdin1,
1230738f66d3SMichael Turquette 	&gxbb_ahb_arb0,
1231738f66d3SMichael Turquette 	&gxbb_efuse,
1232738f66d3SMichael Turquette 	&gxbb_boot_rom,
1233738f66d3SMichael Turquette 	&gxbb_ahb_data_bus,
1234738f66d3SMichael Turquette 	&gxbb_ahb_ctrl_bus,
1235738f66d3SMichael Turquette 	&gxbb_hdmi_intr_sync,
1236738f66d3SMichael Turquette 	&gxbb_hdmi_pclk,
1237738f66d3SMichael Turquette 	&gxbb_usb1_ddr_bridge,
1238738f66d3SMichael Turquette 	&gxbb_usb0_ddr_bridge,
1239738f66d3SMichael Turquette 	&gxbb_mmc_pclk,
1240738f66d3SMichael Turquette 	&gxbb_dvin,
1241738f66d3SMichael Turquette 	&gxbb_uart2,
1242738f66d3SMichael Turquette 	&gxbb_sana,
1243738f66d3SMichael Turquette 	&gxbb_vpu_intr,
1244738f66d3SMichael Turquette 	&gxbb_sec_ahb_ahb3_bridge,
1245738f66d3SMichael Turquette 	&gxbb_clk81_a53,
1246738f66d3SMichael Turquette 	&gxbb_vclk2_venci0,
1247738f66d3SMichael Turquette 	&gxbb_vclk2_venci1,
1248738f66d3SMichael Turquette 	&gxbb_vclk2_vencp0,
1249738f66d3SMichael Turquette 	&gxbb_vclk2_vencp1,
1250738f66d3SMichael Turquette 	&gxbb_gclk_venci_int0,
1251738f66d3SMichael Turquette 	&gxbb_gclk_vencp_int,
1252738f66d3SMichael Turquette 	&gxbb_dac_clk,
1253738f66d3SMichael Turquette 	&gxbb_aoclk_gate,
1254738f66d3SMichael Turquette 	&gxbb_iec958_gate,
1255738f66d3SMichael Turquette 	&gxbb_enc480p,
1256738f66d3SMichael Turquette 	&gxbb_rng1,
1257738f66d3SMichael Turquette 	&gxbb_gclk_venci_int1,
1258738f66d3SMichael Turquette 	&gxbb_vclk2_venclmcc,
1259738f66d3SMichael Turquette 	&gxbb_vclk2_vencl,
1260738f66d3SMichael Turquette 	&gxbb_vclk_other,
1261738f66d3SMichael Turquette 	&gxbb_edp,
1262738f66d3SMichael Turquette 	&gxbb_ao_media_cpu,
1263738f66d3SMichael Turquette 	&gxbb_ao_ahb_sram,
1264738f66d3SMichael Turquette 	&gxbb_ao_ahb_bus,
1265738f66d3SMichael Turquette 	&gxbb_ao_iface,
1266738f66d3SMichael Turquette 	&gxbb_ao_i2c,
126733608dcdSKevin Hilman 	&gxbb_emmc_a,
126833608dcdSKevin Hilman 	&gxbb_emmc_b,
126933608dcdSKevin Hilman 	&gxbb_emmc_c,
127033d0fcdfSMartin Blumenstingl 	&gxbb_sar_adc_clk,
1271fac9a55bSNeil Armstrong 	&gxbb_mali_0,
1272fac9a55bSNeil Armstrong 	&gxbb_mali_1,
1273738f66d3SMichael Turquette };
1274738f66d3SMichael Turquette 
1275b92332eeSJerome Brunet static struct clk_mux *const gxbb_clk_muxes[] = {
1276b92332eeSJerome Brunet 	&gxbb_mpeg_clk_sel,
1277b92332eeSJerome Brunet 	&gxbb_sar_adc_clk_sel,
1278fac9a55bSNeil Armstrong 	&gxbb_mali_0_sel,
1279fac9a55bSNeil Armstrong 	&gxbb_mali_1_sel,
1280fac9a55bSNeil Armstrong 	&gxbb_mali,
1281b92332eeSJerome Brunet };
1282b92332eeSJerome Brunet 
1283b92332eeSJerome Brunet static struct clk_divider *const gxbb_clk_dividers[] = {
1284b92332eeSJerome Brunet 	&gxbb_mpeg_clk_div,
1285b92332eeSJerome Brunet 	&gxbb_sar_adc_clk_div,
1286fac9a55bSNeil Armstrong 	&gxbb_mali_0_div,
1287fac9a55bSNeil Armstrong 	&gxbb_mali_1_div,
1288b92332eeSJerome Brunet };
1289b92332eeSJerome Brunet 
12900d48fc55SNeil Armstrong struct clkc_data {
12910d48fc55SNeil Armstrong 	struct clk_gate *const *clk_gates;
12920d48fc55SNeil Armstrong 	unsigned int clk_gates_count;
12930d48fc55SNeil Armstrong 	struct meson_clk_mpll *const *clk_mplls;
12940d48fc55SNeil Armstrong 	unsigned int clk_mplls_count;
12950d48fc55SNeil Armstrong 	struct meson_clk_pll *const *clk_plls;
12960d48fc55SNeil Armstrong 	unsigned int clk_plls_count;
12970d48fc55SNeil Armstrong 	struct clk_mux *const *clk_muxes;
12980d48fc55SNeil Armstrong 	unsigned int clk_muxes_count;
12990d48fc55SNeil Armstrong 	struct clk_divider *const *clk_dividers;
13000d48fc55SNeil Armstrong 	unsigned int clk_dividers_count;
13010d48fc55SNeil Armstrong 	struct meson_clk_cpu *cpu_clk;
13020d48fc55SNeil Armstrong 	struct clk_hw_onecell_data *hw_onecell_data;
13030d48fc55SNeil Armstrong };
13040d48fc55SNeil Armstrong 
13050d48fc55SNeil Armstrong static const struct clkc_data gxbb_clkc_data = {
13060d48fc55SNeil Armstrong 	.clk_gates = gxbb_clk_gates,
13070d48fc55SNeil Armstrong 	.clk_gates_count = ARRAY_SIZE(gxbb_clk_gates),
13080d48fc55SNeil Armstrong 	.clk_mplls = gxbb_clk_mplls,
13090d48fc55SNeil Armstrong 	.clk_mplls_count = ARRAY_SIZE(gxbb_clk_mplls),
13100d48fc55SNeil Armstrong 	.clk_plls = gxbb_clk_plls,
13110d48fc55SNeil Armstrong 	.clk_plls_count = ARRAY_SIZE(gxbb_clk_plls),
13120d48fc55SNeil Armstrong 	.clk_muxes = gxbb_clk_muxes,
13130d48fc55SNeil Armstrong 	.clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
13140d48fc55SNeil Armstrong 	.clk_dividers = gxbb_clk_dividers,
13150d48fc55SNeil Armstrong 	.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
13160d48fc55SNeil Armstrong 	.cpu_clk = &gxbb_cpu_clk,
13170d48fc55SNeil Armstrong 	.hw_onecell_data = &gxbb_hw_onecell_data,
13180d48fc55SNeil Armstrong };
13190d48fc55SNeil Armstrong 
13200d48fc55SNeil Armstrong static const struct clkc_data gxl_clkc_data = {
13210d48fc55SNeil Armstrong 	.clk_gates = gxbb_clk_gates,
13220d48fc55SNeil Armstrong 	.clk_gates_count = ARRAY_SIZE(gxbb_clk_gates),
13230d48fc55SNeil Armstrong 	.clk_mplls = gxbb_clk_mplls,
13240d48fc55SNeil Armstrong 	.clk_mplls_count = ARRAY_SIZE(gxbb_clk_mplls),
13250d48fc55SNeil Armstrong 	.clk_plls = gxl_clk_plls,
13260d48fc55SNeil Armstrong 	.clk_plls_count = ARRAY_SIZE(gxl_clk_plls),
13270d48fc55SNeil Armstrong 	.clk_muxes = gxbb_clk_muxes,
13280d48fc55SNeil Armstrong 	.clk_muxes_count = ARRAY_SIZE(gxbb_clk_muxes),
13290d48fc55SNeil Armstrong 	.clk_dividers = gxbb_clk_dividers,
13300d48fc55SNeil Armstrong 	.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
13310d48fc55SNeil Armstrong 	.cpu_clk = &gxbb_cpu_clk,
13320d48fc55SNeil Armstrong 	.hw_onecell_data = &gxl_hw_onecell_data,
13330d48fc55SNeil Armstrong };
13340d48fc55SNeil Armstrong 
13350d48fc55SNeil Armstrong static const struct of_device_id clkc_match_table[] = {
13360d48fc55SNeil Armstrong 	{ .compatible = "amlogic,gxbb-clkc", .data = &gxbb_clkc_data },
13370d48fc55SNeil Armstrong 	{ .compatible = "amlogic,gxl-clkc", .data = &gxl_clkc_data },
13380d48fc55SNeil Armstrong 	{},
13390d48fc55SNeil Armstrong };
13400d48fc55SNeil Armstrong 
1341738f66d3SMichael Turquette static int gxbb_clkc_probe(struct platform_device *pdev)
1342738f66d3SMichael Turquette {
13430d48fc55SNeil Armstrong 	const struct clkc_data *clkc_data;
1344738f66d3SMichael Turquette 	void __iomem *clk_base;
1345738f66d3SMichael Turquette 	int ret, clkid, i;
1346738f66d3SMichael Turquette 	struct clk_hw *parent_hw;
1347738f66d3SMichael Turquette 	struct clk *parent_clk;
1348738f66d3SMichael Turquette 	struct device *dev = &pdev->dev;
1349738f66d3SMichael Turquette 
13500d48fc55SNeil Armstrong 	clkc_data = of_device_get_match_data(&pdev->dev);
13510d48fc55SNeil Armstrong 	if (!clkc_data)
13520d48fc55SNeil Armstrong 		return -EINVAL;
13530d48fc55SNeil Armstrong 
1354738f66d3SMichael Turquette 	/*  Generic clocks and PLLs */
1355738f66d3SMichael Turquette 	clk_base = of_iomap(dev->of_node, 0);
1356738f66d3SMichael Turquette 	if (!clk_base) {
1357738f66d3SMichael Turquette 		pr_err("%s: Unable to map clk base\n", __func__);
1358738f66d3SMichael Turquette 		return -ENXIO;
1359738f66d3SMichael Turquette 	}
1360738f66d3SMichael Turquette 
1361738f66d3SMichael Turquette 	/* Populate base address for PLLs */
13620d48fc55SNeil Armstrong 	for (i = 0; i < clkc_data->clk_plls_count; i++)
13630d48fc55SNeil Armstrong 		clkc_data->clk_plls[i]->base = clk_base;
1364738f66d3SMichael Turquette 
1365738f66d3SMichael Turquette 	/* Populate base address for MPLLs */
13660d48fc55SNeil Armstrong 	for (i = 0; i < clkc_data->clk_mplls_count; i++)
13670d48fc55SNeil Armstrong 		clkc_data->clk_mplls[i]->base = clk_base;
1368738f66d3SMichael Turquette 
1369738f66d3SMichael Turquette 	/* Populate the base address for CPU clk */
13700d48fc55SNeil Armstrong 	clkc_data->cpu_clk->base = clk_base;
1371738f66d3SMichael Turquette 
1372738f66d3SMichael Turquette 	/* Populate base address for gates */
13730d48fc55SNeil Armstrong 	for (i = 0; i < clkc_data->clk_gates_count; i++)
13740d48fc55SNeil Armstrong 		clkc_data->clk_gates[i]->reg = clk_base +
13750d48fc55SNeil Armstrong 			(u64)clkc_data->clk_gates[i]->reg;
1376738f66d3SMichael Turquette 
1377b92332eeSJerome Brunet 	/* Populate base address for muxes */
13780d48fc55SNeil Armstrong 	for (i = 0; i < clkc_data->clk_muxes_count; i++)
13790d48fc55SNeil Armstrong 		clkc_data->clk_muxes[i]->reg = clk_base +
13800d48fc55SNeil Armstrong 			(u64)clkc_data->clk_muxes[i]->reg;
1381b92332eeSJerome Brunet 
1382b92332eeSJerome Brunet 	/* Populate base address for dividers */
13830d48fc55SNeil Armstrong 	for (i = 0; i < clkc_data->clk_dividers_count; i++)
13840d48fc55SNeil Armstrong 		clkc_data->clk_dividers[i]->reg = clk_base +
13850d48fc55SNeil Armstrong 			(u64)clkc_data->clk_dividers[i]->reg;
1386b92332eeSJerome Brunet 
1387738f66d3SMichael Turquette 	/*
1388738f66d3SMichael Turquette 	 * register all clks
1389738f66d3SMichael Turquette 	 */
13900d48fc55SNeil Armstrong 	for (clkid = 0; clkid < clkc_data->hw_onecell_data->num; clkid++) {
1391a70c6e06SJerome Brunet 		/* array might be sparse */
1392a70c6e06SJerome Brunet 		if (!clkc_data->hw_onecell_data->hws[clkid])
1393a70c6e06SJerome Brunet 			continue;
1394a70c6e06SJerome Brunet 
13950d48fc55SNeil Armstrong 		ret = devm_clk_hw_register(dev,
13960d48fc55SNeil Armstrong 					clkc_data->hw_onecell_data->hws[clkid]);
1397738f66d3SMichael Turquette 		if (ret)
1398738f66d3SMichael Turquette 			goto iounmap;
1399738f66d3SMichael Turquette 	}
1400738f66d3SMichael Turquette 
1401738f66d3SMichael Turquette 	/*
1402738f66d3SMichael Turquette 	 * Register CPU clk notifier
1403738f66d3SMichael Turquette 	 *
1404738f66d3SMichael Turquette 	 * FIXME this is wrong for a lot of reasons. First, the muxes should be
1405738f66d3SMichael Turquette 	 * struct clk_hw objects. Second, we shouldn't program the muxes in
1406738f66d3SMichael Turquette 	 * notifier handlers. The tricky programming sequence will be handled
1407738f66d3SMichael Turquette 	 * by the forthcoming coordinated clock rates mechanism once that
1408738f66d3SMichael Turquette 	 * feature is released.
1409738f66d3SMichael Turquette 	 *
1410738f66d3SMichael Turquette 	 * Furthermore, looking up the parent this way is terrible. At some
1411738f66d3SMichael Turquette 	 * point we will stop allocating a default struct clk when registering
1412738f66d3SMichael Turquette 	 * a new clk_hw, and this hack will no longer work. Releasing the ccr
1413738f66d3SMichael Turquette 	 * feature before that time solves the problem :-)
1414738f66d3SMichael Turquette 	 */
14150d48fc55SNeil Armstrong 	parent_hw = clk_hw_get_parent(&clkc_data->cpu_clk->hw);
1416738f66d3SMichael Turquette 	parent_clk = parent_hw->clk;
14170d48fc55SNeil Armstrong 	ret = clk_notifier_register(parent_clk, &clkc_data->cpu_clk->clk_nb);
1418738f66d3SMichael Turquette 	if (ret) {
1419738f66d3SMichael Turquette 		pr_err("%s: failed to register clock notifier for cpu_clk\n",
1420738f66d3SMichael Turquette 				__func__);
1421738f66d3SMichael Turquette 		goto iounmap;
1422738f66d3SMichael Turquette 	}
1423738f66d3SMichael Turquette 
1424738f66d3SMichael Turquette 	return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
14250d48fc55SNeil Armstrong 			clkc_data->hw_onecell_data);
1426738f66d3SMichael Turquette 
1427738f66d3SMichael Turquette iounmap:
1428738f66d3SMichael Turquette 	iounmap(clk_base);
1429738f66d3SMichael Turquette 	return ret;
1430738f66d3SMichael Turquette }
1431738f66d3SMichael Turquette 
1432738f66d3SMichael Turquette static struct platform_driver gxbb_driver = {
1433738f66d3SMichael Turquette 	.probe		= gxbb_clkc_probe,
1434738f66d3SMichael Turquette 	.driver		= {
1435738f66d3SMichael Turquette 		.name	= "gxbb-clkc",
14360d48fc55SNeil Armstrong 		.of_match_table = clkc_match_table,
1437738f66d3SMichael Turquette 	},
1438738f66d3SMichael Turquette };
1439738f66d3SMichael Turquette 
144000746f10SWei Yongjun builtin_platform_driver(gxbb_driver);
1441