|
@@ -30,54 +30,12 @@
|
|
|
#include <linux/platform_device.h>
|
|
|
#include <linux/proc_fs.h>
|
|
|
#include <asm/clock.h>
|
|
|
+#include <asm/machvec.h>
|
|
|
|
|
|
static LIST_HEAD(clock_list);
|
|
|
static DEFINE_SPINLOCK(clock_lock);
|
|
|
static DEFINE_MUTEX(clock_list_sem);
|
|
|
|
|
|
-/*
|
|
|
- * Each subtype is expected to define the init routines for these clocks,
|
|
|
- * as each subtype (or processor family) will have these clocks at the
|
|
|
- * very least. These are all provided through the CPG, which even some of
|
|
|
- * the more quirky parts (such as ST40, SH4-202, etc.) still have.
|
|
|
- *
|
|
|
- * The processor-specific code is expected to register any additional
|
|
|
- * clock sources that are of interest.
|
|
|
- */
|
|
|
-static struct clk master_clk = {
|
|
|
- .name = "master_clk",
|
|
|
- .flags = CLK_ENABLE_ON_INIT,
|
|
|
- .rate = CONFIG_SH_PCLK_FREQ,
|
|
|
-};
|
|
|
-
|
|
|
-static struct clk peripheral_clk = {
|
|
|
- .name = "peripheral_clk",
|
|
|
- .parent = &master_clk,
|
|
|
- .flags = CLK_ENABLE_ON_INIT,
|
|
|
-};
|
|
|
-
|
|
|
-static struct clk bus_clk = {
|
|
|
- .name = "bus_clk",
|
|
|
- .parent = &master_clk,
|
|
|
- .flags = CLK_ENABLE_ON_INIT,
|
|
|
-};
|
|
|
-
|
|
|
-static struct clk cpu_clk = {
|
|
|
- .name = "cpu_clk",
|
|
|
- .parent = &master_clk,
|
|
|
- .flags = CLK_ENABLE_ON_INIT,
|
|
|
-};
|
|
|
-
|
|
|
-/*
|
|
|
- * The ordering of these clocks matters, do not change it.
|
|
|
- */
|
|
|
-static struct clk *onchip_clocks[] = {
|
|
|
- &master_clk,
|
|
|
- &peripheral_clk,
|
|
|
- &bus_clk,
|
|
|
- &cpu_clk,
|
|
|
-};
|
|
|
-
|
|
|
/* Used for clocks that always have same value as the parent clock */
|
|
|
unsigned long followparent_recalc(struct clk *clk)
|
|
|
{
|
|
@@ -443,10 +401,6 @@ void clk_put(struct clk *clk)
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(clk_put);
|
|
|
|
|
|
-int __init __weak arch_clk_init(void)
|
|
|
-{
|
|
|
- return 0;
|
|
|
-}
|
|
|
|
|
|
static int show_clocks(char *buf, char **start, off_t off,
|
|
|
int len, int *eof, void *data)
|
|
@@ -533,18 +487,22 @@ subsys_initcall(clk_sysdev_init);
|
|
|
|
|
|
int __init clk_init(void)
|
|
|
{
|
|
|
- int i, ret = 0;
|
|
|
-
|
|
|
- BUG_ON(!master_clk.rate);
|
|
|
-
|
|
|
- for (i = 0; i < ARRAY_SIZE(onchip_clocks); i++) {
|
|
|
- struct clk *clk = onchip_clocks[i];
|
|
|
+ int ret;
|
|
|
|
|
|
- arch_init_clk_ops(&clk->ops, i);
|
|
|
- ret |= clk_register(clk);
|
|
|
+ ret = arch_clk_init();
|
|
|
+ if (unlikely(ret)) {
|
|
|
+ pr_err("%s: CPU clock registration failed.\n", __func__);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
- ret |= arch_clk_init();
|
|
|
+ if (sh_mv.mv_clk_init) {
|
|
|
+ ret = sh_mv.mv_clk_init();
|
|
|
+ if (unlikely(ret)) {
|
|
|
+ pr_err("%s: machvec clock initialization failed.\n",
|
|
|
+ __func__);
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/* Kick the child clocks.. */
|
|
|
recalculate_root_clocks();
|