cregit-Linux how code gets into the kernel

Release 4.14 arch/mips/loongson64/lemote-2f/clock.c

/*
 * Copyright (C) 2006 - 2008 Lemote Inc. & Institute of Computing Technology
 * Author: Yanhua, yanh@lemote.com
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#include <linux/clk.h>
#include <linux/cpufreq.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/list.h>
#include <linux/mutex.h>
#include <linux/spinlock.h>

#include <asm/clock.h>
#include <asm/mach-loongson64/loongson.h>

static LIST_HEAD(clock_list);
static DEFINE_SPINLOCK(clock_lock);
static DEFINE_MUTEX(clock_list_sem);

/* Minimum CLK support */
enum {
	





DC_ZERO, DC_25PT = 2, DC_37PT, DC_50PT, DC_62PT, DC_75PT,
	


DC_87PT, DC_DISABLE, DC_RESV
};


struct cpufreq_frequency_table loongson2_clockmod_table[] = {
	{0, DC_RESV, CPUFREQ_ENTRY_INVALID},
	{0, DC_ZERO, CPUFREQ_ENTRY_INVALID},
	{0, DC_25PT, 0},
	{0, DC_37PT, 0},
	{0, DC_50PT, 0},
	{0, DC_62PT, 0},
	{0, DC_75PT, 0},
	{0, DC_87PT, 0},
	{0, DC_DISABLE, 0},
	{0, DC_RESV, CPUFREQ_TABLE_END},
};

EXPORT_SYMBOL_GPL(loongson2_clockmod_table);


static struct clk cpu_clk = {
	.name = "cpu_clk",
	.flags = CLK_ALWAYS_ENABLED | CLK_RATE_PROPAGATES,
	.rate = 800000000,
};


struct clk *clk_get(struct device *dev, const char *id) { return &cpu_clk; }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin21100.00%1100.00%
Total21100.00%1100.00%

EXPORT_SYMBOL(clk_get);
static void propagate_rate(struct clk *clk) { struct clk *clkp; list_for_each_entry(clkp, &clock_list, node) { if (likely(clkp->parent != clk)) continue; if (likely(clkp->ops && clkp->ops->recalc)) clkp->ops->recalc(clkp); if (unlikely(clkp->flags & CLK_RATE_PROPAGATES)) propagate_rate(clkp); } }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin78100.00%1100.00%
Total78100.00%1100.00%


int clk_enable(struct clk *clk) { return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin13100.00%1100.00%
Total13100.00%1100.00%

EXPORT_SYMBOL(clk_enable);
void clk_disable(struct clk *clk) { }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin9100.00%1100.00%
Total9100.00%1100.00%

EXPORT_SYMBOL(clk_disable);
unsigned long clk_get_rate(struct clk *clk) { if (!clk) return 0; return (unsigned long)clk->rate; }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin2071.43%150.00%
Jonas Gorski828.57%150.00%
Total28100.00%2100.00%

EXPORT_SYMBOL(clk_get_rate);
void clk_put(struct clk *clk) { }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin9100.00%1100.00%
Total9100.00%1100.00%

EXPORT_SYMBOL(clk_put);
int clk_set_rate(struct clk *clk, unsigned long rate) { unsigned int rate_khz = rate / 1000; struct cpufreq_frequency_table *pos; int ret = 0; int regval; if (likely(clk->ops && clk->ops->set_rate)) { unsigned long flags; spin_lock_irqsave(&clock_lock, flags); ret = clk->ops->set_rate(clk, rate, 0); spin_unlock_irqrestore(&clock_lock, flags); } if (unlikely(clk->flags & CLK_RATE_PROPAGATES)) propagate_rate(clk); cpufreq_for_each_valid_entry(pos, loongson2_clockmod_table) if (rate_khz == pos->frequency) break; if (rate_khz != pos->frequency) return -ENOTSUPP; clk->rate = rate; regval = LOONGSON_CHIPCFG(0); regval = (regval & ~0x7) | (pos->driver_data - 1); LOONGSON_CHIPCFG(0) = regval; return ret; }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin13378.24%116.67%
Stratos Karafotis1710.00%116.67%
Aaro Koskinen105.88%116.67%
Huacai Chen84.71%116.67%
Ralf Bächle10.59%116.67%
Viresh Kumar10.59%116.67%
Total170100.00%6100.00%

EXPORT_SYMBOL_GPL(clk_set_rate);
long clk_round_rate(struct clk *clk, unsigned long rate) { if (likely(clk->ops && clk->ops->round_rate)) { unsigned long flags, rounded; spin_lock_irqsave(&clock_lock, flags); rounded = clk->ops->round_rate(clk, rate); spin_unlock_irqrestore(&clock_lock, flags); return rounded; } return rate; }

Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin72100.00%1100.00%
Total72100.00%1100.00%

EXPORT_SYMBOL_GPL(clk_round_rate);

Overall Contributors

PersonTokensPropCommitsCommitProp
Wu Zhangjin53786.47%19.09%
Viresh Kumar213.38%218.18%
Ralf Bächle182.90%327.27%
Stratos Karafotis172.74%19.09%
Aaro Koskinen121.93%218.18%
Jonas Gorski81.29%19.09%
Huacai Chen81.29%19.09%
Total621100.00%11100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.