aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clk/bcm/clk-bcm281xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/clk/bcm/clk-bcm281xx.c')
-rw-r--r--drivers/clk/bcm/clk-bcm281xx.c132
1 files changed, 64 insertions, 68 deletions
diff --git a/drivers/clk/bcm/clk-bcm281xx.c b/drivers/clk/bcm/clk-bcm281xx.c
index d72f2ae01493..71a65a49f1a4 100644
--- a/drivers/clk/bcm/clk-bcm281xx.c
+++ b/drivers/clk/bcm/clk-bcm281xx.c
@@ -41,6 +41,11 @@ static struct peri_clk_data frac_1m_data = {
41 41
42static struct ccu_data root_ccu_data = { 42static struct ccu_data root_ccu_data = {
43 BCM281XX_CCU_COMMON(root, ROOT), 43 BCM281XX_CCU_COMMON(root, ROOT),
44 .kona_clks = {
45 [BCM281XX_ROOT_CCU_FRAC_1M] =
46 KONA_CLK(root, frac_1m, peri),
47 [BCM281XX_ROOT_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
48 },
44}; 49};
45 50
46/* AON CCU */ 51/* AON CCU */
@@ -74,6 +79,15 @@ static struct peri_clk_data pmu_bsc_var_data = {
74 79
75static struct ccu_data aon_ccu_data = { 80static struct ccu_data aon_ccu_data = {
76 BCM281XX_CCU_COMMON(aon, AON), 81 BCM281XX_CCU_COMMON(aon, AON),
82 .kona_clks = {
83 [BCM281XX_AON_CCU_HUB_TIMER] =
84 KONA_CLK(aon, hub_timer, peri),
85 [BCM281XX_AON_CCU_PMU_BSC] =
86 KONA_CLK(aon, pmu_bsc, peri),
87 [BCM281XX_AON_CCU_PMU_BSC_VAR] =
88 KONA_CLK(aon, pmu_bsc_var, peri),
89 [BCM281XX_AON_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
90 },
77}; 91};
78 92
79/* Hub CCU */ 93/* Hub CCU */
@@ -88,6 +102,11 @@ static struct peri_clk_data tmon_1m_data = {
88 102
89static struct ccu_data hub_ccu_data = { 103static struct ccu_data hub_ccu_data = {
90 BCM281XX_CCU_COMMON(hub, HUB), 104 BCM281XX_CCU_COMMON(hub, HUB),
105 .kona_clks = {
106 [BCM281XX_HUB_CCU_TMON_1M] =
107 KONA_CLK(hub, tmon_1m, peri),
108 [BCM281XX_HUB_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
109 },
91}; 110};
92 111
93/* Master CCU */ 112/* Master CCU */
@@ -175,6 +194,23 @@ static struct peri_clk_data hsic2_12m_data = {
175 194
176static struct ccu_data master_ccu_data = { 195static struct ccu_data master_ccu_data = {
177 BCM281XX_CCU_COMMON(master, MASTER), 196 BCM281XX_CCU_COMMON(master, MASTER),
197 .kona_clks = {
198 [BCM281XX_MASTER_CCU_SDIO1] =
199 KONA_CLK(master, sdio1, peri),
200 [BCM281XX_MASTER_CCU_SDIO2] =
201 KONA_CLK(master, sdio2, peri),
202 [BCM281XX_MASTER_CCU_SDIO3] =
203 KONA_CLK(master, sdio3, peri),
204 [BCM281XX_MASTER_CCU_SDIO4] =
205 KONA_CLK(master, sdio4, peri),
206 [BCM281XX_MASTER_CCU_USB_IC] =
207 KONA_CLK(master, usb_ic, peri),
208 [BCM281XX_MASTER_CCU_HSIC2_48M] =
209 KONA_CLK(master, hsic2_48m, peri),
210 [BCM281XX_MASTER_CCU_HSIC2_12M] =
211 KONA_CLK(master, hsic2_12m, peri),
212 [BCM281XX_MASTER_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
213 },
178}; 214};
179 215
180/* Slave CCU */ 216/* Slave CCU */
@@ -287,96 +323,56 @@ static struct peri_clk_data pwm_data = {
287 323
288static struct ccu_data slave_ccu_data = { 324static struct ccu_data slave_ccu_data = {
289 BCM281XX_CCU_COMMON(slave, SLAVE), 325 BCM281XX_CCU_COMMON(slave, SLAVE),
326 .kona_clks = {
327 [BCM281XX_SLAVE_CCU_UARTB] =
328 KONA_CLK(slave, uartb, peri),
329 [BCM281XX_SLAVE_CCU_UARTB2] =
330 KONA_CLK(slave, uartb2, peri),
331 [BCM281XX_SLAVE_CCU_UARTB3] =
332 KONA_CLK(slave, uartb3, peri),
333 [BCM281XX_SLAVE_CCU_UARTB4] =
334 KONA_CLK(slave, uartb4, peri),
335 [BCM281XX_SLAVE_CCU_SSP0] =
336 KONA_CLK(slave, ssp0, peri),
337 [BCM281XX_SLAVE_CCU_SSP2] =
338 KONA_CLK(slave, ssp2, peri),
339 [BCM281XX_SLAVE_CCU_BSC1] =
340 KONA_CLK(slave, bsc1, peri),
341 [BCM281XX_SLAVE_CCU_BSC2] =
342 KONA_CLK(slave, bsc2, peri),
343 [BCM281XX_SLAVE_CCU_BSC3] =
344 KONA_CLK(slave, bsc3, peri),
345 [BCM281XX_SLAVE_CCU_PWM] =
346 KONA_CLK(slave, pwm, peri),
347 [BCM281XX_SLAVE_CCU_CLOCK_COUNT] = LAST_KONA_CLK,
348 },
290}; 349};
291 350
292/*
293 * CCU setup routines
294 *
295 * These are called from kona_dt_ccu_setup() to initialize the array
296 * of clocks provided by the CCU. Once allocated, the entries in
297 * the array are initialized by calling kona_clk_setup() with the
298 * initialization data for each clock. They return 0 if successful
299 * or an error code otherwise.
300 */
301static int __init bcm281xx_root_ccu_clks_setup(struct ccu_data *ccu)
302{
303 PERI_CLK_SETUP(ccu, BCM281XX_ROOT_CCU_FRAC_1M, frac_1m);
304
305 return 0;
306}
307
308static int __init bcm281xx_aon_ccu_clks_setup(struct ccu_data *ccu)
309{
310 PERI_CLK_SETUP(ccu, BCM281XX_AON_CCU_HUB_TIMER, hub_timer);
311 PERI_CLK_SETUP(ccu, BCM281XX_AON_CCU_PMU_BSC, pmu_bsc);
312 PERI_CLK_SETUP(ccu, BCM281XX_AON_CCU_PMU_BSC_VAR, pmu_bsc_var);
313
314 return 0;
315}
316
317static int __init bcm281xx_hub_ccu_clks_setup(struct ccu_data *ccu)
318{
319 PERI_CLK_SETUP(ccu, BCM281XX_HUB_CCU_TMON_1M, tmon_1m);
320
321 return 0;
322}
323
324static int __init bcm281xx_master_ccu_clks_setup(struct ccu_data *ccu)
325{
326 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO1, sdio1);
327 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO2, sdio2);
328 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO3, sdio3);
329 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO4, sdio4);
330 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_USB_IC, usb_ic);
331 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_HSIC2_48M, hsic2_48m);
332 PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_HSIC2_12M, hsic2_12m);
333
334 return 0;
335}
336
337static int __init bcm281xx_slave_ccu_clks_setup(struct ccu_data *ccu)
338{
339 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB, uartb);
340 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB2, uartb2);
341 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB3, uartb3);
342 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB4, uartb4);
343 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_SSP0, ssp0);
344 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_SSP2, ssp2);
345 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_BSC1, bsc1);
346 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_BSC2, bsc2);
347 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_BSC3, bsc3);
348 PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_PWM, pwm);
349
350 return 0;
351}
352
353/* Device tree match table callback functions */ 351/* Device tree match table callback functions */
354 352
355static void __init kona_dt_root_ccu_setup(struct device_node *node) 353static void __init kona_dt_root_ccu_setup(struct device_node *node)
356{ 354{
357 kona_dt_ccu_setup(&root_ccu_data, node, bcm281xx_root_ccu_clks_setup); 355 kona_dt_ccu_setup(&root_ccu_data, node);
358} 356}
359 357
360static void __init kona_dt_aon_ccu_setup(struct device_node *node) 358static void __init kona_dt_aon_ccu_setup(struct device_node *node)
361{ 359{
362 kona_dt_ccu_setup(&aon_ccu_data, node, bcm281xx_aon_ccu_clks_setup); 360 kona_dt_ccu_setup(&aon_ccu_data, node);
363} 361}
364 362
365static void __init kona_dt_hub_ccu_setup(struct device_node *node) 363static void __init kona_dt_hub_ccu_setup(struct device_node *node)
366{ 364{
367 kona_dt_ccu_setup(&hub_ccu_data, node, bcm281xx_hub_ccu_clks_setup); 365 kona_dt_ccu_setup(&hub_ccu_data, node);
368} 366}
369 367
370static void __init kona_dt_master_ccu_setup(struct device_node *node) 368static void __init kona_dt_master_ccu_setup(struct device_node *node)
371{ 369{
372 kona_dt_ccu_setup(&master_ccu_data, node, 370 kona_dt_ccu_setup(&master_ccu_data, node);
373 bcm281xx_master_ccu_clks_setup);
374} 371}
375 372
376static void __init kona_dt_slave_ccu_setup(struct device_node *node) 373static void __init kona_dt_slave_ccu_setup(struct device_node *node)
377{ 374{
378 kona_dt_ccu_setup(&slave_ccu_data, node, 375 kona_dt_ccu_setup(&slave_ccu_data, node);
379 bcm281xx_slave_ccu_clks_setup);
380} 376}
381 377
382CLK_OF_DECLARE(bcm281xx_root_ccu, BCM281XX_DT_ROOT_CCU_COMPAT, 378CLK_OF_DECLARE(bcm281xx_root_ccu, BCM281XX_DT_ROOT_CCU_COMPAT,