1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2013 Broadcom Corporation
4 * Copyright 2013 Linaro Limited
8 #include "dt-bindings/clock/bcm281xx.h"
10 #define BCM281XX_CCU_COMMON(_name, _ucase_name) \
11 KONA_CCU_COMMON(BCM281XX, _name, _ucase_name)
15 static struct peri_clk_data frac_1m_data
= {
16 .gate
= HW_SW_GATE(0x214, 16, 0, 1),
17 .trig
= TRIGGER(0x0e04, 0),
18 .div
= FRAC_DIVIDER(0x0e00, 0, 22, 16),
19 .clocks
= CLOCKS("ref_crystal"),
22 static struct ccu_data root_ccu_data
= {
23 BCM281XX_CCU_COMMON(root
, ROOT
),
25 [BCM281XX_ROOT_CCU_FRAC_1M
] =
26 KONA_CLK(root
, frac_1m
, peri
),
27 [BCM281XX_ROOT_CCU_CLOCK_COUNT
] = LAST_KONA_CLK
,
33 static struct peri_clk_data hub_timer_data
= {
34 .gate
= HW_SW_GATE(0x0414, 16, 0, 1),
35 .clocks
= CLOCKS("bbl_32k",
38 .sel
= SELECTOR(0x0a10, 0, 2),
39 .trig
= TRIGGER(0x0a40, 4),
42 static struct peri_clk_data pmu_bsc_data
= {
43 .gate
= HW_SW_GATE(0x0418, 16, 0, 1),
44 .clocks
= CLOCKS("ref_crystal",
47 .sel
= SELECTOR(0x0a04, 0, 2),
48 .div
= DIVIDER(0x0a04, 3, 4),
49 .trig
= TRIGGER(0x0a40, 0),
52 static struct peri_clk_data pmu_bsc_var_data
= {
53 .clocks
= CLOCKS("var_312m",
55 .sel
= SELECTOR(0x0a00, 0, 2),
56 .div
= DIVIDER(0x0a00, 4, 5),
57 .trig
= TRIGGER(0x0a40, 2),
60 static struct ccu_data aon_ccu_data
= {
61 BCM281XX_CCU_COMMON(aon
, AON
),
63 [BCM281XX_AON_CCU_HUB_TIMER
] =
64 KONA_CLK(aon
, hub_timer
, peri
),
65 [BCM281XX_AON_CCU_PMU_BSC
] =
66 KONA_CLK(aon
, pmu_bsc
, peri
),
67 [BCM281XX_AON_CCU_PMU_BSC_VAR
] =
68 KONA_CLK(aon
, pmu_bsc_var
, peri
),
69 [BCM281XX_AON_CCU_CLOCK_COUNT
] = LAST_KONA_CLK
,
75 static struct peri_clk_data tmon_1m_data
= {
76 .gate
= HW_SW_GATE(0x04a4, 18, 2, 3),
77 .clocks
= CLOCKS("ref_crystal",
79 .sel
= SELECTOR(0x0e74, 0, 2),
80 .trig
= TRIGGER(0x0e84, 1),
83 static struct ccu_data hub_ccu_data
= {
84 BCM281XX_CCU_COMMON(hub
, HUB
),
86 [BCM281XX_HUB_CCU_TMON_1M
] =
87 KONA_CLK(hub
, tmon_1m
, peri
),
88 [BCM281XX_HUB_CCU_CLOCK_COUNT
] = LAST_KONA_CLK
,
94 static struct peri_clk_data sdio1_data
= {
95 .gate
= HW_SW_GATE(0x0358, 18, 2, 3),
96 .clocks
= CLOCKS("ref_crystal",
101 .sel
= SELECTOR(0x0a28, 0, 3),
102 .div
= DIVIDER(0x0a28, 4, 14),
103 .trig
= TRIGGER(0x0afc, 9),
106 static struct peri_clk_data sdio2_data
= {
107 .gate
= HW_SW_GATE(0x035c, 18, 2, 3),
108 .clocks
= CLOCKS("ref_crystal",
113 .sel
= SELECTOR(0x0a2c, 0, 3),
114 .div
= DIVIDER(0x0a2c, 4, 14),
115 .trig
= TRIGGER(0x0afc, 10),
118 static struct peri_clk_data sdio3_data
= {
119 .gate
= HW_SW_GATE(0x0364, 18, 2, 3),
120 .clocks
= CLOCKS("ref_crystal",
125 .sel
= SELECTOR(0x0a34, 0, 3),
126 .div
= DIVIDER(0x0a34, 4, 14),
127 .trig
= TRIGGER(0x0afc, 12),
130 static struct peri_clk_data sdio4_data
= {
131 .gate
= HW_SW_GATE(0x0360, 18, 2, 3),
132 .clocks
= CLOCKS("ref_crystal",
137 .sel
= SELECTOR(0x0a30, 0, 3),
138 .div
= DIVIDER(0x0a30, 4, 14),
139 .trig
= TRIGGER(0x0afc, 11),
142 static struct peri_clk_data usb_ic_data
= {
143 .gate
= HW_SW_GATE(0x0354, 18, 2, 3),
144 .clocks
= CLOCKS("ref_crystal",
147 .div
= FIXED_DIVIDER(2),
148 .sel
= SELECTOR(0x0a24, 0, 2),
149 .trig
= TRIGGER(0x0afc, 7),
152 /* also called usbh_48m */
153 static struct peri_clk_data hsic2_48m_data
= {
154 .gate
= HW_SW_GATE(0x0370, 18, 2, 3),
155 .clocks
= CLOCKS("ref_crystal",
158 .sel
= SELECTOR(0x0a38, 0, 2),
159 .div
= FIXED_DIVIDER(2),
160 .trig
= TRIGGER(0x0afc, 5),
163 /* also called usbh_12m */
164 static struct peri_clk_data hsic2_12m_data
= {
165 .gate
= HW_SW_GATE(0x0370, 20, 4, 5),
166 .div
= DIVIDER(0x0a38, 12, 2),
167 .clocks
= CLOCKS("ref_crystal",
170 .pre_div
= FIXED_DIVIDER(2),
171 .sel
= SELECTOR(0x0a38, 0, 2),
172 .trig
= TRIGGER(0x0afc, 5),
175 static struct ccu_data master_ccu_data
= {
176 BCM281XX_CCU_COMMON(master
, MASTER
),
178 [BCM281XX_MASTER_CCU_SDIO1
] =
179 KONA_CLK(master
, sdio1
, peri
),
180 [BCM281XX_MASTER_CCU_SDIO2
] =
181 KONA_CLK(master
, sdio2
, peri
),
182 [BCM281XX_MASTER_CCU_SDIO3
] =
183 KONA_CLK(master
, sdio3
, peri
),
184 [BCM281XX_MASTER_CCU_SDIO4
] =
185 KONA_CLK(master
, sdio4
, peri
),
186 [BCM281XX_MASTER_CCU_USB_IC
] =
187 KONA_CLK(master
, usb_ic
, peri
),
188 [BCM281XX_MASTER_CCU_HSIC2_48M
] =
189 KONA_CLK(master
, hsic2_48m
, peri
),
190 [BCM281XX_MASTER_CCU_HSIC2_12M
] =
191 KONA_CLK(master
, hsic2_12m
, peri
),
192 [BCM281XX_MASTER_CCU_CLOCK_COUNT
] = LAST_KONA_CLK
,
198 static struct peri_clk_data uartb_data
= {
199 .gate
= HW_SW_GATE(0x0400, 18, 2, 3),
200 .clocks
= CLOCKS("ref_crystal",
203 .sel
= SELECTOR(0x0a10, 0, 2),
204 .div
= FRAC_DIVIDER(0x0a10, 4, 12, 8),
205 .trig
= TRIGGER(0x0afc, 2),
208 static struct peri_clk_data uartb2_data
= {
209 .gate
= HW_SW_GATE(0x0404, 18, 2, 3),
210 .clocks
= CLOCKS("ref_crystal",
213 .sel
= SELECTOR(0x0a14, 0, 2),
214 .div
= FRAC_DIVIDER(0x0a14, 4, 12, 8),
215 .trig
= TRIGGER(0x0afc, 3),
218 static struct peri_clk_data uartb3_data
= {
219 .gate
= HW_SW_GATE(0x0408, 18, 2, 3),
220 .clocks
= CLOCKS("ref_crystal",
223 .sel
= SELECTOR(0x0a18, 0, 2),
224 .div
= FRAC_DIVIDER(0x0a18, 4, 12, 8),
225 .trig
= TRIGGER(0x0afc, 4),
228 static struct peri_clk_data uartb4_data
= {
229 .gate
= HW_SW_GATE(0x0408, 18, 2, 3),
230 .clocks
= CLOCKS("ref_crystal",
233 .sel
= SELECTOR(0x0a1c, 0, 2),
234 .div
= FRAC_DIVIDER(0x0a1c, 4, 12, 8),
235 .trig
= TRIGGER(0x0afc, 5),
238 static struct peri_clk_data ssp0_data
= {
239 .gate
= HW_SW_GATE(0x0410, 18, 2, 3),
240 .clocks
= CLOCKS("ref_crystal",
245 .sel
= SELECTOR(0x0a20, 0, 3),
246 .div
= DIVIDER(0x0a20, 4, 14),
247 .trig
= TRIGGER(0x0afc, 6),
250 static struct peri_clk_data ssp2_data
= {
251 .gate
= HW_SW_GATE(0x0418, 18, 2, 3),
252 .clocks
= CLOCKS("ref_crystal",
257 .sel
= SELECTOR(0x0a28, 0, 3),
258 .div
= DIVIDER(0x0a28, 4, 14),
259 .trig
= TRIGGER(0x0afc, 8),
262 static struct peri_clk_data bsc1_data
= {
263 .gate
= HW_SW_GATE(0x0458, 18, 2, 3),
264 .clocks
= CLOCKS("ref_crystal",
269 .sel
= SELECTOR(0x0a64, 0, 3),
270 .trig
= TRIGGER(0x0afc, 23),
273 static struct peri_clk_data bsc2_data
= {
274 .gate
= HW_SW_GATE(0x045c, 18, 2, 3),
275 .clocks
= CLOCKS("ref_crystal",
280 .sel
= SELECTOR(0x0a68, 0, 3),
281 .trig
= TRIGGER(0x0afc, 24),
284 static struct peri_clk_data bsc3_data
= {
285 .gate
= HW_SW_GATE(0x0484, 18, 2, 3),
286 .clocks
= CLOCKS("ref_crystal",
291 .sel
= SELECTOR(0x0a84, 0, 3),
292 .trig
= TRIGGER(0x0b00, 2),
295 static struct peri_clk_data pwm_data
= {
296 .gate
= HW_SW_GATE(0x0468, 18, 2, 3),
297 .clocks
= CLOCKS("ref_crystal",
299 .sel
= SELECTOR(0x0a70, 0, 2),
300 .div
= DIVIDER(0x0a70, 4, 3),
301 .trig
= TRIGGER(0x0afc, 15),
304 static struct ccu_data slave_ccu_data
= {
305 BCM281XX_CCU_COMMON(slave
, SLAVE
),
307 [BCM281XX_SLAVE_CCU_UARTB
] =
308 KONA_CLK(slave
, uartb
, peri
),
309 [BCM281XX_SLAVE_CCU_UARTB2
] =
310 KONA_CLK(slave
, uartb2
, peri
),
311 [BCM281XX_SLAVE_CCU_UARTB3
] =
312 KONA_CLK(slave
, uartb3
, peri
),
313 [BCM281XX_SLAVE_CCU_UARTB4
] =
314 KONA_CLK(slave
, uartb4
, peri
),
315 [BCM281XX_SLAVE_CCU_SSP0
] =
316 KONA_CLK(slave
, ssp0
, peri
),
317 [BCM281XX_SLAVE_CCU_SSP2
] =
318 KONA_CLK(slave
, ssp2
, peri
),
319 [BCM281XX_SLAVE_CCU_BSC1
] =
320 KONA_CLK(slave
, bsc1
, peri
),
321 [BCM281XX_SLAVE_CCU_BSC2
] =
322 KONA_CLK(slave
, bsc2
, peri
),
323 [BCM281XX_SLAVE_CCU_BSC3
] =
324 KONA_CLK(slave
, bsc3
, peri
),
325 [BCM281XX_SLAVE_CCU_PWM
] =
326 KONA_CLK(slave
, pwm
, peri
),
327 [BCM281XX_SLAVE_CCU_CLOCK_COUNT
] = LAST_KONA_CLK
,
331 /* Device tree match table callback functions */
333 static void __init
kona_dt_root_ccu_setup(struct device_node
*node
)
335 kona_dt_ccu_setup(&root_ccu_data
, node
);
338 static void __init
kona_dt_aon_ccu_setup(struct device_node
*node
)
340 kona_dt_ccu_setup(&aon_ccu_data
, node
);
343 static void __init
kona_dt_hub_ccu_setup(struct device_node
*node
)
345 kona_dt_ccu_setup(&hub_ccu_data
, node
);
348 static void __init
kona_dt_master_ccu_setup(struct device_node
*node
)
350 kona_dt_ccu_setup(&master_ccu_data
, node
);
353 static void __init
kona_dt_slave_ccu_setup(struct device_node
*node
)
355 kona_dt_ccu_setup(&slave_ccu_data
, node
);
358 CLK_OF_DECLARE(bcm281xx_root_ccu
, BCM281XX_DT_ROOT_CCU_COMPAT
,
359 kona_dt_root_ccu_setup
);
360 CLK_OF_DECLARE(bcm281xx_aon_ccu
, BCM281XX_DT_AON_CCU_COMPAT
,
361 kona_dt_aon_ccu_setup
);
362 CLK_OF_DECLARE(bcm281xx_hub_ccu
, BCM281XX_DT_HUB_CCU_COMPAT
,
363 kona_dt_hub_ccu_setup
);
364 CLK_OF_DECLARE(bcm281xx_master_ccu
, BCM281XX_DT_MASTER_CCU_COMPAT
,
365 kona_dt_master_ccu_setup
);
366 CLK_OF_DECLARE(bcm281xx_slave_ccu
, BCM281XX_DT_SLAVE_CCU_COMPAT
,
367 kona_dt_slave_ccu_setup
);