/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * Copyright (C) 2012 ARM Limited */ #include #include #include #include #include #include static DEFINE_SPINLOCK(vexpress_sp810_lock); static const char * const vexpress_clk_24mhz_periphs[] __initconst = { "mb:uart0", "mb:uart1", "mb:uart2", "mb:uart3", "mb:mmci", "mb:kmi0", "mb:kmi1" }; void __init vexpress_clk_init(void __iomem *sp810_base) { struct clk *clk; const char *sp810_parent_names[] = { "v2m:refclk32khz", /* REFCLK */ "v2m:refclk1mhz" /* TIMCLK */ }; struct clk *sp810_parent; int i; clk = clk_register_fixed_rate(NULL, "dummy_apb_pclk", NULL, CLK_IS_ROOT, 0); WARN_ON(clk_register_clkdev(clk, "apb_pclk", NULL)); clk = clk_register_fixed_rate(NULL, "v2m:clk_24mhz", NULL, CLK_IS_ROOT, 24000000); for (i = 0; i < ARRAY_SIZE(vexpress_clk_24mhz_periphs); i++) WARN_ON(clk_register_clkdev(clk, NULL, vexpress_clk_24mhz_periphs[i])); clk = clk_register_fixed_rate(NULL, "v2m:refclk32khz", NULL, CLK_IS_ROOT, 32768); WARN_ON(clk_register_clkdev(clk, NULL, "v2m:wdt")); sp810_parent = clk_register_fixed_rate(NULL, "v2m:refclk1mhz", NULL, CLK_IS_ROOT, 1000000); clk = clk_register_mux(NULL, "timerclken0", sp810_parent_names, 2, 0, sp810_base + SCCTRL, SCCTRL_TIMERENnSEL_SHIFT(0), 1, 0, &vexpress_sp810_lock); WARN_ON(clk_set_parent(clk, sp810_parent)); WARN_ON(clk_register_clkdev(clk, "v2m-timer0", "sp804")); clk = clk_register_mux(NULL, "timerclken1", sp810_parent_names, 2, 0, sp810_base + SCCTRL, SCCTRL_TIMERENnSEL_SHIFT(1), 1, 0, &vexpress_sp810_lock); WARN_ON(clk_set_parent(clk, sp810_parent)); WARN_ON(clk_register_clkdev(clk, "v2m-timer1", "sp804")); } #if defined(CONFIG_OF) void __init vexpress_clk_of_init(void) { of_clk_init(NULL); } #endif