Release 4.11 arch/m68k/coldfire/clk.c
/***************************************************************************/
/*
* clk.c -- general ColdFire CPU kernel clk handling
*
* Copyright (C) 2009, Greg Ungerer (gerg@snapgear.com)
*/
/***************************************************************************/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/mutex.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/err.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
#include <asm/mcfclk.h>
static DEFINE_SPINLOCK(clk_lock);
#ifdef MCFPM_PPMCR0
/*
* For more advanced ColdFire parts that have clocks that can be enabled
* we supply enable/disable functions. These must properly define their
* clocks in their platform specific code.
*/
void __clk_init_enabled(struct clk *clk)
{
clk->enabled = 1;
clk->clk_ops->enable(clk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Ungerer | 22 | 88.00% | 2 | 66.67% |
Steven King | 3 | 12.00% | 1 | 33.33% |
Total | 25 | 100.00% | 3 | 100.00% |
void __clk_init_disabled(struct clk *clk)
{
clk->enabled = 0;
clk->clk_ops->disable(clk);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Ungerer | 22 | 88.00% | 2 | 66.67% |
Steven King | 3 | 12.00% | 1 | 33.33% |
Total | 25 | 100.00% | 3 | 100.00% |
static void __clk_enable0(struct clk *clk)
{
__raw_writeb(clk->slot, MCFPM_PPMCR0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Ungerer | 17 | 85.00% | 2 | 66.67% |
Steven King | 3 | 15.00% | 1 | 33.33% |
Total | 20 | 100.00% | 3 | 100.00% |
static void __clk_disable0(struct clk *clk)
{
__raw_writeb(clk->slot, MCFPM_PPMSR0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Ungerer | 17 | 85.00% | 2 | 66.67% |
Steven King | 3 | 15.00% | 1 | 33.33% |
Total | 20 | 100.00% | 3 | 100.00% |
struct clk_ops clk_ops0 = {
.enable = __clk_enable0,
.disable = __clk_disable0,
};
#ifdef MCFPM_PPMCR1
static void __clk_enable1(struct clk *clk)
{
__raw_writeb(clk->slot, MCFPM_PPMCR1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Ungerer | 17 | 85.00% | 2 | 66.67% |
Steven King | 3 | 15.00% | 1 | 33.33% |
Total | 20 | 100.00% | 3 | 100.00% |
static void __clk_disable1(struct clk *clk)
{
__raw_writeb(clk->slot, MCFPM_PPMSR1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Greg Ungerer | 16 | 80.00% | 1 | 50.00% |
Steven King | 4 | 20.00% | 1 | 50.00% |
Total | 20 | 100.00% | 2 | 100.00% |
struct clk_ops clk_ops1 = {
.enable = __clk_enable1,
.disable = __clk_disable1,
};
#endif /* MCFPM_PPMCR1 */
#endif /* MCFPM_PPMCR0 */
struct clk *clk_get(struct device *dev, const char *id)
{
const char *clk_name = dev ? dev_name(dev) : id ? id : NULL;
struct clk *clk;
unsigned i;
for (i = 0; (clk = mcf_clks[i]) != NULL; ++i)
if (!strcmp(clk->name, clk_name))
return clk;
pr_warn("clk_get: didn't find clock %s\n", clk_name);
return ERR_PTR(-ENOENT);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven King | 92 | 100.00% | 1 | 100.00% |
Total | 92 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(clk_get);
int clk_enable(struct clk *clk)
{
unsigned long flags;
spin_lock_irqsave(&clk_lock, flags);
if ((clk->enabled++ == 0) && clk->clk_ops)
clk->clk_ops->enable(clk);
spin_unlock_irqrestore(&clk_lock, flags);
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven King | 57 | 100.00% | 1 | 100.00% |
Total | 57 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(clk_enable);
void clk_disable(struct clk *clk)
{
unsigned long flags;
if (!clk)
return;
spin_lock_irqsave(&clk_lock, flags);
if ((--clk->enabled == 0) && clk->clk_ops)
clk->clk_ops->disable(clk);
spin_unlock_irqrestore(&clk_lock, flags);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven King | 54 | 90.00% | 1 | 50.00% |
Masahiro Yamada | 6 | 10.00% | 1 | 50.00% |
Total | 60 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL(clk_disable);
void clk_put(struct clk *clk)
{
if (clk->enabled != 0)
pr_warn("clk_put %s still enabled\n", clk->name);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven King | 27 | 100.00% | 1 | 100.00% |
Total | 27 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(clk_put);
unsigned long clk_get_rate(struct clk *clk)
{
return clk->rate;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven King | 16 | 100.00% | 1 | 100.00% |
Total | 16 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL(clk_get_rate);
/***************************************************************************/
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Steven King | 311 | 63.21% | 2 | 40.00% |
Greg Ungerer | 175 | 35.57% | 2 | 40.00% |
Masahiro Yamada | 6 | 1.22% | 1 | 20.00% |
Total | 492 | 100.00% | 5 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.